Skip to content

Commit 763480f

Browse files
fredquintanaAndroid (Google) Code Review
authored andcommitted
Merge "Fixed a bug that causes AccountManager calls to hang forever, eventually exhausting the binder threads in the gapps process, making it unusable." into ics-mr0
2 parents 5657b73 + 166466d commit 763480f

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

core/java/android/accounts/AccountManagerService.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public void onResult(Bundle result) {
499499
if (response != null) {
500500
try {
501501
if (result == null) {
502-
onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, "null bundle");
502+
response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, "null bundle");
503503
return;
504504
}
505505
if (Log.isLoggable(TAG, Log.VERBOSE)) {
@@ -1541,8 +1541,15 @@ public void onServiceDisconnected(ComponentName name) {
15411541
mAuthenticator = null;
15421542
IAccountManagerResponse response = getResponseAndClose();
15431543
if (response != null) {
1544-
onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
1545-
"disconnected");
1544+
try {
1545+
response.onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
1546+
"disconnected");
1547+
} catch (RemoteException e) {
1548+
if (Log.isLoggable(TAG, Log.VERBOSE)) {
1549+
Log.v(TAG, "Session.onServiceDisconnected: "
1550+
+ "caught RemoteException while responding", e);
1551+
}
1552+
}
15461553
}
15471554
}
15481555

@@ -1551,8 +1558,15 @@ public void onServiceDisconnected(ComponentName name) {
15511558
public void onTimedOut() {
15521559
IAccountManagerResponse response = getResponseAndClose();
15531560
if (response != null) {
1554-
onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
1555-
"timeout");
1561+
try {
1562+
response.onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
1563+
"timeout");
1564+
} catch (RemoteException e) {
1565+
if (Log.isLoggable(TAG, Log.VERBOSE)) {
1566+
Log.v(TAG, "Session.onTimedOut: caught RemoteException while responding",
1567+
e);
1568+
}
1569+
}
15561570
}
15571571
}
15581572

0 commit comments

Comments
 (0)