Loading core/api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ package android { field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS"; field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE"; field public static final String RECORD_BACKGROUND_AUDIO = "android.permission.RECORD_BACKGROUND_AUDIO"; field public static final String REMAP_MODIFIER_KEYS = "android.permission.REMAP_MODIFIER_KEYS"; field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS"; field public static final String REQUEST_UNIQUE_ID_ATTESTATION = "android.permission.REQUEST_UNIQUE_ID_ATTESTATION"; field public static final String RESET_APP_ERRORS = "android.permission.RESET_APP_ERRORS"; Loading Loading @@ -1294,8 +1295,11 @@ package android.hardware.input { public final class InputManager { method public void addUniqueIdAssociation(@NonNull String, @NonNull String); method @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public void clearAllModifierKeyRemappings(); method @Nullable public String getCurrentKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier); method @NonNull public java.util.List<java.lang.String> getKeyboardLayoutDescriptorsForInputDevice(@NonNull android.view.InputDevice); method @NonNull @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public java.util.Map<java.lang.Integer,java.lang.Integer> getModifierKeyRemapping(); method @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public void remapModifierKey(int, int); method @RequiresPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT) public void removeKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier, @NonNull String); method public void removeUniqueIdAssociation(@NonNull String); method @RequiresPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT) public void setCurrentKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier, @NonNull String); Loading core/java/android/hardware/input/IInputManager.aidl +16 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,22 @@ interface IInputManager { String[] getKeyboardLayoutListForInputDevice(in InputDeviceIdentifier identifier, int userId, in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype); // Modifier key remapping APIs. @EnforcePermission("REMAP_MODIFIER_KEYS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.REMAP_MODIFIER_KEYS)") void remapModifierKey(int fromKey, int toKey); @EnforcePermission("REMAP_MODIFIER_KEYS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.REMAP_MODIFIER_KEYS)") void clearAllModifierKeyRemappings(); @EnforcePermission("REMAP_MODIFIER_KEYS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.REMAP_MODIFIER_KEYS)") Map getModifierKeyRemapping(); // Registers an input devices changed listener. void registerInputDevicesChangedListener(IInputDevicesChangedListener listener); Loading core/java/android/hardware/input/InputManager.java +80 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; Loading Loading @@ -253,6 +254,31 @@ public final class InputManager { }) public @interface SwitchState {} /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = { "REMAPPABLE_MODIFIER_KEY_" }, value = { RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_CTRL_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_CTRL_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_META_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_META_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_ALT_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_ALT_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_SHIFT_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_SHIFT_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_CAPS_LOCK, }) public @interface RemappableModifierKey { int REMAPPABLE_MODIFIER_KEY_CTRL_LEFT = KeyEvent.KEYCODE_CTRL_LEFT; int REMAPPABLE_MODIFIER_KEY_CTRL_RIGHT = KeyEvent.KEYCODE_CTRL_RIGHT; int REMAPPABLE_MODIFIER_KEY_META_LEFT = KeyEvent.KEYCODE_META_LEFT; int REMAPPABLE_MODIFIER_KEY_META_RIGHT = KeyEvent.KEYCODE_META_RIGHT; int REMAPPABLE_MODIFIER_KEY_ALT_LEFT = KeyEvent.KEYCODE_ALT_LEFT; int REMAPPABLE_MODIFIER_KEY_ALT_RIGHT = KeyEvent.KEYCODE_ALT_RIGHT; int REMAPPABLE_MODIFIER_KEY_SHIFT_LEFT = KeyEvent.KEYCODE_SHIFT_LEFT; int REMAPPABLE_MODIFIER_KEY_SHIFT_RIGHT = KeyEvent.KEYCODE_SHIFT_RIGHT; int REMAPPABLE_MODIFIER_KEY_CAPS_LOCK = KeyEvent.KEYCODE_CAPS_LOCK; } /** * Switch State: Unknown. * Loading Loading @@ -853,6 +879,60 @@ public final class InputManager { } } /** * Remaps modifier keys. Remapping a modifier key to itself will clear any previous remappings * for that key. * * @param fromKey The modifier key getting remapped. * @param toKey The modifier key that it is remapped to. * * @hide */ @TestApi @RequiresPermission(Manifest.permission.REMAP_MODIFIER_KEYS) public void remapModifierKey(@RemappableModifierKey int fromKey, @RemappableModifierKey int toKey) { try { mIm.remapModifierKey(fromKey, toKey); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * Clears all existing modifier key remappings * * @hide */ @TestApi @RequiresPermission(Manifest.permission.REMAP_MODIFIER_KEYS) public void clearAllModifierKeyRemappings() { try { mIm.clearAllModifierKeyRemappings(); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * Provides the current modifier key remapping * * @return a {fromKey, toKey} map that contains the existing modifier key remappings.. * {@link RemappableModifierKey} * * @hide */ @TestApi @NonNull @RequiresPermission(Manifest.permission.REMAP_MODIFIER_KEYS) public Map<Integer, Integer> getModifierKeyRemapping() { try { return mIm.getModifierKeyRemapping(); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * Gets the TouchCalibration applied to the specified input device's coordinates. * Loading core/res/AndroidManifest.xml +8 −0 Original line number Diff line number Diff line Loading @@ -6776,6 +6776,14 @@ @hide --> <permission android:name="android.permission.HANDLE_QUERY_PACKAGE_RESTART" android:protectionLevel="signature" /> <!-- Allows low-level access to re-mapping modifier keys. <p>Not for use by third-party applications. @hide @TestApi --> <permission android:name="android.permission.REMAP_MODIFIER_KEYS" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.HANDLE_QUERY_PACKAGE_RESTART" /> <!-- Allows financed device kiosk apps to perform actions on the Device Lock service Loading packages/Shell/AndroidManifest.xml +3 −0 Original line number Diff line number Diff line Loading @@ -774,6 +774,9 @@ <!-- Permissions required for CTS test - CtsAppFgsTestCases --> <uses-permission android:name="android.permission.USE_EXACT_ALARM" /> <!-- Permission required for CTS test - CtsHardwareTestCases --> <uses-permission android:name="android.permission.REMAP_MODIFIER_KEYS" /> <!-- Permissions required for CTS test - CtsAppFgsTestCases --> <uses-permission android:name="android.permission.health.READ_ACTIVE_CALORIES_BURNED" /> <uses-permission android:name="android.permission.health.READ_BASAL_BODY_TEMPERATURE" /> Loading Loading
core/api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ package android { field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS"; field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE"; field public static final String RECORD_BACKGROUND_AUDIO = "android.permission.RECORD_BACKGROUND_AUDIO"; field public static final String REMAP_MODIFIER_KEYS = "android.permission.REMAP_MODIFIER_KEYS"; field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS"; field public static final String REQUEST_UNIQUE_ID_ATTESTATION = "android.permission.REQUEST_UNIQUE_ID_ATTESTATION"; field public static final String RESET_APP_ERRORS = "android.permission.RESET_APP_ERRORS"; Loading Loading @@ -1294,8 +1295,11 @@ package android.hardware.input { public final class InputManager { method public void addUniqueIdAssociation(@NonNull String, @NonNull String); method @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public void clearAllModifierKeyRemappings(); method @Nullable public String getCurrentKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier); method @NonNull public java.util.List<java.lang.String> getKeyboardLayoutDescriptorsForInputDevice(@NonNull android.view.InputDevice); method @NonNull @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public java.util.Map<java.lang.Integer,java.lang.Integer> getModifierKeyRemapping(); method @RequiresPermission(android.Manifest.permission.REMAP_MODIFIER_KEYS) public void remapModifierKey(int, int); method @RequiresPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT) public void removeKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier, @NonNull String); method public void removeUniqueIdAssociation(@NonNull String); method @RequiresPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT) public void setCurrentKeyboardLayoutForInputDevice(@NonNull android.hardware.input.InputDeviceIdentifier, @NonNull String); Loading
core/java/android/hardware/input/IInputManager.aidl +16 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,22 @@ interface IInputManager { String[] getKeyboardLayoutListForInputDevice(in InputDeviceIdentifier identifier, int userId, in InputMethodInfo imeInfo, in InputMethodSubtype imeSubtype); // Modifier key remapping APIs. @EnforcePermission("REMAP_MODIFIER_KEYS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.REMAP_MODIFIER_KEYS)") void remapModifierKey(int fromKey, int toKey); @EnforcePermission("REMAP_MODIFIER_KEYS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.REMAP_MODIFIER_KEYS)") void clearAllModifierKeyRemappings(); @EnforcePermission("REMAP_MODIFIER_KEYS") @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.REMAP_MODIFIER_KEYS)") Map getModifierKeyRemapping(); // Registers an input devices changed listener. void registerInputDevicesChangedListener(IInputDevicesChangedListener listener); Loading
core/java/android/hardware/input/InputManager.java +80 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; Loading Loading @@ -253,6 +254,31 @@ public final class InputManager { }) public @interface SwitchState {} /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = { "REMAPPABLE_MODIFIER_KEY_" }, value = { RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_CTRL_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_CTRL_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_META_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_META_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_ALT_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_ALT_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_SHIFT_LEFT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_SHIFT_RIGHT, RemappableModifierKey.REMAPPABLE_MODIFIER_KEY_CAPS_LOCK, }) public @interface RemappableModifierKey { int REMAPPABLE_MODIFIER_KEY_CTRL_LEFT = KeyEvent.KEYCODE_CTRL_LEFT; int REMAPPABLE_MODIFIER_KEY_CTRL_RIGHT = KeyEvent.KEYCODE_CTRL_RIGHT; int REMAPPABLE_MODIFIER_KEY_META_LEFT = KeyEvent.KEYCODE_META_LEFT; int REMAPPABLE_MODIFIER_KEY_META_RIGHT = KeyEvent.KEYCODE_META_RIGHT; int REMAPPABLE_MODIFIER_KEY_ALT_LEFT = KeyEvent.KEYCODE_ALT_LEFT; int REMAPPABLE_MODIFIER_KEY_ALT_RIGHT = KeyEvent.KEYCODE_ALT_RIGHT; int REMAPPABLE_MODIFIER_KEY_SHIFT_LEFT = KeyEvent.KEYCODE_SHIFT_LEFT; int REMAPPABLE_MODIFIER_KEY_SHIFT_RIGHT = KeyEvent.KEYCODE_SHIFT_RIGHT; int REMAPPABLE_MODIFIER_KEY_CAPS_LOCK = KeyEvent.KEYCODE_CAPS_LOCK; } /** * Switch State: Unknown. * Loading Loading @@ -853,6 +879,60 @@ public final class InputManager { } } /** * Remaps modifier keys. Remapping a modifier key to itself will clear any previous remappings * for that key. * * @param fromKey The modifier key getting remapped. * @param toKey The modifier key that it is remapped to. * * @hide */ @TestApi @RequiresPermission(Manifest.permission.REMAP_MODIFIER_KEYS) public void remapModifierKey(@RemappableModifierKey int fromKey, @RemappableModifierKey int toKey) { try { mIm.remapModifierKey(fromKey, toKey); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * Clears all existing modifier key remappings * * @hide */ @TestApi @RequiresPermission(Manifest.permission.REMAP_MODIFIER_KEYS) public void clearAllModifierKeyRemappings() { try { mIm.clearAllModifierKeyRemappings(); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * Provides the current modifier key remapping * * @return a {fromKey, toKey} map that contains the existing modifier key remappings.. * {@link RemappableModifierKey} * * @hide */ @TestApi @NonNull @RequiresPermission(Manifest.permission.REMAP_MODIFIER_KEYS) public Map<Integer, Integer> getModifierKeyRemapping() { try { return mIm.getModifierKeyRemapping(); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * Gets the TouchCalibration applied to the specified input device's coordinates. * Loading
core/res/AndroidManifest.xml +8 −0 Original line number Diff line number Diff line Loading @@ -6776,6 +6776,14 @@ @hide --> <permission android:name="android.permission.HANDLE_QUERY_PACKAGE_RESTART" android:protectionLevel="signature" /> <!-- Allows low-level access to re-mapping modifier keys. <p>Not for use by third-party applications. @hide @TestApi --> <permission android:name="android.permission.REMAP_MODIFIER_KEYS" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.HANDLE_QUERY_PACKAGE_RESTART" /> <!-- Allows financed device kiosk apps to perform actions on the Device Lock service Loading
packages/Shell/AndroidManifest.xml +3 −0 Original line number Diff line number Diff line Loading @@ -774,6 +774,9 @@ <!-- Permissions required for CTS test - CtsAppFgsTestCases --> <uses-permission android:name="android.permission.USE_EXACT_ALARM" /> <!-- Permission required for CTS test - CtsHardwareTestCases --> <uses-permission android:name="android.permission.REMAP_MODIFIER_KEYS" /> <!-- Permissions required for CTS test - CtsAppFgsTestCases --> <uses-permission android:name="android.permission.health.READ_ACTIVE_CALORIES_BURNED" /> <uses-permission android:name="android.permission.health.READ_BASAL_BODY_TEMPERATURE" /> Loading