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

Commit 3014e63f authored by Clara Bayarri's avatar Clara Bayarri Committed by Android (Google) Code Review
Browse files

Merge "Hook up Ctrl + '/' to SysUI for a Keyboard Shortcuts screen"

parents 741abfc1 f2debb1f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ oneway interface IStatusBar
    void cancelPreloadRecentApps();
    void showScreenPinningRequest();

    void showKeyboardShortcutsMenu();

    /**
     * Notifies the status bar that an app transition is pending to delay applying some flags with
     * visual impact until {@link #appTransitionReady} is called.
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ interface IStatusBarService
    void preloadRecentApps();
    void cancelPreloadRecentApps();

    void showKeyboardShortcutsMenu();

    /**
     * Notifies the status bar that an app transition is pending to delay applying some flags with
     * visual impact until {@link #appTransitionReady} is called.
+15 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 1023;
    protected static final int MSG_SHOW_NEXT_AFFILIATED_TASK = 1024;
    protected static final int MSG_SHOW_PREV_AFFILIATED_TASK = 1025;
    protected static final int MSG_SHOW_KEYBOARD_SHORTCUTS_MENU = 1026;

    protected static final boolean ENABLE_HEADS_UP = true;
    // scores above this threshold should be displayed in heads up mode.
@@ -1066,6 +1067,13 @@ public abstract class BaseStatusBar extends SystemUI implements
        mHandler.sendEmptyMessage(msg);
    }

    @Override
    public void showKeyboardShortcutsMenu() {
        int msg = MSG_SHOW_KEYBOARD_SHORTCUTS_MENU;
        mHandler.removeMessages(msg);
        mHandler.sendEmptyMessage(msg);
    }

    /** Jumps to the next affiliated task in the group. */
    public void showNextAffiliatedTask() {
        int msg = MSG_SHOW_NEXT_AFFILIATED_TASK;
@@ -1143,6 +1151,10 @@ public abstract class BaseStatusBar extends SystemUI implements
        }
    }

    protected void showKeyboardShortcuts() {
        Toast.makeText(mContext, "Show keyboard shortcuts screen", Toast.LENGTH_LONG).show();
    }

    protected void cancelPreloadingRecents() {
        if (mRecents != null) {
            mRecents.cancelPreloadingRecents();
@@ -1253,6 +1265,9 @@ public abstract class BaseStatusBar extends SystemUI implements
             case MSG_SHOW_PREV_AFFILIATED_TASK:
                  showRecentsPreviousAffiliatedTask();
                  break;
             case MSG_SHOW_KEYBOARD_SHORTCUTS_MENU:
                  showKeyboardShortcuts();
                  break;
            }
        }
    }
+13 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public class CommandQueue extends IStatusBar.Stub {
    private static final int MSG_APP_TRANSITION_STARTING    = 21 << MSG_SHIFT;
    private static final int MSG_ASSIST_DISCLOSURE          = 22 << MSG_SHIFT;
    private static final int MSG_START_ASSIST               = 23 << MSG_SHIFT;
    private static final int MSG_SHOW_KEYBOARD_SHORTCUTS    = 24 << MSG_SHIFT;

    public static final int FLAG_EXCLUDE_NONE = 0;
    public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -98,6 +99,7 @@ public class CommandQueue extends IStatusBar.Stub {
        public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
        public void toggleRecentApps();
        public void preloadRecentApps();
        public void showKeyboardShortcutsMenu();
        public void cancelPreloadRecentApps();
        public void setWindowState(int window, int state);
        public void buzzBeepBlinked();
@@ -224,6 +226,14 @@ public class CommandQueue extends IStatusBar.Stub {
        }
    }

    @Override
    public void showKeyboardShortcutsMenu() {
        synchronized (mList) {
            mHandler.removeMessages(MSG_SHOW_KEYBOARD_SHORTCUTS);
            mHandler.obtainMessage(MSG_SHOW_KEYBOARD_SHORTCUTS).sendToTarget();
        }
    }

    public void setWindowState(int window, int state) {
        synchronized (mList) {
            // don't coalesce these
@@ -360,6 +370,9 @@ public class CommandQueue extends IStatusBar.Stub {
                case MSG_CANCEL_PRELOAD_RECENT_APPS:
                    mCallbacks.cancelPreloadRecentApps();
                    break;
                case MSG_SHOW_KEYBOARD_SHORTCUTS:
                    mCallbacks.showKeyboardShortcutsMenu();
                    break;
                case MSG_SET_WINDOW_STATE:
                    mCallbacks.setWindowState(msg.arg1, msg.arg2);
                    break;
+17 −0
Original line number Diff line number Diff line
@@ -2835,6 +2835,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    }
                }
            }
        } else if (keyCode == KeyEvent.KEYCODE_SLASH && event.isMetaPressed()) {
            if (down) {
                if (repeatCount == 0) {
                    showKeyboardShortcutsMenu();
                }
            }
        } else if (keyCode == KeyEvent.KEYCODE_ASSIST) {
            if (down) {
                if (repeatCount == 0) {
@@ -3255,6 +3261,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    private void showKeyboardShortcutsMenu() {
        try {
            IStatusBarService statusbar = getStatusBarService();
            if (statusbar != null) {
                statusbar.showKeyboardShortcutsMenu();
            }
        } catch (RemoteException e) {
            Slog.e(TAG, "RemoteException when showing keyboard shortcuts menu", e);
        }
    }

    private void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHome) {
        mPreloadedRecentApps = false; // preloading no longer needs to be canceled
        try {
Loading