Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6334f3e3 authored by Austin Borger's avatar Austin Borger
Browse files

CameraManager: Make the rotate and crop property public.

This needs to be visible to app developers and documented so they know
how to use it. Move it to PackageManager with the other properties.

Test: Built locally.
Bug: 271602659
Change-Id: I236a025b12613fd3b62be9f683bafe6f227d6844
parent b929cf7f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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";
+30 −0
Original line number Diff line number Diff line
@@ -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>
+2 −8
Original line number Diff line number Diff line
@@ -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