diff options
| author | 2023-08-29 21:45:07 +0000 | |
|---|---|---|
| committer | 2023-08-29 21:45:07 +0000 | |
| commit | 7b64191b96cf4b1bbe3dcbb94d874654ed23c640 (patch) | |
| tree | 036e9978ffc676e86c68adcabf6793b89e27f7ff | |
| parent | a2ab90c91cd5002fa8a31177d2b423c33df40c29 (diff) | |
| parent | a354379a9331e0e70ba629dfbcdb5f764fe2f4c5 (diff) | |
Merge changes I57de36ba,I75d58e09 into main am: cd00f7a7f2 am: 420ee29980 am: a354379a93
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2729596
Change-Id: I6a4f912530c2643be7af4170ca41106a785a13cd
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.java | 3 | ||||
| -rw-r--r-- | services/core/java/com/android/server/trust/TrustManagerService.java | 99 |
2 files changed, 10 insertions, 92 deletions
diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java index 415d05e96799..004312267d10 100644 --- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java +++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java @@ -120,9 +120,6 @@ public class TrustAgentWrapper { private final BroadcastReceiver mTrustableDowngradeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - if (!TrustManagerService.ENABLE_ACTIVE_UNLOCK_FLAG) { - return; - } // are these the broadcasts we want to listen to if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { downgradeToTrustable(); diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java index bab4886a6c6a..050bc659ee74 100644 --- a/services/core/java/com/android/server/trust/TrustManagerService.java +++ b/services/core/java/com/android/server/trust/TrustManagerService.java @@ -58,7 +58,6 @@ import android.os.Message; import android.os.PersistableBundle; import android.os.RemoteException; import android.os.SystemClock; -import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; @@ -165,10 +164,6 @@ public class TrustManagerService extends SystemService { @GuardedBy("mUserIsTrusted") private final SparseBooleanArray mUserIsTrusted = new SparseBooleanArray(); - //TODO(b/215724686): remove flag - public static final boolean ENABLE_ACTIVE_UNLOCK_FLAG = SystemProperties.getBoolean( - "fw.enable_active_unlock_flag", true); - private enum TrustState { UNTRUSTED, // the phone is not unlocked by any trustagents TRUSTABLE, // the phone is in a semi-locked state that can be unlocked if @@ -569,69 +564,6 @@ public class TrustManagerService extends SystemService { int flags, boolean isFromUnlock, @Nullable AndroidFuture<GrantTrustResult> resultCallback) { - if (ENABLE_ACTIVE_UNLOCK_FLAG) { - updateTrustWithRenewableUnlock(userId, flags, isFromUnlock, resultCallback); - } else { - updateTrustWithNonrenewableTrust(userId, flags, isFromUnlock); - } - } - - private void updateTrustWithNonrenewableTrust(int userId, int flags, boolean isFromUnlock) { - boolean managed = aggregateIsTrustManaged(userId); - dispatchOnTrustManagedChanged(managed, userId); - if (mStrongAuthTracker.isTrustAllowedForUser(userId) - && isTrustUsuallyManagedInternal(userId) != managed) { - updateTrustUsuallyManaged(userId, managed); - } - - boolean trusted = aggregateIsTrusted(userId); - IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); - boolean showingKeyguard = true; - try { - showingKeyguard = wm.isKeyguardLocked(); - } catch (RemoteException e) { - } - - boolean changed; - synchronized (mUserIsTrusted) { - if (mSettingsObserver.getTrustAgentsNonrenewableTrust()) { - // For non-renewable trust agents can only set the device to trusted if it already - // trusted or the device is unlocked. Attempting to set the device as trusted - // when the device is locked will be ignored. - changed = mUserIsTrusted.get(userId) != trusted; - trusted = trusted - && (!showingKeyguard || isFromUnlock || !changed) - && userId == mCurrentUser; - if (DEBUG) { - Slog.d(TAG, "Extend unlock setting trusted as " + Boolean.toString(trusted) - + " && " + Boolean.toString(!showingKeyguard) - + " && " + Boolean.toString(userId == mCurrentUser)); - } - } - changed = mUserIsTrusted.get(userId) != trusted; - mUserIsTrusted.put(userId, trusted); - } - dispatchOnTrustChanged( - trusted, - false /* newlyUnlocked */, - userId, - flags, - getTrustGrantedMessages(userId)); - if (changed) { - refreshDeviceLockedForUser(userId); - if (!trusted) { - maybeLockScreen(userId); - } else { - scheduleTrustTimeout(false /* override */, false /* isTrustableTimeout*/); - } - } - } - - private void updateTrustWithRenewableUnlock( - int userId, - int flags, - boolean isFromUnlock, - @Nullable AndroidFuture<GrantTrustResult> resultCallback) { boolean managed = aggregateIsTrustManaged(userId); dispatchOnTrustManagedChanged(managed, userId); if (mStrongAuthTracker.isTrustAllowedForUser(userId) @@ -2265,16 +2197,11 @@ public class TrustManagerService extends SystemService { @Override public void handleAlarm() { - TrustableTimeoutAlarmListener otherAlarm; - boolean otherAlarmPresent; - if (ENABLE_ACTIVE_UNLOCK_FLAG) { - otherAlarm = mTrustableTimeoutAlarmListenerForUser.get(mUserId); - otherAlarmPresent = (otherAlarm != null) && otherAlarm.isQueued(); - if (otherAlarmPresent) { - synchronized (mAlarmLock) { - disableNonrenewableTrustWhileRenewableTrustIsPresent(); - } - return; + TrustableTimeoutAlarmListener otherAlarm = + mTrustableTimeoutAlarmListenerForUser.get(mUserId); + if (otherAlarm != null && otherAlarm.isQueued()) { + synchronized (mAlarmLock) { + disableNonrenewableTrustWhileRenewableTrustIsPresent(); } } } @@ -2299,17 +2226,11 @@ public class TrustManagerService extends SystemService { @Override public void handleAlarm() { - TrustedTimeoutAlarmListener otherAlarm; - boolean otherAlarmPresent; - if (ENABLE_ACTIVE_UNLOCK_FLAG) { - cancelBothTrustableAlarms(mUserId); - otherAlarm = mTrustTimeoutAlarmListenerForUser.get(mUserId); - otherAlarmPresent = (otherAlarm != null) && otherAlarm.isQueued(); - if (otherAlarmPresent) { - synchronized (mAlarmLock) { - disableRenewableTrustWhileNonrenewableTrustIsPresent(); - } - return; + cancelBothTrustableAlarms(mUserId); + TrustedTimeoutAlarmListener otherAlarm = mTrustTimeoutAlarmListenerForUser.get(mUserId); + if (otherAlarm != null && otherAlarm.isQueued()) { + synchronized (mAlarmLock) { + disableRenewableTrustWhileNonrenewableTrustIsPresent(); } } } |