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

Commit 4b456799 authored by Robin Lee's avatar Robin Lee
Browse files

Continue to allow some orientation overrides

Amend ignore_activity_orientation_request experiment to allow
explicit OEM and User overrides, plus camera compat mode, to
still override the UNSPECIFIED orientation of an app.

This does nothing when the device_config flag below is left
at the default value.

Change-Id: If7e0c5f8fd5f665dc95a41b92ed512b4dc239122
Flag: EXEMPT deviceconfig - adb shell device_config put window_manager ignore_activity_orientation_request true
Test: Manual - use a camera app on tangor
Test: Manual - override calculator orientation in settings
Bug: 357141415
parent 94fa137d
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -8150,13 +8150,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     * into account orientation per-app overrides applied by the device manufacturers.
     */
    @Override
    @ActivityInfo.ScreenOrientation
    protected int getOverrideOrientation() {
        if (mWmService.mConstants.mIgnoreActivityOrientationRequest
                && info.applicationInfo.category != ApplicationInfo.CATEGORY_GAME) {
            return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        final int candidateOrientation;
        if (!mWmService.mConstants.mIgnoreActivityOrientationRequest
                || info.applicationInfo.category == ApplicationInfo.CATEGORY_GAME) {
            candidateOrientation = super.getOverrideOrientation();
        } else {
            candidateOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        }
        return mAppCompatController.getOrientationPolicy()
                .overrideOrientationIfNeeded(super.getOverrideOrientation());
                .overrideOrientationIfNeeded(candidateOrientation);
    }

    /**