diff options
| author | Christine Franks <christyfranks@google.com> | 2022-01-18 11:48:22 -0800 |
|---|---|---|
| committer | Christine Franks <christyfranks@google.com> | 2022-01-27 07:04:27 -0800 |
| commit | acc5a3e2d68bc80e041463c513bc72fcd6798c44 (patch) | |
| tree | a6d241df56c3832b38475c28ddf7f618af3fbf36 /core/java/android | |
| parent | 8ba7b768de018a00bc3446c7d1be958f970b6034 (diff) | |
Update uniqueId association methods
Change from associating via name to associating via physical input port.
This is more robust as there is less likely to be a chance of collision,
as well as less likely to have problems as the userspace language changes
(and therefore the user-visible name should also change).
Bug: 202273865
Test: atest FrameworksServicesTests:com.android.server.companion.virtual
Change-Id: Ieae349e20f66df1490351c85a99d2efa5910d08b
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/hardware/input/IInputManager.aidl | 4 | ||||
| -rw-r--r-- | core/java/android/hardware/input/InputManager.java | 17 |
2 files changed, 10 insertions, 11 deletions
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index 0304815ef8fe..27403ec4fe59 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -122,9 +122,9 @@ interface IInputManager { void removePortAssociation(in String inputPort); // Add a runtime association between the input device and display. - void addUniqueIdAssociation(in String inputDeviceName, in String displayUniqueId); + void addUniqueIdAssociation(in String inputPort, in String displayUniqueId); // Remove the runtime association between the input device and display. - void removeUniqueIdAssociation(in String inputDeviceName); + void removeUniqueIdAssociation(in String inputPort); InputSensorInfo[] getSensorList(int deviceId); diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index cbc837393b6b..979e9dd6a1f6 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -1359,19 +1359,18 @@ 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. + * Add a runtime association between the input port and display, by unique id. Input ports are + * expected to be unique. + * @param inputPort The port of the input device. * @param displayUniqueId The unique id of the associated display. * <p> * Requires {@link android.Manifest.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY}. * </p> * @hide */ - public void addUniqueIdAssociation(@NonNull String inputDeviceName, - @NonNull String displayUniqueId) { + public void addUniqueIdAssociation(@NonNull String inputPort, @NonNull String displayUniqueId) { try { - mIm.addUniqueIdAssociation(inputDeviceName, displayUniqueId); + mIm.addUniqueIdAssociation(inputPort, displayUniqueId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1379,15 +1378,15 @@ public final class InputManager { /** * Removes a runtime association between the input device and display. - * @param inputDeviceName The name of the input device. + * @param inputPort The port of the input device. * <p> * Requires {@link android.Manifest.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY}. * </p> * @hide */ - public void removeUniqueIdAssociation(@NonNull String inputDeviceName) { + public void removeUniqueIdAssociation(@NonNull String inputPort) { try { - mIm.removeUniqueIdAssociation(inputDeviceName); + mIm.removeUniqueIdAssociation(inputPort); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } |
