Handle stopping of services with still bound applications.

When a service is stopping we get unbindFinished when all connections
are unbinded. If applications are still bound to this Service we will
rebind the connection making the service hang in stopping state. This
fixed issues with ANR during CTS test
android.os.cts.BinderTest#testTransact

Change-Id: I9402aebd0d2d0fa3e0e6381fb51d3189d530f31b
This commit is contained in:
Per Edelberg
2010-08-30 20:01:35 +02:00
committed by Johan Redestig
parent 69ebb984f2
commit 78f9fffca4

View File

@@ -9694,8 +9694,10 @@ public final class ActivityManagerService extends ActivityManagerNative
if (DEBUG_SERVICE) Slog.v(TAG, "unbindFinished in " + r
+ " at " + b + ": apps="
+ (b != null ? b.apps.size() : 0));
boolean inStopping = mStoppingServices.contains(r);
if (b != null) {
if (b.apps.size() > 0) {
if (b.apps.size() > 0 && !inStopping) {
// Applications have already bound since the last
// unbind, so just rebind right here.
requestServiceBindingLocked(r, b, true);
@@ -9706,7 +9708,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
serviceDoneExecutingLocked(r, mStoppingServices.contains(r));
serviceDoneExecutingLocked(r, inStopping);
Binder.restoreCallingIdentity(origId);
}