summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java16
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java26
2 files changed, 40 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java
index 990f04b58f95..c147fde65cf7 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java
@@ -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;
@@ -148,7 +150,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;
@@ -278,6 +283,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;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java
index a016a1d8ca70..e175af7a037d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java
@@ -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;
@@ -71,7 +72,6 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
@Mock
FlingAnimationUtils mFlingAnimationUtils;
-
@Mock
FlingAnimationUtils mFlingAnimationUtilsClosing;
@@ -301,6 +301,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),
@@ -321,11 +323,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);
}
/**
@@ -343,6 +354,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),
@@ -367,6 +380,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),
@@ -389,11 +404,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) {