diff options
| author | 2024-01-08 20:09:42 +0000 | |
|---|---|---|
| committer | 2024-01-08 20:09:42 +0000 | |
| commit | 6faf0345e45e4cfbba6e67fe98b1da29228b29f2 (patch) | |
| tree | 4ca8e6b12cbec153af53622453448030977229fa | |
| parent | 0182732e550f7ef162da621312d60748b98d2841 (diff) | |
| parent | bb53f192e0ceaa026a083da156ef0cb0140f0c09 (diff) | |
Merge "Close AccountManagerService.session after timeout." into rvc-dev
| -rw-r--r-- | services/core/java/com/android/server/accounts/AccountManagerService.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 584031ce880c..a3e9753b2c49 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -182,6 +182,7 @@ public class AccountManagerService final MessageHandler mHandler; + private static final int TIMEOUT_DELAY_MS = 1000 * 60 * 15; // Messages that can be sent on mHandler private static final int MESSAGE_TIMED_OUT = 3; private static final int MESSAGE_COPY_SHARED_ACCOUNT = 4; @@ -4755,6 +4756,7 @@ public class AccountManagerService synchronized (mSessions) { mSessions.put(toString(), this); } + scheduleTimeout(); if (response != null) { try { response.asBinder().linkToDeath(this, 0 /* flags */); @@ -4921,6 +4923,11 @@ public class AccountManagerService } } + private void scheduleTimeout() { + mHandler.sendMessageDelayed( + mHandler.obtainMessage(MESSAGE_TIMED_OUT, this), TIMEOUT_DELAY_MS); + } + public void cancelTimeout() { mHandler.removeMessages(MESSAGE_TIMED_OUT, this); } @@ -4957,6 +4964,9 @@ public class AccountManagerService public void onTimedOut() { IAccountManagerResponse response = getResponseAndClose(); + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "Session.onTimedOut"); + } if (response != null) { try { response.onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, |