summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2019-03-12 23:53:24 -0700
committer Winson Chung <winsonc@google.com> 2019-03-12 23:53:24 -0700
commit67f2028b7c3c8547fb2aa9f34ddf247cfadecb24 (patch)
treeaee2785fd9a0f8d21e8c3e433858fad30e0096e5
parent0eaa2f428f5544343439f03e1bf26cd55049dd96 (diff)
Always unbind before rebinding service
Bug: 128474150 Test: Manual Change-Id: I3af252f3e34976976efd65628326bce49758184c
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 4da8ca28f4c7..92195942ca06 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -107,6 +107,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
private IOverviewProxy mOverviewProxy;
private int mConnectionBackoffAttempts;
private @InteractionType int mInteractionFlags;
+ private boolean mBound;
private boolean mIsEnabled;
private int mCurrentBoundedUserId = -1;
private float mBackButtonAlpha;
@@ -510,16 +511,15 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
mHandler.removeCallbacks(mConnectionRunnable);
Intent launcherServiceIntent = new Intent(ACTION_QUICKSTEP)
.setPackage(mRecentsComponentName.getPackageName());
- boolean bound = false;
try {
- bound = mContext.bindServiceAsUser(launcherServiceIntent,
+ mBound = mContext.bindServiceAsUser(launcherServiceIntent,
mOverviewServiceConnection,
Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
UserHandle.of(mDeviceProvisionedController.getCurrentUser()));
} catch (SecurityException e) {
Log.e(TAG_OPS, "Unable to bind because of security error", e);
}
- if (bound) {
+ if (mBound) {
// Ensure that connection has been established even if it thinks it is bound
mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS);
} else {
@@ -573,9 +573,14 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
}
private void disconnectFromLauncherService() {
+ if (mBound) {
+ // Always unbind the service (ie. if called through onNullBinding or onBindingDied)
+ mContext.unbindService(mOverviewServiceConnection);
+ mBound = false;
+ }
+
if (mOverviewProxy != null) {
mOverviewProxy.asBinder().unlinkToDeath(mOverviewServiceDeathRcpt, 0);
- mContext.unbindService(mOverviewServiceConnection);
mOverviewProxy = null;
notifyBackButtonAlphaChanged(1f, false /* animate */);
notifyConnectionChanged();