diff options
12 files changed, 57 insertions, 51 deletions
diff --git a/packages/SystemUI/aconfig/predictive_back.aconfig b/packages/SystemUI/aconfig/predictive_back.aconfig new file mode 100644 index 000000000000..1ad16667f317 --- /dev/null +++ b/packages/SystemUI/aconfig/predictive_back.aconfig @@ -0,0 +1,22 @@ +package: "com.android.systemui" + +flag { + name: "predictive_back_sysui" + namespace: "systemui" + description: "Predictive Back Dispatching for SysUI" + bug: "309545085" +} + +flag { + name: "predictive_back_animate_shade" + namespace: "systemui" + description: "Enable Shade Animations" + bug: "309545085" +} + +flag { + name: "predictive_back_animate_bouncer" + namespace: "systemui" + description: "Enable Predictive Back Animation in Bouncer" + bug: "309545085" +}
\ No newline at end of file diff --git a/packages/SystemUI/shared/Android.bp b/packages/SystemUI/shared/Android.bp index 2b4117866254..3a26ebff6c6a 100644 --- a/packages/SystemUI/shared/Android.bp +++ b/packages/SystemUI/shared/Android.bp @@ -66,6 +66,7 @@ android_library { "kotlinx_coroutines", "dagger2", "jsr330", + "com_android_systemui_shared_flags_lib", ], resource_dirs: [ "res", diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java index 131eb6b63df3..c08b0837da8e 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java @@ -20,10 +20,11 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; +import static com.android.systemui.shared.Flags.shadeAllowBackGesture; + import android.annotation.IntDef; import android.content.Context; import android.content.res.Resources; -import android.os.SystemProperties; import android.view.ViewConfiguration; import android.view.WindowManagerPolicyConstants; @@ -132,8 +133,7 @@ public class QuickStepContract { SYSUI_STATE_WAKEFULNESS_TRANSITION | SYSUI_STATE_AWAKE; // Whether the back gesture is allowed (or ignored) by the Shade - public static final boolean ALLOW_BACK_GESTURE_IN_SHADE = SystemProperties.getBoolean( - "persist.wm.debug.shade_allow_back_gesture", false); + public static final boolean ALLOW_BACK_GESTURE_IN_SHADE = shadeAllowBackGesture(); @Retention(RetentionPolicy.SOURCE) @IntDef({SYSUI_STATE_SCREEN_PINNING, diff --git a/packages/SystemUI/src/com/android/systemui/back/domain/interactor/BackActionInteractor.kt b/packages/SystemUI/src/com/android/systemui/back/domain/interactor/BackActionInteractor.kt index 066cba230b76..6076f32486b9 100644 --- a/packages/SystemUI/src/com/android/systemui/back/domain/interactor/BackActionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/back/domain/interactor/BackActionInteractor.kt @@ -22,10 +22,9 @@ import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import android.window.WindowOnBackInvokedDispatcher import com.android.systemui.CoreStartable +import com.android.systemui.Flags.predictiveBackAnimateShade import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application -import com.android.systemui.flags.FeatureFlags -import com.android.systemui.flags.Flags import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor import com.android.systemui.shade.QuickSettingsController @@ -48,14 +47,13 @@ constructor( private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager, private val shadeController: ShadeController, private val notificationShadeWindowController: NotificationShadeWindowController, - private val windowRootViewVisibilityInteractor: WindowRootViewVisibilityInteractor, - featureFlags: FeatureFlags, + private val windowRootViewVisibilityInteractor: WindowRootViewVisibilityInteractor ) : CoreStartable { private var isCallbackRegistered = false private val callback = - if (featureFlags.isEnabled(Flags.WM_SHADE_ANIMATE_BACK_GESTURE)) { + if (predictiveBackAnimateShade()) { /** * New callback that handles back gesture invoked, cancel, progress and provides * feedback via Shade animation. diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index bb0c2733e511..38c7c6ac67cb 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -444,29 +444,10 @@ object Flags { // TODO(b/254512728): Tracking Bug @JvmField val NEW_BACK_AFFORDANCE = releasedFlag("new_back_affordance") - // TODO(b/255854141): Tracking Bug - @JvmField - val WM_ENABLE_PREDICTIVE_BACK_SYSUI = - unreleasedFlag("persist.wm.debug.predictive_back_sysui_enable", teamfood = true) // TODO(b/270987164): Tracking Bug @JvmField val TRACKPAD_GESTURE_FEATURES = releasedFlag("trackpad_gesture_features") - // TODO(b/263826204): Tracking Bug - @JvmField - val WM_ENABLE_PREDICTIVE_BACK_BOUNCER_ANIM = - unreleasedFlag("persist.wm.debug.predictive_back_bouncer_anim", teamfood = true) - - // TODO(b/238475428): Tracking Bug - @JvmField - val WM_SHADE_ALLOW_BACK_GESTURE = - sysPropBooleanFlag("persist.wm.debug.shade_allow_back_gesture", default = false) - - // TODO(b/238475428): Tracking Bug - @JvmField - val WM_SHADE_ANIMATE_BACK_GESTURE = - unreleasedFlag("persist.wm.debug.shade_animate_back_gesture", teamfood = false) - // TODO(b/265639042): Tracking Bug @JvmField val WM_ENABLE_PREDICTIVE_BACK_QS_DIALOG_ANIM = diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index fb6bc38c9a0b..026201e1e690 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -26,6 +26,7 @@ import static com.android.keyguard.KeyguardClockSwitch.LARGE; import static com.android.keyguard.KeyguardClockSwitch.SMALL; import static com.android.systemui.Flags.keyguardBottomAreaRefactor; import static com.android.systemui.Flags.migrateClocksToBlueprint; +import static com.android.systemui.Flags.predictiveBackAnimateShade; import static com.android.systemui.classifier.Classifier.BOUNCER_UNLOCK; import static com.android.systemui.classifier.Classifier.GENERIC; import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS; @@ -891,7 +892,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mShadeHeaderController = shadeHeaderController; mLayoutInflater = layoutInflater; mFeatureFlags = featureFlags; - mAnimateBack = mFeatureFlags.isEnabled(Flags.WM_SHADE_ANIMATE_BACK_GESTURE); + mAnimateBack = predictiveBackAnimateShade(); mTrackpadGestureFeaturesEnabled = mFeatureFlags.isEnabled(Flags.TRACKPAD_GESTURE_FEATURES); mFalsingCollector = falsingCollector; mWakeUpCoordinator = coordinator; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 57d49b250883..6e3aabf7c754 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -31,6 +31,7 @@ import static com.android.systemui.Flags.lightRevealMigration; import static com.android.systemui.charging.WirelessChargingAnimation.UNKNOWN_BATTERY_LEVEL; import static com.android.systemui.statusbar.NotificationLockscreenUserManager.PERMISSION_SELF; import static com.android.systemui.statusbar.StatusBarState.SHADE; +import static com.android.systemui.Flags.predictiveBackSysui; import android.annotation.Nullable; import android.app.ActivityOptions; @@ -836,7 +837,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mLightRevealScrim = lightRevealScrim; // Based on teamfood flag, turn predictive back dispatch on at runtime. - if (mFeatureFlags.isEnabled(Flags.WM_ENABLE_PREDICTIVE_BACK_SYSUI)) { + if (predictiveBackSysui()) { mContext.getApplicationInfo().setEnableOnBackInvokedCallback(true); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 4999123247a9..88347ab90606 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone; import static android.view.WindowInsets.Type.navigationBars; +import static com.android.systemui.Flags.predictiveBackAnimateBouncer; import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN; import static com.android.systemui.plugins.ActivityStarter.OnDismissAction; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; @@ -400,8 +401,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mFoldAodAnimationController = sysUIUnfoldComponent .map(SysUIUnfoldComponent::getFoldAodAnimationController).orElse(null); mAlternateBouncerInteractor = alternateBouncerInteractor; - mIsBackAnimationEnabled = - featureFlags.isEnabled(Flags.WM_ENABLE_PREDICTIVE_BACK_BOUNCER_ANIM); + mIsBackAnimationEnabled = predictiveBackAnimateBouncer(); mUdfpsOverlayInteractor = udfpsOverlayInteractor; mActivityStarter = activityStarter; mKeyguardTransitionInteractor = keyguardTransitionInteractor; diff --git a/packages/SystemUI/tests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt index 8693d5c87dce..7c626a141a4a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt @@ -16,6 +16,9 @@ package com.android.systemui.back.domain.interactor +import android.platform.test.annotations.RequiresFlagsDisabled +import android.platform.test.annotations.RequiresFlagsEnabled +import android.platform.test.flag.junit.DeviceFlagsValueProvider import android.view.ViewRootImpl import android.window.BackEvent import android.window.BackEvent.EDGE_LEFT @@ -26,9 +29,8 @@ import android.window.WindowOnBackInvokedDispatcher import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.statusbar.IStatusBarService +import com.android.systemui.Flags import com.android.systemui.SysuiTestCase -import com.android.systemui.flags.FakeFeatureFlags -import com.android.systemui.flags.Flags import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest @@ -72,7 +74,6 @@ import org.mockito.junit.MockitoJUnit @OptIn(ExperimentalCoroutinesApi::class) class BackActionInteractorTest : SysuiTestCase() { private val testScope = TestScope() - private val featureFlags = FakeFeatureFlags() private val executor = FakeExecutor(FakeSystemClock()) @JvmField @Rule var mockitoRule = MockitoJUnit.rule() @@ -107,17 +108,17 @@ class BackActionInteractorTest : SysuiTestCase() { statusBarKeyguardViewManager, shadeController, notificationShadeWindowController, - windowRootViewVisibilityInteractor, - featureFlags, + windowRootViewVisibilityInteractor ) .apply { this.setup(qsController, shadeViewController) } } private val powerInteractor = PowerInteractorFactory.create().powerInteractor + @get:Rule val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule() + @Before fun setUp() { - featureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, false) whenever(notificationShadeWindowController.windowRootView).thenReturn(windowRootView) whenever(windowRootView.viewRootImpl).thenReturn(viewRootImpl) whenever(viewRootImpl.onBackInvokedDispatcher).thenReturn(onBackInvokedDispatcher) @@ -229,9 +230,9 @@ class BackActionInteractorTest : SysuiTestCase() { } @Test + @RequiresFlagsDisabled(Flags.FLAG_PREDICTIVE_BACK_ANIMATE_SHADE) fun animationFlagOff_onBackInvoked_keyguardNotified() { backActionInteractor.start() - featureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, false) windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() val callback = getBackInvokedCallback() @@ -243,8 +244,8 @@ class BackActionInteractorTest : SysuiTestCase() { } @Test + @RequiresFlagsEnabled(Flags.FLAG_PREDICTIVE_BACK_ANIMATE_SHADE) fun animationFlagOn_onBackInvoked_keyguardNotified() { - featureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, true) backActionInteractor.start() windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() @@ -257,8 +258,8 @@ class BackActionInteractorTest : SysuiTestCase() { } @Test + @RequiresFlagsEnabled(Flags.FLAG_PREDICTIVE_BACK_ANIMATE_SHADE) fun animationFlagOn_callbackIsAnimationCallback() { - featureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, true) backActionInteractor.start() windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() @@ -269,8 +270,8 @@ class BackActionInteractorTest : SysuiTestCase() { } @Test + @RequiresFlagsEnabled(Flags.FLAG_PREDICTIVE_BACK_ANIMATE_SHADE) fun onBackProgressed_shadeCannotBeCollapsed_shadeViewControllerNotNotified() { - featureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, true) backActionInteractor.start() windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() @@ -284,8 +285,8 @@ class BackActionInteractorTest : SysuiTestCase() { } @Test + @RequiresFlagsEnabled(Flags.FLAG_PREDICTIVE_BACK_ANIMATE_SHADE) fun onBackProgressed_shadeCanBeCollapsed_shadeViewControllerNotified() { - featureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, true) backActionInteractor.start() windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 22207565a7b7..b0792d8ed46f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -382,7 +382,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mFeatureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, false); mFeatureFlags.set(Flags.TRACKPAD_GESTURE_FEATURES, false); mFeatureFlags.set(Flags.LOCKSCREEN_ENABLE_LANDSCAPE, false); mFeatureFlags.set(Flags.QS_USER_DETAIL_SHORTCUT, false); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index e3396364a85a..316f2b99b27b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -334,15 +334,8 @@ public class CentralSurfacesImplTest extends SysuiTestCase { public void setup() throws Exception { MockitoAnnotations.initMocks(this); - // CentralSurfacesImpl's runtime flag check fails if the flag is absent. - // This value is unused, because test manifest is opted in. - mFeatureFlags.set(Flags.WM_ENABLE_PREDICTIVE_BACK_SYSUI, false); // Set default value to avoid IllegalStateException. mFeatureFlags.set(Flags.SHORTCUT_LIST_SEARCH_LAYOUT, false); - // For the Shade to respond to Back gesture, we must enable the event routing - mFeatureFlags.set(Flags.WM_SHADE_ALLOW_BACK_GESTURE, true); - // For the Shade to animate during the Back gesture, we must enable the animation flag. - mFeatureFlags.set(Flags.WM_SHADE_ANIMATE_BACK_GESTURE, true); mSetFlagsRule.enableFlags(FLAG_LIGHT_REVEAL_MIGRATION); // Turn AOD on and toggle feature flag for jank fixes mFeatureFlags.set(Flags.ZJ_285570694_LOCKSCREEN_TRANSITION_FROM_AOD, true); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 225ddb6110c2..8dde9359bdfc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -37,6 +37,9 @@ import static org.mockito.Mockito.when; import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher; +import android.platform.test.annotations.RequiresFlagsEnabled; +import android.platform.test.flag.junit.CheckFlagsRule; +import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.service.trust.TrustAgentService; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; @@ -98,6 +101,7 @@ import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.google.common.truth.Truth; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; @@ -165,6 +169,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Captor private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallback; + @Rule + public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); @Before public void setUp() { @@ -175,7 +181,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { when(mBouncerView.getDelegate()).thenReturn(mBouncerViewDelegate); when(mBouncerViewDelegate.getBackCallback()).thenReturn(mBouncerViewDelegateBackCallback); mFeatureFlags = new FakeFeatureFlags(); - mFeatureFlags.set(Flags.WM_ENABLE_PREDICTIVE_BACK_BOUNCER_ANIM, true); mFeatureFlags.set(Flags.REFACTOR_KEYGUARD_DISMISS_INTENT, false); mFeatureFlags.set(Flags.KEYGUARD_WM_STATE_REFACTOR, false); mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); @@ -584,6 +589,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test + @RequiresFlagsEnabled(com.android.systemui.Flags.FLAG_PREDICTIVE_BACK_ANIMATE_BOUNCER) public void testPredictiveBackCallback_registration() { /* verify that a predictive back callback is registered when the bouncer becomes visible */ mBouncerExpansionCallback.onVisibilityChanged(true); @@ -598,6 +604,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test + @RequiresFlagsEnabled(com.android.systemui.Flags.FLAG_PREDICTIVE_BACK_ANIMATE_BOUNCER) public void testPredictiveBackCallback_invocationHidesBouncer() { mBouncerExpansionCallback.onVisibilityChanged(true); /* capture the predictive back callback during registration */ @@ -615,6 +622,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test + @RequiresFlagsEnabled(com.android.systemui.Flags.FLAG_PREDICTIVE_BACK_ANIMATE_BOUNCER) public void testPredictiveBackCallback_noBackAnimationForFullScreenBouncer() { when(mKeyguardSecurityModel.getSecurityMode(anyInt())) .thenReturn(KeyguardSecurityModel.SecurityMode.SimPin); @@ -634,6 +642,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test + @RequiresFlagsEnabled(com.android.systemui.Flags.FLAG_PREDICTIVE_BACK_ANIMATE_BOUNCER) public void testPredictiveBackCallback_forwardsBackDispatches() { mBouncerExpansionCallback.onVisibilityChanged(true); /* capture the predictive back callback during registration */ |