Log event for bouncer fully visible after dream swiped up.
Bug: 213906448 Test: atest BouncerSwipeTouchHandlerTest Test: Manually on device via `statsd_testdrive ` Change-Id: I99286e055d6750607bfbb8d0ca1501bc5a66be68
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user