diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-08-02 23:00:49 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-08-02 23:00:49 +0000 |
commit | 4c3837773570e6700f52114e14ec8ff9608318a0 (patch) | |
tree | 7ffb0889db34bd467a10f8eea4e7f669651980c6 | |
parent | 9c8a7f0b465a60a29f6efeafcc14ff5cba3ff8cb (diff) | |
parent | d00ac4eb29ca14915ceb4aa4896856e9f0e83262 (diff) | |
download | cts-android14-d1-s5-release.tar.gz |
Snap for 10601469 from d00ac4eb29ca14915ceb4aa4896856e9f0e83262 to udc-d1-releaseandroid-14.0.0_r9android-14.0.0_r8android-14.0.0_r7android-14.0.0_r6android-14.0.0_r5android-14.0.0_r4android-14.0.0_r3android-14.0.0_r11android-14.0.0_r10android14-d1-s7-releaseandroid14-d1-s6-releaseandroid14-d1-s5-releaseandroid14-d1-s4-releaseandroid14-d1-s3-releaseandroid14-d1-s2-releaseandroid14-d1-s1-release
Change-Id: Iec0ad283c52b59135521f6865688dad222e64012
7 files changed, 120 insertions, 11 deletions
diff --git a/apps/CameraITS/tests/scene_extensions/scene_night/test_night_extension.py b/apps/CameraITS/tests/scene_extensions/scene_night/test_night_extension.py index 4b53b8cb8b0..676679a2fd4 100644 --- a/apps/CameraITS/tests/scene_extensions/scene_night/test_night_extension.py +++ b/apps/CameraITS/tests/scene_extensions/scene_night/test_night_extension.py @@ -37,8 +37,7 @@ _MIN_AREA = 0 _WHITE = 255 _FMT_NAME = 'yuv' # To detect noise without conversion to RGB -_WIDTH = 1920 # Most common 16/9 resolution width -_HEIGHT = 1080 # Most common 16/9 resolution height +_IMAGE_FORMAT_YUV_420_888_INT = 35 _DOT_INTENSITY_DIFF_TOL = 20 # Min diff between dot/circle intensities [0:255] _DURATION_DIFF_TOL = 0.5 # Night mode ON captures must take 0.5 seconds longer @@ -172,12 +171,12 @@ def _check_edge_noise(night_y, no_night_y): 'as noisy as night mode ON', right_patch_ratio) if left_patch_ratio < _EDGE_NOISE_IMPROVEMENT_TOL: raise AssertionError('Left edge of night mode OFF capture was only ' - f'{left_patch_ratio:.2f} as noisy as ' + f'{float(left_patch_ratio):.2f} as noisy as ' 'night mode OFF, expected to be ' f'at least {_EDGE_NOISE_IMPROVEMENT_TOL}') if right_patch_ratio < _EDGE_NOISE_IMPROVEMENT_TOL: raise AssertionError('Right edge of night mode OFF capture was only ' - f'{right_patch_ratio:.2f} as noisy as ' + f'{float(right_patch_ratio):.2f} as noisy as ' 'night mode OFF, expected to be ' f'at least {_EDGE_NOISE_IMPROVEMENT_TOL}') @@ -196,7 +195,7 @@ class NightExtensionTest(its_base_test.ItsBaseTest): """ def find_tablet_brightness(self, cam, default_brightness, file_stem, - use_extensions=True): + width, height, use_extensions=True): """Find maximum brightness at which orientation circle in scene is visible. Uses binary search on a range of (0, default_brightness), where visibility @@ -206,6 +205,8 @@ class NightExtensionTest(its_base_test.ItsBaseTest): cam: its_session_utils object. default_brightness: int; brightness set by config.yml. file_stem: str; location and name to save files. + width: int; width for both extension and non-extension captures. + height: int; height for both extension and non-extension captures. use_extensions: bool; whether extension capture should be used. Returns: int; brightness at which orientation circle in scene is visible. @@ -213,7 +214,7 @@ class NightExtensionTest(its_base_test.ItsBaseTest): min_brightness = 0 max_brightness = default_brightness final_brightness = None - out_surfaces = {'format': _FMT_NAME, 'width': _WIDTH, 'height': _HEIGHT} + out_surfaces = {'format': _FMT_NAME, 'width': width, 'height': height} req = capture_request_utils.auto_capture_request() file_stem += '_night' if use_extensions else '_no_night' while min_brightness < max_brightness: @@ -349,18 +350,49 @@ class NightExtensionTest(its_base_test.ItsBaseTest): self.tablet.adb.shell( f'input tap {_TAP_COORDINATES[0]} {_TAP_COORDINATES[1]}') + # Determine capture width and height + width, height = None, None + capture_sizes = capture_request_utils.get_available_output_sizes( + _FMT_NAME, props) + extension_capture_sizes_str = cam.get_supported_extension_sizes( + self.camera_id, _EXTENSION_NIGHT, _IMAGE_FORMAT_YUV_420_888_INT + ) + extension_capture_sizes = [ + tuple(int(size_part) for size_part in s.split(_X_STRING)) + for s in extension_capture_sizes_str + ] + # Extension capture sizes are ordered in ascending area order by default + extension_capture_sizes.reverse() + logging.debug('Capture sizes: %s', capture_sizes) + logging.debug('Extension capture sizes: %s', extension_capture_sizes) + + for capture_size, extension_capture_size in zip( + capture_sizes, extension_capture_sizes): + if capture_size == extension_capture_size: + width, height = capture_size + break + else: + raise AssertionError( + 'No matching sizes for non-extension and extension captures! ' + f'Camera ID {self.camera_id}, ' + f'extension {_EXTENSION_NIGHT}, and ' + f'format {_IMAGE_FORMAT_YUV_420_888_INT}' + ) + # Set tablet brightness to darken scene - file_stem = f'{test_name}_{_FMT_NAME}_{_WIDTH}x{_HEIGHT}' + file_stem = f'{test_name}_{_FMT_NAME}_{width}x{height}' night_brightness = self.find_tablet_brightness( - cam, self.tablet_screen_brightness, file_stem, use_extensions=True) + cam, self.tablet_screen_brightness, file_stem, + width, height, use_extensions=True) logging.debug('Night mode ON brightness: %d', night_brightness) no_night_brightness = self.find_tablet_brightness( - cam, self.tablet_screen_brightness, file_stem, use_extensions=False) + cam, self.tablet_screen_brightness, file_stem, + width, height, use_extensions=False) logging.debug('Night mode OFF brightness: %d', no_night_brightness) brightness = min(night_brightness, no_night_brightness) self.set_screen_brightness(str(brightness)) - out_surfaces = {'format': _FMT_NAME, 'width': _WIDTH, 'height': _HEIGHT} + out_surfaces = {'format': _FMT_NAME, 'width': width, 'height': height} req = capture_request_utils.auto_capture_request() # Take auto capture with night mode on diff --git a/apps/CameraITS/utils/its_session_utils.py b/apps/CameraITS/utils/its_session_utils.py index 12b65aa0696..a1459aae462 100644 --- a/apps/CameraITS/utils/its_session_utils.py +++ b/apps/CameraITS/utils/its_session_utils.py @@ -793,6 +793,35 @@ class ItsSession(object): raise error_util.CameraItsError('No supported extensions') return [int(x) for x in str(data['strValue'][1:-1]).split(', ') if x] + def get_supported_extension_sizes(self, camera_id, extension, image_format): + """Get all supported camera sizes for this camera, extension, and format. + + Sorts in ascending order according to area, i.e. + ['640x480', '800x600', '1280x720', '1440x1080', '1920x1080'] + + Args: + camera_id: int; device ID + extension: int; the integer value of the extension. + image_format: int; the integer value of the format. + Returns: + List of sizes supported for this camera, extension, and format. + """ + cmd = { + 'cmdName': 'getSupportedExtensionSizes', + 'cameraId': camera_id, + 'extension': extension, + 'format': image_format + } + self.sock.send(json.dumps(cmd).encode() + '\n'.encode()) + timeout = self.SOCK_TIMEOUT + self.EXTRA_SOCK_TIMEOUT + self.sock.settimeout(timeout) + data, _ = self.__read_response_from_socket() + if data[_TAG_STR] != 'supportedExtensionSizes': + raise error_util.CameraItsError('Invalid command response') + if not data[_STR_VALUE]: + raise error_util.CameraItsError('No supported extensions') + return data[_STR_VALUE].split(';') + def get_display_size(self): """Get the display size of the screen. diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java index c56eeb8df6b..11e1cfe60f4 100644 --- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java +++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java @@ -944,6 +944,11 @@ public class ItsService extends Service implements SensorEventListener { } else if ("getSupportedExtensions".equals(cmdObj.getString("cmdName"))) { String cameraId = cmdObj.getString("cameraId"); doGetSupportedExtensions(cameraId); + } else if ("getSupportedExtensionSizes".equals(cmdObj.getString("cmdName"))) { + String cameraId = cmdObj.getString("cameraId"); + int extension = cmdObj.getInt("extension"); + int format = cmdObj.getInt("format"); + doGetSupportedExtensionSizes(cameraId, extension, format); } else if ("doBasicRecording".equals(cmdObj.getString("cmdName"))) { String cameraId = cmdObj.getString("cameraId"); int profileId = cmdObj.getInt("profileId"); @@ -2362,6 +2367,23 @@ public class ItsService extends Service implements SensorEventListener { } } + private void doGetSupportedExtensionSizes( + String id, int extension, int format) throws ItsException { + try { + CameraExtensionCharacteristics chars = + mCameraManager.getCameraExtensionCharacteristics(id); + List<Size> extensionSizes = chars.getExtensionSupportedSizes(extension, format); + String response = extensionSizes.stream() + .distinct() + .sorted(Comparator.comparingInt(s -> s.getWidth() * s.getHeight())) + .map(Size::toString) + .collect(Collectors.joining(";")); + mSocketRunnableObj.sendResponse("supportedExtensionSizes", response); + } catch (CameraAccessException e) { + throw new ItsException("Failed to get supported extensions sizes list", e); + } + } + private class MediaCodecListener extends MediaCodec.Callback { private final MediaMuxer mMediaMuxer; private final Object mCondition; diff --git a/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java index ca9d75d3ad0..f306bd97278 100644 --- a/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java +++ b/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java @@ -269,8 +269,10 @@ public class BurstCaptureTest extends Camera2SurfaceViewTestCase { // Wait for first result with locking resultListener.drain(); + // Add 1 extra frame to wait due to earlier repeating request could introduce + // 1 more frame delay. CaptureResult lockedResult = - resultListener.getCaptureResultForRequest(lockedRequest, maxPipelineDepth); + resultListener.getCaptureResultForRequest(lockedRequest, maxPipelineDepth + 1); int pipelineDepth = lockedResult.get(CaptureResult.REQUEST_PIPELINE_DEPTH); diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderValidationTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderValidationTest.java index 0baa3afdbf8..6834b0c75e8 100644 --- a/tests/media/src/android/mediav2/cts/CodecDecoderValidationTest.java +++ b/tests/media/src/android/mediav2/cts/CodecDecoderValidationTest.java @@ -819,6 +819,17 @@ public class CodecDecoderValidationTest extends CodecDecoderTestBase { } Assume.assumeFalse("skip checksum verification due to tone mapping", mSkipChecksumVerification); + if (mIsAudio) { + int inputPcmEncoding = formats.get(0) + .getInteger(MediaFormat.KEY_PCM_ENCODING, AudioFormat.ENCODING_PCM_16BIT); + if (mMediaType.equals(MEDIA_TYPE_RAW) + && inputPcmEncoding != AudioFormat.ENCODING_PCM_16BIT) { + int outputPcmEncoding = mOutFormat.getInteger(MediaFormat.KEY_PCM_ENCODING, + AudioFormat.ENCODING_PCM_16BIT); + Assume.assumeTrue("output pcm encoding is not 16 bit, skipping output" + + " validation", outputPcmEncoding == AudioFormat.ENCODING_PCM_16BIT); + } + } CodecDecoderTest.verify(ref, mRefFile, mRmsError, AudioFormat.ENCODING_PCM_16BIT, mRefCRC, mTestConfig.toString() + mTestEnv.toString()); } diff --git a/tests/tests/content/AndroidTest.xml b/tests/tests/content/AndroidTest.xml index 894c2e1b33f..7d9727e4104 100644 --- a/tests/tests/content/AndroidTest.xml +++ b/tests/tests/content/AndroidTest.xml @@ -39,6 +39,13 @@ <option name="force-root" value="false" /> </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <option name="force-skip-system-props" value="true" /> + <option name="set-global-setting" key="verifier_engprod" value="1" /> + <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" /> + <option name="restore-settings" value="true" /> + </target_preparer> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> <option name="cleanup" value="true" /> <option name="push" value="CtsContentTestCases.apk->/data/local/tmp/cts/content/CtsContentTestCases.apk" /> diff --git a/tests/tests/toastlegacy/AndroidTest.xml b/tests/tests/toastlegacy/AndroidTest.xml index 2d6c4c62768..6976f1eae9c 100644 --- a/tests/tests/toastlegacy/AndroidTest.xml +++ b/tests/tests/toastlegacy/AndroidTest.xml @@ -20,6 +20,12 @@ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" /> <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" /> <option name="config-descriptor:metadata" key="parameter" value="secondary_user" /> + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <option name="force-skip-system-props" value="true" /> + <option name="set-global-setting" key="verifier_engprod" value="1" /> + <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" /> + <option name="restore-settings" value="true" /> + </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> <option name="cleanup-apks" value="true" /> <option name="test-file-name" value="CtsToastLegacyTestCases.apk" /> |