Merge "CameraManager: Make the rotate and crop property public." into udc-dev

This commit is contained in:
Austin Borger
2023-03-13 17:26:25 +00:00
committed by Android (Google) Code Review
3 changed files with 33 additions and 8 deletions

View File

@@ -12812,6 +12812,7 @@ package android.content.pm {
field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L
field public static final int PERMISSION_DENIED = -1; // 0xffffffff
field public static final int PERMISSION_GRANTED = 0; // 0x0
field public static final String PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT = "android.camera.PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT";
field public static final String PROPERTY_MEDIA_CAPABILITIES = "android.media.PROPERTY_MEDIA_CAPABILITIES";
field public static final String PROPERTY_SELF_CERTIFIED_NETWORK_CAPABILITIES = "android.net.PROPERTY_SELF_CERTIFIED_NETWORK_CAPABILITIES";
field public static final String PROPERTY_SPECIAL_USE_FGS_SUBTYPE = "android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE";

View File

@@ -203,6 +203,36 @@ public abstract class PackageManager {
public static final String PROPERTY_SPECIAL_USE_FGS_SUBTYPE =
"android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE";
/**
* Application level {@link android.content.pm.PackageManager.Property PackageManager
* .Property} for an app to inform the system that the app can be opted-in or opted-out
* from the compatibility treatment that rotates camera output by 90 degrees on landscape
* sensors on devices known to have compatibility issues.
*
* <p>The treatment is disabled by default but device manufacturers can enable the treatment
* using their discretion to improve camera compatibility. With this property set to
* {@code false}, the rotation will not be applied. A value of {@code true}
* will ensure that rotation is applied, provided it is enabled for the device. In most cases,
* if rotation is the desired behavior this property need not be set. However, if your app
* experiences stretching or incorrect rotation on these devices, explicitly setting this to
* {@code true} may resolve that behavior. Apps should set this to {@code false} if there
* is confidence that the app handles
* {@link android.hardware.camera2.CameraCharacteristics#SENSOR_ORIENTATION} correctly.
* See <a href="https://developer.android.com/training/camera2/camera-preview"> the
* documentation for best practice.</a>
*
* <p><b>Syntax:</b>
* <pre>
* &lt;application&gt;
* &lt;property
* android:name="android.camera.PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT"
* android:value="true|false"/&gt;
* &lt;/application&gt;
* </pre>
*/
public static final String PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT =
"android.camera.PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT";
/**
* A property value set within the manifest.
* <p>

View File

@@ -117,13 +117,6 @@ public final class CameraManager {
@TestApi
public static final long OVERRIDE_CAMERA_LANDSCAPE_TO_PORTRAIT = 250678880L;
/**
* Package-level opt in/out for the above.
* @hide
*/
public static final String PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT =
"android.camera.PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT";
/**
* System property for allowing the above
* @hide
@@ -1189,7 +1182,8 @@ public final class CameraManager {
PackageManager packageManager = context.getPackageManager();
try {
return packageManager.getProperty(PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT,
return packageManager.getProperty(
PackageManager.PROPERTY_COMPAT_OVERRIDE_LANDSCAPE_TO_PORTRAIT,
context.getOpPackageName()).getBoolean();
} catch (PackageManager.NameNotFoundException e) {
// No such property