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

Commit dba93565 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Break apart DISABLE_HOME and DISABLE_RECENT.

Additionally, start using setSystemUiVisibility() where
possible in the keyguard to allow activities and dialogs to
re-enable some of the navigation keys (notably: home but not
recents).

Finally, stop disabling MENU for activities atop the keyguard.

Bug: 5380495 // no home in driveabout, clock
Bug: 5396134 // able to show home/recent in keyguard
Change-Id: I04eb224554ee8cff79476b85148c4cda75bb0b62
parent 2984971d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -40,15 +40,20 @@ public class StatusBarManager {
    public static final int DISABLE_NOTIFICATION_TICKER
            = View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
    public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;
    public static final int DISABLE_NAVIGATION = View.STATUS_BAR_DISABLE_NAVIGATION;
    public static final int DISABLE_HOME = View.STATUS_BAR_DISABLE_HOME;
    public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
    public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
    public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;

    @Deprecated
    public static final int DISABLE_NAVIGATION = 
            View.STATUS_BAR_DISABLE_HOME | View.STATUS_BAR_DISABLE_RECENT;

    public static final int DISABLE_NONE = 0x00000000;

    public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
            | DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
            | DISABLE_SYSTEM_INFO| DISABLE_NAVIGATION | DISABLE_BACK | DISABLE_CLOCK;
            | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;

    private Context mContext;
    private IStatusBarService mService;
+25 −5
Original line number Diff line number Diff line
@@ -1891,12 +1891,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide only the navigation buttons.  Don't use this
     * Flag to hide only the home button.  Don't use this
     * unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     *
     * THIS DOES NOT DISABLE THE BACK BUTTON
     */
    public static final int STATUS_BAR_DISABLE_NAVIGATION = 0x00200000;
    public static final int STATUS_BAR_DISABLE_HOME = 0x00200000;
    /**
     * @hide
@@ -1920,6 +1918,28 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     */
    public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;
    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide only the recent apps button. Don't use this
     * unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     */
    public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;
    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility, etc. etc.
     *
     * This hides HOME and RECENT and is provided for compatibility with interim implementations.
     */
    @Deprecated
    public static final int STATUS_BAR_DISABLE_NAVIGATION = 
            STATUS_BAR_DISABLE_HOME | STATUS_BAR_DISABLE_RECENT;
    /**
     * @hide
     */
+5 −9
Original line number Diff line number Diff line
@@ -116,15 +116,13 @@ public class NavigationBarView extends LinearLayout {

        mDisabledFlags = disabledFlags;

        final boolean disableNavigation = ((disabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) != 0);
        final boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
        final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
        final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0);

        getBackButton()   .setVisibility(disableBack       ? View.INVISIBLE : View.VISIBLE);
        getHomeButton()   .setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE);
        getRecentsButton().setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE);
 
        getMenuButton()   .setVisibility((disableNavigation || !mShowMenu)
                                                           ? View.INVISIBLE : View.VISIBLE);
        getHomeButton()   .setVisibility(disableHome       ? View.INVISIBLE : View.VISIBLE);
        getRecentsButton().setVisibility(disableRecent     ? View.INVISIBLE : View.VISIBLE);
    }

    public void setMenuVisibility(final boolean show) {
@@ -136,9 +134,7 @@ public class NavigationBarView extends LinearLayout {

        mShowMenu = show;

        getMenuButton().setVisibility(
            (0 != (mDisabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) || !mShowMenu)
                ? View.INVISIBLE : View.VISIBLE);
        getMenuButton().setVisibility(mShowMenu ? View.VISIBLE : View.INVISIBLE);
    }

    public void setLowProfile(final boolean lightsOut) {
+9 −17
Original line number Diff line number Diff line
@@ -300,18 +300,6 @@ public class PhoneStatusBar extends StatusBar {
                    (NavigationBarView) View.inflate(context, R.layout.navigation_bar, null);

                mNavigationBarView.setDisabledFlags(mDisabled);

                sb.setOnSystemUiVisibilityChangeListener(
                    new View.OnSystemUiVisibilityChangeListener() {
                        @Override
                        public void onSystemUiVisibilityChange(int visibility) {
                            if (DEBUG) {
                                Slog.d(TAG, "systemUi: " + visibility);
                            }
                            boolean hide = (0 != (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION));
                            mNavigationBarView.setHidden(hide);
                        }
                    });
            }
        } catch (Resources.NotFoundException ex) {
            // no nav bar for you
@@ -1064,10 +1052,12 @@ public class PhoneStatusBar extends StatusBar {
        flagdbg.append(((diff  & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "SYSTEM_INFO" : "system_info");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_NAVIGATION) != 0) ? "NAVIGATION" : "navigation");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_NAVIGATION) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_BACK) != 0) ? "BACK" : "back");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_BACK) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_HOME) != 0) ? "HOME" : "home");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_HOME) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_RECENT) != 0) ? "RECENT" : "recent");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_RECENT) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_CLOCK) != 0) ? "CLOCK" : "clock");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
        flagdbg.append(">");
@@ -1083,11 +1073,13 @@ public class PhoneStatusBar extends StatusBar {
            }
        }

        if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
            // the nav bar will take care of DISABLE_NAVIGATION and DISABLE_BACK
        if ((diff & (StatusBarManager.DISABLE_HOME 
                        | StatusBarManager.DISABLE_RECENT 
                        | StatusBarManager.DISABLE_BACK)) != 0) {
            // the nav bar will take care of these
            if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state);

            if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
            if ((state & StatusBarManager.DISABLE_RECENT) != 0) {
                // close recents if it's visible
                mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
                mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
+11 −21
Original line number Diff line number Diff line
@@ -964,34 +964,24 @@ public class TabletStatusBar extends StatusBar implements
                mTicker.halt();
            }
        }
        if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
            setNavigationVisibility(state &
                    (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
        if ((diff & (StatusBarManager.DISABLE_RECENT 
                        | StatusBarManager.DISABLE_BACK 
                        | StatusBarManager.DISABLE_HOME)) != 0) {
            setNavigationVisibility(state);
        }
    }

    private void setNavigationVisibility(int visibility) {
        boolean disableNavigation = ((visibility & StatusBarManager.DISABLE_NAVIGATION) != 0);
        boolean disableHome = ((visibility & StatusBarManager.DISABLE_HOME) != 0);
        boolean disableRecent = ((visibility & StatusBarManager.DISABLE_RECENT) != 0);
        boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);

        Slog.i(TAG, "DISABLE_BACK: " + (disableBack ? "yes" : "no"));
        Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no"));
        mBackButton.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
        mHomeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
        mRecentButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);

        if (disableNavigation && disableBack) {
            mNavigationArea.setVisibility(View.INVISIBLE);
        } else {
            int backVisiblity = (disableBack ? View.INVISIBLE : View.VISIBLE);
            int navVisibility = (disableNavigation ? View.INVISIBLE : View.VISIBLE);

            mBackButton.setVisibility(backVisiblity);
            mHomeButton.setVisibility(navVisibility);
            mRecentButton.setVisibility(navVisibility);
            // don't change menu button visibility here

            mNavigationArea.setVisibility(View.VISIBLE);
        }

        mInputMethodSwitchButton.setScreenLocked(disableNavigation);
        mInputMethodSwitchButton.setScreenLocked(
                (visibility & StatusBarManager.DISABLE_SYSTEM_INFO) != 0);
    }

    private boolean hasTicker(Notification n) {
Loading