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

Commit af6cd0c6 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Add predictive back aconfig flag

Bug: 309545085
Flag: ACONFIG com.android.window.flags.predictive_back_system_animations DISABLED
Test: Manual, i.e. building and verifying correct behaviour for different flag configurations
Change-Id: I81908192ef9bef3cf47443bc01f2268338c0b332
parent 4a4bbbfb
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ flag {
  bug: "294925498"
}


flag {
    name: "wallpaper_offset_async"
    namespace: "windowing_frontend"
@@ -52,3 +51,11 @@ flag {
    bug: "293248754"
    is_fixed_read_only: true
}

flag {
    name: "predictive_back_system_animations"
    namespace: "systemui"
    description: "Predictive back for system animations"
    bug: "309545085"
    is_fixed_read_only: true
}
 No newline at end of file
+19 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.back;

import static com.android.internal.jank.InteractionJankMonitor.CUJ_PREDICTIVE_BACK_HOME;
import static com.android.window.flags.Flags.predictiveBackSystemAnimations;
import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BACK_PREVIEW;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BACK_ANIMATION;
@@ -221,6 +222,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont

    private void onInit() {
        setupAnimationDeveloperSettingsObserver(mContentResolver, mBgHandler);
        updateEnableAnimationFromFlags();
        createAdapter();
        mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION,
                this::createExternalInterface, this);
@@ -229,28 +231,39 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
    private void setupAnimationDeveloperSettingsObserver(
            @NonNull ContentResolver contentResolver,
            @NonNull @ShellBackgroundThread final Handler backgroundHandler) {
        if (predictiveBackSystemAnimations()) {
            ProtoLog.d(WM_SHELL_BACK_PREVIEW, "Back animation aconfig flag is enabled, therefore "
                    + "developer settings flag is ignored and no content observer registered");
            return;
        }
        ContentObserver settingsObserver = new ContentObserver(backgroundHandler) {
            @Override
            public void onChange(boolean selfChange, Uri uri) {
                updateEnableAnimationFromSetting();
                updateEnableAnimationFromFlags();
            }
        };
        contentResolver.registerContentObserver(
                Global.getUriFor(Global.ENABLE_BACK_ANIMATION),
                false, settingsObserver, UserHandle.USER_SYSTEM
        );
        updateEnableAnimationFromSetting();
    }

    /**
     * Updates {@link BackAnimationController#mEnableAnimations} based on the current values of the
     * aconfig flag and the developer settings flag
     */
    @ShellBackgroundThread
    private void updateEnableAnimationFromSetting() {
        int settingValue = Global.getInt(mContext.getContentResolver(),
                Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF);
        boolean isEnabled = settingValue == SETTING_VALUE_ON;
    private void updateEnableAnimationFromFlags() {
        boolean isEnabled = predictiveBackSystemAnimations() || isDeveloperSettingEnabled();
        mEnableAnimations.set(isEnabled);
        ProtoLog.d(WM_SHELL_BACK_PREVIEW, "Back animation enabled=%s", isEnabled);
    }

    private boolean isDeveloperSettingEnabled() {
        return Global.getInt(mContext.getContentResolver(),
                Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF) == SETTING_VALUE_ON;
    }

    public BackAnimation getBackAnimationImpl() {
        return mBackAnimation;
    }
+0 −5
Original line number Diff line number Diff line
@@ -450,11 +450,6 @@ object Flags {
        sysPropBooleanFlag("persist.wm.debug.wallpaper_multi_crop", default = false)

    // 1200 - predictive back
    @Keep
    @JvmField
    val WM_ENABLE_PREDICTIVE_BACK =
        sysPropBooleanFlag("persist.wm.debug.predictive_back", default = true)

    @Keep
    @JvmField
    val WM_ENABLE_PREDICTIVE_BACK_ANIM =