Merge "AOD: Fix wakeAndUnlockPulsing transition" into oc-dev

am: 838e365581

Change-Id: I7140eb9253c84dc35a5f3bf62576e71e4828c6c5
This commit is contained in:
Adrian Roos
2017-05-24 22:01:34 +00:00
committed by android-build-merger
5 changed files with 42 additions and 22 deletions

View File

@@ -53,6 +53,7 @@ public class DozeScrimController {
private float mInFrontTarget;
private float mBehindTarget;
private boolean mDozingAborted;
private boolean mWakeAndUnlocking;
public DozeScrimController(ScrimController scrimController, Context context) {
mContext = context;
@@ -63,6 +64,7 @@ public class DozeScrimController {
public void setDozing(boolean dozing, boolean animate) {
if (mDozing == dozing) return;
mDozing = dozing;
mWakeAndUnlocking = false;
if (mDozing) {
mDozingAborted = false;
abortAnimations();
@@ -85,6 +87,16 @@ public class DozeScrimController {
}
}
public void setWakeAndUnlocking() {
// Immediately abort the doze scrims in case of wake-and-unlock
// for pulsing so the Keyguard fade-out animation scrim can take over.
if (!mWakeAndUnlocking) {
mWakeAndUnlocking = true;
mScrimController.setDozeBehindAlpha(0f);
mScrimController.setDozeInFrontAlpha(0f);
}
}
/** When dozing, fade screen contents in and out using the front scrim. */
public void pulse(@NonNull DozeHost.PulseCallback callback, int reason) {
if (callback == null) {
@@ -109,7 +121,7 @@ public class DozeScrimController {
*/
public void abortPulsing() {
cancelPulsing();
if (mDozing) {
if (mDozing && !mWakeAndUnlocking) {
mScrimController.setDozeBehindAlpha(1f);
mScrimController.setDozeInFrontAlpha(
mDozeParameters.getAlwaysOn() && !mDozingAborted ? 0f : 1f);
@@ -244,6 +256,9 @@ public class DozeScrimController {
}
private void setDozeAlpha(boolean inFront, float alpha) {
if (mWakeAndUnlocking) {
return;
}
if (inFront) {
mScrimController.setDozeInFrontAlpha(alpha);
} else {

View File

@@ -98,7 +98,6 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
private StatusBar mStatusBar;
private final UnlockMethodCache mUnlockMethodCache;
private final Context mContext;
private boolean mGoingToSleep;
private int mPendingAuthenticatedUserId = -1;
public FingerprintUnlockController(Context context,
@@ -213,17 +212,19 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
Trace.endSection();
break;
case MODE_WAKE_AND_UNLOCK_PULSING:
Trace.beginSection("MODE_WAKE_AND_UNLOCK_PULSING");
mStatusBar.updateMediaMetaData(false /* metaDataChanged */,
true /* allowEnterAnimation */);
// Fall through.
Trace.endSection();
case MODE_WAKE_AND_UNLOCK:
Trace.beginSection("MODE_WAKE_AND_UNLOCK");
if (mMode == MODE_WAKE_AND_UNLOCK_PULSING) {
Trace.beginSection("MODE_WAKE_AND_UNLOCK_PULSING");
mStatusBar.updateMediaMetaData(false /* metaDataChanged */,
true /* allowEnterAnimation */);
} else {
Trace.beginSection("MODE_WAKE_AND_UNLOCK");
mDozeScrimController.abortDoze();
}
mStatusBarWindowManager.setStatusBarFocusable(false);
mDozeScrimController.abortDoze();
mKeyguardViewMediator.onWakeAndUnlocking();
mScrimController.setWakeAndUnlocking();
mDozeScrimController.setWakeAndUnlocking();
if (mStatusBar.getNavigationBarView() != null) {
mStatusBar.getNavigationBarView().setWakeAndUnlocking(true);
}
@@ -302,10 +303,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
}
private void cleanup() {
mMode = MODE_NONE;
releaseFingerprintWakeLock();
mStatusBarWindowManager.setForceDozeBrightness(false);
mStatusBar.notifyFpAuthModeChanged();
}
public void startKeyguardFadingAway() {
@@ -321,6 +319,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
public void finishKeyguardFadingAway() {
mMode = MODE_NONE;
mStatusBarWindowManager.setForceDozeBrightness(false);
if (mStatusBar.getNavigationBarView() != null) {
mStatusBar.getNavigationBarView().setWakeAndUnlocking(false);
}

View File

@@ -2401,17 +2401,26 @@ public class NotificationPanelView extends PanelView implements
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
updateFullyVisibleState();
updateFullyVisibleState(false /* forceNotFullyVisible */);
}
/**
* Must be called before starting a ViewPropertyAnimator alpha animation because those
* do NOT call setAlpha and therefore don't properly update the fullyVisibleState.
*/
public void notifyStartFading() {
updateFullyVisibleState(true /* forceNotFullyVisible */);
}
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
updateFullyVisibleState();
updateFullyVisibleState(false /* forceNotFullyVisible */);
}
private void updateFullyVisibleState() {
mNotificationStackScroller.setParentNotFullyVisible(getAlpha() != 1.0f
private void updateFullyVisibleState(boolean forceNotFullyVisible) {
mNotificationStackScroller.setParentNotFullyVisible(forceNotFullyVisible
|| getAlpha() != 1.0f
|| getVisibility() != VISIBLE);
}

View File

@@ -4138,6 +4138,7 @@ public class StatusBar extends SystemUI implements DemoMode,
* fading.
*/
public void fadeKeyguardWhilePulsing() {
mNotificationPanel.notifyStartFading();
mNotificationPanel.animate()
.alpha(0f)
.setStartDelay(0)
@@ -4356,12 +4357,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mKeyguardIndicationController.setDozing(mDozing);
mNotificationPanel.setDark(mDozing, animate);
updateQsExpansionEnabled();
// Immediately abort the dozing from the doze scrim controller in case of wake-and-unlock
// for pulsing so the Keyguard fade-out animation scrim can take over.
mDozeScrimController.setDozing(mDozing &&
mFingerprintUnlockController.getMode()
!= FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING, animate);
mDozeScrimController.setDozing(mDozing, animate);
updateRowStates();
Trace.endSection();
}

View File

@@ -396,6 +396,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} else {
mScrimController.animateGoingToFullShade(delay, fadeoutDuration);
mStatusBar.finishKeyguardFadingAway();
mFingerprintUnlockController.finishKeyguardFadingAway();
}
}
mStatusBarWindowManager.setKeyguardShowing(false);