OSDN Git Service

Fix crash in ManagedApplicationService.
authorRuben Brunk <rubenbrunk@google.com>
Wed, 23 Mar 2016 02:12:25 +0000 (19:12 -0700)
committerRuben Brunk <rubenbrunk@google.com>
Wed, 23 Mar 2016 02:12:25 +0000 (19:12 -0700)
- Prevent unbindService call in case where we
  are calling disconnect on a service that has crashed.

Bug: 27706497
Change-Id: Ibb24087685f5152b6d8e339bd1e9dfa29be2730b

services/core/java/com/android/server/utils/ManagedApplicationService.java

index ad8acef..0f251fd 100644 (file)
@@ -62,8 +62,6 @@ public class ManagedApplicationService {
     private IInterface mBoundInterface;
     private PendingEvent mPendingEvent;
 
-
-
     private ManagedApplicationService(final Context context, final ComponentName component,
             final int userId, int clientLabel, String settingsAction,
             BinderChecker binderChecker) {
@@ -211,6 +209,7 @@ public class ManagedApplicationService {
                         } else {
                             // Service connection wasn't pending, must have been disconnected
                             mContext.unbindService(this);
+                            return;
                         }
 
                         try {
@@ -242,6 +241,8 @@ public class ManagedApplicationService {
                 @Override
                 public void onServiceDisconnected(ComponentName componentName) {
                     Slog.w(TAG, "Service disconnected: " + intent);
+                    mConnection = null;
+                    mBoundInterface = null;
                 }
             };