diff options
| author | 2021-05-27 14:45:11 -0700 | |
|---|---|---|
| committer | 2021-05-27 18:11:38 -0700 | |
| commit | db73d5d6ba548dcd66b917d06abc766acd9fae70 (patch) | |
| tree | 8dcf594b5d05010d8ffd4bc9aaf42effb1efd528 | |
| parent | ee4d86d0c1f04fdb676ae67d508ca92b167c30b9 (diff) | |
Camera: Add black test pattern mode for privacy
Add an enum value for test pattern BLACK, to be used with
camera muting on devices that can't implement the full
SOLID_COLOR test pattern API.
Also include it in test API to ensure correct behavior can
be tested.
Test: Camera CTS continues to pass
Bug: 189507251
Change-Id: Ie9449f722fdc356c690f1513d4cb25a43a14e4c8
| -rw-r--r-- | core/api/test-current.txt | 4 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CameraMetadata.java | 19 |
2 files changed, 21 insertions, 2 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 2f795f0e103f..572523035556 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -1103,6 +1103,10 @@ package android.hardware.camera2 { method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraOpened(@NonNull String, @NonNull String); } + public abstract class CameraMetadata<TKey> { + field public static final int SENSOR_TEST_PATTERN_MODE_BLACK = 5; // 0x5 + } + } package android.hardware.devicestate { diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index d4da3b9526c3..9501994fe38a 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -17,6 +17,7 @@ package android.hardware.camera2; import android.annotation.NonNull; +import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.hardware.camera2.impl.CameraMetadataNative; import android.hardware.camera2.impl.PublicKey; @@ -2922,10 +2923,10 @@ public abstract class CameraMetadata<TKey> { * respective color channel provided in * {@link CaptureRequest#SENSOR_TEST_PATTERN_DATA android.sensor.testPatternData}.</p> * <p>For example:</p> - * <pre><code>android.control.testPatternData = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0] + * <pre><code>{@link CaptureRequest#SENSOR_TEST_PATTERN_DATA android.sensor.testPatternData} = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0] * </code></pre> * <p>All green pixels are 100% green. All red/blue pixels are black.</p> - * <pre><code>android.control.testPatternData = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0] + * <pre><code>{@link CaptureRequest#SENSOR_TEST_PATTERN_DATA android.sensor.testPatternData} = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0] * </code></pre> * <p>All red pixels are 100% red. Only the odd green pixels * are 100% green. All blue pixels are 100% black.</p> @@ -3002,6 +3003,20 @@ public abstract class CameraMetadata<TKey> { public static final int SENSOR_TEST_PATTERN_MODE_PN9 = 4; /** + * <p>All pixel data is replaced by 0% intensity (black) values.</p> + * <p>This test pattern is identical to SOLID_COLOR with a value of <code>[0, 0, 0, 0]</code> for + * {@link CaptureRequest#SENSOR_TEST_PATTERN_DATA android.sensor.testPatternData}. It is recommended that devices implement full + * SOLID_COLOR support instead, but BLACK can be used to provide minimal support for a + * test pattern suitable for privacy use cases.</p> + * + * @see CaptureRequest#SENSOR_TEST_PATTERN_DATA + * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE + * @hide + */ + @TestApi + public static final int SENSOR_TEST_PATTERN_MODE_BLACK = 5; + + /** * <p>The first custom test pattern. All custom patterns that are * available only on this camera device are at least this numeric * value.</p> |