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

Commit b2b43368 authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Remove concept of system bar from window manager."

parents 5f73a7df 80f00c1f
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -71,9 +71,6 @@ interface IWindowManager


    void setOverscan(int displayId, int left, int top, int right, int bottom);
    void setOverscan(int displayId, int left, int top, int right, int bottom);


    // Is the device configured to have a full system bar for larger screens?
    boolean hasSystemNavBar();

    // These can only be called when holding the MANAGE_APP_TOKENS permission.
    // These can only be called when holding the MANAGE_APP_TOKENS permission.
    void pauseKeyDispatching(IBinder token);
    void pauseKeyDispatching(IBinder token);
    void resumeKeyDispatching(IBinder token);
    void resumeKeyDispatching(IBinder token);
+1 −1
Original line number Original line Diff line number Diff line
@@ -291,7 +291,7 @@ public class ViewConfiguration {
        if (!sHasPermanentMenuKeySet) {
        if (!sHasPermanentMenuKeySet) {
            IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
            IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
            try {
            try {
                sHasPermanentMenuKey = !wm.hasSystemNavBar() && !wm.hasNavigationBar();
                sHasPermanentMenuKey = !wm.hasNavigationBar();
                sHasPermanentMenuKeySet = true;
                sHasPermanentMenuKeySet = true;
            } catch (RemoteException ex) {
            } catch (RemoteException ex) {
                sHasPermanentMenuKey = false;
                sHasPermanentMenuKey = false;
+0 −6
Original line number Original line Diff line number Diff line
@@ -577,12 +577,6 @@ public interface WindowManagerPolicy {
     */
     */
    public int getAboveUniverseLayer();
    public int getAboveUniverseLayer();


    /**
     * Return true if the policy desires a full unified system nav bar.  Otherwise,
     * it is a phone-style status bar with optional nav bar.
     */
    public boolean hasSystemNavBar();

    /**
    /**
     * Return the display width available after excluding any screen
     * Return the display width available after excluding any screen
     * decorations that can never be removed.  That is, system bar or
     * decorations that can never be removed.  That is, system bar or
+15 −49
Original line number Original line Diff line number Diff line
@@ -230,7 +230,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mHeadless;
    boolean mHeadless;
    boolean mSafeMode;
    boolean mSafeMode;
    WindowState mStatusBar = null;
    WindowState mStatusBar = null;
    boolean mHasSystemNavBar;
    int mStatusBarHeight;
    int mStatusBarHeight;
    WindowState mNavigationBar = null;
    WindowState mNavigationBar = null;
    boolean mHasNavigationBar = false;
    boolean mHasNavigationBar = false;
@@ -1046,43 +1045,22 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / density;
        int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / density;


        if (shortSizeDp < 600) {
        if (shortSizeDp < 600) {
            // 0-599dp: "phone" UI with a separate status & navigation bar
            // Allow the navigation bar to move on small devices (phones).
            mHasSystemNavBar = false;
            mNavigationBarCanMove = true;
            mNavigationBarCanMove = true;
        } else if (shortSizeDp < 720) {
            // 600+dp: "phone" UI with modifications for larger screens
            mHasSystemNavBar = false;
            mNavigationBarCanMove = false;
        }
        }


        if (!mHasSystemNavBar) {
        mHasNavigationBar = mContext.getResources().getBoolean(
        mHasNavigationBar = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_showNavigationBar);
                com.android.internal.R.bool.config_showNavigationBar);
        // Allow a system property to override this. Used by the emulator.
        // Allow a system property to override this. Used by the emulator.
        // See also hasNavigationBar().
        // See also hasNavigationBar().
        String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
        String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
            if (! "".equals(navBarOverride)) {
        if ("1".equals(navBarOverride)) {
                if      (navBarOverride.equals("1")) mHasNavigationBar = false;
                else if (navBarOverride.equals("0")) mHasNavigationBar = true;
            }
        } else {
            mHasNavigationBar = false;
            mHasNavigationBar = false;
        } else if ("0".equals(navBarOverride)) {
            mHasNavigationBar = true;
        }
        }


        if (mHasSystemNavBar) {
        if (mHasNavigationBar) {
            // The system bar is always at the bottom.  If you are watching
            // a video in landscape, we don't need to hide it if we can still
            // show a 16:9 aspect ratio with it.
            int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
            int barHeightDp = mNavigationBarHeightForRotation[mLandscapeRotation]
                    * DisplayMetrics.DENSITY_DEFAULT / density;
            int aspect = ((shortSizeDp-barHeightDp) * 16) / longSizeDp;
            // We have computed the aspect ratio with the bar height taken
            // out to be 16:aspect.  If this is less than 9, then hiding
            // the navigation bar will provide more useful space for wide
            // screen movies.
            mCanHideNavigationBar = aspect < 9;
        } else if (mHasNavigationBar) {
            // The navigation bar is at the right in landscape; it seems always
            // The navigation bar is at the right in landscape; it seems always
            // useful to hide it for showing a video.
            // useful to hide it for showing a video.
            mCanHideNavigationBar = true;
            mCanHideNavigationBar = true;
@@ -1496,10 +1474,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return windowTypeToLayerLw(TYPE_SYSTEM_ERROR);
        return windowTypeToLayerLw(TYPE_SYSTEM_ERROR);
    }
    }


    public boolean hasSystemNavBar() {
        return mHasSystemNavBar;
    }

    public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation) {
    public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation) {
        if (mHasNavigationBar) {
        if (mHasNavigationBar) {
            // For a basic navigation bar, when we are in landscape mode we place
            // For a basic navigation bar, when we are in landscape mode we place
@@ -1512,10 +1486,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }
    }


    public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation) {
    public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation) {
        if (mHasSystemNavBar) {
            // For the system navigation bar, we always place it at the bottom.
            return fullHeight - mNavigationBarHeightForRotation[rotation];
        }
        if (mHasNavigationBar) {
        if (mHasNavigationBar) {
            // For a basic navigation bar, when we are in portrait mode we place
            // For a basic navigation bar, when we are in portrait mode we place
            // the navigation bar to the bottom.
            // the navigation bar to the bottom.
@@ -1531,16 +1501,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }
    }


    public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation) {
    public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation) {
        // If we don't have a system nav bar, then there is a separate status
        // There is a separate status bar at the top of the display.  We don't count that as part
        // bar at the top of the display.  We don't count that as part of the
        // of the fixed decor, since it can hide; however, for purposes of configurations,
        // fixed decor, since it can hide; however, for purposes of configurations,
        // we do want to exclude it since applications can't generally use that part
        // we do want to exclude it since applications can't generally use that part
        // of the screen.
        // of the screen.
        if (!mHasSystemNavBar) {
        return getNonDecorDisplayHeight(fullWidth, fullHeight, rotation) - mStatusBarHeight;
        return getNonDecorDisplayHeight(fullWidth, fullHeight, rotation) - mStatusBarHeight;
    }
    }
        return getNonDecorDisplayHeight(fullWidth, fullHeight, rotation);
    }


    @Override
    @Override
    public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs) {
    public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs) {
+0 −5
Original line number Original line Diff line number Diff line
@@ -7782,11 +7782,6 @@ public class WindowManagerService extends IWindowManager.Stub
        }
        }
    }
    }


    @Override
    public boolean hasSystemNavBar() {
        return mPolicy.hasSystemNavBar();
    }

    // -------------------------------------------------------------
    // -------------------------------------------------------------
    // Internals
    // Internals
    // -------------------------------------------------------------
    // -------------------------------------------------------------
Loading