Loading packages/SystemUI/aconfig/systemui.aconfig +1 −4 Original line number Original line Diff line number Diff line Loading @@ -1962,13 +1962,10 @@ flag { } } flag { flag { name: "magnetic_notification_horizontal_swipe" name: "magnetic_notification_swipes" namespace: "systemui" namespace: "systemui" description: "Add support for magnetic behavior on horizontal notification swipes." description: "Add support for magnetic behavior on horizontal notification swipes." bug: "390179908" bug: "390179908" metadata { purpose: PURPOSE_BUGFIX } } } flag { flag { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -165,6 +165,8 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { @Mock @Mock private SensitiveNotificationProtectionController mSensitiveNotificationProtectionController; private SensitiveNotificationProtectionController mSensitiveNotificationProtectionController; @Mock private ExpandHelper mExpandHelper; @Mock private ExpandHelper mExpandHelper; @Mock private MagneticNotificationRowManager mMagneticNotificationRowManager; @Mock private NotificationSectionsManager mSectionsManager; @Captor @Captor private ArgumentCaptor<Runnable> mSensitiveStateListenerArgumentCaptor; private ArgumentCaptor<Runnable> mSensitiveStateListenerArgumentCaptor; Loading Loading @@ -798,7 +800,9 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { mActivityStarter, mActivityStarter, new ResourcesSplitShadeStateController(), new ResourcesSplitShadeStateController(), mSensitiveNotificationProtectionController, mSensitiveNotificationProtectionController, mWallpaperInteractor); mWallpaperInteractor, mMagneticNotificationRowManager, mSectionsManager); } } static class LogMatcher implements ArgumentMatcher<LogMaker> { static class LogMatcher implements ArgumentMatcher<LogMaker> { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -405,7 +405,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 0, 0); doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 0, 0); mSwipeHelper.snapChild(mNotificationRow, 0, 0); mSwipeHelper.snapChild(mNotificationRow, 0, 0); verify(mCallback, times(1)).onDragCancelled(mNotificationRow); verify(mCallback, times(1)).onDragCancelledWithVelocity(mNotificationRow, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 0, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 0, 0); verify(mSwipeHelper, times(1)).handleMenuCoveredOrDismissed(); verify(mSwipeHelper, times(1)).handleMenuCoveredOrDismissed(); } } Loading @@ -416,7 +416,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 10, 0); doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 10, 0); mSwipeHelper.snapChild(mNotificationRow, 10, 0); mSwipeHelper.snapChild(mNotificationRow, 10, 0); verify(mCallback, times(1)).onDragCancelled(mNotificationRow); verify(mCallback, times(1)).onDragCancelledWithVelocity(mNotificationRow, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 10, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 10, 0); verify(mSwipeHelper, times(0)).handleMenuCoveredOrDismissed(); verify(mSwipeHelper, times(0)).handleMenuCoveredOrDismissed(); } } Loading @@ -426,7 +426,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { doNothing().when(mSwipeHelper).superSnapChild(mView, 10, 0); doNothing().when(mSwipeHelper).superSnapChild(mView, 10, 0); mSwipeHelper.snapChild(mView, 10, 0); mSwipeHelper.snapChild(mView, 10, 0); verify(mCallback).onDragCancelled(mView); verify(mCallback).onDragCancelledWithVelocity(mView, 0); verify(mSwipeHelper, never()).superSnapChild(mView, 10, 0); verify(mSwipeHelper, never()).superSnapChild(mView, 10, 0); } } Loading packages/SystemUI/src/com/android/systemui/SwipeHelper.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui; import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_X; import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_X; import static androidx.dynamicanimation.animation.FloatPropertyCompat.createFloatPropertyCompat; import static androidx.dynamicanimation.animation.FloatPropertyCompat.createFloatPropertyCompat; import static com.android.systemui.Flags.magneticNotificationSwipes; import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS; import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS; import static com.android.systemui.statusbar.notification.NotificationUtils.logKey; import static com.android.systemui.statusbar.notification.NotificationUtils.logKey; Loading Loading @@ -76,8 +77,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { protected final Handler mHandler; protected final Handler mHandler; private final SpringConfig mSnapBackSpringConfig = private final SpringConfig mSnapBackSpringConfig; new SpringConfig(SpringForce.STIFFNESS_LOW, SpringForce.DAMPING_RATIO_LOW_BOUNCY); private final FlingAnimationUtils mFlingAnimationUtils; private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; private float mPagingTouchSlop; Loading Loading @@ -153,6 +153,12 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { R.bool.config_fadeDependingOnAmountSwiped); R.bool.config_fadeDependingOnAmountSwiped); mFalsingManager = falsingManager; mFalsingManager = falsingManager; mFeatureFlags = featureFlags; mFeatureFlags = featureFlags; if (magneticNotificationSwipes()) { mSnapBackSpringConfig = new SpringConfig(550f /*stiffness*/, 0.52f /*dampingRatio*/); } else { mSnapBackSpringConfig = new SpringConfig( SpringForce.STIFFNESS_LOW, SpringForce.DAMPING_RATIO_LOW_BOUNCY); } mFlingAnimationUtils = new FlingAnimationUtils(resources.getDisplayMetrics(), mFlingAnimationUtils = new FlingAnimationUtils(resources.getDisplayMetrics(), getMaxEscapeAnimDuration() / 1000f); getMaxEscapeAnimDuration() / 1000f); } } Loading Loading @@ -718,7 +724,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { dismissChild(mTouchedView, velocity, dismissChild(mTouchedView, velocity, !swipedFastEnough() /* useAccelerateInterpolator */); !swipedFastEnough() /* useAccelerateInterpolator */); } else { } else { mCallback.onDragCancelled(mTouchedView); mCallback.onDragCancelledWithVelocity(mTouchedView, velocity); snapChild(mTouchedView, 0 /* leftTarget */, velocity); snapChild(mTouchedView, 0 /* leftTarget */, velocity); } } mTouchedView = null; mTouchedView = null; Loading Loading @@ -924,6 +930,15 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { void onDragCancelled(View v); void onDragCancelled(View v); /** * A drag operation has been cancelled on a view with a final velocity. * @param v View that was dragged. * @param finalVelocity Final velocity of the drag. */ default void onDragCancelledWithVelocity(View v, float finalVelocity) { onDragCancelled(v); } /** /** * Called when the child is long pressed and available to start drag and drop. * Called when the child is long pressed and available to start drag and drop. * * Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.settingslib.notification.data.repository.ZenModeRepositoryImp import com.android.settingslib.notification.domain.interactor.NotificationsSoundPolicyInteractor; import com.android.settingslib.notification.domain.interactor.NotificationsSoundPolicyInteractor; import com.android.settingslib.notification.modes.ZenModesBackend; import com.android.settingslib.notification.modes.ZenModesBackend; import com.android.systemui.CoreStartable; import com.android.systemui.CoreStartable; import com.android.systemui.Flags; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Background; Loading Loading @@ -84,6 +85,8 @@ import com.android.systemui.statusbar.notification.row.NotificationEntryProcesso import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback; import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback; import com.android.systemui.statusbar.notification.row.ui.viewmodel.ActivatableNotificationViewModelModule; import com.android.systemui.statusbar.notification.row.ui.viewmodel.ActivatableNotificationViewModelModule; import com.android.systemui.statusbar.notification.stack.MagneticNotificationRowManager; import com.android.systemui.statusbar.notification.stack.MagneticNotificationRowManagerImpl; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager; import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; Loading Loading @@ -322,4 +325,19 @@ public interface NotificationsModule { return (entry, recoveredBuilder) -> null; return (entry, recoveredBuilder) -> null; } } } } /** * Provide an implementation of {@link MagneticNotificationRowManager} based on its flag. */ @Provides @SysUISingleton static MagneticNotificationRowManager provideMagneticNotificationRowManager( Provider<MagneticNotificationRowManagerImpl> implProvider ) { if (Flags.magneticNotificationSwipes()) { return implProvider.get(); } else { return MagneticNotificationRowManager.getEmpty(); } } } } Loading
packages/SystemUI/aconfig/systemui.aconfig +1 −4 Original line number Original line Diff line number Diff line Loading @@ -1962,13 +1962,10 @@ flag { } } flag { flag { name: "magnetic_notification_horizontal_swipe" name: "magnetic_notification_swipes" namespace: "systemui" namespace: "systemui" description: "Add support for magnetic behavior on horizontal notification swipes." description: "Add support for magnetic behavior on horizontal notification swipes." bug: "390179908" bug: "390179908" metadata { purpose: PURPOSE_BUGFIX } } } flag { flag { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -165,6 +165,8 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { @Mock @Mock private SensitiveNotificationProtectionController mSensitiveNotificationProtectionController; private SensitiveNotificationProtectionController mSensitiveNotificationProtectionController; @Mock private ExpandHelper mExpandHelper; @Mock private ExpandHelper mExpandHelper; @Mock private MagneticNotificationRowManager mMagneticNotificationRowManager; @Mock private NotificationSectionsManager mSectionsManager; @Captor @Captor private ArgumentCaptor<Runnable> mSensitiveStateListenerArgumentCaptor; private ArgumentCaptor<Runnable> mSensitiveStateListenerArgumentCaptor; Loading Loading @@ -798,7 +800,9 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { mActivityStarter, mActivityStarter, new ResourcesSplitShadeStateController(), new ResourcesSplitShadeStateController(), mSensitiveNotificationProtectionController, mSensitiveNotificationProtectionController, mWallpaperInteractor); mWallpaperInteractor, mMagneticNotificationRowManager, mSectionsManager); } } static class LogMatcher implements ArgumentMatcher<LogMaker> { static class LogMatcher implements ArgumentMatcher<LogMaker> { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -405,7 +405,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 0, 0); doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 0, 0); mSwipeHelper.snapChild(mNotificationRow, 0, 0); mSwipeHelper.snapChild(mNotificationRow, 0, 0); verify(mCallback, times(1)).onDragCancelled(mNotificationRow); verify(mCallback, times(1)).onDragCancelledWithVelocity(mNotificationRow, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 0, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 0, 0); verify(mSwipeHelper, times(1)).handleMenuCoveredOrDismissed(); verify(mSwipeHelper, times(1)).handleMenuCoveredOrDismissed(); } } Loading @@ -416,7 +416,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 10, 0); doNothing().when(mSwipeHelper).superSnapChild(mNotificationRow, 10, 0); mSwipeHelper.snapChild(mNotificationRow, 10, 0); mSwipeHelper.snapChild(mNotificationRow, 10, 0); verify(mCallback, times(1)).onDragCancelled(mNotificationRow); verify(mCallback, times(1)).onDragCancelledWithVelocity(mNotificationRow, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 10, 0); verify(mSwipeHelper, times(1)).superSnapChild(mNotificationRow, 10, 0); verify(mSwipeHelper, times(0)).handleMenuCoveredOrDismissed(); verify(mSwipeHelper, times(0)).handleMenuCoveredOrDismissed(); } } Loading @@ -426,7 +426,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { doNothing().when(mSwipeHelper).superSnapChild(mView, 10, 0); doNothing().when(mSwipeHelper).superSnapChild(mView, 10, 0); mSwipeHelper.snapChild(mView, 10, 0); mSwipeHelper.snapChild(mView, 10, 0); verify(mCallback).onDragCancelled(mView); verify(mCallback).onDragCancelledWithVelocity(mView, 0); verify(mSwipeHelper, never()).superSnapChild(mView, 10, 0); verify(mSwipeHelper, never()).superSnapChild(mView, 10, 0); } } Loading
packages/SystemUI/src/com/android/systemui/SwipeHelper.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui; import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_X; import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_X; import static androidx.dynamicanimation.animation.FloatPropertyCompat.createFloatPropertyCompat; import static androidx.dynamicanimation.animation.FloatPropertyCompat.createFloatPropertyCompat; import static com.android.systemui.Flags.magneticNotificationSwipes; import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS; import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS; import static com.android.systemui.statusbar.notification.NotificationUtils.logKey; import static com.android.systemui.statusbar.notification.NotificationUtils.logKey; Loading Loading @@ -76,8 +77,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { protected final Handler mHandler; protected final Handler mHandler; private final SpringConfig mSnapBackSpringConfig = private final SpringConfig mSnapBackSpringConfig; new SpringConfig(SpringForce.STIFFNESS_LOW, SpringForce.DAMPING_RATIO_LOW_BOUNCY); private final FlingAnimationUtils mFlingAnimationUtils; private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; private float mPagingTouchSlop; Loading Loading @@ -153,6 +153,12 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { R.bool.config_fadeDependingOnAmountSwiped); R.bool.config_fadeDependingOnAmountSwiped); mFalsingManager = falsingManager; mFalsingManager = falsingManager; mFeatureFlags = featureFlags; mFeatureFlags = featureFlags; if (magneticNotificationSwipes()) { mSnapBackSpringConfig = new SpringConfig(550f /*stiffness*/, 0.52f /*dampingRatio*/); } else { mSnapBackSpringConfig = new SpringConfig( SpringForce.STIFFNESS_LOW, SpringForce.DAMPING_RATIO_LOW_BOUNCY); } mFlingAnimationUtils = new FlingAnimationUtils(resources.getDisplayMetrics(), mFlingAnimationUtils = new FlingAnimationUtils(resources.getDisplayMetrics(), getMaxEscapeAnimDuration() / 1000f); getMaxEscapeAnimDuration() / 1000f); } } Loading Loading @@ -718,7 +724,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { dismissChild(mTouchedView, velocity, dismissChild(mTouchedView, velocity, !swipedFastEnough() /* useAccelerateInterpolator */); !swipedFastEnough() /* useAccelerateInterpolator */); } else { } else { mCallback.onDragCancelled(mTouchedView); mCallback.onDragCancelledWithVelocity(mTouchedView, velocity); snapChild(mTouchedView, 0 /* leftTarget */, velocity); snapChild(mTouchedView, 0 /* leftTarget */, velocity); } } mTouchedView = null; mTouchedView = null; Loading Loading @@ -924,6 +930,15 @@ public class SwipeHelper implements Gefingerpoken, Dumpable { void onDragCancelled(View v); void onDragCancelled(View v); /** * A drag operation has been cancelled on a view with a final velocity. * @param v View that was dragged. * @param finalVelocity Final velocity of the drag. */ default void onDragCancelledWithVelocity(View v, float finalVelocity) { onDragCancelled(v); } /** /** * Called when the child is long pressed and available to start drag and drop. * Called when the child is long pressed and available to start drag and drop. * * Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.settingslib.notification.data.repository.ZenModeRepositoryImp import com.android.settingslib.notification.domain.interactor.NotificationsSoundPolicyInteractor; import com.android.settingslib.notification.domain.interactor.NotificationsSoundPolicyInteractor; import com.android.settingslib.notification.modes.ZenModesBackend; import com.android.settingslib.notification.modes.ZenModesBackend; import com.android.systemui.CoreStartable; import com.android.systemui.CoreStartable; import com.android.systemui.Flags; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Background; Loading Loading @@ -84,6 +85,8 @@ import com.android.systemui.statusbar.notification.row.NotificationEntryProcesso import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback; import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback; import com.android.systemui.statusbar.notification.row.ui.viewmodel.ActivatableNotificationViewModelModule; import com.android.systemui.statusbar.notification.row.ui.viewmodel.ActivatableNotificationViewModelModule; import com.android.systemui.statusbar.notification.stack.MagneticNotificationRowManager; import com.android.systemui.statusbar.notification.stack.MagneticNotificationRowManagerImpl; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager; import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; Loading Loading @@ -322,4 +325,19 @@ public interface NotificationsModule { return (entry, recoveredBuilder) -> null; return (entry, recoveredBuilder) -> null; } } } } /** * Provide an implementation of {@link MagneticNotificationRowManager} based on its flag. */ @Provides @SysUISingleton static MagneticNotificationRowManager provideMagneticNotificationRowManager( Provider<MagneticNotificationRowManagerImpl> implProvider ) { if (Flags.magneticNotificationSwipes()) { return implProvider.get(); } else { return MagneticNotificationRowManager.getEmpty(); } } } }