diff options
| author | 2016-05-25 17:11:14 +0000 | |
|---|---|---|
| committer | 2016-05-25 17:11:15 +0000 | |
| commit | 7e10e630b4df10b9ce92953e98dec9d2cda1bfa2 (patch) | |
| tree | 7be495e9815e11bc446348aaaeb77c6ebfa71365 | |
| parent | 8fd8a4fde8356bf2d3eb2dda4b6d91e61e80c0c6 (diff) | |
| parent | 6d21e0d8d2da2a94e47af8b8f0b93a50972ab480 (diff) | |
Merge "QS API: Handle return value from bindServiceAsUser" into nyc-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java index 212f1790fd2d..16b11580a176 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java @@ -81,6 +81,8 @@ public class TileLifecycleManager extends BroadcastReceiver implements private IQSService mService; private boolean mUnbindImmediate; private TileChangeListener mChangeListener; + // Return value from bindServiceAsUser, determines whether safe to call unbind. + private boolean mIsBound; public TileLifecycleManager(Handler handler, Context context, Intent intent, UserHandle user) { mContext = context; @@ -132,7 +134,7 @@ public class TileLifecycleManager extends BroadcastReceiver implements } if (DEBUG) Log.d(TAG, "Binding service " + mIntent + " " + mUser); mBindTryCount++; - mContext.bindServiceAsUser(mIntent, this, + mIsBound = mContext.bindServiceAsUser(mIntent, this, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, mUser); } else { @@ -140,7 +142,10 @@ public class TileLifecycleManager extends BroadcastReceiver implements // Give it another chance next time it needs to be bound, out of kindness. mBindTryCount = 0; mWrapper = null; - mContext.unbindService(this); + if (mIsBound) { + mContext.unbindService(this); + mIsBound = false; + } } } |