Merge "Add predictive back aconfig flag" into main
diff --git a/core/java/android/window/flags/windowing_frontend.aconfig b/core/java/android/window/flags/windowing_frontend.aconfig
index 31a3ebd..7f65c52 100644
--- a/core/java/android/window/flags/windowing_frontend.aconfig
+++ b/core/java/android/window/flags/windowing_frontend.aconfig
@@ -44,11 +44,18 @@
bug: "294925498"
}
-
flag {
name: "wallpaper_offset_async"
namespace: "windowing_frontend"
description: "Do not synchronise the wallpaper offset"
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
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
index 5843635..cf858dc 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
@@ -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 @@
private void onInit() {
setupAnimationDeveloperSettingsObserver(mContentResolver, mBgHandler);
+ updateEnableAnimationFromFlags();
createAdapter();
mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION,
this::createExternalInterface, this);
@@ -229,28 +231,39 @@
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;
}
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
index 5a763b1..b753ff7 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
@@ -437,11 +437,6 @@
// 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 =
sysPropBooleanFlag("persist.wm.debug.predictive_back_anim", default = true)