diff options
| -rw-r--r-- | services/core/java/com/android/server/location/ContextHubClientBroker.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/location/ContextHubClientBroker.java b/services/core/java/com/android/server/location/ContextHubClientBroker.java index 60f70c70b8e0..01ea8f41ca82 100644 --- a/services/core/java/com/android/server/location/ContextHubClientBroker.java +++ b/services/core/java/com/android/server/location/ContextHubClientBroker.java @@ -245,9 +245,15 @@ public class ContextHubClientBroker extends IContextHubClient.Stub public boolean unregisterIntent(PendingIntent pendingIntent) { ContextHubServiceUtil.checkPermissions(mContext); + boolean success = false; synchronized (this) { - return mPendingIntentRequest.unregister(pendingIntent); + success = mPendingIntentRequest.unregister(pendingIntent); + if (mCallbackInterface == null) { + close(); + } } + + return success; } /** @@ -407,6 +413,9 @@ public class ContextHubClientBroker extends IContextHubClient.Stub Log.w(TAG, "PendingIntent has been canceled, unregistering from client" + " (host endpoint ID " + mHostEndPointId + ")"); mPendingIntentRequest.clear(); + if (mCallbackInterface == null) { + close(); + } } } } |