Merge "Improved the unlock animation when bypassing" into qt-r1-dev

This commit is contained in:
Selim Cinek
2019-07-01 20:03:52 +00:00
committed by Android (Google) Code Review
7 changed files with 55 additions and 13 deletions

View File

@@ -95,6 +95,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private boolean mPulsing; private boolean mPulsing;
private boolean mDozing; private boolean mDozing;
private boolean mDocked; private boolean mDocked;
private boolean mBlockUpdates;
private int mIconColor; private int mIconColor;
private float mDozeAmount; private float mDozeAmount;
private boolean mBouncerShowingScrimmed; private boolean mBouncerShowingScrimmed;
@@ -107,8 +108,22 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
new KeyguardMonitor.Callback() { new KeyguardMonitor.Callback() {
@Override @Override
public void onKeyguardShowingChanged() { public void onKeyguardShowingChanged() {
boolean force = false;
boolean wasShowing = mKeyguardShowing;
mKeyguardShowing = mKeyguardMonitor.isShowing(); mKeyguardShowing = mKeyguardMonitor.isShowing();
update(); if (!wasShowing && mKeyguardShowing && mBlockUpdates) {
mBlockUpdates = false;
force = true;
}
update(force);
}
@Override
public void onKeyguardFadingAwayChanged() {
if (!mKeyguardMonitor.isKeyguardFadingAway() && mBlockUpdates) {
mBlockUpdates = false;
update(true /* force */);
}
} }
}; };
private final DockManager.DockEventListener mDockEventListener = private final DockManager.DockEventListener mDockEventListener =
@@ -261,7 +276,11 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
mIsFaceUnlockState = state == STATE_SCANNING_FACE; mIsFaceUnlockState = state == STATE_SCANNING_FACE;
mLastState = state; mLastState = state;
if (lastState != state || mForceUpdate) { boolean shouldUpdate = lastState != state || mForceUpdate;
if (mBlockUpdates && canBlockUpdates()) {
shouldUpdate = false;
}
if (shouldUpdate) {
mForceUpdate = false; mForceUpdate = false;
@LockAnimIndex final int lockAnimIndex = getAnimationIndexForTransition(lastState, @LockAnimIndex final int lockAnimIndex = getAnimationIndexForTransition(lastState,
state, mPulsing, mDozing); state, mPulsing, mDozing);
@@ -330,6 +349,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
return true; return true;
} }
private boolean canBlockUpdates() {
return mKeyguardShowing || mKeyguardMonitor.isKeyguardFadingAway();
}
private void updateClickability() { private void updateClickability() {
if (mAccessibilityController == null) { if (mAccessibilityController == null) {
return; return;
@@ -536,11 +559,17 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
/** /**
* We need to hide the lock whenever there's a fingerprint unlock, otherwise you'll see the * We need to hide the lock whenever there's a fingerprint unlock, otherwise you'll see the
* icon on top of the black front scrim. * icon on top of the black front scrim.
* @param wakeAndUnlock are we wake and unlocking
* @param isUnlock are we currently unlocking
*/ */
public void onBiometricAuthModeChanged(boolean wakeAndUnlock) { public void onBiometricAuthModeChanged(boolean wakeAndUnlock, boolean isUnlock) {
if (wakeAndUnlock) { if (wakeAndUnlock) {
mWakeAndUnlockRunning = true; mWakeAndUnlockRunning = true;
} }
if (isUnlock && mBypassController.getBypassEnabled() && canBlockUpdates()) {
// We don't want the icon to change while we are unlocking
mBlockUpdates = true;
}
update(); update();
} }

View File

@@ -3834,7 +3834,8 @@ public class StatusBar extends SystemUI implements DemoMode,
public void notifyBiometricAuthModeChanged() { public void notifyBiometricAuthModeChanged() {
updateDozing(); updateDozing();
updateScrimController(); updateScrimController();
mStatusBarWindow.onBiometricAuthModeChanged(mBiometricUnlockController.isWakeAndUnlock()); mStatusBarWindow.onBiometricAuthModeChanged(mBiometricUnlockController.isWakeAndUnlock(),
mBiometricUnlockController.isBiometricUnlock());
} }
@VisibleForTesting @VisibleForTesting

View File

@@ -814,7 +814,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
*/ */
public boolean shouldSubtleWindowAnimationsForUnlock() { public boolean shouldSubtleWindowAnimationsForUnlock() {
return mStatusBar.mKeyguardBypassController.getBypassEnabled() return mStatusBar.mKeyguardBypassController.getBypassEnabled()
&& mStatusBar.mState == StatusBarState.KEYGUARD; && mStatusBar.mState == StatusBarState.KEYGUARD && !mBouncer.isAnimatingAway();
} }
public boolean isGoingToNotificationShade() { public boolean isGoingToNotificationShade() {

View File

@@ -272,10 +272,11 @@ public class StatusBarWindowView extends FrameLayout {
/** /**
* Called when the biometric authentication mode changes. * Called when the biometric authentication mode changes.
* @param wakeAndUnlock If the type is {@link BiometricUnlockController#isWakeAndUnlock()} * @param wakeAndUnlock If the type is {@link BiometricUnlockController#isWakeAndUnlock()}
* @param isUnlock If the type is {@link BiometricUnlockController#isBiometricUnlock()} ()
*/ */
public void onBiometricAuthModeChanged(boolean wakeAndUnlock) { public void onBiometricAuthModeChanged(boolean wakeAndUnlock, boolean isUnlock) {
if (mLockIcon != null) { if (mLockIcon != null) {
mLockIcon.onBiometricAuthModeChanged(wakeAndUnlock); mLockIcon.onBiometricAuthModeChanged(wakeAndUnlock, isUnlock);
} }
} }

View File

@@ -50,5 +50,6 @@ public interface KeyguardMonitor extends CallbackController<Callback> {
interface Callback { interface Callback {
void onKeyguardShowingChanged(); void onKeyguardShowingChanged();
default void onKeyguardFadingAwayChanged() {}
} }
} }

View File

@@ -141,14 +141,24 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
} }
public void notifyKeyguardFadingAway(long delay, long fadeoutDuration) { public void notifyKeyguardFadingAway(long delay, long fadeoutDuration) {
mKeyguardFadingAway = true; setKeyguardFadingAway(true);
mKeyguardFadingAwayDelay = delay; mKeyguardFadingAwayDelay = delay;
mKeyguardFadingAwayDuration = fadeoutDuration; mKeyguardFadingAwayDuration = fadeoutDuration;
} }
private void setKeyguardFadingAway(boolean keyguardFadingAway) {
if (mKeyguardFadingAway != keyguardFadingAway) {
mKeyguardFadingAway = keyguardFadingAway;
ArrayList<Callback> callbacks = new ArrayList<>(mCallbacks);
for (int i = 0; i < callbacks.size(); i++) {
callbacks.get(i).onKeyguardFadingAwayChanged();
}
}
}
public void notifyKeyguardDoneFading() { public void notifyKeyguardDoneFading() {
mKeyguardFadingAway = false;
mKeyguardGoingAway = false; mKeyguardGoingAway = false;
setKeyguardFadingAway(false);
} }
@Override @Override

View File

@@ -2523,11 +2523,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} }
final int resource; final int resource;
if (onWallpaper) { if (subtleAnimation) {
resource = R.anim.lock_screen_behind_enter_wallpaper;
} else if (subtleAnimation) {
resource = R.anim.lock_screen_behind_enter_subtle; resource = R.anim.lock_screen_behind_enter_subtle;
} else { } else if (onWallpaper) {
resource = R.anim.lock_screen_behind_enter_wallpaper;
} else {
resource = R.anim.lock_screen_behind_enter; resource = R.anim.lock_screen_behind_enter;
} }