Loading core/api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -3116,6 +3116,7 @@ package android.accessibilityservice { method public boolean onGesture(@NonNull android.accessibilityservice.AccessibilityGestureEvent); method public abstract void onInterrupt(); method protected boolean onKeyEvent(android.view.KeyEvent); method public void onMotionEvent(@NonNull android.view.MotionEvent); method protected void onServiceConnected(); method public void onSystemActionsChanged(); method public final boolean performGlobalAction(int); Loading Loading @@ -3273,6 +3274,7 @@ package android.accessibilityservice { method @Deprecated public String getDescription(); method public String getId(); method public int getInteractiveUiTimeoutMillis(); method public int getMotionEventSources(); method public int getNonInteractiveUiTimeoutMillis(); method public android.content.pm.ResolveInfo getResolveInfo(); method public String getSettingsActivityName(); Loading @@ -3282,6 +3284,7 @@ package android.accessibilityservice { method @Nullable public CharSequence loadIntro(@NonNull android.content.pm.PackageManager); method public CharSequence loadSummary(android.content.pm.PackageManager); method public void setInteractiveUiTimeoutMillis(@IntRange(from=0) int); method public void setMotionEventSources(int); method public void setNonInteractiveUiTimeoutMillis(@IntRange(from=0) int); method public void writeToParcel(android.os.Parcel, int); field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10 core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -440,6 +440,7 @@ package android.app { method @NonNull public java.util.Set<java.lang.String> getAdoptedShellPermissions(); method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle); method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean); method public void injectInputEventToInputFilter(@NonNull android.view.InputEvent); method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle); method public void syncInputTransactions(); method public void syncInputTransactions(boolean); Loading core/java/android/accessibilityservice/AccessibilityService.java +45 −9 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.view.Display; import android.view.InputDevice; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SurfaceControl; Loading Loading @@ -797,6 +798,8 @@ public abstract class AccessibilityService extends Service { private FingerprintGestureController mFingerprintGestureController; private int mMotionEventSources; /** * Callback for {@link android.view.accessibility.AccessibilityEvent}s. * Loading @@ -820,7 +823,11 @@ public abstract class AccessibilityService extends Service { for (int i = 0; i < mMagnificationControllers.size(); i++) { mMagnificationControllers.valueAt(i).onServiceConnectedLocked(); } updateInputMethod(getServiceInfo()); final AccessibilityServiceInfo info = getServiceInfo(); if (info != null) { updateInputMethod(info); mMotionEventSources = info.getMotionEventSources(); } } if (mSoftKeyboardController != null) { mSoftKeyboardController.onServiceConnected(); Loading Loading @@ -945,6 +952,25 @@ public abstract class AccessibilityService extends Service { return false; } /** * Callback that allows an accessibility service to observe generic {@link MotionEvent}s. * <p> * Prefer {@link TouchInteractionController} to observe and control touchscreen events, * including touch gestures. If this or any enabled service is using * {@link AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} then * {@link #onMotionEvent} will not receive touchscreen events. * </p> * <p> * <strong>Note:</strong> The service must first request to listen to events using * {@link AccessibilityServiceInfo#setMotionEventSources}. * {@link MotionEvent}s from sources in {@link AccessibilityServiceInfo#getMotionEventSources()} * are not sent to the rest of the system. To stop listening to events from a given source, call * {@link AccessibilityServiceInfo#setMotionEventSources} with that source removed. * </p> * @param event The event to be processed. */ public void onMotionEvent(@NonNull MotionEvent event) { } /** * Gets the windows on the screen of the default display. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. Loading Loading @@ -2521,6 +2547,7 @@ public abstract class AccessibilityService extends Service { public final void setServiceInfo(AccessibilityServiceInfo info) { mInfo = info; updateInputMethod(info); mMotionEventSources = info.getMotionEventSources(); sendServiceInfo(); } Loading Loading @@ -2724,7 +2751,7 @@ public abstract class AccessibilityService extends Service { @Override public void onMotionEvent(MotionEvent event) { AccessibilityService.this.onMotionEvent(event); AccessibilityService.this.sendMotionEventToCallback(event); } @Override Loading Loading @@ -3359,16 +3386,25 @@ public abstract class AccessibilityService extends Service { } } void onMotionEvent(MotionEvent event) { void sendMotionEventToCallback(MotionEvent event) { boolean sendingTouchEventToTouchInteractionController = false; if (event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN)) { TouchInteractionController controller; synchronized (mLock) { int displayId = event.getDisplayId(); controller = mTouchInteractionControllers.get(displayId); } if (controller != null) { sendingTouchEventToTouchInteractionController = true; controller.onMotionEvent(event); } } final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK; if ((mMotionEventSources & eventSourceWithoutClass) != 0 && !sendingTouchEventToTouchInteractionController) { onMotionEvent(event); } } void onTouchStateChanged(int displayId, int state) { TouchInteractionController controller; Loading core/java/android/accessibilityservice/AccessibilityServiceInfo.java +47 −0 Original line number Diff line number Diff line Loading @@ -611,6 +611,12 @@ public class AccessibilityServiceInfo implements Parcelable { */ private boolean mIsAccessibilityTool = false; /** * The bit mask of {@link android.view.InputDevice} sources that the accessibility * service wants to listen to for generic {@link android.view.MotionEvent}s. */ private int mMotionEventSources = 0; /** * Creates a new instance. */ Loading Loading @@ -785,6 +791,7 @@ public class AccessibilityServiceInfo implements Parcelable { mNonInteractiveUiTimeout = other.mNonInteractiveUiTimeout; mInteractiveUiTimeout = other.mInteractiveUiTimeout; flags = other.flags; mMotionEventSources = other.mMotionEventSources; // NOTE: Ensure that only properties that are safe to be modified by the service itself // are included here (regardless of hidden setters, etc.). } Loading Loading @@ -955,6 +962,44 @@ public class AccessibilityServiceInfo implements Parcelable { mCapabilities = capabilities; } /** * Returns the bit mask of {@link android.view.InputDevice} sources that the accessibility * service wants to listen to for generic {@link android.view.MotionEvent}s. */ public int getMotionEventSources() { return mMotionEventSources; } /** * Sets the bit mask of {@link android.view.InputDevice} sources that the accessibility * service wants to listen to for generic {@link android.view.MotionEvent}s. * * <p> * Note: including an {@link android.view.InputDevice} source that does not send * {@link android.view.MotionEvent}s is effectively a no-op for that source, since you will * not receive any events from that source. * </p> * <p> * Allowed sources include: * <li>{@link android.view.InputDevice#SOURCE_MOUSE}</li> * <li>{@link android.view.InputDevice#SOURCE_STYLUS}</li> * <li>{@link android.view.InputDevice#SOURCE_BLUETOOTH_STYLUS}</li> * <li>{@link android.view.InputDevice#SOURCE_TRACKBALL}</li> * <li>{@link android.view.InputDevice#SOURCE_MOUSE_RELATIVE}</li> * <li>{@link android.view.InputDevice#SOURCE_TOUCHPAD}</li> * <li>{@link android.view.InputDevice#SOURCE_TOUCH_NAVIGATION}</li> * <li>{@link android.view.InputDevice#SOURCE_ROTARY_ENCODER}</li> * <li>{@link android.view.InputDevice#SOURCE_JOYSTICK}</li> * <li>{@link android.view.InputDevice#SOURCE_SENSOR}</li> * </p> * * @param motionEventSources A bit mask of {@link android.view.InputDevice} sources. * @see AccessibilityService#onMotionEvent */ public void setMotionEventSources(int motionEventSources) { mMotionEventSources = motionEventSources; } /** * The localized summary of the accessibility service. * <p> Loading Loading @@ -1179,6 +1224,7 @@ public class AccessibilityServiceInfo implements Parcelable { parcel.writeBoolean(mIsAccessibilityTool); parcel.writeString(mTileServiceName); parcel.writeInt(mIntroResId); parcel.writeInt(mMotionEventSources); } private void initFromParcel(Parcel parcel) { Loading @@ -1203,6 +1249,7 @@ public class AccessibilityServiceInfo implements Parcelable { mIsAccessibilityTool = parcel.readBoolean(); mTileServiceName = parcel.readString(); mIntroResId = parcel.readInt(); mMotionEventSources = parcel.readInt(); } @Override Loading core/java/android/app/IUiAutomationConnection.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ interface IUiAutomationConnection { void connect(IAccessibilityServiceClient client, int flags); void disconnect(); boolean injectInputEvent(in InputEvent event, boolean sync, boolean waitForAnimations); void injectInputEventToInputFilter(in InputEvent event); void syncInputTransactions(boolean waitForAnimations); boolean setRotation(int rotation); Bitmap takeScreenshot(in Rect crop); Loading Loading
core/api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -3116,6 +3116,7 @@ package android.accessibilityservice { method public boolean onGesture(@NonNull android.accessibilityservice.AccessibilityGestureEvent); method public abstract void onInterrupt(); method protected boolean onKeyEvent(android.view.KeyEvent); method public void onMotionEvent(@NonNull android.view.MotionEvent); method protected void onServiceConnected(); method public void onSystemActionsChanged(); method public final boolean performGlobalAction(int); Loading Loading @@ -3273,6 +3274,7 @@ package android.accessibilityservice { method @Deprecated public String getDescription(); method public String getId(); method public int getInteractiveUiTimeoutMillis(); method public int getMotionEventSources(); method public int getNonInteractiveUiTimeoutMillis(); method public android.content.pm.ResolveInfo getResolveInfo(); method public String getSettingsActivityName(); Loading @@ -3282,6 +3284,7 @@ package android.accessibilityservice { method @Nullable public CharSequence loadIntro(@NonNull android.content.pm.PackageManager); method public CharSequence loadSummary(android.content.pm.PackageManager); method public void setInteractiveUiTimeoutMillis(@IntRange(from=0) int); method public void setMotionEventSources(int); method public void setNonInteractiveUiTimeoutMillis(@IntRange(from=0) int); method public void writeToParcel(android.os.Parcel, int); field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -440,6 +440,7 @@ package android.app { method @NonNull public java.util.Set<java.lang.String> getAdoptedShellPermissions(); method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle); method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean); method public void injectInputEventToInputFilter(@NonNull android.view.InputEvent); method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle); method public void syncInputTransactions(); method public void syncInputTransactions(boolean); Loading
core/java/android/accessibilityservice/AccessibilityService.java +45 −9 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.view.Display; import android.view.InputDevice; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SurfaceControl; Loading Loading @@ -797,6 +798,8 @@ public abstract class AccessibilityService extends Service { private FingerprintGestureController mFingerprintGestureController; private int mMotionEventSources; /** * Callback for {@link android.view.accessibility.AccessibilityEvent}s. * Loading @@ -820,7 +823,11 @@ public abstract class AccessibilityService extends Service { for (int i = 0; i < mMagnificationControllers.size(); i++) { mMagnificationControllers.valueAt(i).onServiceConnectedLocked(); } updateInputMethod(getServiceInfo()); final AccessibilityServiceInfo info = getServiceInfo(); if (info != null) { updateInputMethod(info); mMotionEventSources = info.getMotionEventSources(); } } if (mSoftKeyboardController != null) { mSoftKeyboardController.onServiceConnected(); Loading Loading @@ -945,6 +952,25 @@ public abstract class AccessibilityService extends Service { return false; } /** * Callback that allows an accessibility service to observe generic {@link MotionEvent}s. * <p> * Prefer {@link TouchInteractionController} to observe and control touchscreen events, * including touch gestures. If this or any enabled service is using * {@link AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} then * {@link #onMotionEvent} will not receive touchscreen events. * </p> * <p> * <strong>Note:</strong> The service must first request to listen to events using * {@link AccessibilityServiceInfo#setMotionEventSources}. * {@link MotionEvent}s from sources in {@link AccessibilityServiceInfo#getMotionEventSources()} * are not sent to the rest of the system. To stop listening to events from a given source, call * {@link AccessibilityServiceInfo#setMotionEventSources} with that source removed. * </p> * @param event The event to be processed. */ public void onMotionEvent(@NonNull MotionEvent event) { } /** * Gets the windows on the screen of the default display. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. Loading Loading @@ -2521,6 +2547,7 @@ public abstract class AccessibilityService extends Service { public final void setServiceInfo(AccessibilityServiceInfo info) { mInfo = info; updateInputMethod(info); mMotionEventSources = info.getMotionEventSources(); sendServiceInfo(); } Loading Loading @@ -2724,7 +2751,7 @@ public abstract class AccessibilityService extends Service { @Override public void onMotionEvent(MotionEvent event) { AccessibilityService.this.onMotionEvent(event); AccessibilityService.this.sendMotionEventToCallback(event); } @Override Loading Loading @@ -3359,16 +3386,25 @@ public abstract class AccessibilityService extends Service { } } void onMotionEvent(MotionEvent event) { void sendMotionEventToCallback(MotionEvent event) { boolean sendingTouchEventToTouchInteractionController = false; if (event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN)) { TouchInteractionController controller; synchronized (mLock) { int displayId = event.getDisplayId(); controller = mTouchInteractionControllers.get(displayId); } if (controller != null) { sendingTouchEventToTouchInteractionController = true; controller.onMotionEvent(event); } } final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK; if ((mMotionEventSources & eventSourceWithoutClass) != 0 && !sendingTouchEventToTouchInteractionController) { onMotionEvent(event); } } void onTouchStateChanged(int displayId, int state) { TouchInteractionController controller; Loading
core/java/android/accessibilityservice/AccessibilityServiceInfo.java +47 −0 Original line number Diff line number Diff line Loading @@ -611,6 +611,12 @@ public class AccessibilityServiceInfo implements Parcelable { */ private boolean mIsAccessibilityTool = false; /** * The bit mask of {@link android.view.InputDevice} sources that the accessibility * service wants to listen to for generic {@link android.view.MotionEvent}s. */ private int mMotionEventSources = 0; /** * Creates a new instance. */ Loading Loading @@ -785,6 +791,7 @@ public class AccessibilityServiceInfo implements Parcelable { mNonInteractiveUiTimeout = other.mNonInteractiveUiTimeout; mInteractiveUiTimeout = other.mInteractiveUiTimeout; flags = other.flags; mMotionEventSources = other.mMotionEventSources; // NOTE: Ensure that only properties that are safe to be modified by the service itself // are included here (regardless of hidden setters, etc.). } Loading Loading @@ -955,6 +962,44 @@ public class AccessibilityServiceInfo implements Parcelable { mCapabilities = capabilities; } /** * Returns the bit mask of {@link android.view.InputDevice} sources that the accessibility * service wants to listen to for generic {@link android.view.MotionEvent}s. */ public int getMotionEventSources() { return mMotionEventSources; } /** * Sets the bit mask of {@link android.view.InputDevice} sources that the accessibility * service wants to listen to for generic {@link android.view.MotionEvent}s. * * <p> * Note: including an {@link android.view.InputDevice} source that does not send * {@link android.view.MotionEvent}s is effectively a no-op for that source, since you will * not receive any events from that source. * </p> * <p> * Allowed sources include: * <li>{@link android.view.InputDevice#SOURCE_MOUSE}</li> * <li>{@link android.view.InputDevice#SOURCE_STYLUS}</li> * <li>{@link android.view.InputDevice#SOURCE_BLUETOOTH_STYLUS}</li> * <li>{@link android.view.InputDevice#SOURCE_TRACKBALL}</li> * <li>{@link android.view.InputDevice#SOURCE_MOUSE_RELATIVE}</li> * <li>{@link android.view.InputDevice#SOURCE_TOUCHPAD}</li> * <li>{@link android.view.InputDevice#SOURCE_TOUCH_NAVIGATION}</li> * <li>{@link android.view.InputDevice#SOURCE_ROTARY_ENCODER}</li> * <li>{@link android.view.InputDevice#SOURCE_JOYSTICK}</li> * <li>{@link android.view.InputDevice#SOURCE_SENSOR}</li> * </p> * * @param motionEventSources A bit mask of {@link android.view.InputDevice} sources. * @see AccessibilityService#onMotionEvent */ public void setMotionEventSources(int motionEventSources) { mMotionEventSources = motionEventSources; } /** * The localized summary of the accessibility service. * <p> Loading Loading @@ -1179,6 +1224,7 @@ public class AccessibilityServiceInfo implements Parcelable { parcel.writeBoolean(mIsAccessibilityTool); parcel.writeString(mTileServiceName); parcel.writeInt(mIntroResId); parcel.writeInt(mMotionEventSources); } private void initFromParcel(Parcel parcel) { Loading @@ -1203,6 +1249,7 @@ public class AccessibilityServiceInfo implements Parcelable { mIsAccessibilityTool = parcel.readBoolean(); mTileServiceName = parcel.readString(); mIntroResId = parcel.readInt(); mMotionEventSources = parcel.readInt(); } @Override Loading
core/java/android/app/IUiAutomationConnection.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ interface IUiAutomationConnection { void connect(IAccessibilityServiceClient client, int flags); void disconnect(); boolean injectInputEvent(in InputEvent event, boolean sync, boolean waitForAnimations); void injectInputEventToInputFilter(in InputEvent event); void syncInputTransactions(boolean waitForAnimations); boolean setRotation(int rotation); Bitmap takeScreenshot(in Rect crop); Loading