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

Commit 67d55032 authored by Massimo Carli's avatar Massimo Carli Committed by Automerger Merge Worker
Browse files

Merge "Enable translucent activities strategy by default" into tm-qpr-dev am:...

Merge "Enable translucent activities strategy by default" into tm-qpr-dev am: 9649e119 am: 02538b5d am: 54736bf2

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



Change-Id: I25042c142fdc2636ad911ff8d76177d15d4e9ad5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c50509aa 54736bf2
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ALLOW
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_DISPLAY_ROTATION_IMMERSIVE_APP_COMPAT_POLICY;
import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -296,7 +297,6 @@ final class LetterboxConfiguration {
                R.bool.config_isCompatFakeFocusEnabled);
        mIsPolicyForIgnoringRequestedOrientationEnabled = mContext.getResources().getBoolean(
                R.bool.config_letterboxIsPolicyForIgnoringRequestedOrientationEnabled);

        mIsDisplayRotationImmersiveAppCompatPolicyEnabled = mContext.getResources().getBoolean(
                R.bool.config_letterboxIsDisplayRotationImmersiveAppCompatPolicyEnabled);
        mDeviceConfig.updateFlagActiveStatus(
@@ -311,7 +311,9 @@ final class LetterboxConfiguration {
        mDeviceConfig.updateFlagActiveStatus(
                /* isActive */ mIsCompatFakeFocusEnabled,
                /* key */ KEY_ENABLE_COMPAT_FAKE_FOCUS);

        mDeviceConfig.updateFlagActiveStatus(
                /* isActive */ mTranslucentLetterboxingEnabled,
                /* key */ KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY);
        mLetterboxConfigurationPersister = letterboxConfigurationPersister;
        mLetterboxConfigurationPersister.start();
    }
@@ -1003,7 +1005,7 @@ final class LetterboxConfiguration {

    boolean isTranslucentLetterboxingEnabled() {
        return mTranslucentLetterboxingOverrideEnabled || (mTranslucentLetterboxingEnabled
                && isTranslucentLetterboxingAllowed());
                && mDeviceConfig.getFlag(KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY));
    }

    void setTranslucentLetterboxingEnabled(boolean translucentLetterboxingEnabled) {
@@ -1051,13 +1053,6 @@ final class LetterboxConfiguration {
                isDeviceInTabletopMode, nextVerticalPosition);
    }

    // TODO(b/262378106): Cache a runtime flag and implement
    // DeviceConfig.OnPropertiesChangedListener
    static boolean isTranslucentLetterboxingAllowed() {
        return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
                "enable_translucent_activity_letterbox", false);
    }

    /** Whether fake sending focus is enabled for unfocused apps in splitscreen */
    boolean isCompatFakeFocusEnabled() {
        return mIsCompatFakeFocusEnabled && mDeviceConfig.getFlag(KEY_ENABLE_COMPAT_FAKE_FOCUS);
+20 −7
Original line number Diff line number Diff line
@@ -48,6 +48,11 @@ final class LetterboxConfigurationDeviceConfig
    static final String KEY_ENABLE_COMPAT_FAKE_FOCUS = "enable_compat_fake_focus";
    private static final boolean DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS = true;

    static final String KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY =
            "enable_letterbox_translucent_activity";

    private static final boolean DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY = true;

    @VisibleForTesting
    static final Map<String, Boolean> sKeyToDefaultValueMap = Map.of(
            KEY_ENABLE_CAMERA_COMPAT_TREATMENT,
@@ -57,7 +62,9 @@ final class LetterboxConfigurationDeviceConfig
            KEY_ALLOW_IGNORE_ORIENTATION_REQUEST,
            DEFAULT_VALUE_ALLOW_IGNORE_ORIENTATION_REQUEST,
            KEY_ENABLE_COMPAT_FAKE_FOCUS,
            DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS
            DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS,
            KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY,
            DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY
    );

    // Whether camera compatibility treatment is enabled.
@@ -82,6 +89,10 @@ final class LetterboxConfigurationDeviceConfig
    // which isn't guaranteed by default in multi-window modes.
    private boolean mIsCompatFakeFocusAllowed = DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS;

    // Whether the letterbox strategy for transparent activities is allowed
    private boolean mIsTranslucentLetterboxingAllowed =
            DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY;

    // Set of active device configs that need to be updated in
    // DeviceConfig.OnPropertiesChangedListener#onPropertiesChanged.
    private final ArraySet<String> mActiveDeviceConfigsSet = new ArraySet<>();
@@ -129,6 +140,8 @@ final class LetterboxConfigurationDeviceConfig
                return mIsAllowIgnoreOrientationRequest;
            case KEY_ENABLE_COMPAT_FAKE_FOCUS:
                return mIsCompatFakeFocusAllowed;
            case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY:
                return mIsTranslucentLetterboxingAllowed;
            default:
                throw new AssertionError("Unexpected flag name: " + key);
        }
@@ -141,20 +154,20 @@ final class LetterboxConfigurationDeviceConfig
        }
        switch (key) {
            case KEY_ENABLE_CAMERA_COMPAT_TREATMENT:
                mIsCameraCompatTreatmentEnabled =
                        getDeviceConfig(key, defaultValue);
                mIsCameraCompatTreatmentEnabled = getDeviceConfig(key, defaultValue);
                break;
            case KEY_ENABLE_DISPLAY_ROTATION_IMMERSIVE_APP_COMPAT_POLICY:
                mIsDisplayRotationImmersiveAppCompatPolicyEnabled =
                        getDeviceConfig(key, defaultValue);
                break;
            case KEY_ALLOW_IGNORE_ORIENTATION_REQUEST:
                mIsAllowIgnoreOrientationRequest =
                        getDeviceConfig(key, defaultValue);
                mIsAllowIgnoreOrientationRequest = getDeviceConfig(key, defaultValue);
                break;
            case KEY_ENABLE_COMPAT_FAKE_FOCUS:
                mIsCompatFakeFocusAllowed =
                        getDeviceConfig(key, defaultValue);
                mIsCompatFakeFocusAllowed = getDeviceConfig(key, defaultValue);
                break;
            case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY:
                mIsTranslucentLetterboxingAllowed = getDeviceConfig(key, defaultValue);
                break;
            default:
                throw new AssertionError("Unexpected flag name: " + key);