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

Commit 4042744b authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Disable hiding of the system bar on xlarge devices.

We treat the system bar as "outside" the available screen,
so activities will never be able to draw over (or under!)
that space.

Change-Id: I287a0b1e837e415cf08fc94053c4cc14a7753848
parent 0cc6f8f3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,5 +23,6 @@
    <!-- Component to be used as the status bar service.  Must implement the IStatusBar
         interface.  This name is in the ComponentName flattened format (package/class)  -->
    <string name="config_statusBarComponent">com.android.systemui/com.android.systemui.statusbar.tablet.TabletStatusBarService</string>
    <bool name="config_statusBarCanHide">false</bool>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
    <!-- Component to be used as the status bar service.  Must implement the IStatusBar
         interface.  This name is in the ComponentName flattened format (package/class)  -->
    <string name="config_statusBarComponent">com.android.systemui/com.android.systemui.statusbar.PhoneStatusBarService</string>
    <bool name="config_statusBarCanHide">true</bool>

    <!-- Do not translate. Defines the slots for the right-hand side icons.  That is to say, the
         icons in the status bar that are not notifications. -->
+19 −6
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    
    boolean mSafeMode;
    WindowState mStatusBar = null;
    boolean mStatusBarCanHide;
    final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>();
    WindowState mKeyguard = null;
    KeyguardViewMediator mKeyguardMediator;
@@ -546,6 +547,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.array.config_safeModeDisabledVibePattern);
        mSafeModeEnabledVibePattern = getLongIntArray(mContext.getResources(),
                com.android.internal.R.array.config_safeModeEnabledVibePattern);

        // Note: the Configuration is not stable here, so we cannot load mStatusBarCanHide from
        // config_statusBarCanHide because the latter depends on the screen size
    }

    public void updateSettings() {
@@ -954,6 +958,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
                }
                mStatusBar = win;

                // The Configuration will be stable by now, so we can load this
                mStatusBarCanHide = mContext.getResources().getBoolean(
                        com.android.internal.R.bool.config_statusBarCanHide);

                break;
            case TYPE_STATUS_BAR_PANEL:
                mContext.enforceCallingOrSelfPermission(
@@ -1212,7 +1221,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset) {
        final int fl = attrs.flags;
        
        if ((fl &
        if (mStatusBarCanHide && (fl &
                (FLAG_LAYOUT_IN_SCREEN | FLAG_FULLSCREEN | FLAG_LAYOUT_INSET_DECOR))
                == (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {
            contentInset.set(mCurLeft, mCurTop, mW - mCurRight, mH - mCurBottom);
@@ -1340,7 +1349,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            attrs.gravity = Gravity.BOTTOM;
            mDockLayer = win.getSurfaceLayer();
        } else {
            if ((fl &
            if (mStatusBarCanHide && (fl &
                    (FLAG_LAYOUT_IN_SCREEN | FLAG_FULLSCREEN | FLAG_LAYOUT_INSET_DECOR))
                    == (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {
                // This is the case for a normal activity window: we want it
@@ -1372,7 +1381,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    vf.right = mCurRight;
                    vf.bottom = mCurBottom;
                }
            } else if ((fl & FLAG_LAYOUT_IN_SCREEN) != 0) {
            } else if (mStatusBarCanHide && (fl & FLAG_LAYOUT_IN_SCREEN) != 0) {
                // A window that has requested to fill the entire screen just
                // gets everything, period.
                pf.left = df.left = cf.left = 0;
@@ -1516,9 +1525,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                boolean hideStatusBar =
                    (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
                if (hideStatusBar) {
                    if (mStatusBarCanHide) {
                        if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar");
                        if (mStatusBar.hideLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;
                        hiding = true;
                    } else if (localLOGV) {
                        Log.v(TAG, "Preventing status bar from hiding by policy");
                    }
                } else {
                    if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar");
                    if (mStatusBar.showLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;