Fade scrim in unlock animation.
This also introduces a startTime which gets sent from window manager
to SystemUI, which tells when the animation should start, to allow
for a more synchronized animation with fading out the scrim and
fading in the activity behind.
Bug: 15163546
Change-Id: I16212b1ef9eb76f1f98734da1d14fc5b7e626937
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 c5a9b85..220b691 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -200,8 +200,10 @@
case MotionEvent.ACTION_CANCEL:
mTrackingPointer = -1;
trackMovement(event);
- boolean expand = flingWithCurrentVelocity();
+ float vel = getCurrentVelocity();
+ boolean expand = flingExpands(vel);
onTrackingStopped(expand);
+ fling(vel, expand);
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
@@ -323,18 +325,15 @@
}
/**
- * @return whether the panel will be expanded after the animation
+ * @param vel the current velocity of the motion
+ * @return whether a fling should expands the panel; contracts otherwise
*/
- private boolean flingWithCurrentVelocity() {
- float vel = getCurrentVelocity();
- boolean expand;
+ private boolean flingExpands(float vel) {
if (Math.abs(vel) < mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
- expand = getExpandedFraction() > 0.5f;
+ return getExpandedFraction() > 0.5f;
} else {
- expand = vel > 0;
+ return vel > 0;
}
- fling(vel, expand);
- return expand;
}
protected void fling(float vel, boolean expand) {
@@ -342,6 +341,7 @@
float target = expand ? getMaxPanelHeight() : 0.0f;
if (target == mExpandedHeight) {
onExpandingFinished();
+ mBar.panelExpansionChanged(this, mExpandedFraction);
return;
}
ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, target);
@@ -430,7 +430,7 @@
public void setExpandedHeightInternal(float h) {
float fh = getMaxPanelHeight();
- mExpandedHeight = Math.min(fh, h);
+ mExpandedHeight = Math.max(0, Math.min(fh, h));
float overExpansion = h - fh;
overExpansion = Math.max(0, overExpansion);
if (overExpansion != mOverExpansion) {
@@ -442,7 +442,7 @@
}
onHeightUpdated(mExpandedHeight);
- mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh);
+ mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : mExpandedHeight / fh);
}
protected void onOverExpansionChanged(float overExpansion) {