Fix issues with light status bar and fp wake-and-unlock

- When wake-and-unlocking, make sure to skip the light status bar
transition.
- Fix race condition with window manager when unlocking when device
is interactive for supplying the timings for the light status bar
transition.
- Fix media artwork when wake-and-unlocking while pulsing.

Bug: 23365544
Change-Id: I209ca1e6684811f5f313354ca1614a0ebd49388c
This commit is contained in:
Jorim Jaggi
2015-08-21 16:52:55 -07:00
parent 8a8885b91d
commit d94d3a2aa5
4 changed files with 56 additions and 33 deletions

View File

@@ -183,8 +183,11 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
mStatusBarKeyguardViewManager.animateCollapsePanels(
FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR);
break;
case MODE_WAKE_AND_UNLOCK:
case MODE_WAKE_AND_UNLOCK_PULSING:
mPhoneStatusBar.updateMediaMetaData(false /* metaDataChanged */);
// Fall through.
case MODE_WAKE_AND_UNLOCK:
mStatusBarWindowManager.setStatusBarFocusable(false);
mDozeScrimController.abortPulsing();
mKeyguardViewMediator.onWakeAndUnlocking();
mScrimController.setWakeAndUnlocking();

View File

@@ -1694,7 +1694,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
final boolean hasArtwork = artworkBitmap != null;
if ((hasArtwork || DEBUG_MEDIA_FAKE_ARTWORK)
&& (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED)) {
&& (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED)
&& mFingerprintUnlockController.getMode()
!= FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING) {
// time to show some art!
if (mBackdrop.getVisibility() != View.VISIBLE) {
mBackdrop.setVisibility(View.VISIBLE);
@@ -1749,31 +1751,40 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
if (DEBUG_MEDIA) {
Log.v(TAG, "DEBUG_MEDIA: Fading out album artwork");
}
mBackdrop.animate()
// Never let the alpha become zero - otherwise the RenderNode
// won't draw anything and uninitialized memory will show through
// if mScrimSrcModeEnabled. Note that 0.001 is rounded down to 0 in libhwui.
.alpha(0.002f)
.setInterpolator(mBackdropInterpolator)
.setDuration(300)
.setStartDelay(0)
.withEndAction(new Runnable() {
@Override
public void run() {
mBackdrop.setVisibility(View.GONE);
mBackdropFront.animate().cancel();
mBackdropBack.animate().cancel();
mHandler.post(mHideBackdropFront);
}
});
if (mKeyguardFadingAway) {
mBackdrop.animate()
if (mFingerprintUnlockController.getMode()
== FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING) {
// Make it disappear faster, as the focus should be on the activity behind.
.setDuration(mKeyguardFadingAwayDuration / 2)
.setStartDelay(mKeyguardFadingAwayDelay)
.setInterpolator(mLinearInterpolator)
.start();
// We are unlocking directly - no animation!
mBackdrop.setVisibility(View.GONE);
} else {
mBackdrop.animate()
// Never let the alpha become zero - otherwise the RenderNode
// won't draw anything and uninitialized memory will show through
// if mScrimSrcModeEnabled. Note that 0.001 is rounded down to 0 in
// libhwui.
.alpha(0.002f)
.setInterpolator(mBackdropInterpolator)
.setDuration(300)
.setStartDelay(0)
.withEndAction(new Runnable() {
@Override
public void run() {
mBackdrop.setVisibility(View.GONE);
mBackdropFront.animate().cancel();
mBackdropBack.animate().cancel();
mHandler.post(mHideBackdropFront);
}
});
if (mKeyguardFadingAway) {
mBackdrop.animate()
// Make it disappear faster, as the focus should be on the activity
// behind.
.setDuration(mKeyguardFadingAwayDuration / 2)
.setStartDelay(mKeyguardFadingAwayDelay)
.setInterpolator(mLinearInterpolator)
.start();
}
}
}
}
@@ -2436,8 +2447,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|| mStatusBarMode == MODE_LIGHTS_OUT_TRANSPARENT);
boolean allowLight = isTransparentBar && !mBatteryController.isPowerSave();
boolean light = (vis & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0;
mIconController.setIconsDark(allowLight && light);
boolean animate = mFingerprintUnlockController == null
|| (mFingerprintUnlockController.getMode()
!= FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
&& mFingerprintUnlockController.getMode()
!= FingerprintUnlockController.MODE_WAKE_AND_UNLOCK);
mIconController.setIconsDark(allowLight && light, animate);
}
// restore the recents bit
if (wasRecentsVisible) {
@@ -4029,8 +4044,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
public void appTransitionStarting(long startTime, long duration) {
// Use own timings when Keyguard is going away, see keyguardGoingAway and
// setKeyguardFadingAway
if (!mKeyguardFadingAway) {
// setKeyguardFadingAway. When duration is 0, skip this one because no animation is really
// playing.
if (!mKeyguardFadingAway && duration > 0) {
mIconController.appTransitionStarting(startTime, duration);
}
if (mIconPolicy != null) {

View File

@@ -335,8 +335,10 @@ public class StatusBarIconController implements Tunable {
}
}
public void setIconsDark(boolean dark) {
if (mTransitionPending) {
public void setIconsDark(boolean dark, boolean animate) {
if (!animate) {
setIconTintInternal(dark ? 1.0f : 0.0f);
} else if (mTransitionPending) {
deferIconTintChange(dark ? 1.0f : 0.0f);
} else if (mTransitionDeferring) {
animateIconTint(dark ? 1.0f : 0.0f,

View File

@@ -72,7 +72,9 @@ public class StatusBarController extends BarController {
if (statusbar != null) {
long startTime = calculateStatusBarTransitionStartTime(openAnimation,
closeAnimation);
statusbar.appTransitionStarting(startTime, TRANSITION_DURATION);
long duration = closeAnimation != null || openAnimation != null
? TRANSITION_DURATION : 0;
statusbar.appTransitionStarting(startTime, duration);
}
} catch (RemoteException e) {
Slog.e(mTag, "RemoteException when app transition is starting", e);