Loading core/java/android/window/WindowOnBackInvokedDispatcher.java +8 −7 Original line number Diff line number Diff line Loading @@ -51,9 +51,10 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { private IWindowSession mWindowSession; private IWindow mWindow; private static final String TAG = "WindowOnBackDispatcher"; private static final String BACK_PREDICTABILITY_PROP = "persist.debug.back_predictability"; private static final boolean IS_BACK_PREDICTABILITY_ENABLED = SystemProperties .getInt(BACK_PREDICTABILITY_PROP, 1) > 0; private static final boolean ENABLE_PREDICTIVE_BACK = SystemProperties .getInt("persist.wm.debug.predictive_back", 1) != 0; private static final boolean ALWAYS_ENFORCE_PREDICTIVE_BACK = SystemProperties .getInt("persist.wm.debug.predictive_back_always_enforce", 0) != 0; /** Convenience hashmap to quickly decide if a callback has been added. */ private final HashMap<OnBackInvokedCallback, Integer> mAllCallbacks = new HashMap<>(); Loading Loading @@ -254,18 +255,18 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { public static boolean isOnBackInvokedCallbackEnabled(@Nullable Context context) { // new back is enabled if the feature flag is enabled AND the app does not explicitly // request legacy back. boolean featureFlagEnabled = IS_BACK_PREDICTABILITY_ENABLED; boolean featureFlagEnabled = ENABLE_PREDICTIVE_BACK; // If the context is null, we assume true and fallback on the two other conditions. boolean appRequestsPredictiveBack = context != null && context.getApplicationInfo().isOnBackInvokedCallbackEnabled(); if (DEBUG) { Log.d(TAG, TextUtils.formatSimple("App: %s featureFlagEnabled=%s " + "appRequestsPredictiveBack=%s", + "appRequestsPredictiveBack=%s alwaysEnforce=%s", context != null ? context.getApplicationInfo().packageName : "null context", featureFlagEnabled, appRequestsPredictiveBack)); featureFlagEnabled, appRequestsPredictiveBack, ALWAYS_ENFORCE_PREDICTIVE_BACK)); } return featureFlagEnabled && appRequestsPredictiveBack; return featureFlagEnabled && (appRequestsPredictiveBack || ALWAYS_ENFORCE_PREDICTIVE_BACK); } } libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +8 −10 Original line number Diff line number Diff line Loading @@ -48,18 +48,16 @@ import com.android.wm.shell.common.annotations.ShellMainThread; * Controls the window animation run when a user initiates a back gesture. */ public class BackAnimationController implements RemoteCallable<BackAnimationController> { private static final String BACK_PREDICTABILITY_PROGRESS_THRESHOLD_PROP = "persist.debug.back_predictability_progress_threshold"; // By default, enable new back dispatching without any animations. private static final int BACK_PREDICTABILITY_PROP = SystemProperties.getInt("persist.debug.back_predictability", 1); public static final boolean IS_ENABLED = BACK_PREDICTABILITY_PROP > 0; private static final int PROGRESS_THRESHOLD = SystemProperties .getInt(BACK_PREDICTABILITY_PROGRESS_THRESHOLD_PROP, -1); private static final String TAG = "BackAnimationController"; private static final String PREDICTIVE_BACK_PROGRESS_THRESHOLD_PROP = "persist.wm.debug.predictive_back_progress_threshold"; public static final boolean IS_ENABLED = SystemProperties.getInt("persist.wm.debug.predictive_back", 1) != 0; private static final int PROGRESS_THRESHOLD = SystemProperties .getInt(PREDICTIVE_BACK_PROGRESS_THRESHOLD_PROP, -1); @VisibleForTesting boolean mEnableAnimations = (BACK_PREDICTABILITY_PROP & (1 << 1)) != 0; boolean mEnableAnimations = SystemProperties.getInt( "persist.wm.debug.predictive_back_anim", 0) != 0; /** * Location of the initial touch event of the back gesture. Loading packages/SystemUI/src/com/android/systemui/flags/Flags.java +11 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,17 @@ public class Flags { public static final SysPropBooleanFlag WM_ENABLE_SHELL_TRANSITIONS = new SysPropBooleanFlag(1100, "persist.wm.debug.shell_transit", false); // 1200 - predictive back @Keep public static final SysPropBooleanFlag WM_ENABLE_PREDICTIVE_BACK = new SysPropBooleanFlag( 1200, "persist.wm.debug.predictive_back", true); @Keep public static final SysPropBooleanFlag WM_ENABLE_PREDICTIVE_BACK_ANIM = new SysPropBooleanFlag( 1201, "persist.wm.debug.predictive_back_anim", false); @Keep public static final SysPropBooleanFlag WM_ALWAYS_ENFORCE_PREDICTIVE_BACK = new SysPropBooleanFlag(1202, "persist.wm.debug.predictive_back_always_enforce", false); // Pay no attention to the reflection behind the curtain. // ========================== Curtain ========================== // | | Loading services/core/java/com/android/server/wm/BackNavigationController.java +3 −9 Original line number Diff line number Diff line Loading @@ -47,12 +47,6 @@ import com.android.server.LocalServices; class BackNavigationController { private static final String TAG = "BackNavigationController"; // By default, enable new back dispatching without any animations. private static final int BACK_PREDICTABILITY_PROP = SystemProperties.getInt("persist.debug.back_predictability", 1); private static final int ANIMATIONS_MASK = 1 << 1; private static final int SCREENSHOT_MASK = 1 << 2; @Nullable private TaskSnapshotController mTaskSnapshotController; Loading @@ -60,15 +54,15 @@ class BackNavigationController { * Returns true if the back predictability feature is enabled */ static boolean isEnabled() { return BACK_PREDICTABILITY_PROP > 0; return SystemProperties.getInt("persist.wm.debug.predictive_back", 1) != 0; } static boolean isScreenshotEnabled() { return (BACK_PREDICTABILITY_PROP & SCREENSHOT_MASK) != 0; return SystemProperties.getInt("persist.wm.debug.predictive_back_screenshot", 0) != 0; } private static boolean isAnimationEnabled() { return (BACK_PREDICTABILITY_PROP & ANIMATIONS_MASK) != 0; return SystemProperties.getInt("persist.wm.debug.predictive_back_anim", 0) != 0; } /** Loading Loading
core/java/android/window/WindowOnBackInvokedDispatcher.java +8 −7 Original line number Diff line number Diff line Loading @@ -51,9 +51,10 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { private IWindowSession mWindowSession; private IWindow mWindow; private static final String TAG = "WindowOnBackDispatcher"; private static final String BACK_PREDICTABILITY_PROP = "persist.debug.back_predictability"; private static final boolean IS_BACK_PREDICTABILITY_ENABLED = SystemProperties .getInt(BACK_PREDICTABILITY_PROP, 1) > 0; private static final boolean ENABLE_PREDICTIVE_BACK = SystemProperties .getInt("persist.wm.debug.predictive_back", 1) != 0; private static final boolean ALWAYS_ENFORCE_PREDICTIVE_BACK = SystemProperties .getInt("persist.wm.debug.predictive_back_always_enforce", 0) != 0; /** Convenience hashmap to quickly decide if a callback has been added. */ private final HashMap<OnBackInvokedCallback, Integer> mAllCallbacks = new HashMap<>(); Loading Loading @@ -254,18 +255,18 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { public static boolean isOnBackInvokedCallbackEnabled(@Nullable Context context) { // new back is enabled if the feature flag is enabled AND the app does not explicitly // request legacy back. boolean featureFlagEnabled = IS_BACK_PREDICTABILITY_ENABLED; boolean featureFlagEnabled = ENABLE_PREDICTIVE_BACK; // If the context is null, we assume true and fallback on the two other conditions. boolean appRequestsPredictiveBack = context != null && context.getApplicationInfo().isOnBackInvokedCallbackEnabled(); if (DEBUG) { Log.d(TAG, TextUtils.formatSimple("App: %s featureFlagEnabled=%s " + "appRequestsPredictiveBack=%s", + "appRequestsPredictiveBack=%s alwaysEnforce=%s", context != null ? context.getApplicationInfo().packageName : "null context", featureFlagEnabled, appRequestsPredictiveBack)); featureFlagEnabled, appRequestsPredictiveBack, ALWAYS_ENFORCE_PREDICTIVE_BACK)); } return featureFlagEnabled && appRequestsPredictiveBack; return featureFlagEnabled && (appRequestsPredictiveBack || ALWAYS_ENFORCE_PREDICTIVE_BACK); } }
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +8 −10 Original line number Diff line number Diff line Loading @@ -48,18 +48,16 @@ import com.android.wm.shell.common.annotations.ShellMainThread; * Controls the window animation run when a user initiates a back gesture. */ public class BackAnimationController implements RemoteCallable<BackAnimationController> { private static final String BACK_PREDICTABILITY_PROGRESS_THRESHOLD_PROP = "persist.debug.back_predictability_progress_threshold"; // By default, enable new back dispatching without any animations. private static final int BACK_PREDICTABILITY_PROP = SystemProperties.getInt("persist.debug.back_predictability", 1); public static final boolean IS_ENABLED = BACK_PREDICTABILITY_PROP > 0; private static final int PROGRESS_THRESHOLD = SystemProperties .getInt(BACK_PREDICTABILITY_PROGRESS_THRESHOLD_PROP, -1); private static final String TAG = "BackAnimationController"; private static final String PREDICTIVE_BACK_PROGRESS_THRESHOLD_PROP = "persist.wm.debug.predictive_back_progress_threshold"; public static final boolean IS_ENABLED = SystemProperties.getInt("persist.wm.debug.predictive_back", 1) != 0; private static final int PROGRESS_THRESHOLD = SystemProperties .getInt(PREDICTIVE_BACK_PROGRESS_THRESHOLD_PROP, -1); @VisibleForTesting boolean mEnableAnimations = (BACK_PREDICTABILITY_PROP & (1 << 1)) != 0; boolean mEnableAnimations = SystemProperties.getInt( "persist.wm.debug.predictive_back_anim", 0) != 0; /** * Location of the initial touch event of the back gesture. Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.java +11 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,17 @@ public class Flags { public static final SysPropBooleanFlag WM_ENABLE_SHELL_TRANSITIONS = new SysPropBooleanFlag(1100, "persist.wm.debug.shell_transit", false); // 1200 - predictive back @Keep public static final SysPropBooleanFlag WM_ENABLE_PREDICTIVE_BACK = new SysPropBooleanFlag( 1200, "persist.wm.debug.predictive_back", true); @Keep public static final SysPropBooleanFlag WM_ENABLE_PREDICTIVE_BACK_ANIM = new SysPropBooleanFlag( 1201, "persist.wm.debug.predictive_back_anim", false); @Keep public static final SysPropBooleanFlag WM_ALWAYS_ENFORCE_PREDICTIVE_BACK = new SysPropBooleanFlag(1202, "persist.wm.debug.predictive_back_always_enforce", false); // Pay no attention to the reflection behind the curtain. // ========================== Curtain ========================== // | | Loading
services/core/java/com/android/server/wm/BackNavigationController.java +3 −9 Original line number Diff line number Diff line Loading @@ -47,12 +47,6 @@ import com.android.server.LocalServices; class BackNavigationController { private static final String TAG = "BackNavigationController"; // By default, enable new back dispatching without any animations. private static final int BACK_PREDICTABILITY_PROP = SystemProperties.getInt("persist.debug.back_predictability", 1); private static final int ANIMATIONS_MASK = 1 << 1; private static final int SCREENSHOT_MASK = 1 << 2; @Nullable private TaskSnapshotController mTaskSnapshotController; Loading @@ -60,15 +54,15 @@ class BackNavigationController { * Returns true if the back predictability feature is enabled */ static boolean isEnabled() { return BACK_PREDICTABILITY_PROP > 0; return SystemProperties.getInt("persist.wm.debug.predictive_back", 1) != 0; } static boolean isScreenshotEnabled() { return (BACK_PREDICTABILITY_PROP & SCREENSHOT_MASK) != 0; return SystemProperties.getInt("persist.wm.debug.predictive_back_screenshot", 0) != 0; } private static boolean isAnimationEnabled() { return (BACK_PREDICTABILITY_PROP & ANIMATIONS_MASK) != 0; return SystemProperties.getInt("persist.wm.debug.predictive_back_anim", 0) != 0; } /** Loading