Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +21 −1 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public class KeyguardIndicationController { private String mRestingIndication; private String mAlignmentIndication; private CharSequence mTrustGrantedIndication; private CharSequence mTransientIndication; private CharSequence mBiometricMessage; protected ColorStateList mInitialTextColorState; Loading Loading @@ -609,7 +610,9 @@ public class KeyguardIndicationController { */ @VisibleForTesting String getTrustGrantedIndication() { return mContext.getString(R.string.keyguard_indication_trust_unlocked); return TextUtils.isEmpty(mTrustGrantedIndication) ? mContext.getString(R.string.keyguard_indication_trust_unlocked) : mTrustGrantedIndication.toString(); } /** Loading Loading @@ -909,6 +912,7 @@ public class KeyguardIndicationController { pw.println(" mTextView.getText(): " + ( mTopIndicationView == null ? null : mTopIndicationView.getText())); pw.println(" computePowerIndication(): " + computePowerIndication()); pw.println(" trustGrantedIndication: " + getTrustGrantedIndication()); mRotateTextViewController.dump(fd, pw, args); } Loading Loading @@ -1054,6 +1058,22 @@ public class KeyguardIndicationController { || msgId == FaceManager.FACE_ERROR_CANCELED); } @Override public void onTrustChanged(int userId) { if (KeyguardUpdateMonitor.getCurrentUser() != userId) { return; } updateTrust(userId, getTrustGrantedIndication(), getTrustManagedIndication()); } @Override public void showTrustGrantedMessage(CharSequence message) { mTrustGrantedIndication = message; updateTrust(KeyguardUpdateMonitor.getCurrentUser(), getTrustGrantedIndication(), getTrustManagedIndication()); } @Override public void onTrustAgentErrorMessage(CharSequence message) { showBiometricMessage(message); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +37 −0 Original line number Diff line number Diff line Loading @@ -774,6 +774,43 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verify(mRotateTextViewController).hideIndication(INDICATION_TYPE_LOGOUT); } @Test public void onTrustGrantedMessageDoesNotShowUntilTrustGranted() { createController(); // GIVEN a trust granted message but trust isn't granted final String trustGrantedMsg = "testing trust granted message"; mController.getKeyguardCallback().showTrustGrantedMessage(trustGrantedMsg); verifyHideIndication(INDICATION_TYPE_TRUST); // WHEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); mController.setVisible(true); // THEN verify the trust granted message shows verifyIndicationMessage( INDICATION_TYPE_TRUST, trustGrantedMsg); } @Test public void onTrustGrantedMessageDoesShowsOnTrustGranted() { createController(); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted message is called final String trustGrantedMsg = "testing trust granted message"; mController.getKeyguardCallback().showTrustGrantedMessage(trustGrantedMsg); // THEN verify the trust granted message shows verifyIndicationMessage( INDICATION_TYPE_TRUST, trustGrantedMsg); } private void sendUpdateDisclosureBroadcast() { mBroadcastReceiver.onReceive(mContext, new Intent()); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +21 −1 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public class KeyguardIndicationController { private String mRestingIndication; private String mAlignmentIndication; private CharSequence mTrustGrantedIndication; private CharSequence mTransientIndication; private CharSequence mBiometricMessage; protected ColorStateList mInitialTextColorState; Loading Loading @@ -609,7 +610,9 @@ public class KeyguardIndicationController { */ @VisibleForTesting String getTrustGrantedIndication() { return mContext.getString(R.string.keyguard_indication_trust_unlocked); return TextUtils.isEmpty(mTrustGrantedIndication) ? mContext.getString(R.string.keyguard_indication_trust_unlocked) : mTrustGrantedIndication.toString(); } /** Loading Loading @@ -909,6 +912,7 @@ public class KeyguardIndicationController { pw.println(" mTextView.getText(): " + ( mTopIndicationView == null ? null : mTopIndicationView.getText())); pw.println(" computePowerIndication(): " + computePowerIndication()); pw.println(" trustGrantedIndication: " + getTrustGrantedIndication()); mRotateTextViewController.dump(fd, pw, args); } Loading Loading @@ -1054,6 +1058,22 @@ public class KeyguardIndicationController { || msgId == FaceManager.FACE_ERROR_CANCELED); } @Override public void onTrustChanged(int userId) { if (KeyguardUpdateMonitor.getCurrentUser() != userId) { return; } updateTrust(userId, getTrustGrantedIndication(), getTrustManagedIndication()); } @Override public void showTrustGrantedMessage(CharSequence message) { mTrustGrantedIndication = message; updateTrust(KeyguardUpdateMonitor.getCurrentUser(), getTrustGrantedIndication(), getTrustManagedIndication()); } @Override public void onTrustAgentErrorMessage(CharSequence message) { showBiometricMessage(message); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +37 −0 Original line number Diff line number Diff line Loading @@ -774,6 +774,43 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verify(mRotateTextViewController).hideIndication(INDICATION_TYPE_LOGOUT); } @Test public void onTrustGrantedMessageDoesNotShowUntilTrustGranted() { createController(); // GIVEN a trust granted message but trust isn't granted final String trustGrantedMsg = "testing trust granted message"; mController.getKeyguardCallback().showTrustGrantedMessage(trustGrantedMsg); verifyHideIndication(INDICATION_TYPE_TRUST); // WHEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); mController.setVisible(true); // THEN verify the trust granted message shows verifyIndicationMessage( INDICATION_TYPE_TRUST, trustGrantedMsg); } @Test public void onTrustGrantedMessageDoesShowsOnTrustGranted() { createController(); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted message is called final String trustGrantedMsg = "testing trust granted message"; mController.getKeyguardCallback().showTrustGrantedMessage(trustGrantedMsg); // THEN verify the trust granted message shows verifyIndicationMessage( INDICATION_TYPE_TRUST, trustGrantedMsg); } private void sendUpdateDisclosureBroadcast() { mBroadcastReceiver.onReceive(mContext, new Intent()); } Loading