Loading core/java/android/view/IWindowManager.aidl +13 −0 Original line number Diff line number Diff line Loading @@ -471,9 +471,22 @@ interface IWindowManager * Requests Keyboard Shortcuts from the displayed window. * * @param receiver The receiver to deliver the results to. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * @see #requestImeKeyboardShortcuts(IResultReceiver, int) */ void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId); /** * Requests Keyboard Shortcuts from currently selected IME. * * @param receiver The receiver to deliver the results to. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * @see #requestAppKeyboardShortcuts(IResultReceiver, int) */ void requestImeKeyboardShortcuts(IResultReceiver receiver, int deviceId); /** * Retrieves the current stable insets from the primary display. */ Loading core/java/android/view/WindowManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -1384,14 +1384,27 @@ public interface WindowManager extends ViewManager { "android.window.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED"; /** * Request for keyboard shortcuts to be retrieved asynchronously. * Request for app's keyboard shortcuts to be retrieved asynchronously. * * @param receiver The callback to be triggered when the result is ready. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * * @hide */ public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId); /** * Request for ime's keyboard shortcuts to be retrieved asynchronously. * * @param receiver The callback to be triggered when the result is ready. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * * @hide */ default void requestImeKeyboardShortcuts(KeyboardShortcutsReceiver receiver, int deviceId) {}; /** * Return the touch region for the current IME window, or an empty region if there is none. * Loading core/java/android/view/WindowManagerImpl.java +24 −2 Original line number Diff line number Diff line Loading @@ -215,7 +215,8 @@ public final class WindowManagerImpl implements WindowManager { @Override public void send(int resultCode, Bundle resultData) throws RemoteException { List<KeyboardShortcutGroup> result = resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY, android.view.KeyboardShortcutGroup.class); resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY, android.view.KeyboardShortcutGroup.class); receiver.onKeyboardShortcutsReceived(result); } }; Loading @@ -223,6 +224,27 @@ public final class WindowManagerImpl implements WindowManager { WindowManagerGlobal.getWindowManagerService() .requestAppKeyboardShortcuts(resultReceiver, deviceId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } @Override public void requestImeKeyboardShortcuts( final KeyboardShortcutsReceiver receiver, int deviceId) { IResultReceiver resultReceiver = new IResultReceiver.Stub() { @Override public void send(int resultCode, Bundle resultData) throws RemoteException { List<KeyboardShortcutGroup> result = resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY, android.view.KeyboardShortcutGroup.class); receiver.onKeyboardShortcutsReceived(result); } }; try { WindowManagerGlobal.getWindowManagerService() .requestImeKeyboardShortcuts(resultReceiver, deviceId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } Loading data/etc/services.core.protolog.json +6 −0 Original line number Diff line number Diff line Loading @@ -3379,6 +3379,12 @@ "group": "WM_DEBUG_REMOTE_ANIMATIONS", "at": "com\/android\/server\/wm\/RemoteAnimationController.java" }, "975028389": { "message": "unable to call receiver for empty keyboard shortcuts", "level": "ERROR", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "975275467": { "message": "Set animatingExit: reason=remove\/isAnimating win=%s", "level": "VERBOSE", Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java +40 −17 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.view.View.AccessibilityDelegate; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.view.WindowManager.KeyboardShortcutsReceiver; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Button; import android.widget.EditText; Loading Loading @@ -337,6 +336,12 @@ public final class KeyboardShortcutListSearch { mSpecialCharacterNames.put(KeyEvent.KEYCODE_MUHENKAN, "無変換"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_HENKAN, "変換"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_KATAKANA_HIRAGANA, "かな"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_ALT_LEFT, "Alt"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_ALT_RIGHT, "Alt"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_CTRL_LEFT, "Ctrl"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_CTRL_RIGHT, "Ctrl"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_SHIFT_LEFT, "Shift"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_SHIFT_RIGHT, "Shift"); mModifierNames.put(KeyEvent.META_META_ON, "Meta"); mModifierNames.put(KeyEvent.META_CTRL_ON, "Ctrl"); Loading Loading @@ -411,28 +416,46 @@ public final class KeyboardShortcutListSearch { mKeyCharacterMap = mBackupKeyCharacterMap; } private boolean mAppShortcutsReceived; private boolean mImeShortcutsReceived; @VisibleForTesting void showKeyboardShortcuts(int deviceId) { retrieveKeyCharacterMap(deviceId); mWindowManager.requestAppKeyboardShortcuts(new KeyboardShortcutsReceiver() { @Override public void onKeyboardShortcutsReceived( final List<KeyboardShortcutGroup> result) { mAppShortcutsReceived = false; mImeShortcutsReceived = false; mWindowManager.requestAppKeyboardShortcuts(result -> { // Add specific app shortcuts if (result.isEmpty()) { mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, false); } else { mSpecificAppGroup = reMapToKeyboardShortcutMultiMappingGroup(result); mSpecificAppGroup.addAll(reMapToKeyboardShortcutMultiMappingGroup(result)); mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, true); } mAppShortcutsReceived = true; if (mImeShortcutsReceived) { mergeAndShowKeyboardShortcutsGroups(); } }, deviceId); mWindowManager.requestImeKeyboardShortcuts(result -> { // Add specific Ime shortcuts if (!result.isEmpty()) { mInputGroup.addAll(reMapToKeyboardShortcutMultiMappingGroup(result)); } mImeShortcutsReceived = true; if (mAppShortcutsReceived) { mergeAndShowKeyboardShortcutsGroups(); } }, deviceId); } private void mergeAndShowKeyboardShortcutsGroups() { mFullShortsGroup.add(SHORTCUT_SYSTEM_INDEX, mSystemGroup); mFullShortsGroup.add(SHORTCUT_INPUT_INDEX, mInputGroup); mFullShortsGroup.add(SHORTCUT_OPENAPPS_INDEX, mOpenAppsGroup); mFullShortsGroup.add(SHORTCUT_SPECIFICAPP_INDEX, mSpecificAppGroup); showKeyboardShortcutSearchList(mFullShortsGroup); } }, deviceId); } // The original data structure is only for 1-to-1 shortcut mapping, so remap the old // data structure to the new data structure for handling the N-to-1 key mapping and other Loading Loading
core/java/android/view/IWindowManager.aidl +13 −0 Original line number Diff line number Diff line Loading @@ -471,9 +471,22 @@ interface IWindowManager * Requests Keyboard Shortcuts from the displayed window. * * @param receiver The receiver to deliver the results to. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * @see #requestImeKeyboardShortcuts(IResultReceiver, int) */ void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId); /** * Requests Keyboard Shortcuts from currently selected IME. * * @param receiver The receiver to deliver the results to. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * @see #requestAppKeyboardShortcuts(IResultReceiver, int) */ void requestImeKeyboardShortcuts(IResultReceiver receiver, int deviceId); /** * Retrieves the current stable insets from the primary display. */ Loading
core/java/android/view/WindowManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -1384,14 +1384,27 @@ public interface WindowManager extends ViewManager { "android.window.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED"; /** * Request for keyboard shortcuts to be retrieved asynchronously. * Request for app's keyboard shortcuts to be retrieved asynchronously. * * @param receiver The callback to be triggered when the result is ready. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * * @hide */ public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId); /** * Request for ime's keyboard shortcuts to be retrieved asynchronously. * * @param receiver The callback to be triggered when the result is ready. * @param deviceId The deviceId of KeyEvent by which this request is triggered, or -1 if it's * not triggered by a KeyEvent. * * @hide */ default void requestImeKeyboardShortcuts(KeyboardShortcutsReceiver receiver, int deviceId) {}; /** * Return the touch region for the current IME window, or an empty region if there is none. * Loading
core/java/android/view/WindowManagerImpl.java +24 −2 Original line number Diff line number Diff line Loading @@ -215,7 +215,8 @@ public final class WindowManagerImpl implements WindowManager { @Override public void send(int resultCode, Bundle resultData) throws RemoteException { List<KeyboardShortcutGroup> result = resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY, android.view.KeyboardShortcutGroup.class); resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY, android.view.KeyboardShortcutGroup.class); receiver.onKeyboardShortcutsReceived(result); } }; Loading @@ -223,6 +224,27 @@ public final class WindowManagerImpl implements WindowManager { WindowManagerGlobal.getWindowManagerService() .requestAppKeyboardShortcuts(resultReceiver, deviceId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } @Override public void requestImeKeyboardShortcuts( final KeyboardShortcutsReceiver receiver, int deviceId) { IResultReceiver resultReceiver = new IResultReceiver.Stub() { @Override public void send(int resultCode, Bundle resultData) throws RemoteException { List<KeyboardShortcutGroup> result = resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY, android.view.KeyboardShortcutGroup.class); receiver.onKeyboardShortcutsReceived(result); } }; try { WindowManagerGlobal.getWindowManagerService() .requestImeKeyboardShortcuts(resultReceiver, deviceId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } Loading
data/etc/services.core.protolog.json +6 −0 Original line number Diff line number Diff line Loading @@ -3379,6 +3379,12 @@ "group": "WM_DEBUG_REMOTE_ANIMATIONS", "at": "com\/android\/server\/wm\/RemoteAnimationController.java" }, "975028389": { "message": "unable to call receiver for empty keyboard shortcuts", "level": "ERROR", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "975275467": { "message": "Set animatingExit: reason=remove\/isAnimating win=%s", "level": "VERBOSE", Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java +40 −17 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.view.View.AccessibilityDelegate; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.view.WindowManager.KeyboardShortcutsReceiver; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Button; import android.widget.EditText; Loading Loading @@ -337,6 +336,12 @@ public final class KeyboardShortcutListSearch { mSpecialCharacterNames.put(KeyEvent.KEYCODE_MUHENKAN, "無変換"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_HENKAN, "変換"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_KATAKANA_HIRAGANA, "かな"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_ALT_LEFT, "Alt"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_ALT_RIGHT, "Alt"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_CTRL_LEFT, "Ctrl"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_CTRL_RIGHT, "Ctrl"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_SHIFT_LEFT, "Shift"); mSpecialCharacterNames.put(KeyEvent.KEYCODE_SHIFT_RIGHT, "Shift"); mModifierNames.put(KeyEvent.META_META_ON, "Meta"); mModifierNames.put(KeyEvent.META_CTRL_ON, "Ctrl"); Loading Loading @@ -411,28 +416,46 @@ public final class KeyboardShortcutListSearch { mKeyCharacterMap = mBackupKeyCharacterMap; } private boolean mAppShortcutsReceived; private boolean mImeShortcutsReceived; @VisibleForTesting void showKeyboardShortcuts(int deviceId) { retrieveKeyCharacterMap(deviceId); mWindowManager.requestAppKeyboardShortcuts(new KeyboardShortcutsReceiver() { @Override public void onKeyboardShortcutsReceived( final List<KeyboardShortcutGroup> result) { mAppShortcutsReceived = false; mImeShortcutsReceived = false; mWindowManager.requestAppKeyboardShortcuts(result -> { // Add specific app shortcuts if (result.isEmpty()) { mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, false); } else { mSpecificAppGroup = reMapToKeyboardShortcutMultiMappingGroup(result); mSpecificAppGroup.addAll(reMapToKeyboardShortcutMultiMappingGroup(result)); mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, true); } mAppShortcutsReceived = true; if (mImeShortcutsReceived) { mergeAndShowKeyboardShortcutsGroups(); } }, deviceId); mWindowManager.requestImeKeyboardShortcuts(result -> { // Add specific Ime shortcuts if (!result.isEmpty()) { mInputGroup.addAll(reMapToKeyboardShortcutMultiMappingGroup(result)); } mImeShortcutsReceived = true; if (mAppShortcutsReceived) { mergeAndShowKeyboardShortcutsGroups(); } }, deviceId); } private void mergeAndShowKeyboardShortcutsGroups() { mFullShortsGroup.add(SHORTCUT_SYSTEM_INDEX, mSystemGroup); mFullShortsGroup.add(SHORTCUT_INPUT_INDEX, mInputGroup); mFullShortsGroup.add(SHORTCUT_OPENAPPS_INDEX, mOpenAppsGroup); mFullShortsGroup.add(SHORTCUT_SPECIFICAPP_INDEX, mSpecificAppGroup); showKeyboardShortcutSearchList(mFullShortsGroup); } }, deviceId); } // The original data structure is only for 1-to-1 shortcut mapping, so remap the old // data structure to the new data structure for handling the N-to-1 key mapping and other Loading