diff options
| author | 2021-10-29 13:21:17 -0700 | |
|---|---|---|
| committer | 2021-11-03 17:39:01 +0000 | |
| commit | 852aa2cb93c79ac171624c6e7976f08bf6a37097 (patch) | |
| tree | 2145e83daf6f1149289b37bdc3d025a524accbd8 | |
| parent | c3e4e96ef22e67e8da834d401c71bac47496bac9 (diff) | |
CameraServiceProxy: Clean up app compat overrides
The rotate&crop heuristics must now return specific
modes instead of true&false. Various modes are not
supported by the app compat overrides which can only be
enabled or disabled.
Clean up unnecessary app compat overrides that can not
be supported and update the corresponding comments.
Bug: 204587197
Test: Manual using application
Change-Id: Iacb6844c625092a9864ab5ff7cae7376cfd2cd9a
| -rw-r--r-- | services/core/java/com/android/server/camera/CameraServiceProxy.java | 96 |
1 files changed, 26 insertions, 70 deletions
diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java index 9d2cff9901e2..5ce72c2fd080 100644 --- a/services/core/java/com/android/server/camera/CameraServiceProxy.java +++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java @@ -108,8 +108,9 @@ public class CameraServiceProxy extends SystemService /** * When enabled this change id forces the packages it is applied to override the default - * camera rotate & crop behavior. The default behavior along with all possible override - * combinations is discussed in the table below. + * camera rotate & crop behavior and always return CaptureRequest.SCALER_ROTATE_AND_CROP_NONE . + * The default behavior along with all possible override combinations is discussed in the table + * below. */ @ChangeId @Overridable @@ -121,9 +122,7 @@ public class CameraServiceProxy extends SystemService * When enabled this change id forces the packages it is applied to ignore the current value of * 'android:resizeableActivity' as well as target SDK equal to or below M and consider the * activity as non-resizeable. In this case, the value of camera rotate & crop will only depend - * on potential mismatches between the orientation of the camera and the fixed orientation of - * the activity. You can check the table below for further details on the possible override - * combinations. + * on the needed compensation considering the current display rotation. */ @ChangeId @Overridable @@ -132,67 +131,30 @@ public class CameraServiceProxy extends SystemService public static final long OVERRIDE_CAMERA_RESIZABLE_AND_SDK_CHECK = 191513214L; // buganizer id /** - * This change id forces the packages it is applied to override the default camera rotate & crop - * behavior. Enabling it will set the crop & rotate parameter to - * {@link android.hardware.camera2.CaptureRequest#SCALER_ROTATE_AND_CROP_90} and disabling it - * will reset the parameter to - * {@link android.hardware.camera2.CaptureRequest#SCALER_ROTATE_AND_CROP_NONE} as long as camera - * clients include {@link android.hardware.camera2.CaptureRequest#SCALER_ROTATE_AND_CROP_AUTO} - * in their capture requests. - * - * This treatment only takes effect if OVERRIDE_CAMERA_ROTATE_AND_CROP_DEFAULTS is also enabled. - * The table below includes further information about the possible override combinations. - */ - @ChangeId - @Overridable - @Disabled - @TestApi - public static final long OVERRIDE_CAMERA_ROTATE_AND_CROP = 190069291L; //buganizer id - - /** * Possible override combinations * - * |OVERRIDE | |OVERRIDE_ - * |CAMERA_ |OVERRIDE |CAMERA_ - * |ROTATE_ |CAMERA_ |RESIZEABLE_ - * |AND_CROP_ |ROTATE_ |AND_SDK_ - * |DEFAULTS |AND_CROP |CHECK - * ______________________________________________ - * Default | | | - * Behavior | D |D |D - * ______________________________________________ - * Ignore | | | - * SDK&Resize | D |D |E - * ______________________________________________ - * Default | | | - * Behavior | D |E |D - * ______________________________________________ - * Ignore | | | - * SDK&Resize | D |E |E - * ______________________________________________ - * Rotate&Crop| | | - * disabled | E |D |D - * ______________________________________________ - * Rotate&Crop| | | - * disabled | E |D |E - * ______________________________________________ - * Rotate&Crop| | | - * enabled | E |E |D - * ______________________________________________ - * Rotate&Crop| | | - * enabled | E |E |E - * ______________________________________________ + * |OVERRIDE |OVERRIDE_ + * |CAMERA_ |CAMERA_ + * |ROTATE_ |RESIZEABLE_ + * |AND_CROP_ |AND_SDK_ + * |DEFAULTS |CHECK + * _________________________________________________ + * Default Behavior | D |D + * _________________________________________________ + * Ignore SDK&Resize | D |E + * _________________________________________________ + * SCALER_ROTATE_AND_CROP_NONE | E |D, E + * _________________________________________________ * Where: - * E -> Override enabled - * D -> Override disabled - * Default behavior -> Rotate&crop will be enabled only in cases - * where the fixed app orientation mismatches - * with the orientation of the camera. - * Additionally the app must either target M (or below) - * or is declared as non-resizeable. - * Ignore SDK&Resize -> Rotate&crop will be enabled only in cases - * where the fixed app orientation mismatches - * with the orientation of the camera. + * E -> Override enabled + * D -> Override disabled + * Default behavior -> Rotate&crop will be calculated depending on the required + * compensation necessary for the current display rotation. + * Additionally the app must either target M (or below) + * or is declared as non-resizeable. + * Ignore SDK&Resize -> The Rotate&crop value will depend on the required + * compensation for the current display rotation. + * SCALER_ROTATE_AND_CROP_NONE -> Always return CaptureRequest.SCALER_ROTATE_AND_CROP_NONE */ // Flags arguments to NFC adapter to enable/disable NFC @@ -543,14 +505,8 @@ public class CameraServiceProxy extends SystemService if ((taskInfo != null) && (CompatChanges.isChangeEnabled( OVERRIDE_CAMERA_ROTATE_AND_CROP_DEFAULTS, packageName, UserHandle.getUserHandleForUid(taskInfo.userId)))) { - if (CompatChanges.isChangeEnabled(OVERRIDE_CAMERA_ROTATE_AND_CROP, packageName, - UserHandle.getUserHandleForUid(taskInfo.userId))) { - Slog.v(TAG, "OVERRIDE_CAMERA_ROTATE_AND_CROP enabled!"); + Slog.v(TAG, "OVERRIDE_CAMERA_ROTATE_AND_CROP_DEFAULTS enabled!"); return CaptureRequest.SCALER_ROTATE_AND_CROP_NONE; - } else { - Slog.v(TAG, "OVERRIDE_CAMERA_ROTATE_AND_CROP disabled!"); - return CaptureRequest.SCALER_ROTATE_AND_CROP_NONE; - } } boolean ignoreResizableAndSdkCheck = false; if ((taskInfo != null) && (CompatChanges.isChangeEnabled( |