2024-03-09 11:25:46 -05:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2024-03-09 11:05:06 -05:00
|
|
|
From: Dmitry Dementyev <dementyev@google.com>
|
|
|
|
Date: Wed, 3 Jan 2024 09:26:56 -0800
|
|
|
|
Subject: [PATCH] Close AccountManagerService.session after timeout.
|
|
|
|
|
|
|
|
Bug: 303905130
|
|
|
|
Bug: 316893159
|
|
|
|
Test: manual
|
|
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bb53f192e0ceaa026a083da156ef0cb0140f0c09)
|
|
|
|
Merged-In: Ib4cebf1750fc6324dc1c8853e0d716ea5e8ec073
|
|
|
|
Change-Id: Ib4cebf1750fc6324dc1c8853e0d716ea5e8ec073
|
|
|
|
|
|
|
|
Change-Id: I39afbe8f4bfc6b652365c798c64328797f27e5d4
|
|
|
|
---
|
|
|
|
.../android/server/accounts/AccountManagerService.java | 10 ++++++++++
|
|
|
|
1 file changed, 10 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
|
2024-03-09 11:25:46 -05:00
|
|
|
index 9069cd7ffe9c..b28e532c01bb 100644
|
2024-03-09 11:05:06 -05:00
|
|
|
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
|
|
|
|
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
|
2024-03-09 11:25:46 -05:00
|
|
|
@@ -182,6 +182,7 @@ public class AccountManagerService
|
2024-03-09 11:05:06 -05:00
|
|
|
|
|
|
|
final MessageHandler mMessageHandler;
|
|
|
|
|
|
|
|
+ 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;
|
2024-03-09 11:25:46 -05:00
|
|
|
@@ -4202,6 +4203,7 @@ public class AccountManagerService
|
2024-03-09 11:05:06 -05:00
|
|
|
synchronized (mSessions) {
|
|
|
|
mSessions.put(toString(), this);
|
|
|
|
}
|
|
|
|
+ scheduleTimeout();
|
|
|
|
if (response != null) {
|
|
|
|
try {
|
|
|
|
response.asBinder().linkToDeath(this, 0 /* flags */);
|
2024-03-09 11:25:46 -05:00
|
|
|
@@ -4357,6 +4359,11 @@ public class AccountManagerService
|
2024-03-09 11:05:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ private void scheduleTimeout() {
|
|
|
|
+ mMessageHandler.sendMessageDelayed(
|
|
|
|
+ mMessageHandler.obtainMessage(MESSAGE_TIMED_OUT, this), TIMEOUT_DELAY_MS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
public void cancelTimeout() {
|
|
|
|
mMessageHandler.removeMessages(MESSAGE_TIMED_OUT, this);
|
|
|
|
}
|
2024-03-09 11:25:46 -05:00
|
|
|
@@ -4393,6 +4400,9 @@ public class AccountManagerService
|
2024-03-09 11:05:06 -05:00
|
|
|
|
|
|
|
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,
|