Fix scrim handling when dismissing Keyguard in occluded case

Test: Manual, no security, Keyguard occluded, pull down shade,
press settings, ensure smooth scrim animation.
Test: Manual, with pattern, Keyguard occluded, pull down shade,
press settings, solve pattern, ensure smooth scrim animations.

Change-Id: I74e13844573e94d9fdc016ba33171c7c64a4f0f4
This commit is contained in:
Jorim Jaggi
2016-11-11 18:24:38 -08:00
parent 3e68bb5d28
commit e93698b8e0
2 changed files with 21 additions and 19 deletions

View File

@@ -78,7 +78,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
private boolean mWakeAndUnlocking;
protected boolean mAnimateChange;
private boolean mUpdatePending;
private boolean mExpanding;
private boolean mTracking;
private boolean mAnimateKeyguardFadingOut;
protected long mDurationOverride = -1;
private long mAnimationDelay;
@@ -122,12 +122,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
}
public void onTrackingStarted() {
mExpanding = true;
mTracking = true;
mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
}
public void onExpandingFinished() {
mExpanding = false;
mTracking = false;
}
public void setPanelExpansion(float fraction) {
@@ -137,7 +137,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
if (mPinnedHeadsUpCount != 0) {
updateHeadsUpScrim(false);
}
if (mKeyguardFadeoutAnimation != null) {
if (mKeyguardFadeoutAnimation != null && mTracking) {
mKeyguardFadeoutAnimation.cancel();
}
}
@@ -145,7 +145,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
public void setBouncerShowing(boolean showing) {
mBouncerShowing = showing;
mAnimateChange = !mExpanding && !mDontAnimateBouncerChanges;
mAnimateChange = !mTracking && !mDontAnimateBouncerChanges;
scheduleUpdate();
}
@@ -268,7 +268,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
}
private void updateScrimKeyguard() {
if (mExpanding && mDarkenWhileDragging) {
if (mTracking && mDarkenWhileDragging) {
float behindFraction = Math.max(0, Math.min(mFraction, 1));
float fraction = 1 - behindFraction;
fraction = (float) Math.pow(fraction, 0.8f);
@@ -277,7 +277,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
setScrimBehindColor(behindFraction * mScrimBehindAlphaKeyguard);
} else if (mBouncerShowing && !mBouncerIsKeyguard) {
setScrimInFrontColor(getScrimInFrontAlpha());
setScrimBehindColor(0f);
updateScrimNormal();
} else if (mBouncerShowing) {
setScrimInFrontColor(0f);
setScrimBehindColor(mScrimBehindAlpha);
@@ -473,7 +473,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
}
private void updateScrim(boolean animate, View scrim, float alpha, float currentAlpha) {
if (mKeyguardFadingOutInProgress) {
if (mKeyguardFadingOutInProgress && mKeyguardFadeoutAnimation.getCurrentPlayTime() != 0) {
return;
}

View File

@@ -330,17 +330,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
});
} else {
executeAfterKeyguardGoneAction();
if (mFingerprintUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING) {
mFingerprintUnlockController.startKeyguardFadingAway();
mPhoneStatusBar.setKeyguardFadingAway(startTime, 0, 240);
boolean wakeUnlockPulsing =
mFingerprintUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
if (wakeUnlockPulsing) {
delay = 0;
fadeoutDuration = 240;
}
mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
mFingerprintUnlockController.startKeyguardFadingAway();
mBouncer.hide(true /* destroyView */);
updateStates();
if (wakeUnlockPulsing) {
mStatusBarWindowManager.setKeyguardFadingAway(true);
mPhoneStatusBar.fadeKeyguardWhilePulsing();
animateScrimControllerKeyguardFadingOut(0, 240, new Runnable() {
@Override
public void run() {
mPhoneStatusBar.hideKeyguard();
}
}, false /* skipFirstFrame */);
animateScrimControllerKeyguardFadingOut(delay, fadeoutDuration,
mPhoneStatusBar::hideKeyguard, false /* skipFirstFrame */);
} else {
mFingerprintUnlockController.startKeyguardFadingAway();
mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
@@ -367,9 +371,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}
}
mStatusBarWindowManager.setKeyguardShowing(false);
mBouncer.hide(true /* destroyView */);
mViewMediatorCallback.keyguardGone();
updateStates();
}
}