diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index 336fbf2954a39..19fb845d93848 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -117,6 +117,11 @@ interface IInputManager { // static association for the cleared input port will be restored. void removePortAssociation(in String inputPort); + // Add a runtime association between the input device and display. + void addUniqueIdAssociation(in String inputDeviceName, in String displayUniqueId); + // Remove the runtime association between the input device and display. + void removeUniqueIdAssociation(in String inputDeviceName); + InputSensorInfo[] getSensorList(int deviceId); boolean registerSensorListener(IInputSensorEventListener listener); diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index b6d2eaf11be67..648fda7c22bb5 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -1293,7 +1293,7 @@ public final class InputManager { * @param inputPort The port of the input device. * @param displayPort The physical port of the associated display. *
- * Requires {@link android.Manifest.permissions.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY_BY_PORT}. + * Requires {@link android.Manifest.permissions.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY}. *
* @hide */ @@ -1310,7 +1310,7 @@ public final class InputManager { * static association for the cleared input port will be restored. * @param inputPort The port of the input device to be cleared. *- * Requires {@link android.Manifest.permissions.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY_BY_PORT}. + * Requires {@link android.Manifest.permissions.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY}. *
* @hide */ @@ -1322,6 +1322,41 @@ public final class InputManager { } } + /** + * Add a runtime association between the input device name and display, by unique id. Input + * device names are expected to be unique. + * @param inputDeviceName The name of the input device. + * @param displayUniqueId The unique id of the associated display. + *+ * Requires {@link android.Manifest.permissions.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY}. + *
+ * @hide + */ + public void addUniqueIdAssociation(@NonNull String inputDeviceName, + @NonNull String displayUniqueId) { + try { + mIm.addUniqueIdAssociation(inputDeviceName, displayUniqueId); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Removes a runtime association between the input device and display. + * @param inputDeviceName The name of the input device. + *+ * Requires {@link android.Manifest.permissions.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY}. + *
+ * @hide + */ + public void removeUniqueIdAssociation(@NonNull String inputDeviceName) { + try { + mIm.removeUniqueIdAssociation(inputDeviceName); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + private void populateInputDevicesLocked() { if (mInputDevicesChangedListener == null) { final InputDevicesChangedListener listener = new InputDevicesChangedListener(); diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index bf98a2eeccbb8..e4f16a90180c4 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -5638,7 +5638,7 @@ android:protectionLevel="signature|recents" /> -