diff options
| author | 2018-08-20 11:51:04 -0700 | |
|---|---|---|
| committer | 2018-08-20 11:51:04 -0700 | |
| commit | 9b68f016ee9ae9f2175c2a48b74cbed6d82aa80f (patch) | |
| tree | 8e74150c5e428cddd7c5c3cf4bdfa0c3037782b7 | |
| parent | 4ef06935d81df5c476a1509c692c0e43166b7a86 (diff) | |
| parent | e7cb864046a2a973d922efff26ccdc1367aca0b6 (diff) | |
Merge "Reuse DeathRecipient object for StatusBarManagerService" am: edeaddcd26
am: e7cb864046
Change-Id: I1f11b8f67e9b99d60d819f6760097e1c57dca49a
| -rw-r--r-- | services/core/java/com/android/server/statusbar/StatusBarManagerService.java | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 738b0ca4a74f..8cccbb1a5fb4 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -80,6 +80,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub { private int mDisabled2 = 0; private final Object mLock = new Object(); + private final DeathRecipient mDeathRecipient = new DeathRecipient(); // encompasses lights-out mode and other flags defined on View private int mSystemUiVisibility = 0; private int mFullscreenStackSysUiVisibility; @@ -93,6 +94,23 @@ public class StatusBarManagerService extends IStatusBarService.Stub { private IBinder mImeToken = null; private int mCurrentUserId; + private class DeathRecipient implements IBinder.DeathRecipient { + public void binderDied() { + mBar.asBinder().unlinkToDeath(this,0); + mBar = null; + notifyBarAttachChanged(); + } + + public void linkToDeath() { + try { + mBar.asBinder().linkToDeath(mDeathRecipient,0); + } catch (RemoteException e) { + Slog.e(TAG,"Unable to register Death Recipient for status bar", e); + } + } + + } + private class DisableRecord implements IBinder.DeathRecipient { int userId; String pkg; @@ -859,16 +877,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub { Slog.i(TAG, "registerStatusBar bar=" + bar); mBar = bar; - try { - mBar.asBinder().linkToDeath(new DeathRecipient() { - @Override - public void binderDied() { - mBar = null; - notifyBarAttachChanged(); - } - }, 0); - } catch (RemoteException e) { - } + mDeathRecipient.linkToDeath(); notifyBarAttachChanged(); synchronized (mIcons) { for (String slot : mIcons.keySet()) { |