am 230719c7: am 640cf0ab: am 1e0f6faf: Merge "Clean up some flashy jank (issue 7454766)" into jb-mr1-lockscreen-dev

* commit '230719c7b5da0d36bd4e475cfba258011ab32d95':
  Clean up some flashy jank (issue 7454766)
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
index b82d7c7..88cf343 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
@@ -220,6 +220,11 @@
                     mKeyguardWidgetPager.setWidgetToResetOnPageFadeOut(mPageListeningToSlider);
                 }
             }
+            if (frame.isSmall()) {
+                // This is to make sure that if the scroller animation gets cut off midway
+                // that the frame doesn't stay in a partial down position.
+                frame.setFrameHeight(frame.getSmallFrameHeight());
+            }
             if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
                 frame.hideFrame(this);
             }
@@ -250,7 +255,7 @@
                 if (!frame.isSmall()) {
                     // We need to fetch the final page, in case the pages are in motion.
                     mPageListeningToSlider = mKeyguardWidgetPager.getNextPage();
-                    frame.shrinkWidget();
+                    frame.shrinkWidget(false);
                 }
             } else {
                 if (!frame.isSmall()) {
@@ -269,7 +274,7 @@
     public void onScrollPositionChanged(float scrollPosition, int challengeTop) {
         mChallengeTop = challengeTop;
         KeyguardWidgetFrame frame = mKeyguardWidgetPager.getWidgetPageAt(mPageListeningToSlider);
-        if (frame != null && !mKeyguardWidgetPager.isPageMoving()) {
+        if (frame != null && mLastScrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
             frame.adjustFrame(getChallengeTopRelativeToFrame(frame, mChallengeTop));
         }
     }
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java
index d9953bf..4c7ab6c 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java
@@ -329,6 +329,7 @@
 
     public void setMaxChallengeTop(int top) {
         boolean dirty = mMaxChallengeTop != top;
+        mMaxChallengeTop = top;
         mSmallWidgetHeight = top - getPaddingTop();
         mSmallFrameHeight = top + getPaddingBottom();
         if (dirty && mIsSmall) {
@@ -348,10 +349,21 @@
         setFrameHeight(frameHeight);
     }
 
-    public void shrinkWidget() {
+    public void shrinkWidget(boolean alsoShrinkFrame) {
         mIsSmall = true;
         setWidgetHeight(mSmallWidgetHeight);
-        setFrameHeight(mSmallFrameHeight);
+
+        if (alsoShrinkFrame) {
+            setFrameHeight(mSmallFrameHeight);
+        }
+    }
+
+    public int getSmallFrameHeight() {
+        return mSmallFrameHeight;
+    }
+
+    public void shrinkWidget() {
+        shrinkWidget(true);
     }
 
     public void setWidgetLockedSmall(boolean locked) {