Merge "Send newlyUnlocked information to KeyguardUpdateMontiorCallbacks" into tm-qpr-dev
This commit is contained in:
@@ -67,8 +67,12 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
||||
private final KeyguardUpdateMonitorCallback mUpdateCallback =
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onTrustGrantedForCurrentUser(boolean dismissKeyguard,
|
||||
TrustGrantFlags flags, String message) {
|
||||
public void onTrustGrantedForCurrentUser(
|
||||
boolean dismissKeyguard,
|
||||
boolean newlyUnlocked,
|
||||
TrustGrantFlags flags,
|
||||
String message
|
||||
) {
|
||||
if (dismissKeyguard) {
|
||||
if (!mView.isVisibleToUser()) {
|
||||
// The trust agent dismissed the keyguard without the user proving
|
||||
|
||||
@@ -510,7 +510,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
}
|
||||
}
|
||||
|
||||
mLogger.logTrustGrantedWithFlags(flags, userId, message);
|
||||
mLogger.logTrustGrantedWithFlags(flags, newlyUnlocked, userId, message);
|
||||
if (userId == getCurrentUser()) {
|
||||
final TrustGrantFlags trustGrantFlags = new TrustGrantFlags(flags);
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
@@ -518,7 +518,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
if (cb != null) {
|
||||
cb.onTrustGrantedForCurrentUser(
|
||||
shouldDismissKeyguardOnTrustGrantedWithCurrentUser(trustGrantFlags),
|
||||
trustGrantFlags, message);
|
||||
newlyUnlocked,
|
||||
trustGrantFlags,
|
||||
message
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,11 +178,17 @@ public class KeyguardUpdateMonitorCallback {
|
||||
* Called after trust was granted.
|
||||
* @param dismissKeyguard whether the keyguard should be dismissed as a result of the
|
||||
* trustGranted
|
||||
* @param newlyUnlocked whether the grantedTrust is believed to be the cause of a newly
|
||||
* unlocked device (after being locked).
|
||||
* @param message optional message the trust agent has provided to show that should indicate
|
||||
* why trust was granted.
|
||||
*/
|
||||
public void onTrustGrantedForCurrentUser(boolean dismissKeyguard,
|
||||
@NonNull TrustGrantFlags flags, @Nullable String message) { }
|
||||
public void onTrustGrantedForCurrentUser(
|
||||
boolean dismissKeyguard,
|
||||
boolean newlyUnlocked,
|
||||
@NonNull TrustGrantFlags flags,
|
||||
@Nullable String message
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Called when a biometric has been acquired.
|
||||
|
||||
@@ -379,14 +379,17 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
|
||||
|
||||
fun logTrustGrantedWithFlags(
|
||||
flags: Int,
|
||||
newlyUnlocked: Boolean,
|
||||
userId: Int,
|
||||
message: String?
|
||||
) {
|
||||
logBuffer.log(TAG, DEBUG, {
|
||||
int1 = flags
|
||||
bool1 = newlyUnlocked
|
||||
int2 = userId
|
||||
str1 = message
|
||||
}, { "trustGrantedWithFlags[user=$int2] flags=${TrustGrantFlags(int1)} message=$str1" })
|
||||
}, { "trustGrantedWithFlags[user=$int2] newlyUnlocked=$bool1 " +
|
||||
"flags=${TrustGrantFlags(int1)} message=$str1" })
|
||||
}
|
||||
|
||||
fun logTrustChanged(
|
||||
|
||||
@@ -1193,8 +1193,12 @@ public class KeyguardIndicationController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrustGrantedForCurrentUser(boolean dismissKeyguard,
|
||||
@NonNull TrustGrantFlags flags, @Nullable String message) {
|
||||
public void onTrustGrantedForCurrentUser(
|
||||
boolean dismissKeyguard,
|
||||
boolean newlyUnlocked,
|
||||
@NonNull TrustGrantFlags flags,
|
||||
@Nullable String message
|
||||
) {
|
||||
showTrustGrantedMessage(dismissKeyguard, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -1424,7 +1424,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
|
||||
// THEN the showTrustGrantedMessage should be called with the first message
|
||||
verify(mTestCallback).onTrustGrantedForCurrentUser(
|
||||
anyBoolean(),
|
||||
anyBoolean() /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
eq(new TrustGrantFlags(0)),
|
||||
eq("Unlocked by wearable"));
|
||||
}
|
||||
@@ -1878,6 +1879,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// THEN onTrustGrantedForCurrentUser callback called
|
||||
verify(callback).onTrustGrantedForCurrentUser(
|
||||
eq(true) /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
eq(new TrustGrantFlags(TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD)),
|
||||
eq(null) /* message */
|
||||
);
|
||||
@@ -1902,6 +1904,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// THEN onTrustGrantedForCurrentUser callback called
|
||||
verify(callback).onTrustGrantedForCurrentUser(
|
||||
eq(false) /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
eq(new TrustGrantFlags(TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD)),
|
||||
eq(null) /* message */
|
||||
);
|
||||
@@ -1927,6 +1930,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// THEN onTrustGrantedForCurrentUser callback called
|
||||
verify(callback, never()).onTrustGrantedForCurrentUser(
|
||||
anyBoolean() /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
anyObject() /* flags */,
|
||||
anyString() /* message */
|
||||
);
|
||||
@@ -1953,6 +1957,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// THEN onTrustGrantedForCurrentUser callback called
|
||||
verify(callback).onTrustGrantedForCurrentUser(
|
||||
eq(true) /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
eq(new TrustGrantFlags(TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD
|
||||
| TrustAgentService.FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE)),
|
||||
eq(null) /* message */
|
||||
@@ -1980,6 +1985,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// THEN onTrustGrantedForCurrentUser callback called
|
||||
verify(callback, never()).onTrustGrantedForCurrentUser(
|
||||
eq(true) /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
eq(new TrustGrantFlags(TrustAgentService.FLAG_GRANT_TRUST_INITIATED_BY_USER)),
|
||||
anyString() /* message */
|
||||
);
|
||||
@@ -2006,6 +2012,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// THEN onTrustGrantedForCurrentUser callback called
|
||||
verify(callback, never()).onTrustGrantedForCurrentUser(
|
||||
eq(true) /* dismissKeyguard */,
|
||||
eq(true) /* newlyUnlocked */,
|
||||
eq(new TrustGrantFlags(TrustAgentService.FLAG_GRANT_TRUST_INITIATED_BY_USER
|
||||
| TrustAgentService.FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE)),
|
||||
anyString() /* message */
|
||||
|
||||
@@ -1042,7 +1042,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
// GIVEN a trust granted message but trust isn't granted
|
||||
final String trustGrantedMsg = "testing trust granted message";
|
||||
mController.getKeyguardCallback().onTrustGrantedForCurrentUser(
|
||||
false, new TrustGrantFlags(0), trustGrantedMsg);
|
||||
false, false, new TrustGrantFlags(0), trustGrantedMsg);
|
||||
|
||||
verifyHideIndication(INDICATION_TYPE_TRUST);
|
||||
|
||||
@@ -1067,7 +1067,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
// WHEN the showTrustGranted method is called
|
||||
final String trustGrantedMsg = "testing trust granted message";
|
||||
mController.getKeyguardCallback().onTrustGrantedForCurrentUser(
|
||||
false, new TrustGrantFlags(0), trustGrantedMsg);
|
||||
false, false, new TrustGrantFlags(0), trustGrantedMsg);
|
||||
|
||||
// THEN verify the trust granted message shows
|
||||
verifyIndicationMessage(
|
||||
@@ -1085,7 +1085,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
|
||||
// WHEN the showTrustGranted method is called with a null message
|
||||
mController.getKeyguardCallback().onTrustGrantedForCurrentUser(
|
||||
false, new TrustGrantFlags(0), null);
|
||||
false, false, new TrustGrantFlags(0), null);
|
||||
|
||||
// THEN verify the default trust granted message shows
|
||||
verifyIndicationMessage(
|
||||
@@ -1103,7 +1103,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
|
||||
// WHEN the showTrustGranted method is called with an EMPTY string
|
||||
mController.getKeyguardCallback().onTrustGrantedForCurrentUser(
|
||||
false, new TrustGrantFlags(0), "");
|
||||
false, false, new TrustGrantFlags(0), "");
|
||||
|
||||
// THEN verify NO trust message is shown
|
||||
verifyNoMessage(INDICATION_TYPE_TRUST);
|
||||
|
||||
Reference in New Issue
Block a user