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

Commit 9ded1170 authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Shortcut helper now shows correct application launch shortcuts.

Prior to this change, shortcut helper would build a list of application
launch shortuts based on the content of aosp bookmarks.xml. This list
would then be incorrect on devices with their own version of the file.

With this change, we request the shortcuts from system server after it
has parsed bookmarks.xml, so the set of shortcuts is complete and
correct.

Bug: 312452252
Flag: com.android.systemui.fetch_bookmarks_xml_keyboard_shortcuts
Test: atest KeyboardShortcutsTest KeyboardShortcutListSearchTest ModifierShortcutManagerTests ModifierShortcutTests
Change-Id: I4a3d34f93b0be12e5c48f5f8b3938c3e9f1618de
parent c52ed01e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.view.IWallpaperVisibilityListener;
import android.view.IWindow;
import android.view.IWindowSession;
import android.view.IWindowSessionCallback;
import android.view.KeyboardShortcutGroup;
import android.view.KeyEvent;
import android.view.InputEvent;
import android.view.InsetsState;
@@ -1095,4 +1096,11 @@ interface IWindowManager

    boolean transferTouchGesture(in InputTransferToken transferFromToken,
            in InputTransferToken transferToToken);

    /**
     * Request the application launch keyboard shortcuts the system has defined.
     *
     * @param deviceId The id of the {@link InputDevice} that will handle the shortcut.
     */
    KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId);
}
+3 −0
Original line number Diff line number Diff line
package android.view;

@JavaOnlyStableParcelable parcelable KeyboardShortcutGroup;
+18 −1
Original line number Diff line number Diff line
@@ -81,12 +81,29 @@ public final class KeyboardShortcutInfo implements Parcelable {
     *     {@link KeyEvent#META_SYM_ON}.
     */
    public KeyboardShortcutInfo(CharSequence label, char baseCharacter, int modifiers) {
        this(label, null, baseCharacter, modifiers);
    }

    /**
     * @param label The label that identifies the action performed by this shortcut.
     * @param icon An icon that identifies the action performed by this shortcut.
     * @param baseCharacter The character that triggers the shortcut.
     * @param modifiers The set of modifiers that, combined with the key, trigger the shortcut.
     *     These should be a combination of {@link KeyEvent#META_CTRL_ON},
     *     {@link KeyEvent#META_SHIFT_ON}, {@link KeyEvent#META_META_ON},
     *     {@link KeyEvent#META_ALT_ON}, {@link KeyEvent#META_FUNCTION_ON} and
     *     {@link KeyEvent#META_SYM_ON}.
     *
     * @hide
     */
    public KeyboardShortcutInfo(
            CharSequence label, @Nullable Icon icon, char baseCharacter, int modifiers) {
        mLabel = label;
        checkArgument(baseCharacter != MIN_VALUE);
        mBaseCharacter = baseCharacter;
        mKeycode = KeyEvent.KEYCODE_UNKNOWN;
        mModifiers = modifiers;
        mIcon = null;
        mIcon = icon;
    }

    private KeyboardShortcutInfo(Parcel source) {
+9 −0
Original line number Diff line number Diff line
@@ -1667,6 +1667,15 @@ public interface WindowManager extends ViewManager {
     */
    public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);

    /**
     * Request the application launch keyboard shortcuts the system has defined.
     *
     * @param deviceId The id of the {@link InputDevice} that will handle the shortcut.
     *
     * @hide
     */
    KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId);

    /**
     * Request for ime's keyboard shortcuts to be retrieved asynchronously.
     *
+10 −0
Original line number Diff line number Diff line
@@ -236,6 +236,16 @@ public final class WindowManagerImpl implements WindowManager {
        }
    }

    @Override
    public KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId) {
        try {
            return WindowManagerGlobal.getWindowManagerService()
                    .getApplicationLaunchKeyboardShortcuts(deviceId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @Override
    public void requestImeKeyboardShortcuts(
            final KeyboardShortcutsReceiver receiver, int deviceId) {
Loading