OSDN Git Service

Fix blank Keyguard #4
authorJorim Jaggi <jjaggi@google.com>
Fri, 3 Oct 2014 22:17:20 +0000 (15:17 -0700)
committerJorim Jaggi <jjaggi@google.com>
Fri, 3 Oct 2014 22:52:24 +0000 (15:52 -0700)
When we were fading out the preview for phone/camera to crossfade to
the real application, it might have been that showKeyguard was
called in the middle of this transition. This change makes sure that
we cancel this animation when showing the keyguard.

Bug: 17439581
Change-Id: I89cacf7ecf43d37ea979418b976390272510a09d

packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java

index 26420e1..a6fccb6 100644 (file)
@@ -983,10 +983,12 @@ public class NotificationPanelView extends PanelView implements
                     .withEndAction(mAnimateKeyguardStatusViewVisibleEndRunnable);
         } else if (statusBarState == StatusBarState.KEYGUARD) {
             mKeyguardStatusView.animate().cancel();
+            mKeyguardStatusViewAnimating = false;
             mKeyguardStatusView.setVisibility(View.VISIBLE);
             mKeyguardStatusView.setAlpha(1f);
         } else {
             mKeyguardStatusView.animate().cancel();
+            mKeyguardStatusViewAnimating = false;
             mKeyguardStatusView.setVisibility(View.GONE);
             mKeyguardStatusView.setAlpha(1f);
         }
index 05d6001..3b05ef1 100644 (file)
@@ -3494,6 +3494,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
     }
 
     public void showKeyguard() {
+        if (mLaunchTransitionFadingAway) {
+            mNotificationPanel.animate().cancel();
+            mNotificationPanel.setAlpha(1f);
+            if (mLaunchTransitionEndRunnable != null) {
+                mLaunchTransitionEndRunnable.run();
+            }
+            mLaunchTransitionEndRunnable = null;
+            mLaunchTransitionFadingAway = false;
+        }
         setBarState(StatusBarState.KEYGUARD);
         updateKeyguardState(false /* goingToFullShade */, false /* fromShadeLocked */);
         if (!mScreenOnFromKeyguard) {
@@ -3533,7 +3542,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
      * @param endRunnable the runnable to be run when the transition is done
      */
     public void fadeKeyguardAfterLaunchTransition(final Runnable beforeFading,
-            final Runnable endRunnable) {
+            Runnable endRunnable) {
+        mLaunchTransitionEndRunnable = endRunnable;
         Runnable hideRunnable = new Runnable() {
             @Override
             public void run() {
@@ -3551,9 +3561,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                             @Override
                             public void run() {
                                 mNotificationPanel.setAlpha(1);
-                                if (endRunnable != null) {
-                                    endRunnable.run();
+                                if (mLaunchTransitionEndRunnable != null) {
+                                    mLaunchTransitionEndRunnable.run();
                                 }
+                                mLaunchTransitionEndRunnable = null;
                                 mLaunchTransitionFadingAway = false;
                             }
                         });
index 6793f69..54adbf4 100644 (file)
@@ -260,6 +260,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
     }
 
     private void setScrimColor(ScrimView scrim, float alpha) {
+        Object runningAnim = scrim.getTag(TAG_KEY_ANIM);
+        if (runningAnim instanceof ValueAnimator) {
+            ((ValueAnimator) runningAnim).cancel();
+            scrim.setTag(TAG_KEY_ANIM, null);
+        }
         int color = Color.argb((int) (alpha * 255), 0, 0, 0);
         if (mAnimateChange) {
             startScrimAnimation(scrim, color);
@@ -274,10 +279,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
         if (current == targetColor) {
             return;
         }
-        Object runningAnim = scrim.getTag(TAG_KEY_ANIM);
-        if (runningAnim instanceof ValueAnimator) {
-            ((ValueAnimator) runningAnim).cancel();
-        }
         ValueAnimator anim = ValueAnimator.ofInt(current, target);
         anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
             @Override