diff options
| author | 2023-10-23 21:45:24 +0000 | |
|---|---|---|
| committer | 2023-10-23 21:45:24 +0000 | |
| commit | 46f5295b8f21dfaaaeb3865d11f87739507faf50 (patch) | |
| tree | c07b8fe1cf90521b39a008d9886d87cf13b6e476 | |
| parent | 87d4bc1eebaedeacf576d5ab6fc24fc212972b01 (diff) | |
| parent | c1b2d61dd84467ba2621a17718761ad4949dfd5e (diff) | |
Merge "Close AccountManagerService.session after timeout." into main
| -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 1650a96a4012..bdda95ef58c8 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -190,6 +190,7 @@ public class AccountManagerService final MessageHandler mHandler; + private static final int TIMEOUT_DELAY_MS = 1000 * 60; // Messages that can be sent on mHandler private static final int MESSAGE_TIMED_OUT = 3; private static final int MESSAGE_COPY_SHARED_ACCOUNT = 4; @@ -4942,6 +4943,7 @@ public class AccountManagerService synchronized (mSessions) { mSessions.put(toString(), this); } + scheduleTimeout(); if (response != null) { try { response.asBinder().linkToDeath(this, 0 /* flags */); @@ -5109,6 +5111,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); } @@ -5146,6 +5153,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, |