Fix blank Keyguard #4

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
This commit is contained in:
Jorim Jaggi
2014-10-03 15:17:20 -07:00
parent 449981be16
commit 5e08e6957d
3 changed files with 21 additions and 7 deletions

View 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);
}

View 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;
}
});

View 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