Loading core/api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -4122,6 +4122,7 @@ package android.hardware.input { public class VirtualMouse implements java.io.Closeable { method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void close(); method @NonNull @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public android.graphics.PointF getCursorPosition(); method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendButtonEvent(@NonNull android.hardware.input.VirtualMouseButtonEvent); method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendRelativeEvent(@NonNull android.hardware.input.VirtualMouseRelativeEvent); method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendScrollEvent(@NonNull android.hardware.input.VirtualMouseScrollEvent); core/java/android/companion/virtual/IVirtualDevice.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.companion.virtual; import android.app.PendingIntent; import android.graphics.Point; import android.graphics.PointF; import android.hardware.input.VirtualKeyEvent; import android.hardware.input.VirtualMouseButtonEvent; import android.hardware.input.VirtualMouseRelativeEvent; Loading Loading @@ -75,4 +76,5 @@ interface IVirtualDevice { */ void launchPendingIntent( int displayId, in PendingIntent pendingIntent, in ResultReceiver resultReceiver); PointF getCursorPosition(IBinder token); } core/java/android/companion/virtual/VirtualDeviceManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,9 @@ public final class VirtualDeviceManager { /** * Creates a virtual display for this virtual device. All displays created on the same * device belongs to the same display group. * device belongs to the same display group. Requires the ADD_TRUSTED_DISPLAY permission * to create a virtual display which is not in the default DisplayGroup, and to create * trusted displays. * * @param width The width of the virtual display in pixels, must be greater than 0. * @param height The height of the virtual display in pixels, must be greater than 0. Loading core/java/android/hardware/input/InputManagerInternal.java +17 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.hardware.input; import android.annotation.NonNull; import android.graphics.PointF; import android.hardware.display.DisplayViewport; import android.os.IBinder; import android.view.InputEvent; Loading Loading @@ -79,6 +80,22 @@ public abstract class InputManagerInternal { public abstract boolean transferTouchFocus(@NonNull IBinder fromChannelToken, @NonNull IBinder toChannelToken); /** * Sets the display id that the MouseCursorController will be forced to target. Pass * {@link android.view.Display#INVALID_DISPLAY} to clear the override. */ public abstract void setVirtualMousePointerDisplayId(int pointerDisplayId); /** Gets the current position of the mouse cursor. */ public abstract PointF getCursorPosition(); /** * Sets the eligibility of windows on a given display for pointer capture. If a display is * marked ineligible, requests to enable pointer capture for windows on that display will be * ignored. */ public abstract void setDisplayEligibilityForPointerCapture(int displayId, boolean isEligible); /** Registers the {@link LidSwitchCallback} to begin receiving notifications. */ public abstract void registerLidSwitchCallback(@NonNull LidSwitchCallback callbacks); Loading core/java/android/hardware/input/VirtualMouse.java +23 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.companion.virtual.IVirtualDevice; import android.graphics.PointF; import android.os.IBinder; import android.os.RemoteException; import android.view.MotionEvent; Loading Loading @@ -61,6 +62,8 @@ public class VirtualMouse implements Closeable { * Send a mouse button event to the system. * * @param event the event * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendButtonEvent(@NonNull VirtualMouseButtonEvent event) { Loading @@ -76,6 +79,8 @@ public class VirtualMouse implements Closeable { * {@link MotionEvent#AXIS_SCROLL}. * * @param event the event * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendScrollEvent(@NonNull VirtualMouseScrollEvent event) { Loading @@ -90,6 +95,8 @@ public class VirtualMouse implements Closeable { * Sends a relative movement event to the system. * * @param event the event * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendRelativeEvent(@NonNull VirtualMouseRelativeEvent event) { Loading @@ -99,4 +106,20 @@ public class VirtualMouse implements Closeable { throw e.rethrowFromSystemServer(); } } /** * Gets the current cursor position. * * @return the position, expressed as x and y coordinates * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public @NonNull PointF getCursorPosition() { try { return mVirtualDevice.getCursorPosition(mToken); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } Loading
core/api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -4122,6 +4122,7 @@ package android.hardware.input { public class VirtualMouse implements java.io.Closeable { method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void close(); method @NonNull @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public android.graphics.PointF getCursorPosition(); method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendButtonEvent(@NonNull android.hardware.input.VirtualMouseButtonEvent); method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendRelativeEvent(@NonNull android.hardware.input.VirtualMouseRelativeEvent); method @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendScrollEvent(@NonNull android.hardware.input.VirtualMouseScrollEvent);
core/java/android/companion/virtual/IVirtualDevice.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.companion.virtual; import android.app.PendingIntent; import android.graphics.Point; import android.graphics.PointF; import android.hardware.input.VirtualKeyEvent; import android.hardware.input.VirtualMouseButtonEvent; import android.hardware.input.VirtualMouseRelativeEvent; Loading Loading @@ -75,4 +76,5 @@ interface IVirtualDevice { */ void launchPendingIntent( int displayId, in PendingIntent pendingIntent, in ResultReceiver resultReceiver); PointF getCursorPosition(IBinder token); }
core/java/android/companion/virtual/VirtualDeviceManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,9 @@ public final class VirtualDeviceManager { /** * Creates a virtual display for this virtual device. All displays created on the same * device belongs to the same display group. * device belongs to the same display group. Requires the ADD_TRUSTED_DISPLAY permission * to create a virtual display which is not in the default DisplayGroup, and to create * trusted displays. * * @param width The width of the virtual display in pixels, must be greater than 0. * @param height The height of the virtual display in pixels, must be greater than 0. Loading
core/java/android/hardware/input/InputManagerInternal.java +17 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.hardware.input; import android.annotation.NonNull; import android.graphics.PointF; import android.hardware.display.DisplayViewport; import android.os.IBinder; import android.view.InputEvent; Loading Loading @@ -79,6 +80,22 @@ public abstract class InputManagerInternal { public abstract boolean transferTouchFocus(@NonNull IBinder fromChannelToken, @NonNull IBinder toChannelToken); /** * Sets the display id that the MouseCursorController will be forced to target. Pass * {@link android.view.Display#INVALID_DISPLAY} to clear the override. */ public abstract void setVirtualMousePointerDisplayId(int pointerDisplayId); /** Gets the current position of the mouse cursor. */ public abstract PointF getCursorPosition(); /** * Sets the eligibility of windows on a given display for pointer capture. If a display is * marked ineligible, requests to enable pointer capture for windows on that display will be * ignored. */ public abstract void setDisplayEligibilityForPointerCapture(int displayId, boolean isEligible); /** Registers the {@link LidSwitchCallback} to begin receiving notifications. */ public abstract void registerLidSwitchCallback(@NonNull LidSwitchCallback callbacks); Loading
core/java/android/hardware/input/VirtualMouse.java +23 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.companion.virtual.IVirtualDevice; import android.graphics.PointF; import android.os.IBinder; import android.os.RemoteException; import android.view.MotionEvent; Loading Loading @@ -61,6 +62,8 @@ public class VirtualMouse implements Closeable { * Send a mouse button event to the system. * * @param event the event * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendButtonEvent(@NonNull VirtualMouseButtonEvent event) { Loading @@ -76,6 +79,8 @@ public class VirtualMouse implements Closeable { * {@link MotionEvent#AXIS_SCROLL}. * * @param event the event * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendScrollEvent(@NonNull VirtualMouseScrollEvent event) { Loading @@ -90,6 +95,8 @@ public class VirtualMouse implements Closeable { * Sends a relative movement event to the system. * * @param event the event * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public void sendRelativeEvent(@NonNull VirtualMouseRelativeEvent event) { Loading @@ -99,4 +106,20 @@ public class VirtualMouse implements Closeable { throw e.rethrowFromSystemServer(); } } /** * Gets the current cursor position. * * @return the position, expressed as x and y coordinates * @throws IllegalStateException if the display this mouse is associated with is not currently * targeted */ @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE) public @NonNull PointF getCursorPosition() { try { return mVirtualDevice.getCursorPosition(mToken); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }