Loading packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java +15 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static com.android.systemui.dreams.touch.dagger.BouncerSwipeModule.SWIPE_ import static com.android.systemui.dreams.touch.dagger.BouncerSwipeModule.SWIPE_TO_BOUNCER_FLING_ANIMATION_UTILS_OPENING; import static com.android.systemui.dreams.touch.dagger.BouncerSwipeModule.SWIPE_TO_BOUNCER_START_REGION; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -151,7 +153,10 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { @VisibleForTesting public enum DreamEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "The screensaver has been swiped up.") DREAM_SWIPED(988); DREAM_SWIPED(988), @UiEvent(doc = "The bouncer has become fully visible over dream.") DREAM_BOUNCER_FULLY_VISIBLE(1056); private final int mId; Loading Loading @@ -281,6 +286,15 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { animation -> { setPanelExpansion((float) animation.getAnimatedValue()); }); if (!mBouncerInitiallyShowing && targetExpansion == KeyguardBouncer.EXPANSION_VISIBLE) { animator.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mUiEventLogger.log(DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } }); } return animator; } Loading packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java +25 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -71,7 +72,6 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { @Mock FlingAnimationUtils mFlingAnimationUtils; @Mock FlingAnimationUtils mFlingAnimationUtilsClosing; Loading Loading @@ -323,6 +323,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { swipeToPosition(swipeUpPercentage, Direction.UP, velocityY); verify(mValueAnimatorCreator).create(eq(expansion), eq(KeyguardBouncer.EXPANSION_HIDDEN)); verify(mValueAnimator, never()).addListener(any()); verify(mFlingAnimationUtilsClosing).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * expansion), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_HIDDEN), Loading @@ -343,11 +345,20 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { swipeToPosition(swipeUpPercentage, Direction.UP, velocityY); verify(mValueAnimatorCreator).create(eq(expansion), eq(KeyguardBouncer.EXPANSION_VISIBLE)); ArgumentCaptor<AnimatorListenerAdapter> endAnimationListenerCaptor = ArgumentCaptor.forClass(AnimatorListenerAdapter.class); verify(mValueAnimator).addListener(endAnimationListenerCaptor.capture()); AnimatorListenerAdapter endAnimationListener = endAnimationListenerCaptor.getValue(); verify(mFlingAnimationUtils).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * expansion), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_VISIBLE), eq(velocityY), eq((float) SCREEN_HEIGHT_PX)); verify(mValueAnimator).start(); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_SWIPED); endAnimationListener.onAnimationEnd(mValueAnimator); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } /** Loading @@ -365,6 +376,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { verify(mValueAnimatorCreator).create(eq(swipeDownPercentage), eq(KeyguardBouncer.EXPANSION_VISIBLE)); verify(mValueAnimator, never()).addListener(any()); verify(mFlingAnimationUtils).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * swipeDownPercentage), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_VISIBLE), Loading @@ -389,6 +402,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { verify(mValueAnimatorCreator).create(eq(swipeDownPercentage), eq(KeyguardBouncer.EXPANSION_HIDDEN)); verify(mValueAnimator, never()).addListener(any()); verify(mFlingAnimationUtilsClosing).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * swipeDownPercentage), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_HIDDEN), Loading @@ -411,11 +426,20 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { swipeToPosition(swipeUpPercentage, Direction.UP, velocityY); verify(mValueAnimatorCreator).create(eq(expansion), eq(KeyguardBouncer.EXPANSION_VISIBLE)); ArgumentCaptor<AnimatorListenerAdapter> endAnimationListenerCaptor = ArgumentCaptor.forClass(AnimatorListenerAdapter.class); verify(mValueAnimator).addListener(endAnimationListenerCaptor.capture()); AnimatorListenerAdapter endAnimationListener = endAnimationListenerCaptor.getValue(); verify(mFlingAnimationUtils).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * expansion), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_VISIBLE), eq(velocityY), eq((float) SCREEN_HEIGHT_PX)); verify(mValueAnimator).start(); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_SWIPED); endAnimationListener.onAnimationEnd(mValueAnimator); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } private void swipeToPosition(float percent, Direction direction, float velocityY) { Loading Loading
packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java +15 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static com.android.systemui.dreams.touch.dagger.BouncerSwipeModule.SWIPE_ import static com.android.systemui.dreams.touch.dagger.BouncerSwipeModule.SWIPE_TO_BOUNCER_FLING_ANIMATION_UTILS_OPENING; import static com.android.systemui.dreams.touch.dagger.BouncerSwipeModule.SWIPE_TO_BOUNCER_START_REGION; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -151,7 +153,10 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { @VisibleForTesting public enum DreamEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "The screensaver has been swiped up.") DREAM_SWIPED(988); DREAM_SWIPED(988), @UiEvent(doc = "The bouncer has become fully visible over dream.") DREAM_BOUNCER_FULLY_VISIBLE(1056); private final int mId; Loading Loading @@ -281,6 +286,15 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { animation -> { setPanelExpansion((float) animation.getAnimatedValue()); }); if (!mBouncerInitiallyShowing && targetExpansion == KeyguardBouncer.EXPANSION_VISIBLE) { animator.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mUiEventLogger.log(DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } }); } return animator; } Loading
packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java +25 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -71,7 +72,6 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { @Mock FlingAnimationUtils mFlingAnimationUtils; @Mock FlingAnimationUtils mFlingAnimationUtilsClosing; Loading Loading @@ -323,6 +323,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { swipeToPosition(swipeUpPercentage, Direction.UP, velocityY); verify(mValueAnimatorCreator).create(eq(expansion), eq(KeyguardBouncer.EXPANSION_HIDDEN)); verify(mValueAnimator, never()).addListener(any()); verify(mFlingAnimationUtilsClosing).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * expansion), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_HIDDEN), Loading @@ -343,11 +345,20 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { swipeToPosition(swipeUpPercentage, Direction.UP, velocityY); verify(mValueAnimatorCreator).create(eq(expansion), eq(KeyguardBouncer.EXPANSION_VISIBLE)); ArgumentCaptor<AnimatorListenerAdapter> endAnimationListenerCaptor = ArgumentCaptor.forClass(AnimatorListenerAdapter.class); verify(mValueAnimator).addListener(endAnimationListenerCaptor.capture()); AnimatorListenerAdapter endAnimationListener = endAnimationListenerCaptor.getValue(); verify(mFlingAnimationUtils).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * expansion), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_VISIBLE), eq(velocityY), eq((float) SCREEN_HEIGHT_PX)); verify(mValueAnimator).start(); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_SWIPED); endAnimationListener.onAnimationEnd(mValueAnimator); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } /** Loading @@ -365,6 +376,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { verify(mValueAnimatorCreator).create(eq(swipeDownPercentage), eq(KeyguardBouncer.EXPANSION_VISIBLE)); verify(mValueAnimator, never()).addListener(any()); verify(mFlingAnimationUtils).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * swipeDownPercentage), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_VISIBLE), Loading @@ -389,6 +402,8 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { verify(mValueAnimatorCreator).create(eq(swipeDownPercentage), eq(KeyguardBouncer.EXPANSION_HIDDEN)); verify(mValueAnimator, never()).addListener(any()); verify(mFlingAnimationUtilsClosing).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * swipeDownPercentage), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_HIDDEN), Loading @@ -411,11 +426,20 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { swipeToPosition(swipeUpPercentage, Direction.UP, velocityY); verify(mValueAnimatorCreator).create(eq(expansion), eq(KeyguardBouncer.EXPANSION_VISIBLE)); ArgumentCaptor<AnimatorListenerAdapter> endAnimationListenerCaptor = ArgumentCaptor.forClass(AnimatorListenerAdapter.class); verify(mValueAnimator).addListener(endAnimationListenerCaptor.capture()); AnimatorListenerAdapter endAnimationListener = endAnimationListenerCaptor.getValue(); verify(mFlingAnimationUtils).apply(eq(mValueAnimator), eq(SCREEN_HEIGHT_PX * expansion), eq(SCREEN_HEIGHT_PX * KeyguardBouncer.EXPANSION_VISIBLE), eq(velocityY), eq((float) SCREEN_HEIGHT_PX)); verify(mValueAnimator).start(); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_SWIPED); endAnimationListener.onAnimationEnd(mValueAnimator); verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } private void swipeToPosition(float percent, Direction direction, float velocityY) { Loading