summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jacob Hobbie <jacobhobbie@google.com> 2022-11-29 17:44:12 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-11-29 17:44:12 +0000
commitb61f54c521f7cb86363222b9ce263f0c5bbca60c (patch)
tree77b04bf336f5cc6a0b782cd776c05deb992e5ce7
parent5d391fa63865f063a42c2a430b8f6aec0b28f93c (diff)
parent738f874e448428e30043677557452b5909d7f87c (diff)
Merge "Fixing an Active Unlock security vulnerability." into tm-qpr-dev am: 738f874e44
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20513670 Change-Id: Iea014b8fba2e894bb615420f27aa4ab21fe0ec39 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/core/java/com/android/server/trust/TrustAgentWrapper.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
index 4b8c7c176fda..36293d518f51 100644
--- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java
+++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
@@ -107,6 +107,7 @@ public class TrustAgentWrapper {
// Trust state
private boolean mTrusted;
private boolean mWaitingForTrustableDowngrade = false;
+ private boolean mWithinSecurityLockdownWindow = false;
private boolean mTrustable;
private CharSequence mMessage;
private boolean mDisplayTrustGrantedMessage;
@@ -160,6 +161,7 @@ public class TrustAgentWrapper {
mDisplayTrustGrantedMessage = (flags & FLAG_GRANT_TRUST_DISPLAY_MESSAGE) != 0;
if ((flags & FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE) != 0) {
mWaitingForTrustableDowngrade = true;
+ setSecurityWindowTimer();
} else {
mWaitingForTrustableDowngrade = false;
}
@@ -452,6 +454,9 @@ public class TrustAgentWrapper {
if (mBound) {
scheduleRestart();
}
+ if (mWithinSecurityLockdownWindow) {
+ mTrustManagerService.lockUser(mUserId);
+ }
// mTrustDisabledByDpm maintains state
}
};
@@ -673,6 +678,22 @@ public class TrustAgentWrapper {
}
}
+ private void setSecurityWindowTimer() {
+ mWithinSecurityLockdownWindow = true;
+ long expiration = SystemClock.elapsedRealtime() + (15 * 1000); // timer for 15 seconds
+ mAlarmManager.setExact(
+ AlarmManager.ELAPSED_REALTIME_WAKEUP,
+ expiration,
+ TAG,
+ new AlarmManager.OnAlarmListener() {
+ @Override
+ public void onAlarm() {
+ mWithinSecurityLockdownWindow = false;
+ }
+ },
+ Handler.getMain());
+ }
+
public boolean isManagingTrust() {
return mManagingTrust && !mTrustDisabledByDpm;
}
@@ -691,7 +712,6 @@ public class TrustAgentWrapper {
public void destroy() {
mHandler.removeMessages(MSG_RESTART_TIMEOUT);
-
if (!mBound) {
return;
}