Loading services/core/java/com/android/server/trust/TrustManagerService.java +28 −19 Original line number Diff line number Diff line Loading @@ -393,6 +393,23 @@ public class TrustManagerService extends SystemService { true /* overrideHardTimeout */); } private void cancelBothTrustableAlarms(int userId) { TrustableTimeoutAlarmListener idleTimeout = mIdleTrustableTimeoutAlarmListenerForUser.get( userId); TrustableTimeoutAlarmListener trustableTimeout = mTrustableTimeoutAlarmListenerForUser.get( userId); if (idleTimeout != null && idleTimeout.isQueued()) { idleTimeout.setQueued(false); mAlarmManager.cancel(idleTimeout); } if (trustableTimeout != null && trustableTimeout.isQueued()) { trustableTimeout.setQueued(false); mAlarmManager.cancel(trustableTimeout); } } private void handleScheduleTrustedTimeout(int userId, boolean shouldOverride) { long when = SystemClock.elapsedRealtime() + TRUST_TIMEOUT_IN_MILLIS; TrustedTimeoutAlarmListener alarm = mTrustTimeoutAlarmListenerForUser.get(userId); Loading Loading @@ -657,6 +674,11 @@ public class TrustManagerService extends SystemService { resultCallback.complete(new GrantTrustResult(STATUS_UNLOCKED_BY_GRANT)); } } if ((wasTrusted || wasTrustable) && pendingTrustState == TrustState.UNTRUSTED) { if (DEBUG) Slog.d(TAG, "Trust was revoked, destroy trustable alarms"); cancelBothTrustableAlarms(userId); } } private void updateTrustUsuallyManaged(int userId, boolean managed) { Loading Loading @@ -1908,7 +1930,11 @@ public class TrustManagerService extends SystemService { handleScheduleTrustTimeout(shouldOverride, timeoutType); break; case MSG_REFRESH_TRUSTABLE_TIMERS_AFTER_AUTH: TrustableTimeoutAlarmListener trustableAlarm = mTrustableTimeoutAlarmListenerForUser.get(msg.arg1); if (trustableAlarm != null && trustableAlarm.isQueued()) { refreshTrustableTimers(msg.arg1); } break; } } Loading Loading @@ -2160,7 +2186,7 @@ public class TrustManagerService extends SystemService { TrustedTimeoutAlarmListener otherAlarm; boolean otherAlarmPresent; if (ENABLE_ACTIVE_UNLOCK_FLAG) { cancelBothTrustableAlarms(); cancelBothTrustableAlarms(mUserId); otherAlarm = mTrustTimeoutAlarmListenerForUser.get(mUserId); otherAlarmPresent = (otherAlarm != null) && otherAlarm.isQueued(); if (otherAlarmPresent) { Loading @@ -2172,23 +2198,6 @@ public class TrustManagerService extends SystemService { } } private void cancelBothTrustableAlarms() { TrustableTimeoutAlarmListener idleTimeout = mIdleTrustableTimeoutAlarmListenerForUser.get( mUserId); TrustableTimeoutAlarmListener trustableTimeout = mTrustableTimeoutAlarmListenerForUser.get( mUserId); if (idleTimeout != null && idleTimeout.isQueued()) { idleTimeout.setQueued(false); mAlarmManager.cancel(idleTimeout); } if (trustableTimeout != null && trustableTimeout.isQueued()) { trustableTimeout.setQueued(false); mAlarmManager.cancel(trustableTimeout); } } private void disableRenewableTrustWhileNonrenewableTrustIsPresent() { // if non-renewable trust is running, we need to temporarily prevent // renewable trust from being used Loading Loading
services/core/java/com/android/server/trust/TrustManagerService.java +28 −19 Original line number Diff line number Diff line Loading @@ -393,6 +393,23 @@ public class TrustManagerService extends SystemService { true /* overrideHardTimeout */); } private void cancelBothTrustableAlarms(int userId) { TrustableTimeoutAlarmListener idleTimeout = mIdleTrustableTimeoutAlarmListenerForUser.get( userId); TrustableTimeoutAlarmListener trustableTimeout = mTrustableTimeoutAlarmListenerForUser.get( userId); if (idleTimeout != null && idleTimeout.isQueued()) { idleTimeout.setQueued(false); mAlarmManager.cancel(idleTimeout); } if (trustableTimeout != null && trustableTimeout.isQueued()) { trustableTimeout.setQueued(false); mAlarmManager.cancel(trustableTimeout); } } private void handleScheduleTrustedTimeout(int userId, boolean shouldOverride) { long when = SystemClock.elapsedRealtime() + TRUST_TIMEOUT_IN_MILLIS; TrustedTimeoutAlarmListener alarm = mTrustTimeoutAlarmListenerForUser.get(userId); Loading Loading @@ -657,6 +674,11 @@ public class TrustManagerService extends SystemService { resultCallback.complete(new GrantTrustResult(STATUS_UNLOCKED_BY_GRANT)); } } if ((wasTrusted || wasTrustable) && pendingTrustState == TrustState.UNTRUSTED) { if (DEBUG) Slog.d(TAG, "Trust was revoked, destroy trustable alarms"); cancelBothTrustableAlarms(userId); } } private void updateTrustUsuallyManaged(int userId, boolean managed) { Loading Loading @@ -1908,7 +1930,11 @@ public class TrustManagerService extends SystemService { handleScheduleTrustTimeout(shouldOverride, timeoutType); break; case MSG_REFRESH_TRUSTABLE_TIMERS_AFTER_AUTH: TrustableTimeoutAlarmListener trustableAlarm = mTrustableTimeoutAlarmListenerForUser.get(msg.arg1); if (trustableAlarm != null && trustableAlarm.isQueued()) { refreshTrustableTimers(msg.arg1); } break; } } Loading Loading @@ -2160,7 +2186,7 @@ public class TrustManagerService extends SystemService { TrustedTimeoutAlarmListener otherAlarm; boolean otherAlarmPresent; if (ENABLE_ACTIVE_UNLOCK_FLAG) { cancelBothTrustableAlarms(); cancelBothTrustableAlarms(mUserId); otherAlarm = mTrustTimeoutAlarmListenerForUser.get(mUserId); otherAlarmPresent = (otherAlarm != null) && otherAlarm.isQueued(); if (otherAlarmPresent) { Loading @@ -2172,23 +2198,6 @@ public class TrustManagerService extends SystemService { } } private void cancelBothTrustableAlarms() { TrustableTimeoutAlarmListener idleTimeout = mIdleTrustableTimeoutAlarmListenerForUser.get( mUserId); TrustableTimeoutAlarmListener trustableTimeout = mTrustableTimeoutAlarmListenerForUser.get( mUserId); if (idleTimeout != null && idleTimeout.isQueued()) { idleTimeout.setQueued(false); mAlarmManager.cancel(idleTimeout); } if (trustableTimeout != null && trustableTimeout.isQueued()) { trustableTimeout.setQueued(false); mAlarmManager.cancel(trustableTimeout); } } private void disableRenewableTrustWhileNonrenewableTrustIsPresent() { // if non-renewable trust is running, we need to temporarily prevent // renewable trust from being used Loading