Only doing the icon animations now when expanding slowly
Previously the animation was too distrating when expanding
fast.
Test: add notification, expand fast, observe no animations
Change-Id: I11658368b49094368886c64028c210a1dc95d938
Fixes: 33458094
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index b5865db..a239cb6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -105,7 +105,7 @@
private boolean mAnimateNextTopPaddingChange;
private int mTrackingPointer;
- private VelocityTracker mVelocityTracker;
+ private VelocityTracker mQsVelocityTracker;
private boolean mQsTracking;
/**
@@ -688,7 +688,7 @@
}
private void flingQsWithCurrentVelocity(float y, boolean isCancelMotionEvent) {
- float vel = getCurrentVelocity();
+ float vel = getCurrentQSVelocity();
final boolean expandsQs = flingExpandsQs(vel);
if (expandsQs) {
logQsSwipeDown(y);
@@ -697,7 +697,7 @@
}
private void logQsSwipeDown(float y) {
- float vel = getCurrentVelocity();
+ float vel = getCurrentQSVelocity();
final int gesture = mStatusBarState == StatusBarState.KEYGUARD
? EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_QS
: EventLogConstants.SYSUI_SHADE_GESTURE_SWIPE_DOWN_QS;
@@ -926,9 +926,9 @@
flingQsWithCurrentVelocity(y,
event.getActionMasked() == MotionEvent.ACTION_CANCEL);
}
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
+ if (mQsVelocityTracker != null) {
+ mQsVelocityTracker.recycle();
+ mQsVelocityTracker = null;
}
break;
}
@@ -1290,24 +1290,24 @@
}
private void trackMovement(MotionEvent event) {
- if (mVelocityTracker != null) mVelocityTracker.addMovement(event);
+ if (mQsVelocityTracker != null) mQsVelocityTracker.addMovement(event);
mLastTouchX = event.getX();
mLastTouchY = event.getY();
}
private void initVelocityTracker() {
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
+ if (mQsVelocityTracker != null) {
+ mQsVelocityTracker.recycle();
}
- mVelocityTracker = VelocityTracker.obtain();
+ mQsVelocityTracker = VelocityTracker.obtain();
}
- private float getCurrentVelocity() {
- if (mVelocityTracker == null) {
+ private float getCurrentQSVelocity() {
+ if (mQsVelocityTracker == null) {
return 0;
}
- mVelocityTracker.computeCurrentVelocity(1000);
- return mVelocityTracker.getYVelocity();
+ mQsVelocityTracker.computeCurrentVelocity(1000);
+ return mQsVelocityTracker.getYVelocity();
}
private void cancelQsAnimation() {
@@ -2282,6 +2282,9 @@
}
protected void updateExpandedHeight(float expandedHeight) {
+ if (mTracking) {
+ mNotificationStackScroller.setExpandingVelocity(getCurrentExpandVelocity());
+ }
mNotificationStackScroller.setExpandedHeight(expandedHeight);
updateKeyguardBottomAreaAlpha();
setOpening(expandedHeight <= getOpeningHeight());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 83bae11..cf53e3f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -306,6 +306,7 @@
}
break;
case MotionEvent.ACTION_MOVE:
+ trackMovement(event);
float h = y - mInitialTouchY;
// If the panel was collapsed when touching, we only need to check for the
@@ -346,8 +347,6 @@
!isTrackingBlocked()) {
setExpandedHeightInternal(newHeight);
}
-
- trackMovement(event);
break;
case MotionEvent.ACTION_UP:
@@ -449,6 +448,14 @@
mPeekTouching = false;
}
+ protected float getCurrentExpandVelocity() {
+ if (mVelocityTracker == null) {
+ return 0;
+ }
+ mVelocityTracker.computeCurrentVelocity(1000);
+ return mVelocityTracker.getYVelocity();
+ }
+
private int getFalsingThreshold() {
float factor = mStatusBar.isWakeUpComingFromTouch() ? 1.5f : 1.0f;
return (int) (mUnlockFalsingThreshold * factor);