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