Loading core/java/android/service/trust/TrustAgentService.java +3 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,9 @@ public class TrustAgentService extends Service { * * Without this flag, the message passed to {@code grantTrust} is only used for debugging * purposes. With the flag, it may be displayed to the user as the reason why the device is * unlocked. * unlocked. If this flag isn't set OR the message is set to null, the device will display * its own default message for trust granted. If the TrustAgent intentionally doesn't want to * show any message, then it can set this flag AND set the message to an empty string. */ public static final int FLAG_GRANT_TRUST_DISPLAY_MESSAGE = 1 << 3; Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +2 −2 Original line number Diff line number Diff line Loading @@ -482,8 +482,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab final boolean userHasTrust = getUserHasTrust(userId); if (userHasTrust && trustGrantedMessages != null) { for (String msg : trustGrantedMessages) { if (!TextUtils.isEmpty(msg)) { message = msg; if (!TextUtils.isEmpty(message)) { break; } } Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -692,11 +692,11 @@ public class KeyguardIndicationController { /** * Returns the indication text indicating that trust has been granted. * * @return {@code null} or an empty string if a trust indication text should not be shown. * @return an empty string if a trust indication text should not be shown. */ @VisibleForTesting String getTrustGrantedIndication() { return TextUtils.isEmpty(mTrustGrantedIndication) return mTrustGrantedIndication == null ? mContext.getString(R.string.keyguard_indication_trust_unlocked) : mTrustGrantedIndication.toString(); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +34 −2 Original line number Diff line number Diff line Loading @@ -1050,14 +1050,14 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test public void onTrustGrantedMessageDoesShowsOnTrustGranted() { public void onTrustGrantedMessageShowsOnTrustGranted() { createController(); mController.setVisible(true); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted message is called // WHEN the showTrustGranted method is called final String trustGrantedMsg = "testing trust granted message"; mController.getKeyguardCallback().showTrustGrantedMessage(trustGrantedMsg); Loading @@ -1067,6 +1067,38 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { trustGrantedMsg); } @Test public void onTrustGrantedMessage_nullMessage_showsDefaultMessage() { createController(); mController.setVisible(true); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted method is called with a null message mController.getKeyguardCallback().showTrustGrantedMessage(null); // THEN verify the default trust granted message shows verifyIndicationMessage( INDICATION_TYPE_TRUST, getContext().getString(R.string.keyguard_indication_trust_unlocked)); } @Test public void onTrustGrantedMessage_emptyString_showsNoMessage() { createController(); mController.setVisible(true); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted method is called with an EMPTY string mController.getKeyguardCallback().showTrustGrantedMessage(""); // THEN verify NO trust message is shown verifyNoMessage(INDICATION_TYPE_TRUST); } @Test public void coEx_faceSuccess_showsPressToOpen() { // GIVEN bouncer isn't showing, can skip bouncer, udfps is supported, no a11y enabled Loading services/core/java/com/android/server/trust/TrustManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1211,7 +1211,7 @@ public class TrustManagerService extends SystemService { if (info.userId == userId && info.agent.isTrusted() && info.agent.shouldDisplayTrustGrantedMessage() && !TextUtils.isEmpty(info.agent.getMessage())) { && info.agent.getMessage() != null) { trustGrantedMessages.add(info.agent.getMessage().toString()); } } Loading Loading
core/java/android/service/trust/TrustAgentService.java +3 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,9 @@ public class TrustAgentService extends Service { * * Without this flag, the message passed to {@code grantTrust} is only used for debugging * purposes. With the flag, it may be displayed to the user as the reason why the device is * unlocked. * unlocked. If this flag isn't set OR the message is set to null, the device will display * its own default message for trust granted. If the TrustAgent intentionally doesn't want to * show any message, then it can set this flag AND set the message to an empty string. */ public static final int FLAG_GRANT_TRUST_DISPLAY_MESSAGE = 1 << 3; Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +2 −2 Original line number Diff line number Diff line Loading @@ -482,8 +482,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab final boolean userHasTrust = getUserHasTrust(userId); if (userHasTrust && trustGrantedMessages != null) { for (String msg : trustGrantedMessages) { if (!TextUtils.isEmpty(msg)) { message = msg; if (!TextUtils.isEmpty(message)) { break; } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -692,11 +692,11 @@ public class KeyguardIndicationController { /** * Returns the indication text indicating that trust has been granted. * * @return {@code null} or an empty string if a trust indication text should not be shown. * @return an empty string if a trust indication text should not be shown. */ @VisibleForTesting String getTrustGrantedIndication() { return TextUtils.isEmpty(mTrustGrantedIndication) return mTrustGrantedIndication == null ? mContext.getString(R.string.keyguard_indication_trust_unlocked) : mTrustGrantedIndication.toString(); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +34 −2 Original line number Diff line number Diff line Loading @@ -1050,14 +1050,14 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test public void onTrustGrantedMessageDoesShowsOnTrustGranted() { public void onTrustGrantedMessageShowsOnTrustGranted() { createController(); mController.setVisible(true); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted message is called // WHEN the showTrustGranted method is called final String trustGrantedMsg = "testing trust granted message"; mController.getKeyguardCallback().showTrustGrantedMessage(trustGrantedMsg); Loading @@ -1067,6 +1067,38 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { trustGrantedMsg); } @Test public void onTrustGrantedMessage_nullMessage_showsDefaultMessage() { createController(); mController.setVisible(true); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted method is called with a null message mController.getKeyguardCallback().showTrustGrantedMessage(null); // THEN verify the default trust granted message shows verifyIndicationMessage( INDICATION_TYPE_TRUST, getContext().getString(R.string.keyguard_indication_trust_unlocked)); } @Test public void onTrustGrantedMessage_emptyString_showsNoMessage() { createController(); mController.setVisible(true); // GIVEN trust is granted when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); // WHEN the showTrustGranted method is called with an EMPTY string mController.getKeyguardCallback().showTrustGrantedMessage(""); // THEN verify NO trust message is shown verifyNoMessage(INDICATION_TYPE_TRUST); } @Test public void coEx_faceSuccess_showsPressToOpen() { // GIVEN bouncer isn't showing, can skip bouncer, udfps is supported, no a11y enabled Loading
services/core/java/com/android/server/trust/TrustManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1211,7 +1211,7 @@ public class TrustManagerService extends SystemService { if (info.userId == userId && info.agent.isTrusted() && info.agent.shouldDisplayTrustGrantedMessage() && !TextUtils.isEmpty(info.agent.getMessage())) { && info.agent.getMessage() != null) { trustGrantedMessages.add(info.agent.getMessage().toString()); } } Loading