Merge "Prevent AOD clock from appearing on LS after fold" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e9032700f4
@@ -961,6 +961,7 @@ public final class NotificationPanelViewController implements Dumpable {
|
|||||||
onTrackingStopped(false);
|
onTrackingStopped(false);
|
||||||
instantCollapse();
|
instantCollapse();
|
||||||
} else {
|
} else {
|
||||||
|
mView.animate().cancel();
|
||||||
mView.animate()
|
mView.animate()
|
||||||
.alpha(0f)
|
.alpha(0f)
|
||||||
.setStartDelay(0)
|
.setStartDelay(0)
|
||||||
@@ -3087,7 +3088,9 @@ public final class NotificationPanelViewController implements Dumpable {
|
|||||||
*/
|
*/
|
||||||
public void startFoldToAodAnimation(Runnable startAction, Runnable endAction,
|
public void startFoldToAodAnimation(Runnable startAction, Runnable endAction,
|
||||||
Runnable cancelAction) {
|
Runnable cancelAction) {
|
||||||
mView.animate()
|
final ViewPropertyAnimator viewAnimator = mView.animate();
|
||||||
|
viewAnimator.cancel();
|
||||||
|
viewAnimator
|
||||||
.translationX(0)
|
.translationX(0)
|
||||||
.alpha(1f)
|
.alpha(1f)
|
||||||
.setDuration(ANIMATION_DURATION_FOLD_TO_AOD)
|
.setDuration(ANIMATION_DURATION_FOLD_TO_AOD)
|
||||||
@@ -3106,9 +3109,14 @@ public final class NotificationPanelViewController implements Dumpable {
|
|||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
endAction.run();
|
endAction.run();
|
||||||
|
|
||||||
|
viewAnimator.setListener(null);
|
||||||
|
viewAnimator.setUpdateListener(null);
|
||||||
}
|
}
|
||||||
}).setUpdateListener(anim -> mKeyguardStatusViewController.animateFoldToAod(
|
})
|
||||||
anim.getAnimatedFraction())).start();
|
.setUpdateListener(anim ->
|
||||||
|
mKeyguardStatusViewController.animateFoldToAod(anim.getAnimatedFraction()))
|
||||||
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cancels fold to AOD transition and resets view state. */
|
/** Cancels fold to AOD transition and resets view state. */
|
||||||
@@ -3307,6 +3315,7 @@ public final class NotificationPanelViewController implements Dumpable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ViewPropertyAnimator fadeOut(long startDelayMs, long durationMs, Runnable endAction) {
|
public ViewPropertyAnimator fadeOut(long startDelayMs, long durationMs, Runnable endAction) {
|
||||||
|
mView.animate().cancel();
|
||||||
return mView.animate().alpha(0).setStartDelay(startDelayMs).setDuration(
|
return mView.animate().alpha(0).setStartDelay(startDelayMs).setDuration(
|
||||||
durationMs).setInterpolator(Interpolators.ALPHA_OUT).withLayer().withEndAction(
|
durationMs).setInterpolator(Interpolators.ALPHA_OUT).withLayer().withEndAction(
|
||||||
endAction);
|
endAction);
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyLong;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.atLeast;
|
import static org.mockito.Mockito.atLeast;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
@@ -184,6 +186,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
|
|||||||
@Mock protected NotificationStackScrollLayout mNotificationStackScrollLayout;
|
@Mock protected NotificationStackScrollLayout mNotificationStackScrollLayout;
|
||||||
@Mock protected KeyguardBottomAreaView mKeyguardBottomArea;
|
@Mock protected KeyguardBottomAreaView mKeyguardBottomArea;
|
||||||
@Mock protected KeyguardBottomAreaViewController mKeyguardBottomAreaViewController;
|
@Mock protected KeyguardBottomAreaViewController mKeyguardBottomAreaViewController;
|
||||||
|
@Mock protected ViewPropertyAnimator mViewPropertyAnimator;
|
||||||
@Mock protected KeyguardBottomAreaView mQsFrame;
|
@Mock protected KeyguardBottomAreaView mQsFrame;
|
||||||
@Mock protected HeadsUpManagerPhone mHeadsUpManager;
|
@Mock protected HeadsUpManagerPhone mHeadsUpManager;
|
||||||
@Mock protected NotificationShelfController mNotificationShelfController;
|
@Mock protected NotificationShelfController mNotificationShelfController;
|
||||||
@@ -357,7 +360,14 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
|
|||||||
.thenReturn(mHeadsUpCallback);
|
.thenReturn(mHeadsUpCallback);
|
||||||
when(mKeyguardBottomAreaViewController.getView()).thenReturn(mKeyguardBottomArea);
|
when(mKeyguardBottomAreaViewController.getView()).thenReturn(mKeyguardBottomArea);
|
||||||
when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea);
|
when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea);
|
||||||
when(mKeyguardBottomArea.animate()).thenReturn(mock(ViewPropertyAnimator.class));
|
when(mKeyguardBottomArea.animate()).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mView.animate()).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mViewPropertyAnimator.translationX(anyFloat())).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mViewPropertyAnimator.alpha(anyFloat())).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mViewPropertyAnimator.setDuration(anyLong())).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mViewPropertyAnimator.setInterpolator(any())).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mViewPropertyAnimator.setListener(any())).thenReturn(mViewPropertyAnimator);
|
||||||
|
when(mViewPropertyAnimator.setUpdateListener(any())).thenReturn(mViewPropertyAnimator);
|
||||||
when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame);
|
when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame);
|
||||||
when(mView.findViewById(R.id.keyguard_status_view))
|
when(mView.findViewById(R.id.keyguard_status_view))
|
||||||
.thenReturn(mock(KeyguardStatusView.class));
|
.thenReturn(mock(KeyguardStatusView.class));
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ import static org.mockito.Mockito.times;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
import android.testing.TestableLooper;
|
import android.testing.TestableLooper;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -673,6 +675,24 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
|
|||||||
verify(mKeyguardStatusViewController, never()).displayClock(LARGE, /* animate */ true);
|
verify(mKeyguardStatusViewController, never()).displayClock(LARGE, /* animate */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFoldToAodAnimationCleansupInAnimationEnd() {
|
||||||
|
ArgumentCaptor<Animator.AnimatorListener> animCaptor =
|
||||||
|
ArgumentCaptor.forClass(Animator.AnimatorListener.class);
|
||||||
|
ArgumentCaptor<ValueAnimator.AnimatorUpdateListener> updateCaptor =
|
||||||
|
ArgumentCaptor.forClass(ValueAnimator.AnimatorUpdateListener.class);
|
||||||
|
|
||||||
|
// Start fold animation & Capture Listeners
|
||||||
|
mNotificationPanelViewController.startFoldToAodAnimation(() -> {}, () -> {}, () -> {});
|
||||||
|
verify(mViewPropertyAnimator).setListener(animCaptor.capture());
|
||||||
|
verify(mViewPropertyAnimator).setUpdateListener(updateCaptor.capture());
|
||||||
|
|
||||||
|
// End animation and validate listeners were unset
|
||||||
|
animCaptor.getValue().onAnimationEnd(null);
|
||||||
|
verify(mViewPropertyAnimator).setListener(null);
|
||||||
|
verify(mViewPropertyAnimator).setUpdateListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExpandWithQsMethodIsUsingLockscreenTransitionController() {
|
public void testExpandWithQsMethodIsUsingLockscreenTransitionController() {
|
||||||
enableSplitShade(/* enabled= */ true);
|
enableSplitShade(/* enabled= */ true);
|
||||||
|
|||||||
Reference in New Issue
Block a user