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

Commit fc57383b authored by Vali Calinescu's avatar Vali Calinescu Committed by Automerger Merge Worker
Browse files

Merge "Clean up DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP"...

Merge "Clean up DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP" into udc-dev am: aef711e5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23027345



Change-Id: I7170c031647a6103d18164d46a665374ff9cf993
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 981d46aa aef711e5
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -7941,9 +7941,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        }
        // This is necessary in order to avoid going into size compat mode when the orientation
        // This is necessary in order to avoid going into size compat mode when the orientation
        // change request comes from the app
        // change request comes from the app
        if (mWmService.mLetterboxConfiguration
        if (getRequestedConfigurationOrientation(false, requestedOrientation)
                    .isSizeCompatModeDisabledAfterOrientationChangeFromApp()
                && getRequestedConfigurationOrientation(false, requestedOrientation)
                    != getRequestedConfigurationOrientation(false /*forDisplay */)) {
                    != getRequestedConfigurationOrientation(false /*forDisplay */)) {
            // Do not change the requested configuration now, because this will be done when setting
            // Do not change the requested configuration now, because this will be done when setting
            // the orientation below with the new mCompatDisplayInsets
            // the orientation below with the new mCompatDisplayInsets
+0 −14
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.wm;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ALLOW_IGNORE_ORIENTATION_REQUEST;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ALLOW_IGNORE_ORIENTATION_REQUEST;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_CAMERA_COMPAT_TREATMENT;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_CAMERA_COMPAT_TREATMENT;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_COMPAT_FAKE_FOCUS;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_COMPAT_FAKE_FOCUS;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_DISPLAY_ROTATION_IMMERSIVE_APP_COMPAT_POLICY;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_DISPLAY_ROTATION_IMMERSIVE_APP_COMPAT_POLICY;
@@ -330,9 +329,6 @@ final class LetterboxConfiguration {
        mDeviceConfig.updateFlagActiveStatus(
        mDeviceConfig.updateFlagActiveStatus(
                /* isActive */ mTranslucentLetterboxingEnabled,
                /* isActive */ mTranslucentLetterboxingEnabled,
                /* key */ KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY);
                /* key */ KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY);
        mDeviceConfig.updateFlagActiveStatus(
                /* isActive */ true,
                /* key */ KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP);


        mLetterboxConfigurationPersister = letterboxConfigurationPersister;
        mLetterboxConfigurationPersister = letterboxConfigurationPersister;
        mLetterboxConfigurationPersister.start();
        mLetterboxConfigurationPersister.start();
@@ -346,16 +342,6 @@ final class LetterboxConfiguration {
        return mDeviceConfig.getFlag(KEY_ALLOW_IGNORE_ORIENTATION_REQUEST);
        return mDeviceConfig.getFlag(KEY_ALLOW_IGNORE_ORIENTATION_REQUEST);
    }
    }


    /**
     * Whether size compat mode is disabled after an orientation change request comes from the app.
     * This value is controlled via {@link android.provider.DeviceConfig}.
     */
    // TODO(b/270356567) Clean up this flag
    boolean isSizeCompatModeDisabledAfterOrientationChangeFromApp() {
        return mDeviceConfig.getFlag(
                KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP);
    }

    /**
    /**
     * Overrides the aspect ratio of letterbox for fixed orientation. If given value is <= {@link
     * Overrides the aspect ratio of letterbox for fixed orientation. If given value is <= {@link
     * #MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO}, both it and a value of {@link
     * #MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO}, both it and a value of {@link
+1 −18
Original line number Original line Diff line number Diff line
@@ -52,11 +52,6 @@ final class LetterboxConfigurationDeviceConfig


    private static final boolean DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY = true;
    private static final boolean DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY = true;


    static final String KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP =
            "disable_size_compat_mode_after_orientation_change_from_app";
    private static final boolean
            DEFAULT_VALUE_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP = true;

    @VisibleForTesting
    @VisibleForTesting
    static final Map<String, Boolean> sKeyToDefaultValueMap = Map.of(
    static final Map<String, Boolean> sKeyToDefaultValueMap = Map.of(
            KEY_ENABLE_CAMERA_COMPAT_TREATMENT,
            KEY_ENABLE_CAMERA_COMPAT_TREATMENT,
@@ -68,9 +63,7 @@ final class LetterboxConfigurationDeviceConfig
            KEY_ENABLE_COMPAT_FAKE_FOCUS,
            KEY_ENABLE_COMPAT_FAKE_FOCUS,
            DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS,
            DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS,
            KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY,
            KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY,
            DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY,
            DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY
            KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP,
            DEFAULT_VALUE_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP
    );
    );


    // Whether camera compatibility treatment is enabled.
    // Whether camera compatibility treatment is enabled.
@@ -99,10 +92,6 @@ final class LetterboxConfigurationDeviceConfig
    private boolean mIsTranslucentLetterboxingAllowed =
    private boolean mIsTranslucentLetterboxingAllowed =
            DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY;
            DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY;


    // Whether size compat mode is disabled after an orientation change request comes from the app
    private boolean mIsSizeCompatModeDisabledAfterOrientationChangeFromApp =
            DEFAULT_VALUE_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP;

    // Set of active device configs that need to be updated in
    // Set of active device configs that need to be updated in
    // DeviceConfig.OnPropertiesChangedListener#onPropertiesChanged.
    // DeviceConfig.OnPropertiesChangedListener#onPropertiesChanged.
    private final ArraySet<String> mActiveDeviceConfigsSet = new ArraySet<>();
    private final ArraySet<String> mActiveDeviceConfigsSet = new ArraySet<>();
@@ -152,8 +141,6 @@ final class LetterboxConfigurationDeviceConfig
                return mIsCompatFakeFocusAllowed;
                return mIsCompatFakeFocusAllowed;
            case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY:
            case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY:
                return mIsTranslucentLetterboxingAllowed;
                return mIsTranslucentLetterboxingAllowed;
            case KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP:
                return mIsSizeCompatModeDisabledAfterOrientationChangeFromApp;
            default:
            default:
                throw new AssertionError("Unexpected flag name: " + key);
                throw new AssertionError("Unexpected flag name: " + key);
        }
        }
@@ -181,10 +168,6 @@ final class LetterboxConfigurationDeviceConfig
            case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY:
            case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY:
                mIsTranslucentLetterboxingAllowed = getDeviceConfig(key, defaultValue);
                mIsTranslucentLetterboxingAllowed = getDeviceConfig(key, defaultValue);
                break;
                break;
            case KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP:
                mIsSizeCompatModeDisabledAfterOrientationChangeFromApp =
                        getDeviceConfig(key, defaultValue);
                break;
            default:
            default:
                throw new AssertionError("Unexpected flag name: " + key);
                throw new AssertionError("Unexpected flag name: " + key);
        }
        }