Fix crash:

W/BinderNative(  667): Uncaught exception from death notification
W/BinderNative(  667): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
W/BinderNative(  667): 	at android.util.ArraySet.valueAt(ArraySet.java:301)
W/BinderNative(  667): 	at com.android.server.am.ActiveServices.killServicesLocked(ActiveServices.java:2069)
W/BinderNative(  667): 	at com.android.server.am.ActivityManagerService.cleanUpApplicationRecordLocked(ActivityManagerService.java:12412)
W/BinderNative(  667): 	at com.android.server.am.ActivityManagerService.handleAppDiedLocked(ActivityManagerService.java:3596)
W/BinderNative(  667): 	at com.android.server.am.ActivityManagerService.appDiedLocked(ActivityManagerService.java:3744)
W/BinderNative(  667): 	at com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied(ActivityManagerService.java:1024)
W/BinderNative(  667): 	at android.os.BinderProxy.sendDeathNotice(Binder.java:493)
W/BinderNative(  667): 	at dalvik.system.NativeStart.run(Native Method)

Change-Id: I5cd03187dfaa8ec25c7db34ad10e2b6c089c468c
This commit is contained in:
Dianne Hackborn
2013-12-09 18:20:16 -08:00
parent 3732f8d078
commit 4190fc52e1

View File

@@ -2071,16 +2071,15 @@ public final class ActiveServices {
// Unless the process is persistent, this process record is going away,
// so make sure the service is cleaned out of it.
if (!app.persistent) {
app.services.remove(sr);
app.services.removeAt(i);
}
// Sanity check: if the service listed for the app is not one
// we actually are maintaining, drop it.
// we actually are maintaining, just let it drop.
if (smap.mServicesByName.get(sr.name) != sr) {
ServiceRecord cur = smap.mServicesByName.get(sr.name);
Slog.wtf(TAG, "Service " + sr + " in process " + app
+ " not same as in map: " + cur);
app.services.removeAt(i);
continue;
}