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

Commit e5c8379d authored by Gopal Krishna Shukla's avatar Gopal Krishna Shukla Committed by Shibin George
Browse files

Reuse DeathRecipient object for StatusBarManagerService

With each SystemUI crash don't create new DeathRecipient
Object during registration of Status Bar

BUG: 111051603
Test: manual -Device booted up and running
Change-Id: Ie9219400c87722cd9e9fc13f106a052d692400ea
parent 73200d9a
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -77,6 +77,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;
@@ -90,6 +91,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;
@@ -713,16 +731,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()) {