diff options
22 files changed, 302 insertions, 1364 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 65a519d3d7d9..1f5ea1081bc3 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -19376,11 +19376,9 @@ package android.hardware.camera2 { method @NonNull public java.util.List<java.lang.Integer> getSupportedExtensions(); method public boolean isCaptureProcessProgressAvailable(int); method public boolean isPostviewAvailable(int); - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Float>> EFV_PADDING_ZOOM_FACTOR_RANGE; field public static final int EXTENSION_AUTOMATIC = 0; // 0x0 field @Deprecated public static final int EXTENSION_BEAUTY = 1; // 0x1 field public static final int EXTENSION_BOKEH = 2; // 0x2 - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") public static final int EXTENSION_EYES_FREE_VIDEOGRAPHY = 5; // 0x5 field public static final int EXTENSION_FACE_RETOUCH = 1; // 0x1 field public static final int EXTENSION_HDR = 3; // 0x3 field public static final int EXTENSION_NIGHT = 4; // 0x4 @@ -19980,30 +19978,6 @@ package android.hardware.camera2 { field public static final int MAX_THUMBNAIL_DIMENSION = 256; // 0x100 } - @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") public final class ExtensionCaptureRequest { - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> EFV_AUTO_ZOOM; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> EFV_MAX_PADDING_ZOOM_FACTOR; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> EFV_PADDING_ZOOM_FACTOR; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> EFV_ROTATE_VIEWPORT; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> EFV_STABILIZATION_MODE; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") public static final int EFV_STABILIZATION_MODE_GIMBAL = 1; // 0x1 - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") public static final int EFV_STABILIZATION_MODE_LOCKED = 2; // 0x2 - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") public static final int EFV_STABILIZATION_MODE_OFF = 0; // 0x0 - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.util.Pair<java.lang.Integer,java.lang.Integer>> EFV_TRANSLATE_VIEWPORT; - } - - @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") public final class ExtensionCaptureResult { - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> EFV_AUTO_ZOOM; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<int[]> EFV_AUTO_ZOOM_PADDING_REGION; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> EFV_MAX_PADDING_ZOOM_FACTOR; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<int[]> EFV_PADDING_REGION; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> EFV_PADDING_ZOOM_FACTOR; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> EFV_ROTATE_VIEWPORT; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> EFV_STABILIZATION_MODE; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.graphics.PointF[]> EFV_TARGET_COORDINATES; - field @FlaggedApi("com.android.internal.camera.flags.concert_mode_api") @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Integer,java.lang.Integer>> EFV_TRANSLATE_VIEWPORT; - } - public class MultiResolutionImageReader implements java.lang.AutoCloseable { ctor public MultiResolutionImageReader(@NonNull java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>, int, @IntRange(from=1) int); method public void close(); diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 7a8a16f4b98a..ae84c93344ba 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -5976,28 +5976,6 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri public static final Key<android.hardware.camera2.params.StreamConfigurationDuration[]> JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION = new Key<android.hardware.camera2.params.StreamConfigurationDuration[]>("android.jpegr.availableJpegRStallDurationsMaximumResolution", android.hardware.camera2.params.StreamConfigurationDuration[].class); - /** - * <p>Minimum and maximum padding zoom factors supported by this camera device for - * android.efv.paddingZoomFactor used for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension.</p> - * <p>The minimum and maximum padding zoom factors supported by the device for - * android.efv.paddingZoomFactor used as part of the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension feature. This extension specific camera characteristic can be queried using - * {@link android.hardware.camera2.CameraExtensionCharacteristics#get }.</p> - * <p><b>Units</b>: A pair of padding zoom factors in floating-points: - * (minPaddingZoomFactor, maxPaddingZoomFactor)</p> - * <p><b>Range of valid values:</b><br></p> - * <p>1.0 < minPaddingZoomFactor <= maxPaddingZoomFactor</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.util.Range<Float>> EFV_PADDING_ZOOM_FACTOR_RANGE = - new Key<android.util.Range<Float>>("android.efv.paddingZoomFactorRange", new TypeReference<android.util.Range<Float>>() {{ }}); - /** * Mapping from INFO_SESSION_CONFIGURATION_QUERY_VERSION to session characteristics key. diff --git a/core/java/android/hardware/camera2/CameraExtensionCharacteristics.java b/core/java/android/hardware/camera2/CameraExtensionCharacteristics.java index 04a810a89f47..9b87df9ad3a4 100644 --- a/core/java/android/hardware/camera2/CameraExtensionCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraExtensionCharacteristics.java @@ -141,12 +141,6 @@ public final class CameraExtensionCharacteristics { public static final int EXTENSION_NIGHT = 4; /** - * An extension that aims to lock and stabilize a given region or object of interest. - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EXTENSION_EYES_FREE_VIDEOGRAPHY = 5; - - /** * @hide */ @Retention(RetentionPolicy.SOURCE) @@ -154,8 +148,7 @@ public final class CameraExtensionCharacteristics { EXTENSION_FACE_RETOUCH, EXTENSION_BOKEH, EXTENSION_HDR, - EXTENSION_NIGHT, - EXTENSION_EYES_FREE_VIDEOGRAPHY}) + EXTENSION_NIGHT}) public @interface Extension { } @@ -634,9 +627,6 @@ public final class CameraExtensionCharacteristics { public ExtensionConnectionManager() { IntArray extensionList = new IntArray(EXTENSION_LIST.length); extensionList.addAll(EXTENSION_LIST); - if (Flags.concertModeApi()) { - extensionList.add(EXTENSION_EYES_FREE_VIDEOGRAPHY); - } for (int extensionType : extensionList.toArray()) { mConnections.put(extensionType, new ExtensionConnection()); @@ -837,9 +827,6 @@ public final class CameraExtensionCharacteristics { IntArray extensionList = new IntArray(EXTENSION_LIST.length); extensionList.addAll(EXTENSION_LIST); - if (Flags.concertModeApi()) { - extensionList.add(EXTENSION_EYES_FREE_VIDEOGRAPHY); - } for (int extensionType : extensionList.toArray()) { try { @@ -1598,28 +1585,4 @@ public final class CameraExtensionCharacteristics { return Collections.unmodifiableSet(ret); } - - - /** - * <p>Minimum and maximum padding zoom factors supported by this camera device for - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } used for - * the {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension.</p> - * <p>The minimum and maximum padding zoom factors supported by the device for - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } used as part of the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension feature. This extension specific camera characteristic can be queried using - * {@link android.hardware.camera2.CameraExtensionCharacteristics#get}.</p> - * <p><b>Units</b>: A pair of padding zoom factors in floating-points: - * (minPaddingZoomFactor, maxPaddingZoomFactor)</p> - * <p><b>Range of valid values:</b><br></p> - * <p>1.0 < minPaddingZoomFactor <= maxPaddingZoomFactor</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.util.Range<Float>> EFV_PADDING_ZOOM_FACTOR_RANGE = - CameraCharacteristics.EFV_PADDING_ZOOM_FACTOR_RANGE; } diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 4819f67cb566..a69a37133192 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -3897,36 +3897,6 @@ public abstract class CameraMetadata<TKey> { public static final int DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2; // - // Enumeration values for CaptureRequest#EFV_STABILIZATION_MODE - // - - /** - * <p>No stabilization.</p> - * @see CaptureRequest#EFV_STABILIZATION_MODE - * @hide - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EFV_STABILIZATION_MODE_OFF = 0; - - /** - * <p>Gimbal stabilization mode.</p> - * @see CaptureRequest#EFV_STABILIZATION_MODE - * @hide - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EFV_STABILIZATION_MODE_GIMBAL = 1; - - /** - * <p>Locked stabilization mode which uses the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * stabilization to directionally steady the target region.</p> - * @see CaptureRequest#EFV_STABILIZATION_MODE - * @hide - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EFV_STABILIZATION_MODE_LOCKED = 2; - - // // Enumeration values for CaptureResult#CONTROL_AE_STATE // diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 3b69aa742b85..d25def4635e1 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -4325,146 +4325,6 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> public static final Key<Integer> EXTENSION_STRENGTH = new Key<Integer>("android.extension.strength", int.class); - /** - * <p>Used to apply an additional digital zoom factor for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>For the {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature, an additional zoom factor is applied on top of the existing {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. - * This additional zoom factor serves as a buffer to provide more flexibility for the - * {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } - * mode. If android.efv.paddingZoomFactor is not set, the default will be used. - * The effectiveness of the stabilization may be influenced by the amount of padding zoom - * applied. A higher padding zoom factor can stabilize the target region more effectively - * with greater flexibility but may potentially impact image quality. Conversely, a lower - * padding zoom factor may be used to prioritize preserving image quality, albeit with less - * leeway in stabilizing the target region. It is recommended to set the - * android.efv.paddingZoomFactor to at least 1.5.</p> - * <p>If android.efv.autoZoom is enabled, the requested android.efv.paddingZoomFactor will be overridden. - * android.efv.maxPaddingZoomFactor can be checked for more details on controlling the - * padding zoom factor during android.efv.autoZoom.</p> - * <p><b>Range of valid values:</b><br> - * android.efv.paddingZoomFactorRange</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_PADDING_ZOOM_FACTOR = - new Key<Float>("android.efv.paddingZoomFactor", float.class); - - /** - * <p>Used to enable or disable auto zoom for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Turn on auto zoom to let the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature decide at any given point a combination of - * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} and android.efv.paddingZoomFactor - * to keep the target region in view and stabilized. The combination chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * will equal the requested {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} multiplied with the requested - * android.efv.paddingZoomFactor. A limit can be set on the padding zoom if wanting - * to control image quality further using android.efv.maxPaddingZoomFactor.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Boolean> EFV_AUTO_ZOOM = - new Key<Boolean>("android.efv.autoZoom", boolean.class); - - /** - * <p>Used to limit the android.efv.paddingZoomFactor if - * android.efv.autoZoom is enabled for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>If android.efv.autoZoom is enabled, this key can be used to set a limit - * on the android.efv.paddingZoomFactor chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode - * to control image quality.</p> - * <p><b>Range of valid values:</b><br> - * The range of android.efv.paddingZoomFactorRange. Use a value greater than or equal to - * the android.efv.paddingZoomFactor to effectively utilize this key.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_MAX_PADDING_ZOOM_FACTOR = - new Key<Float>("android.efv.maxPaddingZoomFactor", float.class); - - /** - * <p>Set the stabilization mode for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension</p> - * <p>The desired stabilization mode. Gimbal stabilization mode provides simple, non-locked - * video stabilization. Locked mode uses the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * stabilization feature to fixate on the current region, utilizing it as the target area for - * stabilization.</p> - * <p><b>Possible values:</b></p> - * <ul> - * <li>{@link #EFV_STABILIZATION_MODE_OFF OFF}</li> - * <li>{@link #EFV_STABILIZATION_MODE_GIMBAL GIMBAL}</li> - * <li>{@link #EFV_STABILIZATION_MODE_LOCKED LOCKED}</li> - * </ul> - * - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @see #EFV_STABILIZATION_MODE_OFF - * @see #EFV_STABILIZATION_MODE_GIMBAL - * @see #EFV_STABILIZATION_MODE_LOCKED - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Integer> EFV_STABILIZATION_MODE = - new Key<Integer>("android.efv.stabilizationMode", int.class); - - /** - * <p>Used to update the target region for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>A android.util.Pair<Integer,Integer> that represents the desired - * <Horizontal,Vertical> shift of the current locked view (or target region) in - * pixels. Negative values indicate left and upward shifts, while positive values indicate - * right and downward shifts in the active array coordinate system.</p> - * <p><b>Range of valid values:</b><br> - * android.util.Pair<Integer,Integer> represents the - * <Horizontal,Vertical> shift. The range for the horizontal shift is - * [-max(android.efv.paddingRegion-left), max(android.efv.paddingRegion-right)]. - * The range for the vertical shift is - * [-max(android.efv.paddingRegion-top), max(android.efv.paddingRegion-bottom)]</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.util.Pair<Integer,Integer>> EFV_TRANSLATE_VIEWPORT = - new Key<android.util.Pair<Integer,Integer>>("android.efv.translateViewport", new TypeReference<android.util.Pair<Integer,Integer>>() {{ }}); - - /** - * <p>Representing the desired clockwise rotation - * of the target region in degrees for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Value representing the desired clockwise rotation of the target - * region in degrees.</p> - * <p><b>Range of valid values:</b><br> - * 0 to 360</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_ROTATE_VIEWPORT = - new Key<Float>("android.efv.rotateViewport", float.class); - /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * End generated code *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 34ce92c0f498..642384a57a2c 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -5940,214 +5940,6 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { public static final Key<Integer> EXTENSION_STRENGTH = new Key<Integer>("android.extension.strength", int.class); - /** - * <p>The padding region for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>An array [left, top, right, bottom] of the padding in pixels remaining on all four sides - * before the target region starts to go out of bounds.</p> - * <p>The padding region denotes the area surrounding the stabilized target region within which - * the camera can be moved while maintaining the target region in view. As the camera moves, - * the padding region adjusts to represent the proximity of the target region to the - * boundary, which is the point at which the target region will start to go out of bounds.</p> - * <p><b>Range of valid values:</b><br> - * The padding is the number of remaining pixels of padding in each direction. - * The pixels reference the active array coordinate system. Negative values indicate the target - * region is out of bounds. The value for this key may be null for when the stabilization mode is - * in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_OFF } - * or {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_GIMBAL } mode.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<int[]> EFV_PADDING_REGION = - new Key<int[]>("android.efv.paddingRegion", int[].class); - - /** - * <p>The padding region when android.efv.autoZoom is enabled for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>An array [left, top, right, bottom] of the padding in pixels remaining on all four sides - * before the target region starts to go out of bounds.</p> - * <p>This may differ from android.efv.paddingRegion as the field of view can change - * during android.efv.autoZoom, altering the boundary region and thus updating the padding between the - * target region and the boundary.</p> - * <p><b>Range of valid values:</b><br> - * The padding is the number of remaining pixels of padding in each direction - * when android.efv.autoZoom is enabled. Negative values indicate the target region is out of bounds. - * The value for this key may be null for when the android.efv.autoZoom is not enabled.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<int[]> EFV_AUTO_ZOOM_PADDING_REGION = - new Key<int[]>("android.efv.autoZoomPaddingRegion", int[].class); - - /** - * <p>List of coordinates representing the target region relative to the - * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE } - * for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in - * {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>A list of android.graphics.PointF that define the coordinates of the target region - * relative to the - * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE }. - * The array represents the target region coordinates as: top-left, top-right, bottom-left, - * bottom-right.</p> - * <p><b>Range of valid values:</b><br> - * The list of target coordinates will define a region within the bounds of the - * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE }</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.graphics.PointF[]> EFV_TARGET_COORDINATES = - new Key<android.graphics.PointF[]>("android.efv.targetCoordinates", android.graphics.PointF[].class); - - /** - * <p>Used to apply an additional digital zoom factor for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>For the {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature, an additional zoom factor is applied on top of the existing {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. - * This additional zoom factor serves as a buffer to provide more flexibility for the - * {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } - * mode. If android.efv.paddingZoomFactor is not set, the default will be used. - * The effectiveness of the stabilization may be influenced by the amount of padding zoom - * applied. A higher padding zoom factor can stabilize the target region more effectively - * with greater flexibility but may potentially impact image quality. Conversely, a lower - * padding zoom factor may be used to prioritize preserving image quality, albeit with less - * leeway in stabilizing the target region. It is recommended to set the - * android.efv.paddingZoomFactor to at least 1.5.</p> - * <p>If android.efv.autoZoom is enabled, the requested android.efv.paddingZoomFactor will be overridden. - * android.efv.maxPaddingZoomFactor can be checked for more details on controlling the - * padding zoom factor during android.efv.autoZoom.</p> - * <p><b>Range of valid values:</b><br> - * android.efv.paddingZoomFactorRange</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_PADDING_ZOOM_FACTOR = - new Key<Float>("android.efv.paddingZoomFactor", float.class); - - /** - * <p>Set the stabilization mode for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension</p> - * <p>The desired stabilization mode. Gimbal stabilization mode provides simple, non-locked - * video stabilization. Locked mode uses the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * stabilization feature to fixate on the current region, utilizing it as the target area for - * stabilization.</p> - * <p><b>Possible values:</b></p> - * <ul> - * <li>{@link #EFV_STABILIZATION_MODE_OFF OFF}</li> - * <li>{@link #EFV_STABILIZATION_MODE_GIMBAL GIMBAL}</li> - * <li>{@link #EFV_STABILIZATION_MODE_LOCKED LOCKED}</li> - * </ul> - * - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @see #EFV_STABILIZATION_MODE_OFF - * @see #EFV_STABILIZATION_MODE_GIMBAL - * @see #EFV_STABILIZATION_MODE_LOCKED - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Integer> EFV_STABILIZATION_MODE = - new Key<Integer>("android.efv.stabilizationMode", int.class); - - /** - * <p>Used to enable or disable auto zoom for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Turn on auto zoom to let the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature decide at any given point a combination of - * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} and android.efv.paddingZoomFactor - * to keep the target region in view and stabilized. The combination chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * will equal the requested {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} multiplied with the requested - * android.efv.paddingZoomFactor. A limit can be set on the padding zoom if wanting - * to control image quality further using android.efv.maxPaddingZoomFactor.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Boolean> EFV_AUTO_ZOOM = - new Key<Boolean>("android.efv.autoZoom", boolean.class); - - /** - * <p>Representing the desired clockwise rotation - * of the target region in degrees for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Value representing the desired clockwise rotation of the target - * region in degrees.</p> - * <p><b>Range of valid values:</b><br> - * 0 to 360</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_ROTATE_VIEWPORT = - new Key<Float>("android.efv.rotateViewport", float.class); - - /** - * <p>Used to update the target region for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>A android.util.Pair<Integer,Integer> that represents the desired - * <Horizontal,Vertical> shift of the current locked view (or target region) in - * pixels. Negative values indicate left and upward shifts, while positive values indicate - * right and downward shifts in the active array coordinate system.</p> - * <p><b>Range of valid values:</b><br> - * android.util.Pair<Integer,Integer> represents the - * <Horizontal,Vertical> shift. The range for the horizontal shift is - * [-max(android.efv.paddingRegion-left), max(android.efv.paddingRegion-right)]. - * The range for the vertical shift is - * [-max(android.efv.paddingRegion-top), max(android.efv.paddingRegion-bottom)]</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.util.Pair<Integer,Integer>> EFV_TRANSLATE_VIEWPORT = - new Key<android.util.Pair<Integer,Integer>>("android.efv.translateViewport", new TypeReference<android.util.Pair<Integer,Integer>>() {{ }}); - - /** - * <p>Used to limit the android.efv.paddingZoomFactor if - * android.efv.autoZoom is enabled for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>If android.efv.autoZoom is enabled, this key can be used to set a limit - * on the android.efv.paddingZoomFactor chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.CameraMetadata#EFV_STABILIZATION_MODE_LOCKED } mode - * to control image quality.</p> - * <p><b>Range of valid values:</b><br> - * The range of android.efv.paddingZoomFactorRange. Use a value greater than or equal to - * the android.efv.paddingZoomFactor to effectively utilize this key.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @hide - */ - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_MAX_PADDING_ZOOM_FACTOR = - new Key<Float>("android.efv.maxPaddingZoomFactor", float.class); - /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ * End generated code *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ diff --git a/core/java/android/hardware/camera2/ExtensionCaptureRequest.java b/core/java/android/hardware/camera2/ExtensionCaptureRequest.java deleted file mode 100644 index b681ce40dfd9..000000000000 --- a/core/java/android/hardware/camera2/ExtensionCaptureRequest.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.hardware.camera2; - -import android.annotation.FlaggedApi; -import android.annotation.NonNull; -import android.hardware.camera2.CaptureRequest; -import android.hardware.camera2.CaptureRequest.Key; -import android.hardware.camera2.impl.ExtensionKey; -import android.hardware.camera2.impl.PublicKey; - -import com.android.internal.camera.flags.Flags; - -/** - * ExtensionCaptureRequest contains definitions for extension-specific CaptureRequest keys that - * can be used to configure a {@link android.hardware.camera2.CaptureRequest} during a - * {@link android.hardware.camera2.CameraExtensionSession}. - * - * Note that ExtensionCaptureRequest is not intended to be used as a replacement - * for CaptureRequest in the extensions. It serves as a supplementary class providing - * extension-specific CaptureRequest keys. Developers should use these keys in conjunction - * with regular CaptureRequest objects during a - * {@link android.hardware.camera2.CameraExtensionSession}. - * - * @see CaptureRequest - * @see CameraExtensionSession - */ -@FlaggedApi(Flags.FLAG_CONCERT_MODE_API) -public final class ExtensionCaptureRequest { - - /** To avoid exposing constructor */ - private ExtensionCaptureRequest() {} - - /** - * <p>Used to apply an additional digital zoom factor for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>For the {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature, an additional zoom factor is applied on top of the existing {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. - * This additional zoom factor serves as a buffer to provide more flexibility for the - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } - * mode. If {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } is not set, the default will be used. - * The effectiveness of the stabilization may be influenced by the amount of padding zoom - * applied. A higher padding zoom factor can stabilize the target region more effectively - * with greater flexibility but may potentially impact image quality. Conversely, a lower - * padding zoom factor may be used to prioritize preserving image quality, albeit with less - * leeway in stabilizing the target region. It is recommended to set the - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } to at least 1.5.</p> - * <p>If {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled, the requested {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } will be overridden. - * {@link ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR } can be checked for more details on controlling the - * padding zoom factor during {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM }.</p> - * <p><b>Range of valid values:</b><br> - * {@link CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE }</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM - * @see ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR - * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR - * @see CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_PADDING_ZOOM_FACTOR = CaptureRequest.EFV_PADDING_ZOOM_FACTOR; - - /** - * <p>Used to enable or disable auto zoom for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Turn on auto zoom to let the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature decide at any given point a combination of - * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} and {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } - * to keep the target region in view and stabilized. The combination chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * will equal the requested {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} multiplied with the requested - * {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR }. A limit can be set on the padding zoom if wanting - * to control image quality further using {@link ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR }.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @see ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR - * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Boolean> EFV_AUTO_ZOOM = CaptureRequest.EFV_AUTO_ZOOM; - - /** - * <p>Used to limit the {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } if - * {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>If {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled, this key can be used to set a limit - * on the {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode - * to control image quality.</p> - * <p><b>Range of valid values:</b><br> - * The range of {@link CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE Range}. Use a value greater than or equal to - * the {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } to - * effectively utilize this key.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM - * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR - * @see CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_MAX_PADDING_ZOOM_FACTOR = CaptureRequest.EFV_MAX_PADDING_ZOOM_FACTOR; - - /** - * <p>Set the stabilization mode for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension</p> - * <p>The desired stabilization mode. Gimbal stabilization mode provides simple, non-locked - * video stabilization. Locked mode uses the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * stabilization feature to fixate on the current region, utilizing it as the target area for - * stabilization.</p> - * <p><b>Possible values:</b></p> - * <ul> - * <li>{@link #EFV_STABILIZATION_MODE_OFF OFF}</li> - * <li>{@link #EFV_STABILIZATION_MODE_GIMBAL GIMBAL}</li> - * <li>{@link #EFV_STABILIZATION_MODE_LOCKED LOCKED}</li> - * </ul> - * - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @see #EFV_STABILIZATION_MODE_OFF - * @see #EFV_STABILIZATION_MODE_GIMBAL - * @see #EFV_STABILIZATION_MODE_LOCKED - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Integer> EFV_STABILIZATION_MODE = CaptureRequest.EFV_STABILIZATION_MODE; - - /** - * <p>Used to update the target region for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>A android.util.Pair<Integer,Integer> that represents the desired - * <Horizontal,Vertical> shift of the current locked view (or target region) in - * pixels. Negative values indicate left and upward shifts, while positive values indicate - * right and downward shifts in the active array coordinate system.</p> - * <p><b>Range of valid values:</b><br> - * android.util.Pair<Integer,Integer> represents the - * <Horizontal,Vertical> shift. The range for the horizontal shift is - * [-max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-left), max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-right)]. - * The range for the vertical shift is - * [-max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-top), max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-bottom)]</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see ExtensionCaptureResult#EFV_PADDING_REGION - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.util.Pair<Integer,Integer>> EFV_TRANSLATE_VIEWPORT = CaptureRequest.EFV_TRANSLATE_VIEWPORT; - - /** - * <p>Representing the desired clockwise rotation - * of the target region in degrees for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Value representing the desired clockwise rotation of the target - * region in degrees.</p> - * <p><b>Range of valid values:</b><br> - * 0 to 360</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_ROTATE_VIEWPORT = CaptureRequest.EFV_ROTATE_VIEWPORT; - - - // - // Enumeration values for CaptureRequest#EFV_STABILIZATION_MODE - // - - /** - * <p>No stabilization.</p> - * @see ExtensionCaptureRequest#EFV_STABILIZATION_MODE - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EFV_STABILIZATION_MODE_OFF = CaptureRequest.EFV_STABILIZATION_MODE_OFF; - - /** - * <p>Gimbal stabilization mode.</p> - * @see ExtensionCaptureRequest#EFV_STABILIZATION_MODE - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EFV_STABILIZATION_MODE_GIMBAL = CaptureRequest.EFV_STABILIZATION_MODE_GIMBAL; - - /** - * <p>Locked stabilization mode which uses the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * stabilization to directionally steady the target region.</p> - * @see ExtensionCaptureRequest#EFV_STABILIZATION_MODE - */ - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final int EFV_STABILIZATION_MODE_LOCKED = CaptureRequest.EFV_STABILIZATION_MODE_LOCKED; - -} diff --git a/core/java/android/hardware/camera2/ExtensionCaptureResult.java b/core/java/android/hardware/camera2/ExtensionCaptureResult.java deleted file mode 100644 index b7ba78cb34b5..000000000000 --- a/core/java/android/hardware/camera2/ExtensionCaptureResult.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.hardware.camera2; - -import android.annotation.FlaggedApi; -import android.annotation.NonNull; -import android.hardware.camera2.CameraExtensionCharacteristics; -import android.hardware.camera2.CaptureResult; -import android.hardware.camera2.CaptureResult.Key; -import android.hardware.camera2.impl.ExtensionKey; -import android.hardware.camera2.impl.PublicKey; - -import com.android.internal.camera.flags.Flags; - -/** - * ExtensionCaptureResult contains definitions for extension-specific CaptureResult keys that - * are available during a {@link android.hardware.camera2.CameraExtensionSession} after a - * {@link android.hardware.camera2.CaptureRequest} is processed. - * - * Note that ExtensionCaptureResult is not intended to be used as a replacement - * for CaptureResult in the extensions. It serves as a supplementary class providing - * extension-specific CaptureResult keys. Developers should use these keys in conjunction - * with regular CaptureResult objects during a - * {@link android.hardware.camera2.CameraExtensionSession}. - * - * @see CaptureResult - * @see CaptureRequest - * @see CameraExtensionSession - */ -@FlaggedApi(Flags.FLAG_CONCERT_MODE_API) -public final class ExtensionCaptureResult { - - /** To avoid exposing constructor */ - private ExtensionCaptureResult() {} - - /** - * <p>The padding region for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>An array [left, top, right, bottom] of the padding in pixels remaining on all four sides - * before the target region starts to go out of bounds.</p> - * <p>The padding region denotes the area surrounding the stabilized target region within which - * the camera can be moved while maintaining the target region in view. As the camera moves, - * the padding region adjusts to represent the proximity of the target region to the - * boundary, which is the point at which the target region will start to go out of bounds.</p> - * <p><b>Range of valid values:</b><br> - * The padding is the number of remaining pixels of padding in each direction. - * The pixels reference the active array coordinate system. Negative values indicate the target region - * is out of bounds. The value for this key may be null for when the stabilization mode is - * in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_OFF } - * or {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_GIMBAL } mode.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<int[]> EFV_PADDING_REGION = CaptureResult.EFV_PADDING_REGION; - - /** - * <p>The padding region when {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>An array [left, top, right, bottom] of the padding in pixels remaining on all four sides - * before the target region starts to go out of bounds.</p> - * <p>This may differ from {@link ExtensionCaptureResult#EFV_PADDING_REGION } as the field of view can change - * during {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM }, altering the boundary region and thus updating the padding between the - * target region and the boundary.</p> - * <p><b>Range of valid values:</b><br> - * The padding is the number of remaining pixels of padding in each direction - * when {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled. Negative values indicate the target region is out of bounds. - * The value for this key may be null for when the {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is not enabled.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM - * @see ExtensionCaptureResult#EFV_PADDING_REGION - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<int[]> EFV_AUTO_ZOOM_PADDING_REGION = CaptureResult.EFV_AUTO_ZOOM_PADDING_REGION; - - /** - * <p>List of coordinates representing the target region relative to the - * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE } - * for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>A list of android.graphics.PointF that define the coordinates of the target region - * relative to the - * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE }. - * The array represents the target region coordinates as: top-left, top-right, bottom-left, - * bottom-right.</p> - * <p><b>Range of valid values:</b><br> - * The list of target coordinates will define a region within the bounds of the - * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE }</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.graphics.PointF[]> EFV_TARGET_COORDINATES = CaptureResult.EFV_TARGET_COORDINATES; - - /** - * <p>Used to apply an additional digital zoom factor for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>For the {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature, an additional zoom factor is applied on top of the existing {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}. - * This additional zoom factor serves as a buffer to provide more flexibility for the - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } - * mode. If {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } is not set, the default will be used. - * The effectiveness of the stabilization may be influenced by the amount of padding zoom - * applied. A higher padding zoom factor can stabilize the target region more effectively - * with greater flexibility but may potentially impact image quality. Conversely, a lower - * padding zoom factor may be used to prioritize preserving image quality, albeit with less - * leeway in stabilizing the target region. It is recommended to set the - * {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } to at least 1.5.</p> - * <p>If {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled, the requested {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } will be overridden. - * {@link ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR } can be checked for more details on controlling the - * padding zoom factor during {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM }.</p> - * <p><b>Range of valid values:</b><br> - * {@link CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE }</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM - * @see ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR - * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR - * @see CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_PADDING_ZOOM_FACTOR = CaptureResult.EFV_PADDING_ZOOM_FACTOR; - - /** - * <p>Set the stabilization mode for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension</p> - * <p>The desired stabilization mode. Gimbal stabilization mode provides simple, non-locked - * video stabilization. Locked mode uses the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * stabilization feature to fixate on the current region, utilizing it as the target area for - * stabilization.</p> - * <p><b>Possible values:</b></p> - * <ul> - * <li>{@link #EFV_STABILIZATION_MODE_OFF OFF}</li> - * <li>{@link #EFV_STABILIZATION_MODE_GIMBAL GIMBAL}</li> - * <li>{@link #EFV_STABILIZATION_MODE_LOCKED LOCKED}</li> - * </ul> - * - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * @see #EFV_STABILIZATION_MODE_OFF - * @see #EFV_STABILIZATION_MODE_GIMBAL - * @see #EFV_STABILIZATION_MODE_LOCKED - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Integer> EFV_STABILIZATION_MODE = CaptureResult.EFV_STABILIZATION_MODE; - - /** - * <p>Used to enable or disable auto zoom for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Turn on auto zoom to let the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * feature decide at any given point a combination of - * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} and {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } - * to keep the target region in view and stabilized. The combination chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * will equal the requested {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} multiplied with the requested - * {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR }. A limit can be set on the padding zoom if wanting - * to control image quality further using {@link ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR }.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see CaptureRequest#CONTROL_ZOOM_RATIO - * @see ExtensionCaptureRequest#EFV_MAX_PADDING_ZOOM_FACTOR - * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Boolean> EFV_AUTO_ZOOM = CaptureResult.EFV_AUTO_ZOOM; - - /** - * <p>Representing the desired clockwise rotation - * of the target region in degrees for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>Value representing the desired clockwise rotation of the target - * region in degrees.</p> - * <p><b>Range of valid values:</b><br> - * 0 to 360</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_ROTATE_VIEWPORT = CaptureResult.EFV_ROTATE_VIEWPORT; - - /** - * <p>Used to update the target region for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>A android.util.Pair<Integer,Integer> that represents the desired - * <Horizontal,Vertical> shift of the current locked view (or target region) in - * pixels. Negative values indicate left and upward shifts, while positive values indicate - * right and downward shifts in the active array coordinate system.</p> - * <p><b>Range of valid values:</b><br> - * android.util.Pair<Integer,Integer> represents the - * <Horizontal,Vertical> shift. The range for the horizontal shift is - * [-max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-left), max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-right)]. - * The range for the vertical shift is - * [-max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-top), max({@link ExtensionCaptureResult#EFV_PADDING_REGION }-bottom)]</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see ExtensionCaptureResult#EFV_PADDING_REGION - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<android.util.Pair<Integer,Integer>> EFV_TRANSLATE_VIEWPORT = CaptureResult.EFV_TRANSLATE_VIEWPORT; - - /** - * <p>Used to limit the {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } if - * {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled for the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode.</p> - * <p>If {@link ExtensionCaptureRequest#EFV_AUTO_ZOOM } is enabled, this key can be used to set a limit - * on the {@link ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } chosen by the - * {@link android.hardware.camera2.CameraExtensionCharacteristics#EXTENSION_EYES_FREE_VIDEOGRAPHY } - * extension in {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_STABILIZATION_MODE_LOCKED } mode - * to control image quality.</p> - * <p><b>Range of valid values:</b><br> - * The range of {@link CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE }. Use a value greater than or equal to - * the {@link android.hardware.camera2.ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR } to - * effectively utilize this key.</p> - * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> - * - * @see ExtensionCaptureRequest#EFV_AUTO_ZOOM - * @see ExtensionCaptureRequest#EFV_PADDING_ZOOM_FACTOR - * @see CameraExtensionCharacteristics#EFV_PADDING_ZOOM_FACTOR_RANGE - */ - @PublicKey - @NonNull - @ExtensionKey - @FlaggedApi(Flags.FLAG_CONCERT_MODE_API) - public static final Key<Float> EFV_MAX_PADDING_ZOOM_FACTOR = CaptureResult.EFV_MAX_PADDING_ZOOM_FACTOR; - -} diff --git a/packages/SystemUI/src/com/android/systemui/modes/shared/ModesUi.kt b/packages/SystemUI/src/com/android/systemui/modes/shared/ModesUi.kt new file mode 100644 index 000000000000..a0663d72a076 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/modes/shared/ModesUi.kt @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.modes.shared + +import android.app.Flags +import com.android.systemui.flags.RefactorFlagUtils + +/** Helper for reading or using the modes ui flag state. */ +@Suppress("NOTHING_TO_INLINE") +object ModesUi { + /** Is the refactor enabled */ + @JvmStatic + inline val isEnabled + get() = Flags.modesApi() && Flags.modesUi() + + /** + * Called to ensure code is only run when the flag is enabled. This protects users from the + * unintended behaviors caused by accidentally running new logic, while also crashing on an eng + * build to ensure that the refactor author catches issues in testing. + */ + @JvmStatic + inline fun isUnexpectedlyInLegacyMode() = + RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, Flags.FLAG_MODES_UI) + + /** + * Called to ensure code is only run when the flag is disabled. This will throw an exception if + * the flag is not enabled to ensure that the refactor author catches issues in testing. + * Caution!! Using this check incorrectly will cause crashes in nextfood builds! + */ + @JvmStatic + inline fun assertInNewMode() = RefactorFlagUtils.assertInNewMode(isEnabled, Flags.FLAG_MODES_UI) + + /** + * Called to ensure code is only run when the flag is disabled. This will throw an exception if + * the flag is enabled to ensure that the refactor author catches issues in testing. + */ + @JvmStatic + inline fun assertInLegacyMode() = + RefactorFlagUtils.assertInLegacyMode(isEnabled, Flags.FLAG_MODES_UI) +} diff --git a/packages/SystemUI/src/com/android/systemui/modes/shared/ModesUiIcons.kt b/packages/SystemUI/src/com/android/systemui/modes/shared/ModesUiIcons.kt new file mode 100644 index 000000000000..032b0aca1770 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/modes/shared/ModesUiIcons.kt @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.modes.shared + +import android.app.Flags +import com.android.systemui.flags.RefactorFlagUtils + +/** Helper for reading or using the modes ui icons flag state. */ +@Suppress("NOTHING_TO_INLINE") +object ModesUiIcons { + /** Is the refactor enabled */ + @JvmStatic + inline val isEnabled + get() = ModesUi.isEnabled && Flags.modesUiIcons() + + /** + * Called to ensure code is only run when the flag is enabled. This protects users from the + * unintended behaviors caused by accidentally running new logic, while also crashing on an eng + * build to ensure that the refactor author catches issues in testing. + */ + @JvmStatic + inline fun isUnexpectedlyInLegacyMode() = + RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, Flags.FLAG_MODES_UI_ICONS) + + /** + * Called to ensure code is only run when the flag is disabled. This will throw an exception if + * the flag is not enabled to ensure that the refactor author catches issues in testing. + * Caution!! Using this check incorrectly will cause crashes in nextfood builds! + */ + @JvmStatic + inline fun assertInNewMode() = + RefactorFlagUtils.assertInNewMode(isEnabled, Flags.FLAG_MODES_UI_ICONS) + + /** + * Called to ensure code is only run when the flag is disabled. This will throw an exception if + * the flag is enabled to ensure that the refactor author catches issues in testing. + */ + @JvmStatic + inline fun assertInLegacyMode() = + RefactorFlagUtils.assertInLegacyMode(isEnabled, Flags.FLAG_MODES_UI_ICONS) +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index b927134842df..a4fe4e3e1243 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -49,7 +49,7 @@ import com.android.systemui.animation.DialogTransitionAnimator; import com.android.systemui.animation.Expandable; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; -import com.android.systemui.flags.RefactorFlagUtils; +import com.android.systemui.modes.shared.ModesUi; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.qs.QSTile.BooleanState; @@ -108,8 +108,7 @@ public class DndTile extends QSTileImpl<BooleanState> { statusBarStateController, activityStarter, qsLogger); // If the flag is on, this shouldn't run at all since the modes tile replaces the DND tile. - RefactorFlagUtils.INSTANCE.assertInLegacyMode(android.app.Flags.modesUi(), - android.app.Flags.FLAG_MODES_UI); + ModesUi.assertInLegacyMode(); mController = zenModeController; mSharedPreferences = sharedPreferences; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt index 7d23fbdf2ece..cf2db6c66ce7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt @@ -16,7 +16,6 @@ package com.android.systemui.qs.tiles -import android.app.Flags import android.content.Intent import android.os.Handler import android.os.Looper @@ -30,7 +29,8 @@ import com.android.internal.logging.MetricsLogger import com.android.systemui.animation.Expandable import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.flags.RefactorFlagUtils.isUnexpectedlyInLegacyMode +import com.android.systemui.modes.shared.ModesUi +import com.android.systemui.modes.shared.ModesUiIcons import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.qs.QSTile @@ -77,14 +77,14 @@ constructor( metricsLogger, statusBarStateController, activityStarter, - qsLogger + qsLogger, ) { private lateinit var tileState: QSTileState private val config = qsTileConfigProvider.getConfig(TILE_SPEC) init { - /* Check if */ isUnexpectedlyInLegacyMode(Flags.modesUi(), Flags.FLAG_MODES_UI) + /* Check if */ ModesUiIcons.isUnexpectedlyInLegacyMode() lifecycle.coroutineScope.launch { lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) { @@ -93,7 +93,7 @@ constructor( } } - override fun isAvailable(): Boolean = Flags.modesUi() + override fun isAvailable(): Boolean = ModesUi.isEnabled override fun getTileLabel(): CharSequence = tileState.label diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt index 483373d8fb6d..5d44ead7c21a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt @@ -16,13 +16,14 @@ package com.android.systemui.qs.tiles.impl.modes.domain.interactor -import android.app.Flags import android.content.Context import android.os.UserHandle import com.android.app.tracing.coroutines.flow.map import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.asIcon import com.android.systemui.dagger.qualifiers.Background +import com.android.systemui.modes.shared.ModesUi +import com.android.systemui.modes.shared.ModesUiIcons import com.android.systemui.qs.tiles.ModesTile import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger import com.android.systemui.qs.tiles.base.interactor.QSTileDataInteractor @@ -47,7 +48,7 @@ constructor( override fun tileData( user: UserHandle, - triggers: Flow<DataUpdateTrigger> + triggers: Flow<DataUpdateTrigger>, ): Flow<ModesTileModel> = tileData() /** @@ -64,20 +65,20 @@ constructor( suspend fun getCurrentTileModel() = buildTileData(zenModeInteractor.getActiveModes()) private fun buildTileData(activeModes: ActiveZenModes): ModesTileModel { - if (usesModeIcons()) { + if (ModesUiIcons.isEnabled) { val tileIcon = getTileIcon(activeModes.mainMode) return ModesTileModel( isActivated = activeModes.isAnyActive(), icon = tileIcon.icon, iconResId = tileIcon.resId, - activeModes = activeModes.modeNames + activeModes = activeModes.modeNames, ) } else { return ModesTileModel( isActivated = activeModes.isAnyActive(), icon = context.getDrawable(ModesTile.ICON_RES_ID)!!.asIcon(), iconResId = ModesTile.ICON_RES_ID, - activeModes = activeModes.modeNames + activeModes = activeModes.modeNames, ) } } @@ -97,7 +98,5 @@ constructor( } } - override fun availability(user: UserHandle): Flow<Boolean> = flowOf(Flags.modesUi()) - - private fun usesModeIcons() = Flags.modesApi() && Flags.modesUi() && Flags.modesUiIcons() + override fun availability(user: UserHandle): Flow<Boolean> = flowOf(ModesUi.isEnabled) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java index 87f360eb9712..ad3afd4d1756 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java @@ -61,6 +61,7 @@ import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIcon.Shape; import com.android.internal.util.ContrastColorUtil; import com.android.systemui.Flags; +import com.android.systemui.modes.shared.ModesUiIcons; import com.android.systemui.res.R; import com.android.systemui.statusbar.notification.NotificationContentDescription; import com.android.systemui.statusbar.notification.NotificationDozeHelper; @@ -215,7 +216,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi // We scale notification icons (on the left) plus icons on the right that explicitly // want FIXED_SPACE. boolean useNonSystemIconScaling = isNotification() - || (usesModeIcons() && mIcon != null && mIcon.shape == Shape.FIXED_SPACE); + || (ModesUiIcons.isEnabled() && mIcon != null && mIcon.shape == Shape.FIXED_SPACE); if (useNonSystemIconScaling) { updateIconScaleForNonSystemIcons(); @@ -415,7 +416,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi if (!levelEquals) { setImageLevel(icon.iconLevel); } - if (usesModeIcons() && icon.shape == Shape.FIXED_SPACE) { + if (ModesUiIcons.isEnabled() && icon.shape == Shape.FIXED_SPACE) { setScaleType(ScaleType.FIT_CENTER); } if (!visibilityEquals) { @@ -506,7 +507,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi @Nullable private Drawable loadDrawable(Context context, StatusBarIcon statusBarIcon) { - if (usesModeIcons() && statusBarIcon.preloadedIcon != null) { + if (ModesUiIcons.isEnabled() && statusBarIcon.preloadedIcon != null) { Drawable.ConstantState cached = statusBarIcon.preloadedIcon.getConstantState(); if (cached != null) { return cached.newDrawable(mContext.getResources()).mutate(); @@ -1041,9 +1042,4 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi public boolean showsConversation() { return mShowsConversation; } - - private static boolean usesModeIcons() { - return android.app.Flags.modesApi() && android.app.Flags.modesUi() - && android.app.Flags.modesUiIcons(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index ba39c3bb4124..8c0353813ec6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -51,6 +51,7 @@ import com.android.systemui.dagger.qualifiers.DisplayId; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor; +import com.android.systemui.modes.shared.ModesUiIcons; import com.android.systemui.privacy.PrivacyItem; import com.android.systemui.privacy.PrivacyItemController; import com.android.systemui.privacy.PrivacyType; @@ -360,7 +361,7 @@ public class PhoneStatusBarPolicy mBluetooth.addCallback(this); mProvisionedController.addCallback(this); mCurrentUserSetup = mProvisionedController.isCurrentUserSetup(); - if (usesModeIcons()) { + if (ModesUiIcons.isEnabled()) { // Note that we're not fully replacing ZenModeController with ZenModeInteractor, so // we listen for the extra event here but still add the ZMC callback. mJavaAdapter.alwaysCollectFlow(mZenModeInteractor.getMainActiveMode(), @@ -397,8 +398,7 @@ public class PhoneStatusBarPolicy } private void onMainActiveModeChanged(@Nullable ZenModeInfo mainActiveMode) { - if (!usesModeIcons()) { - Log.wtf(TAG, "onMainActiveModeChanged shouldn't run if MODES_UI_ICONS is disabled"); + if (ModesUiIcons.isUnexpectedlyInLegacyMode()) { return; } @@ -458,14 +458,14 @@ public class PhoneStatusBarPolicy private void updateVolumeZen() { int zen = mZenController.getZen(); - if (!usesModeIcons()) { + if (!ModesUiIcons.isEnabled()) { updateZenIcon(zen); } updateRingerAndAlarmIcons(zen); } private void updateZenIcon(int zen) { - if (usesModeIcons()) { + if (ModesUiIcons.isEnabled()) { Log.wtf(TAG, "updateZenIcon shouldn't be called if MODES_UI_ICONS is enabled"); return; } @@ -942,9 +942,4 @@ public class PhoneStatusBarPolicy mIconController.setIconVisibility(mSlotConnectedDisplay, visible); } - - private static boolean usesModeIcons() { - return android.app.Flags.modesApi() && android.app.Flags.modesUi() - && android.app.Flags.modesUiIcons(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/IconManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/IconManager.java index 91ead614ffa4..fd16c6090cb1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/IconManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/IconManager.java @@ -20,7 +20,6 @@ import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_BIND import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_ICON; import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_MOBILE_NEW; import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_WIFI_NEW; -import static com.android.systemui.statusbar.phone.ui.StatusBarIconControllerImpl.usesModeIcons; import android.annotation.Nullable; import android.content.Context; @@ -31,6 +30,7 @@ import android.widget.LinearLayout; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIcon.Shape; import com.android.systemui.demomode.DemoModeCommandReceiver; +import com.android.systemui.modes.shared.ModesUiIcons; import com.android.systemui.statusbar.BaseStatusBarFrameLayout; import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.StatusIconDisplayable; @@ -233,7 +233,7 @@ public class IconManager implements DemoModeCommandReceiver { } protected LinearLayout.LayoutParams onCreateLayoutParams(Shape shape) { - int width = usesModeIcons() && shape == StatusBarIcon.Shape.FIXED_SPACE + int width = ModesUiIcons.isEnabled() && shape == StatusBarIcon.Shape.FIXED_SPACE ? mIconSize : ViewGroup.LayoutParams.WRAP_CONTENT; @@ -259,7 +259,7 @@ public class IconManager implements DemoModeCommandReceiver { /** Called once an icon has been set. */ public void onSetIcon(int viewIndex, StatusBarIcon icon) { StatusBarIconView view = (StatusBarIconView) mGroup.getChildAt(viewIndex); - if (usesModeIcons()) { + if (ModesUiIcons.isEnabled()) { ViewGroup.LayoutParams current = view.getLayoutParams(); ViewGroup.LayoutParams desired = onCreateLayoutParams(icon.shape); if (desired.width != current.width || desired.height != current.height) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImpl.java index 9b6d32bd179d..e66e8138102e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerImpl.java @@ -42,6 +42,7 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.demomode.DemoMode; import com.android.systemui.demomode.DemoModeController; import com.android.systemui.dump.DumpManager; +import com.android.systemui.modes.shared.ModesUiIcons; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.StatusIconDisplayable; import com.android.systemui.statusbar.phone.StatusBarIconHolder; @@ -242,10 +243,7 @@ public class StatusBarIconControllerImpl implements Tunable, public void setResourceIcon(String slot, @Nullable String resPackage, @DrawableRes int iconResId, @Nullable Drawable preloadedIcon, CharSequence contentDescription, StatusBarIcon.Shape shape) { - if (!usesModeIcons()) { - Log.wtf("TAG", - "StatusBarIconController.setResourceIcon() should not be called without " - + "MODES_UI & MODES_UI_ICONS!"); + if (ModesUiIcons.isUnexpectedlyInLegacyMode()) { // Fall back to old implementation, although it will not load the icon if it's from a // different package. setIcon(slot, iconResId, contentDescription); @@ -580,9 +578,4 @@ public class StatusBarIconControllerImpl implements Tunable, return slot + EXTERNAL_SLOT_SUFFIX; } } - - static boolean usesModeIcons() { - return android.app.Flags.modesApi() && android.app.Flags.modesUi() - && android.app.Flags.modesUiIcons(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt index cf9f9f4a2a81..3cb7090ea6d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt @@ -21,6 +21,7 @@ import android.os.UserManager.DISALLOW_CONFIG_LOCATION import android.os.UserManager.DISALLOW_MICROPHONE_TOGGLE import android.os.UserManager.DISALLOW_SHARE_LOCATION import com.android.systemui.Flags +import com.android.systemui.modes.shared.ModesUi import com.android.systemui.qs.QsEventLogger import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.shared.model.TileCategory @@ -142,7 +143,7 @@ interface PolicyModule { dndTile: Provider<DndTile>, modesTile: Provider<ModesTile>, ): QSTileImpl<*> { - return if (android.app.Flags.modesUi()) modesTile.get() else dndTile.get() + return if (ModesUi.isEnabled) modesTile.get() else dndTile.get() } /** Inject flashlight config */ @@ -169,7 +170,7 @@ interface PolicyModule { factory: QSTileViewModelFactory.Static<FlashlightTileModel>, mapper: FlashlightMapper, stateInteractor: FlashlightTileDataInteractor, - userActionInteractor: FlashlightTileUserActionInteractor + userActionInteractor: FlashlightTileUserActionInteractor, ): QSTileViewModel = factory.create( TileSpec.create(FLASHLIGHT_TILE_SPEC), @@ -206,7 +207,7 @@ interface PolicyModule { factory: QSTileViewModelFactory.Static<LocationTileModel>, mapper: LocationTileMapper, stateInteractor: LocationTileDataInteractor, - userActionInteractor: LocationTileUserActionInteractor + userActionInteractor: LocationTileUserActionInteractor, ): QSTileViewModel = factory.create( TileSpec.create(LOCATION_TILE_SPEC), @@ -239,7 +240,7 @@ interface PolicyModule { factory: QSTileViewModelFactory.Static<AlarmTileModel>, mapper: AlarmTileMapper, stateInteractor: AlarmTileDataInteractor, - userActionInteractor: AlarmTileUserActionInteractor + userActionInteractor: AlarmTileUserActionInteractor, ): QSTileViewModel = factory.create( TileSpec.create(ALARM_TILE_SPEC), @@ -272,7 +273,7 @@ interface PolicyModule { factory: QSTileViewModelFactory.Static<UiModeNightTileModel>, mapper: UiModeNightTileMapper, stateInteractor: UiModeNightTileDataInteractor, - userActionInteractor: UiModeNightTileUserActionInteractor + userActionInteractor: UiModeNightTileUserActionInteractor, ): QSTileViewModel = factory.create( TileSpec.create(UIMODENIGHT_TILE_SPEC), @@ -306,7 +307,7 @@ interface PolicyModule { factory: QSTileViewModelFactory.Static<WorkModeTileModel>, mapper: WorkModeTileMapper, stateInteractor: WorkModeTileDataInteractor, - userActionInteractor: WorkModeTileUserActionInteractor + userActionInteractor: WorkModeTileUserActionInteractor, ): QSTileViewModel = factory.create( TileSpec.create(WORK_MODE_TILE_SPEC), @@ -406,7 +407,7 @@ interface PolicyModule { @IntoMap @StringKey(DND_TILE_SPEC) fun provideDndOrModesTileConfig(uiEventLogger: QsEventLogger): QSTileConfig = - if (android.app.Flags.modesUi()) { + if (ModesUi.isEnabled) { QSTileConfig( tileSpec = TileSpec.create(DND_TILE_SPEC), uiConfig = @@ -438,9 +439,9 @@ interface PolicyModule { factory: QSTileViewModelFactory.Static<ModesTileModel>, mapper: ModesTileMapper, stateInteractor: ModesTileDataInteractor, - userActionInteractor: ModesTileUserActionInteractor + userActionInteractor: ModesTileUserActionInteractor, ): QSTileViewModel = - if (android.app.Flags.modesUi() && Flags.qsNewTilesFuture()) + if (ModesUi.isEnabled && Flags.qsNewTilesFuture()) factory.create( TileSpec.create(DND_TILE_SPEC), userActionInteractor, diff --git a/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java b/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java index c3d68cf04edd..93cdde0d9a20 100644 --- a/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java +++ b/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java @@ -529,167 +529,6 @@ public class CameraExtensionsProxyService extends Service { */ public static Pair<PreviewExtenderImpl, ImageCaptureExtenderImpl> initializeExtension( int extensionType) { - if (Flags.concertModeApi()) { - if (extensionType == CameraExtensionCharacteristics.EXTENSION_EYES_FREE_VIDEOGRAPHY) { - // Basic extensions are deprecated starting with extension version 1.5 - return new Pair<>(new PreviewExtenderImpl() { - @Override - public boolean isExtensionAvailable(String cameraId, - CameraCharacteristics cameraCharacteristics) { - return false; - } - - @Override - public void init(String cameraId, CameraCharacteristics cameraCharacteristics) { - - } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl getCaptureStage() { - return null; - } - - @Override - public ProcessorType getProcessorType() { - return null; - } - - @Override - public ProcessorImpl getProcessor() { - return null; - } - - @Nullable - @Override - public List<Pair<Integer, Size[]>> getSupportedResolutions() { - return null; - } - - @Override - public void onInit(String cameraId, CameraCharacteristics cameraCharacteristics, - Context context) { } - - @Override - public void onDeInit() { } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl onPresetSession() { - return null; - } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl onEnableSession() { - return null; - } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl onDisableSession() { - return null; - } - - @Override - public int onSessionType() { - return 0; - } - }, new ImageCaptureExtenderImpl() { - @Override - public boolean isExtensionAvailable(String cameraId, - CameraCharacteristics cameraCharacteristics) { - return false; - } - - @Override - public void init(String cameraId, - CameraCharacteristics cameraCharacteristics) { } - - @Override - public CaptureProcessorImpl getCaptureProcessor() { - return null; - } - - @Override - public - List<androidx.camera.extensions.impl.CaptureStageImpl> getCaptureStages() { - return null; - } - - @Override - public int getMaxCaptureStage() { - return 0; - } - - @Override - public List<Pair<Integer, Size[]>> getSupportedResolutions() { - return null; - } - - @Override - public List<Pair<Integer, Size[]>> getSupportedPostviewResolutions( - Size captureSize) { - return null; - } - - @Override - public Range<Long> getEstimatedCaptureLatencyRange( - Size captureOutputSize) { - return null; - } - - @Override - public List<CaptureRequest.Key> getAvailableCaptureRequestKeys() { - return null; - } - - @Override - public List<CaptureResult.Key> getAvailableCaptureResultKeys() { - return null; - } - - @Override - public boolean isCaptureProcessProgressAvailable() { - return false; - } - - @Override - public Pair<Long, Long> getRealtimeCaptureLatency() { - return null; - } - - @Override - public boolean isPostviewAvailable() { - return false; - } - - @Override - public void onInit(String cameraId, - CameraCharacteristics cameraCharacteristics, Context context) { } - - @Override - public void onDeInit() { } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl onPresetSession() { - return null; - } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl onEnableSession() { - return null; - } - - @Override - public androidx.camera.extensions.impl.CaptureStageImpl onDisableSession() { - return null; - } - - @Override - public int onSessionType() { - return 0; - } - }); - } - } - switch (extensionType) { case CameraExtensionCharacteristics.EXTENSION_AUTOMATIC: return new Pair<>(new AutoPreviewExtenderImpl(), @@ -714,88 +553,6 @@ public class CameraExtensionsProxyService extends Service { * @hide */ public static AdvancedExtenderImpl initializeAdvancedExtensionImpl(int extensionType) { - if (Flags.concertModeApi()) { - if (extensionType == CameraExtensionCharacteristics.EXTENSION_EYES_FREE_VIDEOGRAPHY) { - if (EFV_SUPPORTED) { - return new EyesFreeVideographyAdvancedExtenderImpl(); - } else { - return new AdvancedExtenderImpl() { - @Override - public boolean isExtensionAvailable(String cameraId, - Map<String, CameraCharacteristics> characteristicsMap) { - return false; - } - - @Override - public void init(String cameraId, - Map<String, CameraCharacteristics> characteristicsMap) { - - } - - @Override - public Range<Long> getEstimatedCaptureLatencyRange(String cameraId, - Size captureOutputSize, int imageFormat) { - return null; - } - - @Override - public Map<Integer, List<Size>> getSupportedPreviewOutputResolutions( - String cameraId) { - return null; - } - - @Override - public Map<Integer, List<Size>> getSupportedCaptureOutputResolutions( - String cameraId) { - return null; - } - - @Override - public Map<Integer, List<Size>> getSupportedPostviewResolutions( - Size captureSize) { - return null; - } - - @Override - public List<Size> getSupportedYuvAnalysisResolutions(String cameraId) { - return null; - } - - @Override - public SessionProcessorImpl createSessionProcessor() { - return null; - } - - @Override - public List<CaptureRequest.Key> getAvailableCaptureRequestKeys() { - return null; - } - - @Override - public List<CaptureResult.Key> getAvailableCaptureResultKeys() { - return null; - } - - @Override - public boolean isCaptureProcessProgressAvailable() { - return false; - } - - @Override - public boolean isPostviewAvailable() { - return false; - } - - @Override - public List<Pair<CameraCharacteristics.Key, Object>> - getAvailableCharacteristicsKeyValues() { - return Collections.emptyList(); - } - }; - } - } - } - switch (extensionType) { case CameraExtensionCharacteristics.EXTENSION_AUTOMATIC: return new AutoAdvancedExtenderImpl(); diff --git a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java index 2c261fe668fb..bd1b0ea99e17 100644 --- a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java +++ b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java @@ -732,6 +732,7 @@ public final class PresentationStatsEventLogger { // These autofill id's are being refilled, so they had failed previously. // Note that these autofillIds correspond to the new autofill ids after relayout. event.mFailedAutofillIds = new ArraySet<>(autofillIds); + setHasRelayoutLog(); }); } @@ -753,6 +754,7 @@ public final class PresentationStatsEventLogger { int failureCount = ids.size(); if (isRefill) { event.mViewFailedOnRefillCount = failureCount; + setHasRelayoutLog(); } else { event.mViewFillFailureCount = failureCount; event.mViewFailedPriorToRefillCount = failureCount; @@ -834,6 +836,19 @@ public final class PresentationStatsEventLogger { } /** + * Set the log contains relayout metrics. + * This is being added as a temporary measure to add logging. + * In future, when we map Session's old view states to the new autofill id's as part of fixing + * save for relayout cases, we no longer would need this. But till then, this is needed to set + * autofill logs for relayout cases. + */ + private void setHasRelayoutLog() { + mEventInternal.ifPresent(event -> { + event.mHasRelayoutLog = true; + }); + } + + /** * Finish and log the event. */ public void logAndEndEvent(String caller) { @@ -844,8 +859,10 @@ public final class PresentationStatsEventLogger { } PresentationStatsEventInternal event = mEventInternal.get(); - boolean ignoreLogging = !event.mIsDatasetAvailable; - + boolean ignoreLogging = !event.mIsDatasetAvailable + && !event.mHasRelayoutLog + && !(event.mFixExpireResponseDuringAuthCount > 0) + && !(event.mNotifyViewEnteredIgnoredDuringAuthCount > 0); if (sVerbose) { Slog.v(TAG, "(" + caller + ") " + (ignoreLogging ? "IGNORING - following event won't be logged: " : "") @@ -1032,8 +1049,9 @@ public final class PresentationStatsEventLogger { ArraySet<AutofillId> mFailedAutofillIds = new ArraySet<>(); ArraySet<AutofillId> mAlreadyFilledAutofillIds = new ArraySet<>(); - // Not logged - used for internal logic + // Following are not logged and used only for internal logic boolean shouldResetShownCount = false; + boolean mHasRelayoutLog = false; PresentationStatsEventInternal() {} } diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index f7478799527c..2bb2b7b21cce 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -6107,7 +6107,22 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final int argUserId = parseUserIdFromDumpArgs(args); final Printer p = new PrintWriterPrinter(pw); p.println("Current Input Method Manager state:"); - p.println(" concurrentMultiUserModeEnabled=" + mConcurrentMultiUserModeEnabled); + p.println(" mSystemReady=" + mSystemReady); + p.println(" mInteractive=" + mIsInteractive); + p.println(" mConcurrentMultiUserModeEnabled=" + mConcurrentMultiUserModeEnabled); + p.println(" ENABLE_HIDE_IME_CAPTION_BAR=" + + InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR); + synchronized (ImfLock.class) { + p.println(" mStylusIds=" + (mStylusIds != null + ? Arrays.toString(mStylusIds.toArray()) : "")); + } + if (Flags.imeSwitcherRevamp()) { + p.println(" mMenuControllerNew:"); + mMenuControllerNew.dump(p, " "); + } else { + p.println(" mMenuController:"); + mMenuController.dump(p, " "); + } if (mConcurrentMultiUserModeEnabled && argUserId == UserHandle.USER_NULL) { mUserDataRepository.forAllUserData( u -> dumpAsStringNoCheckForUser(u, fd, pw, args, isCritical)); @@ -6116,6 +6131,22 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final var userData = getUserData(userId); dumpAsStringNoCheckForUser(userData, fd, pw, args, isCritical); } + + // TODO(b/365868861): Make StartInputHistory, SoftInputShowHideHistory and ImeTracker per + // user. + synchronized (ImfLock.class) { + p.println(" mStartInputHistory:"); + mStartInputHistory.dump(pw, " "); + + p.println(" mSoftInputShowHideHistory:"); + mSoftInputShowHideHistory.dump(pw, " "); + } + + p.println(" mImeTrackerService#History:"); + mImeTrackerService.dump(pw, " "); + + dumpUserRepository(p); + dumpClientStates(p); } @UserIdInt @@ -6140,104 +6171,33 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. userData.mUserId); final List<InputMethodInfo> methodList = settings.getMethodList(); int numImes = methodList.size(); - p.println(" Input Methods:"); + p.println(" Input Methods:"); for (int i = 0; i < numImes; i++) { InputMethodInfo info = methodList.get(i); - p.println(" InputMethod #" + i + ":"); - info.dump(p, " "); + p.println(" InputMethod #" + i + ":"); + info.dump(p, " "); } - // Dump ClientController#mClients - p.println(" ClientStates:"); - // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed. - @SuppressWarnings("GuardedBy") Consumer<ClientState> clientControllerDump = c -> { - p.println(" " + c + ":"); - p.println(" client=" + c.mClient); - p.println(" fallbackInputConnection=" - + c.mFallbackInputConnection); - p.println(" sessionRequested=" - + c.mSessionRequested); - p.println(" sessionRequestedForAccessibility=" - + c.mSessionRequestedForAccessibility); - p.println(" curSession=" + c.mCurSession); - p.println(" selfReportedDisplayId=" + c.mSelfReportedDisplayId); - p.println(" uid=" + c.mUid); - p.println(" pid=" + c.mPid); - }; - mClientController.forAllClients(clientControllerDump); final var bindingController = userData.mBindingController; - p.println(" mCurMethodId=" + bindingController.getSelectedMethodId()); + p.println(" mCurMethodId=" + bindingController.getSelectedMethodId()); client = userData.mCurClient; - p.println(" mCurClient=" + client + " mCurSeq=" + p.println(" mCurClient=" + client + " mCurSeq=" + bindingController.getSequenceNumber()); - p.println(" mFocusedWindowPerceptible=" + mFocusedWindowPerceptible); + p.println(" mFocusedWindowPerceptible=" + mFocusedWindowPerceptible); userData.mImeBindingState.dump(/* prefix= */ " ", p); - - p.println(" mCurId=" + bindingController.getCurId() - + " mHaveConnection=" + bindingController.hasMainConnection() - + " mBoundToMethod=" + userData.mBoundToMethod + " mVisibleBound=" - + bindingController.isVisibleBound()); - - p.println(" mUserDataRepository="); - // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed. - @SuppressWarnings("GuardedBy") Consumer<UserData> userDataDump = - u -> { - p.println(" mUserId=" + u.mUserId); - p.println(" unlocked=" + u.mIsUnlockingOrUnlocked.get()); - p.println(" hasMainConnection=" - + u.mBindingController.hasMainConnection()); - p.println(" isVisibleBound=" + u.mBindingController.isVisibleBound()); - p.println(" boundToMethod=" + u.mBoundToMethod); - p.println(" curClient=" + u.mCurClient); - if (u.mCurEditorInfo != null) { - p.println(" curEditorInfo:"); - u.mCurEditorInfo.dump(p, " ", false /* dumpExtras */); - } else { - p.println(" curEditorInfo: null"); - } - p.println(" imeBindingState:"); - u.mImeBindingState.dump(" ", p); - p.println(" enabledSession=" + u.mEnabledSession); - p.println(" inFullscreenMode=" + u.mInFullscreenMode); - p.println(" imeDrawsNavBar=" + u.mImeDrawsNavBar.get()); - p.println(" switchingController:"); - u.mSwitchingController.dump(p, " "); - p.println(" mLastEnabledInputMethodsStr=" - + u.mLastEnabledInputMethodsStr); - }; - mUserDataRepository.forAllUserData(userDataDump); - - if (Flags.imeSwitcherRevamp()) { - p.println(" menuControllerNew:"); - mMenuControllerNew.dump(p, " "); - } else { - p.println(" menuController:"); - mMenuController.dump(p, " "); - } - p.println(" mCurToken=" + bindingController.getCurToken()); - p.println(" mCurTokenDisplayId=" + bindingController.getCurTokenDisplayId()); - p.println(" mCurHostInputToken=" + bindingController.getCurHostInputToken()); - p.println(" mCurIntent=" + bindingController.getCurIntent()); + p.println(" mCurId=" + bindingController.getCurId()); + p.println(" mHaveConnection=" + bindingController.hasMainConnection()); + p.println(" mBoundToMethod=" + userData.mBoundToMethod); + p.println(" mVisibleBound=" + bindingController.isVisibleBound()); + p.println(" mCurToken=" + bindingController.getCurToken()); + p.println(" mCurTokenDisplayId=" + bindingController.getCurTokenDisplayId()); + p.println(" mCurHostInputToken=" + bindingController.getCurHostInputToken()); + p.println(" mCurIntent=" + bindingController.getCurIntent()); method = bindingController.getCurMethod(); - p.println(" mCurMethod=" + method); - p.println(" mEnabledSession=" + userData.mEnabledSession); + p.println(" mCurMethod=" + method); + p.println(" mEnabledSession=" + userData.mEnabledSession); final var visibilityStateComputer = userData.mVisibilityStateComputer; visibilityStateComputer.dump(pw, " "); - p.println(" mInFullscreenMode=" + userData.mInFullscreenMode); - p.println(" mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive); - p.println(" mConcurrentMultiUserModeEnabled=" + mConcurrentMultiUserModeEnabled); - p.println(" ENABLE_HIDE_IME_CAPTION_BAR=" - + InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR); - p.println(" mStylusIds=" + (mStylusIds != null - ? Arrays.toString(mStylusIds.toArray()) : "")); - - p.println(" mStartInputHistory:"); - mStartInputHistory.dump(pw, " "); - - p.println(" mSoftInputShowHideHistory:"); - mSoftInputShowHideHistory.dump(pw, " "); - - p.println(" mImeTrackerService#History:"); - mImeTrackerService.dump(pw, " "); + p.println(" mInFullscreenMode=" + userData.mInFullscreenMode); } // Exit here for critical dump, as remaining sections require IPCs to other processes. @@ -6288,6 +6248,61 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } + private void dumpClientStates(Printer p) { + p.println(" ClientStates:"); + // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed. + @SuppressWarnings("GuardedBy") Consumer<ClientState> clientControllerDump = c -> { + p.println(" " + c + ":"); + p.println(" client=" + c.mClient); + p.println(" fallbackInputConnection=" + + c.mFallbackInputConnection); + p.println(" sessionRequested=" + + c.mSessionRequested); + p.println(" sessionRequestedForAccessibility=" + + c.mSessionRequestedForAccessibility); + p.println(" curSession=" + c.mCurSession); + p.println(" selfReportedDisplayId=" + c.mSelfReportedDisplayId); + p.println(" uid=" + c.mUid); + p.println(" pid=" + c.mPid); + }; + synchronized (ImfLock.class) { + mClientController.forAllClients(clientControllerDump); + } + } + + private void dumpUserRepository(Printer p) { + p.println(" mUserDataRepository="); + // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed. + @SuppressWarnings("GuardedBy") Consumer<UserData> userDataDump = + u -> { + p.println(" mUserId=" + u.mUserId); + p.println(" unlocked=" + u.mIsUnlockingOrUnlocked.get()); + p.println(" hasMainConnection=" + + u.mBindingController.hasMainConnection()); + p.println(" isVisibleBound=" + u.mBindingController.isVisibleBound()); + p.println(" boundToMethod=" + u.mBoundToMethod); + p.println(" curClient=" + u.mCurClient); + if (u.mCurEditorInfo != null) { + p.println(" curEditorInfo:"); + u.mCurEditorInfo.dump(p, " ", false /* dumpExtras */); + } else { + p.println(" curEditorInfo: null"); + } + p.println(" imeBindingState:"); + u.mImeBindingState.dump(" ", p); + p.println(" enabledSession=" + u.mEnabledSession); + p.println(" inFullscreenMode=" + u.mInFullscreenMode); + p.println(" imeDrawsNavBar=" + u.mImeDrawsNavBar.get()); + p.println(" switchingController:"); + u.mSwitchingController.dump(p, " "); + p.println(" mLastEnabledInputMethodsStr=" + + u.mLastEnabledInputMethodsStr); + }; + synchronized (ImfLock.class) { + mUserDataRepository.forAllUserData(userDataDump); + } + } + @BinderThread @Override public void onShellCommand(@Nullable FileDescriptor in, @Nullable FileDescriptor out, diff --git a/services/lint-baseline.xml b/services/lint-baseline.xml index a311d07e52fb..95da56da156c 100644 --- a/services/lint-baseline.xml +++ b/services/lint-baseline.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<issues format="6" by="lint 8.4.0-alpha01" type="baseline" client="" dependencies="true" name="" variant="all" version="8.4.0-alpha01"> +<issues format="6" by="lint 8.4.0-alpha08" type="baseline" client="" dependencies="true" name="" variant="all" version="8.4.0-alpha08"> <issue id="SimpleManualPermissionEnforcement" @@ -8,7 +8,7 @@ errorLine2=" ^"> <location file="frameworks/base/services/java/com/android/server/SystemConfigService.java" - line="46" + line="50" column="13"/> </issue> @@ -19,7 +19,7 @@ errorLine2=" ^"> <location file="frameworks/base/services/java/com/android/server/SystemConfigService.java" - line="54" + line="58" column="13"/> </issue> @@ -30,7 +30,7 @@ errorLine2=" ^"> <location file="frameworks/base/services/java/com/android/server/SystemConfigService.java" - line="67" + line="71" column="13"/> </issue> @@ -41,7 +41,7 @@ errorLine2=" ^"> <location file="frameworks/base/services/java/com/android/server/SystemConfigService.java" - line="76" + line="80" column="13"/> </issue> @@ -52,8 +52,30 @@ errorLine2=" ^"> <location file="frameworks/base/services/java/com/android/server/SystemConfigService.java" - line="107" + line="111" column="13"/> </issue> -</issues>
\ No newline at end of file + <issue + id="SimpleManualPermissionEnforcement" + message="ISystemConfig permission check should be converted to @EnforcePermission annotation" + errorLine1=" getContext().enforceCallingOrSelfPermission(" + errorLine2=" ^"> + <location + file="frameworks/base/services/java/com/android/server/SystemConfigService.java" + line="127" + column="13"/> + </issue> + + <issue + id="SimpleManualPermissionEnforcement" + message="ISystemConfig permission check should be converted to @EnforcePermission annotation" + errorLine1=" getContext().enforceCallingOrSelfPermission(" + errorLine2=" ^"> + <location + file="frameworks/base/services/java/com/android/server/SystemConfigService.java" + line="137" + column="13"/> + </issue> + +</issues> |