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

Commit b9938df3 authored by Jens Doll's avatar Jens Doll
Browse files

Pie controls: Fix flickering nav bar in full screen

On rare occasions the pie service will deadlock. When this
happens, full screen mode can no longer hide the
navigation bar, since it is masked out internally.

This commit switchs from a self cooked mask mechanism within
the WindowManager to the private flag
WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_NAV_BAR.

Note that this will avoid flickering when pie service get
stuck in the activation path, but it will not resolve the
deadlock.

Change-Id: I2b64867081b37d9d6070df8086975e4327d97f5d
parent 37ec53f0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ public class PieController implements BaseStatusBar.NavigationBarCallback, PieVi
                | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                PixelFormat.TRANSLUCENT);
        lp.privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_NAV_BAR;
        // This title is for debugging only. See: dumpsys window
        lp.setTitle("PieControlPanel");
        lp.windowAnimations = android.R.style.Animation;
+0 −9
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ public class PieService extends IPieService.Stub {
                Slog.d(TAG, "Restore listener state");
            }
            if (mActive) {
                mWindowManager.resetStatusBarVisibilityMask();
                mInputFilter.unlockFilter();
                mActive = false;
                synchronized (mLock) {
@@ -319,9 +318,6 @@ public class PieService extends IPieService.Stub {
        if (mActiveRecord != null) {
            Slog.w(TAG, "Handing activition while another activition is still in progress");
        }
        if (!mWindowManager.updateStatusBarVisibilityMask(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)) {
            return false;
        }
        synchronized(mLock) {
            PieActivationListenerRecord target = null;
            for (PieActivationListenerRecord record : mPieActivationListener) {
@@ -338,11 +334,6 @@ public class PieService extends IPieService.Stub {
                mActiveRecord = target;
            }
        }
        if (mActiveRecord != null) {
            mWindowManager.reevaluateStatusBarVisibility();
        } else {
            mWindowManager.resetStatusBarVisibilityMask();
        }
        return mActiveRecord != null;
    }

+0 −33
Original line number Diff line number Diff line
@@ -487,12 +487,6 @@ public class WindowManagerService extends IWindowManager.Stub

    int mLastStatusBarVisibility = 0;

    /**
     * Mask used to control the visibility of the status and navigation bar for short periods
     * of time. (e.g. during pie controls)
     */
    int mStatusBarVisibilityMask = 0;

    // State while inside of layoutAndPlaceSurfacesLocked().
    boolean mFocusMayChange;

@@ -10400,7 +10394,6 @@ public class WindowManagerService extends IWindowManager.Stub
        synchronized (mWindowMap) {
            mLastStatusBarVisibility = visibility;
            visibility = mPolicy.adjustSystemUiVisibilityLw(visibility);
            visibility &= ~mStatusBarVisibilityMask;
            updateStatusBarVisibilityLocked(visibility);
        }
    }
@@ -10439,7 +10432,6 @@ public class WindowManagerService extends IWindowManager.Stub
    public void reevaluateStatusBarVisibility() {
        synchronized (mWindowMap) {
            int visibility = mPolicy.adjustSystemUiVisibilityLw(mLastStatusBarVisibility);
            visibility &= ~mStatusBarVisibilityMask;
            updateStatusBarVisibilityLocked(visibility);
            performLayoutAndPlaceSurfacesLocked();
        }
@@ -10534,31 +10526,6 @@ public class WindowManagerService extends IWindowManager.Stub
        Binder.restoreCallingIdentity(origId);
    }

    /**
     * Tries to set the status bar visibilty mask. This will fail if the mask was set already.
     *
     * @param mask specifies the positive mask. E.g. all bit that should be masked out are set.
     */
    public boolean updateStatusBarVisibilityMask(int mask) {
        boolean result = false;
        synchronized(mWindowMap) {
            if (mStatusBarVisibilityMask == 0) {
                mStatusBarVisibilityMask = mask;
                result = true;
            }
        }
        return result;
    }

    /**
     * Call this, only if {@link #updateStatusBarVisibilityMask(int)} returned {@code true}.
     */
    public void resetStatusBarVisibilityMask() {
        synchronized(mWindowMap) {
            mStatusBarVisibilityMask = 0;
        }
    }

    void dumpPolicyLocked(PrintWriter pw, String[] args, boolean dumpAll) {
        pw.println("WINDOW MANAGER POLICY STATE (dumpsys window policy)");
        mPolicy.dump("    ", pw, args);