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
|
* Controls the indications and error messages shown on the Keyguard
|
||||||
*/
|
*/
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
public class KeyguardIndicationController implements KeyguardStateController.Callback {
|
public class KeyguardIndicationController {
|
||||||
|
|
||||||
private static final String TAG = "KeyguardIndication";
|
private static final String TAG = "KeyguardIndication";
|
||||||
private static final boolean DEBUG_CHARGING_SPEED = false;
|
private static final boolean DEBUG_CHARGING_SPEED = false;
|
||||||
@@ -206,7 +206,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
|||||||
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
|
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
|
||||||
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
|
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
|
||||||
mStatusBarStateController.addCallback(mStatusBarStateListener);
|
mStatusBarStateController.addCallback(mStatusBarStateListener);
|
||||||
mKeyguardStateController.addCallback(this);
|
mKeyguardStateController.addCallback(mKeyguardStateCallback);
|
||||||
|
|
||||||
mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing());
|
mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing());
|
||||||
}
|
}
|
||||||
@@ -827,11 +827,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
|||||||
mRotateTextViewController.dump(fd, pw, args);
|
mRotateTextViewController.dump(fd, pw, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUnlockedChanged() {
|
|
||||||
updateIndication(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
|
protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
|
||||||
public static final int HIDE_DELAY_MS = 5000;
|
public static final int HIDE_DELAY_MS = 5000;
|
||||||
|
|
||||||
@@ -890,10 +885,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
|||||||
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
|
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
|
||||||
mInitialTextColorState);
|
mInitialTextColorState);
|
||||||
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
|
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
|
||||||
if (biometricSourceType == BiometricSourceType.FACE
|
if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsg()) {
|
||||||
&& shouldSuppressFaceMsgAndShowTryFingerprintMsg()) {
|
|
||||||
// suggest trying fingerprint
|
|
||||||
showTransientIndication(R.string.keyguard_try_fingerprint);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showTransientIndication(helpString, false /* isError */, showSwipeToUnlock);
|
showTransientIndication(helpString, false /* isError */, showSwipeToUnlock);
|
||||||
@@ -911,11 +903,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (biometricSourceType == BiometricSourceType.FACE
|
if (biometricSourceType == BiometricSourceType.FACE
|
||||||
&& shouldSuppressFaceMsgAndShowTryFingerprintMsg()
|
&& shouldSuppressFaceMsg()
|
||||||
&& !mStatusBarKeyguardViewManager.isBouncerShowing()
|
&& !mStatusBarKeyguardViewManager.isBouncerShowing()
|
||||||
&& mKeyguardUpdateMonitor.isScreenOn()) {
|
&& mKeyguardUpdateMonitor.isScreenOn()) {
|
||||||
// suggest trying fingerprint
|
|
||||||
showTransientIndication(R.string.keyguard_try_fingerprint);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
|
if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
|
||||||
@@ -966,11 +956,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
|||||||
|| msgId == FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED);
|
|| msgId == FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldSuppressFaceMsgAndShowTryFingerprintMsg() {
|
private boolean shouldSuppressFaceMsg() {
|
||||||
// For dual biometric, don't show face auth messages unless face auth was explicitly
|
// For dual biometric, don't show face auth messages
|
||||||
// requested by the user.
|
|
||||||
return mKeyguardUpdateMonitor.isFingerprintDetectionRunning()
|
return mKeyguardUpdateMonitor.isFingerprintDetectionRunning()
|
||||||
&& !mKeyguardUpdateMonitor.isFaceAuthUserRequested()
|
|
||||||
&& mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
&& mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(
|
||||||
true /* isStrongBiometric */);
|
true /* isStrongBiometric */);
|
||||||
}
|
}
|
||||||
@@ -1068,4 +1056,20 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
|||||||
updateIndication(false);
|
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);
|
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.
|
* 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;
|
private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor;
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<KeyguardIndication> mKeyguardIndicationCaptor;
|
private ArgumentCaptor<KeyguardIndication> mKeyguardIndicationCaptor;
|
||||||
|
@Captor
|
||||||
|
private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor;
|
||||||
|
private KeyguardStateController.Callback mKeyguardStateControllerCallback;
|
||||||
private StatusBarStateController.StateListener mStatusBarStateListener;
|
private StatusBarStateController.StateListener mStatusBarStateListener;
|
||||||
private BroadcastReceiver mBroadcastReceiver;
|
private BroadcastReceiver mBroadcastReceiver;
|
||||||
private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock());
|
private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock());
|
||||||
@@ -223,6 +226,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
mController.mRotateTextViewController = mRotateTextViewController;
|
mController.mRotateTextViewController = mRotateTextViewController;
|
||||||
mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
|
mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
|
||||||
clearInvocations(mIBatteryStats);
|
clearInvocations(mIBatteryStats);
|
||||||
|
|
||||||
|
verify(mKeyguardStateController).addCallback(
|
||||||
|
mKeyguardStateControllerCallbackCaptor.capture());
|
||||||
|
mKeyguardStateControllerCallback = mKeyguardStateControllerCallbackCaptor.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -529,7 +536,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
reset(mKeyguardUpdateMonitor);
|
reset(mKeyguardUpdateMonitor);
|
||||||
when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true);
|
when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true);
|
||||||
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
|
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
|
||||||
mController.onUnlockedChanged();
|
mKeyguardStateControllerCallback.onUnlockedChanged();
|
||||||
verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication);
|
verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,7 +579,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void updateMonitor_listener() {
|
public void updateMonitor_listener() {
|
||||||
createController();
|
createController();
|
||||||
verify(mKeyguardStateController).addCallback(eq(mController));
|
verify(mKeyguardStateController).addCallback(any());
|
||||||
verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any());
|
verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user