Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7cb8640 authored by Gopal Krishna Shukla's avatar Gopal Krishna Shukla Committed by android-build-merger
Browse files

Merge "Reuse DeathRecipient object for StatusBarManagerService"

am: edeaddcd

Change-Id: I2c5fb035f65cbb819bf28eefbf7db6307cd4aa97
parents 5e2a54ab edeaddcd
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -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()) {