Loading packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java +13 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; Loading Loading @@ -49,6 +50,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.ambient.touch.scrim.ScrimController; import com.android.systemui.ambient.touch.scrim.ScrimManager; import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.FakeUserTracker; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.shared.system.InputChannelCompat; Loading Loading @@ -112,6 +114,9 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { @Mock LockPatternUtils mLockPatternUtils; @Mock ActivityStarter mActivityStarter; @Mock Region mRegion; Loading Loading @@ -148,7 +153,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { mFlingAnimationUtilsClosing, TOUCH_REGION, MIN_BOUNCER_HEIGHT, mUiEventLogger); mUiEventLogger, mActivityStarter); when(mScrimManager.getCurrentController()).thenReturn(mScrimController); when(mValueAnimatorCreator.create(anyFloat(), anyFloat())).thenReturn(mValueAnimator); Loading Loading @@ -397,7 +403,12 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { .isTrue(); // We should not expand since the keyguard is not secure verify(mScrimController, never()).expand(any()); // Since we are swiping up, we should wake from dreams. // Since we are swiping up, we should dismiss the keyguard and wake from dreams. ArgumentCaptor<Runnable> dismissKeyguardRunnable = ArgumentCaptor.forClass(Runnable.class); verify(mActivityStarter).executeRunnableDismissingKeyguard( dismissKeyguardRunnable.capture(), isNull(), eq(true), eq(true), eq(false)); dismissKeyguardRunnable.getValue().run(); verify(mCentralSurfaces).awakenDreams(); } Loading packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java +14 −5 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.ambient.touch.dagger.BouncerSwipeModule; import com.android.systemui.ambient.touch.scrim.ScrimController; import com.android.systemui.ambient.touch.scrim.ScrimManager; import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.statusbar.NotificationShadeWindowController; Loading Loading @@ -103,6 +104,8 @@ public class BouncerSwipeTouchHandler implements TouchHandler { private final UiEventLogger mUiEventLogger; private final ActivityStarter mActivityStarter; private final ScrimManager.Callback mScrimManagerCallback = new ScrimManager.Callback() { @Override public void onScrimControllerChanged(ScrimController controller) { Loading Loading @@ -149,11 +152,16 @@ public class BouncerSwipeTouchHandler implements TouchHandler { return true; } // If scrolling up and keyguard is not locked, dismiss the dream since there's // no bouncer to show. // If scrolling up and keyguard is not locked, dismiss both keyguard and the // dream since there's no bouncer to show. if (e1.getY() > e2.getY() && !mLockPatternUtils.isSecure(mUserTracker.getUserId())) { mCentralSurfaces.get().awakenDreams(); mActivityStarter.executeRunnableDismissingKeyguard( () -> mCentralSurfaces.get().awakenDreams(), /* cancelAction= */ null, /* dismissShade= */ true, /* afterKeyguardGone= */ true, /* deferred= */ false); return true; } Loading @@ -162,7 +170,6 @@ public class BouncerSwipeTouchHandler implements TouchHandler { // bouncer. As that view's expansion shrinks, the bouncer appears. The bouncer // is fully hidden at full expansion (1) and fully visible when fully collapsed // (0). final float dragDownAmount = e2.getY() - e1.getY(); final float screenTravelPercentage = Math.abs(e1.getY() - e2.getY()) / mTouchSession.getBounds().height(); setPanelExpansion(1 - screenTravelPercentage); Loading Loading @@ -216,7 +223,8 @@ public class BouncerSwipeTouchHandler implements TouchHandler { FlingAnimationUtils flingAnimationUtilsClosing, @Named(BouncerSwipeModule.SWIPE_TO_BOUNCER_START_REGION) float swipeRegionPercentage, @Named(BouncerSwipeModule.MIN_BOUNCER_ZONE_SCREEN_PERCENTAGE) float minRegionPercentage, UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger, ActivityStarter activityStarter) { mCentralSurfaces = centralSurfaces; mScrimManager = scrimManager; mNotificationShadeWindowController = notificationShadeWindowController; Loading @@ -229,6 +237,7 @@ public class BouncerSwipeTouchHandler implements TouchHandler { mValueAnimatorCreator = valueAnimatorCreator; mVelocityTrackerFactory = velocityTrackerFactory; mUiEventLogger = uiEventLogger; mActivityStarter = activityStarter; } @Override Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java +13 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; Loading Loading @@ -49,6 +50,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.ambient.touch.scrim.ScrimController; import com.android.systemui.ambient.touch.scrim.ScrimManager; import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.FakeUserTracker; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.shared.system.InputChannelCompat; Loading Loading @@ -112,6 +114,9 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { @Mock LockPatternUtils mLockPatternUtils; @Mock ActivityStarter mActivityStarter; @Mock Region mRegion; Loading Loading @@ -148,7 +153,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { mFlingAnimationUtilsClosing, TOUCH_REGION, MIN_BOUNCER_HEIGHT, mUiEventLogger); mUiEventLogger, mActivityStarter); when(mScrimManager.getCurrentController()).thenReturn(mScrimController); when(mValueAnimatorCreator.create(anyFloat(), anyFloat())).thenReturn(mValueAnimator); Loading Loading @@ -397,7 +403,12 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { .isTrue(); // We should not expand since the keyguard is not secure verify(mScrimController, never()).expand(any()); // Since we are swiping up, we should wake from dreams. // Since we are swiping up, we should dismiss the keyguard and wake from dreams. ArgumentCaptor<Runnable> dismissKeyguardRunnable = ArgumentCaptor.forClass(Runnable.class); verify(mActivityStarter).executeRunnableDismissingKeyguard( dismissKeyguardRunnable.capture(), isNull(), eq(true), eq(true), eq(false)); dismissKeyguardRunnable.getValue().run(); verify(mCentralSurfaces).awakenDreams(); } Loading
packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java +14 −5 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.ambient.touch.dagger.BouncerSwipeModule; import com.android.systemui.ambient.touch.scrim.ScrimController; import com.android.systemui.ambient.touch.scrim.ScrimManager; import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.statusbar.NotificationShadeWindowController; Loading Loading @@ -103,6 +104,8 @@ public class BouncerSwipeTouchHandler implements TouchHandler { private final UiEventLogger mUiEventLogger; private final ActivityStarter mActivityStarter; private final ScrimManager.Callback mScrimManagerCallback = new ScrimManager.Callback() { @Override public void onScrimControllerChanged(ScrimController controller) { Loading Loading @@ -149,11 +152,16 @@ public class BouncerSwipeTouchHandler implements TouchHandler { return true; } // If scrolling up and keyguard is not locked, dismiss the dream since there's // no bouncer to show. // If scrolling up and keyguard is not locked, dismiss both keyguard and the // dream since there's no bouncer to show. if (e1.getY() > e2.getY() && !mLockPatternUtils.isSecure(mUserTracker.getUserId())) { mCentralSurfaces.get().awakenDreams(); mActivityStarter.executeRunnableDismissingKeyguard( () -> mCentralSurfaces.get().awakenDreams(), /* cancelAction= */ null, /* dismissShade= */ true, /* afterKeyguardGone= */ true, /* deferred= */ false); return true; } Loading @@ -162,7 +170,6 @@ public class BouncerSwipeTouchHandler implements TouchHandler { // bouncer. As that view's expansion shrinks, the bouncer appears. The bouncer // is fully hidden at full expansion (1) and fully visible when fully collapsed // (0). final float dragDownAmount = e2.getY() - e1.getY(); final float screenTravelPercentage = Math.abs(e1.getY() - e2.getY()) / mTouchSession.getBounds().height(); setPanelExpansion(1 - screenTravelPercentage); Loading Loading @@ -216,7 +223,8 @@ public class BouncerSwipeTouchHandler implements TouchHandler { FlingAnimationUtils flingAnimationUtilsClosing, @Named(BouncerSwipeModule.SWIPE_TO_BOUNCER_START_REGION) float swipeRegionPercentage, @Named(BouncerSwipeModule.MIN_BOUNCER_ZONE_SCREEN_PERCENTAGE) float minRegionPercentage, UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger, ActivityStarter activityStarter) { mCentralSurfaces = centralSurfaces; mScrimManager = scrimManager; mNotificationShadeWindowController = notificationShadeWindowController; Loading @@ -229,6 +237,7 @@ public class BouncerSwipeTouchHandler implements TouchHandler { mValueAnimatorCreator = valueAnimatorCreator; mVelocityTrackerFactory = velocityTrackerFactory; mUiEventLogger = uiEventLogger; mActivityStarter = activityStarter; } @Override Loading