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

Commit 656d1a78 authored by Danny Baumann's avatar Danny Baumann
Browse files

Allow applications to show the navigation bar in expanded desktop mode.

This is used by the settings app to show the navigation bar when editing
it.

Change-Id: Idc8fa5e49f31175dea603d7f1a1ef94ffab7249d
parent 49b819d9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2343,6 +2343,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 0x00000400;
    /**
     * @hide
     *
     * Flag to force showing the navigation bar even in expanded desktop mode.
     */
    public static final int SYSTEM_UI_FLAG_SHOW_NAVIGATION_IN_EXPANDED_DESKTOP = 0x00008000;
    /**
     * @deprecated Use {@link #SYSTEM_UI_FLAG_LOW_PROFILE} instead.
     */
+14 −38
Original line number Diff line number Diff line
@@ -1447,37 +1447,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                mHasSoftInput = hasSoftInput;
                updateRotation = true;
            }

            // Update navigation bar dimensions
            if (expandedDesktopHidesNavigationBar()) {
                // Set the navigation bar's dimensions to 0 in expanded desktop mode
                mNavigationBarWidthForRotation[mPortraitRotation]
                        = mNavigationBarWidthForRotation[mUpsideDownRotation]
                        = mNavigationBarWidthForRotation[mLandscapeRotation]
                        = mNavigationBarWidthForRotation[mSeascapeRotation]
                        = mNavigationBarHeightForRotation[mPortraitRotation]
                        = mNavigationBarHeightForRotation[mUpsideDownRotation]
                        = mNavigationBarHeightForRotation[mLandscapeRotation]
                        = mNavigationBarHeightForRotation[mSeascapeRotation] = 0;
            } else {
                // Height of the navigation bar when presented horizontally at bottom
                mNavigationBarHeightForRotation[mPortraitRotation] =
                mNavigationBarHeightForRotation[mUpsideDownRotation] =
                        mContext.getResources().getDimensionPixelSize(
                                com.android.internal.R.dimen.navigation_bar_height);
                mNavigationBarHeightForRotation[mLandscapeRotation] =
                mNavigationBarHeightForRotation[mSeascapeRotation] =
                        mContext.getResources().getDimensionPixelSize(
                                com.android.internal.R.dimen.navigation_bar_height_landscape);

                // Width of the navigation bar when presented vertically along one side
                mNavigationBarWidthForRotation[mPortraitRotation] =
                mNavigationBarWidthForRotation[mUpsideDownRotation] =
                mNavigationBarWidthForRotation[mLandscapeRotation] =
                mNavigationBarWidthForRotation[mSeascapeRotation] =
                        mContext.getResources().getDimensionPixelSize(
                                com.android.internal.R.dimen.navigation_bar_width);
            }
        }

        if (updateRotation) {
@@ -1821,7 +1790,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation) {
        if (mHasNavigationBar) {
        if (mHasNavigationBar && !expandedDesktopHidesNavigationBar()) {
            // For a basic navigation bar, when we are in landscape mode we place
            // the navigation bar to the side.
            if (mNavigationBarCanMove && fullWidth > fullHeight) {
@@ -1832,11 +1801,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation) {
        if (mHasSystemNavBar) {
        if (mHasSystemNavBar && !expandedDesktopHidesNavigationBar()) {
            // For the system navigation bar, we always place it at the bottom.
            return fullHeight - mNavigationBarHeightForRotation[rotation];
        }
        if (mHasNavigationBar) {
        if (mHasNavigationBar && !expandedDesktopHidesNavigationBar()) {
            // For a basic navigation bar, when we are in portrait mode we place
            // the navigation bar to the bottom.
            if (!mNavigationBarCanMove || fullWidth < fullHeight) {
@@ -2888,6 +2857,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            // For purposes of putting out fake window up to steal focus, we will
            // drive nav being hidden only by whether it is requested.
            boolean navVisible = (mLastSystemUiFlags&View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
            int navWidth = mNavigationBarWidthForRotation[displayRotation];
            int navHeight = mNavigationBarHeightForRotation[displayRotation];

            // When the navigation bar isn't visible, we put up a fake
            // input window to catch all touch events.  This way we can
@@ -2908,8 +2879,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            // For purposes of positioning and showing the nav bar, if we have
            // decided that it can't be hidden (because of the screen aspect ratio),
            // then take that into account.
            if (expandedDesktopHidesNavigationBar()) {
            if (expandedDesktopHidesNavigationBar()
                    && (mLastSystemUiFlags & View.SYSTEM_UI_FLAG_SHOW_NAVIGATION_IN_EXPANDED_DESKTOP) == 0) {
                navVisible = false;
                navWidth = 0;
                navHeight = 0;
            } else if (!mCanHideNavigationBar) {
                navVisible = true;
            }
@@ -2922,7 +2896,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                mNavigationBarOnBottom = (!mNavigationBarCanMove || displayWidth < displayHeight);
                if (mNavigationBarOnBottom) {
                    // It's a system nav bar or a portrait screen; nav bar goes on bottom.
                    int top = displayHeight - mNavigationBarHeightForRotation[displayRotation];
                    int top = displayHeight - navHeight;
                    mTmpNavigationFrame.set(0, top, displayWidth, displayHeight);
                    mStableBottom = mStableFullscreenBottom = mTmpNavigationFrame.top;
                    if (navVisible) {
@@ -2941,7 +2915,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    }
                } else {
                    // Landscape screen; nav bar goes to the right.
                    int left = displayWidth - mNavigationBarWidthForRotation[displayRotation];
                    int left = displayWidth - navWidth;
                    mTmpNavigationFrame.set(left, 0, displayWidth, displayHeight);
                    mStableRight = mStableFullscreenRight = mTmpNavigationFrame.left;
                    if (navVisible) {
@@ -3403,8 +3377,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private boolean shouldHideNavigationBarLw(int systemUiVisibility) {
        if (expandedDesktopHidesNavigationBar()) {
            if ((systemUiVisibility & View.SYSTEM_UI_FLAG_SHOW_NAVIGATION_IN_EXPANDED_DESKTOP) == 0) {
                return true;
            }
        }

        if (mCanHideNavigationBar) {
            if ((systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {