summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly Tai <beverlyt@google.com> 2022-12-16 18:41:50 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-12-16 18:41:50 +0000
commit92a79033e9d11ceeaae2329efefad27d694a59d8 (patch)
tree593ae90967a23811bcd6d64b42d3d8991d69a3a1
parent099cdc6ef7138391c9a307a65950e9e3e7b123b9 (diff)
parent57e7c16e2f066dc5da3134a7499e7bd17fdc1581 (diff)
Merge "Send newlyUnlocked information to KeyguardUpdateMontiorCallbacks" into tm-qpr-dev
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java7
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java8
7 files changed, 41 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
index 2b660dee4f16..d4ca8e34fb32 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java
@@ -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
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 8283ce8d3a8d..cfd9dd9e1635 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -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
+ );
}
}
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 1d58fc9cf94b..e6b9ac8b38a8 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -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.
diff --git a/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt b/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt
index ceebe4c69091..21d3b24174b6 100644
--- a/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt
+++ b/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt
@@ -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(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 0f27420e22b0..b7001e476dcf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -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);
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index 2aef726f2221..13cd328d00e0 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -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 */
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index c280ec8c4ec8..8d96932f0051 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -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);