Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -1813,6 +1813,7 @@ package android.hardware.input { method @FlaggedApi("com.android.input.flags.device_associations") @RequiresPermission("android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY") public void removeUniqueIdAssociationByDescriptor(@NonNull String); method @RequiresPermission("android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY") public void removeUniqueIdAssociationByPort(@NonNull String); method public void resetLockedModifierState(); method @RequiresPermission(android.Manifest.permission.SET_POINTER_SPEED) public void setMouseScalingEnabled(boolean, int); field public static final long BLOCK_UNTRUSTED_TOUCHES = 158002302L; // 0x96aec7eL } Loading core/java/android/hardware/input/IInputManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -305,4 +305,6 @@ interface IInputManager { AidlInputGestureData[] getAppLaunchBookmarks(); void resetLockedModifierState(); void setMouseScalingEnabled(boolean enabled, int displayId); } core/java/android/hardware/input/InputManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -1620,6 +1620,28 @@ public final class InputManager { } } /** * Set whether all pointer scaling, including linear scaling based on the * user's pointer speed setting, should be enabled or disabled for mice. * * Note that this only affects pointer movements from mice (that is, pointing devices which send * relative motions, including trackballs and pointing sticks), not from other pointer devices * such as touchpads and styluses. * * Scaling is enabled by default on new displays until it is explicitly disabled. * @hide */ @TestApi @SuppressLint("UnflaggedApi") // @TestApi without associated feature. @RequiresPermission(Manifest.permission.SET_POINTER_SPEED) public void setMouseScalingEnabled(boolean enabled, int displayId) { try { mIm.setMouseScalingEnabled(enabled, displayId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * A callback used to be notified about battery state changes for an input device. The * {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the Loading services/companion/java/com/android/server/companion/virtual/InputController.java +7 −5 Original line number Diff line number Diff line Loading @@ -102,26 +102,28 @@ class InputController { private final NativeWrapper mNativeWrapper; private final DisplayManagerInternal mDisplayManagerInternal; private final InputManagerInternal mInputManagerInternal; private final InputManager mInputManager; private final WindowManager mWindowManager; private final AttributionSource mAttributionSource; private final DeviceCreationThreadVerifier mThreadVerifier; InputController(@NonNull Handler handler, InputController(@NonNull Handler handler, @NonNull InputManager inputManager, @NonNull WindowManager windowManager, AttributionSource attributionSource) { this(new NativeWrapper(), handler, windowManager, attributionSource, this(new NativeWrapper(), handler, inputManager, windowManager, attributionSource, // Verify that virtual devices are not created on the handler thread. () -> !handler.getLooper().isCurrentThread()); } @VisibleForTesting InputController(@NonNull NativeWrapper nativeWrapper, @NonNull Handler handler, @NonNull WindowManager windowManager, InputController(@NonNull NativeWrapper nativeWrapper, @NonNull Handler handler, @NonNull InputManager inputManager, @NonNull WindowManager windowManager, AttributionSource attributionSource, @NonNull DeviceCreationThreadVerifier threadVerifier) { mHandler = handler; mNativeWrapper = nativeWrapper; mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); mInputManagerInternal = LocalServices.getService(InputManagerInternal.class); mInputManager = inputManager; mWindowManager = windowManager; mAttributionSource = attributionSource; mThreadVerifier = threadVerifier; Loading Loading @@ -266,7 +268,7 @@ class InputController { } void setMouseScalingEnabled(boolean enabled, int displayId) { mInputManagerInternal.setMouseScalingEnabled(enabled, displayId); mInputManager.setMouseScalingEnabled(enabled, displayId); } void setDisplayEligibilityForPointerCapture(boolean isEligible, int displayId) { Loading services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java +3 −2 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ import android.hardware.display.DisplayManagerGlobal; import android.hardware.display.DisplayManagerInternal; import android.hardware.display.IVirtualDisplayCallback; import android.hardware.display.VirtualDisplayConfig; import android.hardware.input.InputManager; import android.hardware.input.VirtualDpadConfig; import android.hardware.input.VirtualKeyEvent; import android.hardware.input.VirtualKeyboardConfig; Loading Loading @@ -474,8 +475,8 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub mBaseVirtualDisplayFlags = flags; if (inputController == null) { mInputController = new InputController( context.getMainThreadHandler(), mInputController = new InputController(context.getMainThreadHandler(), context.getSystemService(InputManager.class), context.getSystemService(WindowManager.class), mAttributionSource); } else { mInputController = inputController; Loading Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -1813,6 +1813,7 @@ package android.hardware.input { method @FlaggedApi("com.android.input.flags.device_associations") @RequiresPermission("android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY") public void removeUniqueIdAssociationByDescriptor(@NonNull String); method @RequiresPermission("android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY") public void removeUniqueIdAssociationByPort(@NonNull String); method public void resetLockedModifierState(); method @RequiresPermission(android.Manifest.permission.SET_POINTER_SPEED) public void setMouseScalingEnabled(boolean, int); field public static final long BLOCK_UNTRUSTED_TOUCHES = 158002302L; // 0x96aec7eL } Loading
core/java/android/hardware/input/IInputManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -305,4 +305,6 @@ interface IInputManager { AidlInputGestureData[] getAppLaunchBookmarks(); void resetLockedModifierState(); void setMouseScalingEnabled(boolean enabled, int displayId); }
core/java/android/hardware/input/InputManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -1620,6 +1620,28 @@ public final class InputManager { } } /** * Set whether all pointer scaling, including linear scaling based on the * user's pointer speed setting, should be enabled or disabled for mice. * * Note that this only affects pointer movements from mice (that is, pointing devices which send * relative motions, including trackballs and pointing sticks), not from other pointer devices * such as touchpads and styluses. * * Scaling is enabled by default on new displays until it is explicitly disabled. * @hide */ @TestApi @SuppressLint("UnflaggedApi") // @TestApi without associated feature. @RequiresPermission(Manifest.permission.SET_POINTER_SPEED) public void setMouseScalingEnabled(boolean enabled, int displayId) { try { mIm.setMouseScalingEnabled(enabled, displayId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * A callback used to be notified about battery state changes for an input device. The * {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the Loading
services/companion/java/com/android/server/companion/virtual/InputController.java +7 −5 Original line number Diff line number Diff line Loading @@ -102,26 +102,28 @@ class InputController { private final NativeWrapper mNativeWrapper; private final DisplayManagerInternal mDisplayManagerInternal; private final InputManagerInternal mInputManagerInternal; private final InputManager mInputManager; private final WindowManager mWindowManager; private final AttributionSource mAttributionSource; private final DeviceCreationThreadVerifier mThreadVerifier; InputController(@NonNull Handler handler, InputController(@NonNull Handler handler, @NonNull InputManager inputManager, @NonNull WindowManager windowManager, AttributionSource attributionSource) { this(new NativeWrapper(), handler, windowManager, attributionSource, this(new NativeWrapper(), handler, inputManager, windowManager, attributionSource, // Verify that virtual devices are not created on the handler thread. () -> !handler.getLooper().isCurrentThread()); } @VisibleForTesting InputController(@NonNull NativeWrapper nativeWrapper, @NonNull Handler handler, @NonNull WindowManager windowManager, InputController(@NonNull NativeWrapper nativeWrapper, @NonNull Handler handler, @NonNull InputManager inputManager, @NonNull WindowManager windowManager, AttributionSource attributionSource, @NonNull DeviceCreationThreadVerifier threadVerifier) { mHandler = handler; mNativeWrapper = nativeWrapper; mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); mInputManagerInternal = LocalServices.getService(InputManagerInternal.class); mInputManager = inputManager; mWindowManager = windowManager; mAttributionSource = attributionSource; mThreadVerifier = threadVerifier; Loading Loading @@ -266,7 +268,7 @@ class InputController { } void setMouseScalingEnabled(boolean enabled, int displayId) { mInputManagerInternal.setMouseScalingEnabled(enabled, displayId); mInputManager.setMouseScalingEnabled(enabled, displayId); } void setDisplayEligibilityForPointerCapture(boolean isEligible, int displayId) { Loading
services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java +3 −2 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ import android.hardware.display.DisplayManagerGlobal; import android.hardware.display.DisplayManagerInternal; import android.hardware.display.IVirtualDisplayCallback; import android.hardware.display.VirtualDisplayConfig; import android.hardware.input.InputManager; import android.hardware.input.VirtualDpadConfig; import android.hardware.input.VirtualKeyEvent; import android.hardware.input.VirtualKeyboardConfig; Loading Loading @@ -474,8 +475,8 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub mBaseVirtualDisplayFlags = flags; if (inputController == null) { mInputController = new InputController( context.getMainThreadHandler(), mInputController = new InputController(context.getMainThreadHandler(), context.getSystemService(InputManager.class), context.getSystemService(WindowManager.class), mAttributionSource); } else { mInputController = inputController; Loading