Merge "Reset messages when the keyguard isn't showing" into sc-dev
This commit is contained in:
@@ -94,7 +94,7 @@ import javax.inject.Inject;
|
||||
* Controls the indications and error messages shown on the Keyguard
|
||||
*/
|
||||
@SysUISingleton
|
||||
public class KeyguardIndicationController implements KeyguardStateController.Callback {
|
||||
public class KeyguardIndicationController {
|
||||
|
||||
private static final String TAG = "KeyguardIndication";
|
||||
private static final boolean DEBUG_CHARGING_SPEED = false;
|
||||
@@ -206,7 +206,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
|
||||
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
|
||||
mStatusBarStateController.addCallback(mStatusBarStateListener);
|
||||
mKeyguardStateController.addCallback(this);
|
||||
mKeyguardStateController.addCallback(mKeyguardStateCallback);
|
||||
|
||||
mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing());
|
||||
}
|
||||
@@ -827,11 +827,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
mRotateTextViewController.dump(fd, pw, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnlockedChanged() {
|
||||
updateIndication(false);
|
||||
}
|
||||
|
||||
protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
|
||||
public static final int HIDE_DELAY_MS = 5000;
|
||||
|
||||
@@ -890,10 +885,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
|
||||
mInitialTextColorState);
|
||||
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
|
||||
if (biometricSourceType == BiometricSourceType.FACE
|
||||
&& shouldSuppressFaceMsgAndShowTryFingerprintMsg()) {
|
||||
// suggest trying fingerprint
|
||||
showTransientIndication(R.string.keyguard_try_fingerprint);
|
||||
if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsg()) {
|
||||
return;
|
||||
}
|
||||
showTransientIndication(helpString, false /* isError */, showSwipeToUnlock);
|
||||
@@ -911,11 +903,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
return;
|
||||
}
|
||||
if (biometricSourceType == BiometricSourceType.FACE
|
||||
&& shouldSuppressFaceMsgAndShowTryFingerprintMsg()
|
||||
&& shouldSuppressFaceMsg()
|
||||
&& !mStatusBarKeyguardViewManager.isBouncerShowing()
|
||||
&& mKeyguardUpdateMonitor.isScreenOn()) {
|
||||
// suggest trying fingerprint
|
||||
showTransientIndication(R.string.keyguard_try_fingerprint);
|
||||
return;
|
||||
}
|
||||
if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
|
||||
@@ -966,11 +956,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
|| msgId == FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED);
|
||||
}
|
||||
|
||||
private boolean shouldSuppressFaceMsgAndShowTryFingerprintMsg() {
|
||||
// For dual biometric, don't show face auth messages unless face auth was explicitly
|
||||
// requested by the user.
|
||||
private boolean shouldSuppressFaceMsg() {
|
||||
// For dual biometric, don't show face auth messages
|
||||
return mKeyguardUpdateMonitor.isFingerprintDetectionRunning()
|
||||
&& !mKeyguardUpdateMonitor.isFaceAuthUserRequested()
|
||||
&& mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||
true /* isStrongBiometric */);
|
||||
}
|
||||
@@ -1068,4 +1056,20 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
updateIndication(false);
|
||||
}
|
||||
};
|
||||
|
||||
private KeyguardStateController.Callback mKeyguardStateCallback =
|
||||
new KeyguardStateController.Callback() {
|
||||
@Override
|
||||
public void onUnlockedChanged() {
|
||||
updateIndication(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardShowingChanged() {
|
||||
if (!mKeyguardStateController.isShowing()) {
|
||||
mTopIndicationView.clearMessages();
|
||||
mLockScreenIndicationView.clearMessages();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,6 +61,14 @@ public class KeyguardIndicationTextView extends TextView {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears message queue.
|
||||
*/
|
||||
public void clearMessages() {
|
||||
mMessages.clear();
|
||||
mKeyguardIndicationInfo.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the text with an animation and makes sure a single indication is shown long enough.
|
||||
*/
|
||||
|
||||
@@ -154,6 +154,9 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor;
|
||||
@Captor
|
||||
private ArgumentCaptor<KeyguardIndication> mKeyguardIndicationCaptor;
|
||||
@Captor
|
||||
private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor;
|
||||
private KeyguardStateController.Callback mKeyguardStateControllerCallback;
|
||||
private StatusBarStateController.StateListener mStatusBarStateListener;
|
||||
private BroadcastReceiver mBroadcastReceiver;
|
||||
private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock());
|
||||
@@ -223,6 +226,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
mController.mRotateTextViewController = mRotateTextViewController;
|
||||
mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
|
||||
clearInvocations(mIBatteryStats);
|
||||
|
||||
verify(mKeyguardStateController).addCallback(
|
||||
mKeyguardStateControllerCallbackCaptor.capture());
|
||||
mKeyguardStateControllerCallback = mKeyguardStateControllerCallbackCaptor.getValue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -529,7 +536,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
reset(mKeyguardUpdateMonitor);
|
||||
when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true);
|
||||
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
|
||||
mController.onUnlockedChanged();
|
||||
mKeyguardStateControllerCallback.onUnlockedChanged();
|
||||
verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication);
|
||||
}
|
||||
|
||||
@@ -572,7 +579,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void updateMonitor_listener() {
|
||||
createController();
|
||||
verify(mKeyguardStateController).addCallback(eq(mController));
|
||||
verify(mKeyguardStateController).addCallback(any());
|
||||
verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user