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

Commit 5d9a184e authored by Aran Ink's avatar Aran Ink
Browse files

Force-clear nav bar flags when phone finishes booting.

It looks like there may be a bug in StatusBarManager that prevents it from correctly hiding the home button
if flags to show the home button have not been sent since a restart.

This side-steps that problem by sending an empty dismiss call once after the phone restarts, then following it
immediately with a call to hide the home/recents buttons as needed.

Test: Manual -- no home button visible after restarting phone and opening power menu on lock screen.

Bug: 155663717
Change-Id: I489472e364b34390d20baa28d838687498abe69c
parent 7ccfc086
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
        @Override
        public void onBouncerVisiblityChanged(boolean shown) {
            synchronized (KeyguardViewMediator.this) {
                adjustStatusBarLocked(shown);
                adjustStatusBarLocked(shown, false);
            }
        }

@@ -2003,10 +2003,12 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
    }

    private void adjustStatusBarLocked() {
        adjustStatusBarLocked(false /* forceHideHomeRecentsButtons */);
        adjustStatusBarLocked(false /* forceHideHomeRecentsButtons */,
                false /* forceClearFlags */);
    }

    private void adjustStatusBarLocked(boolean forceHideHomeRecentsButtons) {
    private void adjustStatusBarLocked(boolean forceHideHomeRecentsButtons,
            boolean forceClearFlags) {
        if (mStatusBarManager == null) {
            mStatusBarManager = (StatusBarManager)
                    mContext.getSystemService(Context.STATUS_BAR_SERVICE);
@@ -2018,6 +2020,13 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
            // Disable aspects of the system/status/navigation bars that must not be re-enabled by
            // windows that appear on top, ever
            int flags = StatusBarManager.DISABLE_NONE;

            // TODO (b/155663717) After restart, status bar will not properly hide home button
            //  unless disable is called to show un-hide it once first
            if (forceClearFlags) {
                mStatusBarManager.disable(flags);
            }

            if (forceHideHomeRecentsButtons || isShowingAndNotOccluded()) {
                if (!mShowHomeOverLockscreen || !mInGestureNavigationMode) {
                    flags |= StatusBarManager.DISABLE_HOME;
@@ -2141,6 +2150,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
    public void onBootCompleted() {
        synchronized (this) {
            mBootCompleted = true;
            adjustStatusBarLocked(false, true);
            if (mBootSendUserPresent) {
                sendUserPresentBroadcast();
            }