Loading api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -2851,6 +2851,7 @@ package android.accessibilityservice { method public int describeContents(); method public int getDisplayId(); method public int getGestureId(); method @NonNull public java.util.List<android.view.MotionEvent> getMotionEvents(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityGestureEvent> CREATOR; } Loading Loading @@ -2932,6 +2933,7 @@ package android.accessibilityservice { field public static final int GESTURE_SWIPE_UP_AND_DOWN = 7; // 0x7 field public static final int GESTURE_SWIPE_UP_AND_LEFT = 13; // 0xd field public static final int GESTURE_SWIPE_UP_AND_RIGHT = 14; // 0xe field public static final int GESTURE_UNKNOWN = 0; // 0x0 field public static final int GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS = 14; // 0xe field public static final int GLOBAL_ACTION_ACCESSIBILITY_BUTTON = 11; // 0xb field public static final int GLOBAL_ACTION_ACCESSIBILITY_BUTTON_CHOOSER = 12; // 0xc Loading Loading @@ -3047,6 +3049,7 @@ package android.accessibilityservice { field public static final int FLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK = 1024; // 0x400 field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4 field public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 64; // 0x40 field public static final int FLAG_SEND_MOTION_EVENTS = 16384; // 0x4000 field public static final int FLAG_SERVICE_HANDLES_DOUBLE_TAP = 2048; // 0x800 field public int eventTypes; field public int feedbackType; core/java/android/accessibilityservice/AccessibilityGestureEvent.java +45 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import static android.accessibilityservice.AccessibilityService.GESTURE_4_FINGER import static android.accessibilityservice.AccessibilityService.GESTURE_4_FINGER_TRIPLE_TAP; import static android.accessibilityservice.AccessibilityService.GESTURE_DOUBLE_TAP; import static android.accessibilityservice.AccessibilityService.GESTURE_DOUBLE_TAP_AND_HOLD; import static android.accessibilityservice.AccessibilityService.GESTURE_PASSTHROUGH; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_DOWN; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_DOWN_AND_LEFT; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_DOWN_AND_RIGHT; Loading @@ -62,15 +63,21 @@ import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP_AND_DOWN; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP_AND_LEFT; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP_AND_RIGHT; import static android.accessibilityservice.AccessibilityService.GESTURE_TOUCH_EXPLORATION; import static android.accessibilityservice.AccessibilityService.GESTURE_UNKNOWN; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.TestApi; import android.content.pm.ParceledListSlice; import android.os.Parcel; import android.os.Parcelable; import android.view.MotionEvent; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; /** * This class describes the gesture event including gesture id and which display it happens Loading @@ -87,6 +94,8 @@ public final class AccessibilityGestureEvent implements Parcelable { /** @hide */ @IntDef(prefix = { "GESTURE_" }, value = { GESTURE_UNKNOWN, GESTURE_TOUCH_EXPLORATION, GESTURE_2_FINGER_SINGLE_TAP, GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD, GESTURE_2_FINGER_DOUBLE_TAP, Loading Loading @@ -139,17 +148,27 @@ public final class AccessibilityGestureEvent implements Parcelable { @GestureId private final int mGestureId; private final int mDisplayId; private List<MotionEvent> mMotionEvents = new ArrayList<>(); /** @hide */ @TestApi public AccessibilityGestureEvent(int gestureId, int displayId) { public AccessibilityGestureEvent( int gestureId, int displayId, @NonNull List<MotionEvent> motionEvents) { mGestureId = gestureId; mDisplayId = displayId; mMotionEvents.addAll(motionEvents); } /** @hide */ @TestApi public AccessibilityGestureEvent(int gestureId, int displayId) { this(gestureId, displayId, new ArrayList<MotionEvent>()); } private AccessibilityGestureEvent(@NonNull Parcel parcel) { mGestureId = parcel.readInt(); mDisplayId = parcel.readInt(); ParceledListSlice<MotionEvent> slice = parcel.readParcelable(getClass().getClassLoader()); mMotionEvents = slice.getList(); } /** Loading @@ -172,6 +191,15 @@ public final class AccessibilityGestureEvent implements Parcelable { return mGestureId; } /** * Returns the motion events that lead to this gesture. * */ @NonNull public List<MotionEvent> getMotionEvents() { return mMotionEvents; } @NonNull @Override public String toString() { Loading @@ -179,12 +207,26 @@ public final class AccessibilityGestureEvent implements Parcelable { stringBuilder.append("gestureId: ").append(eventTypeToString(mGestureId)); stringBuilder.append(", "); stringBuilder.append("displayId: ").append(mDisplayId); stringBuilder.append(", "); stringBuilder.append("Motion Events: ["); for (int i = 0; i < mMotionEvents.size(); ++i) { String action = MotionEvent.actionToString(mMotionEvents.get(i).getActionMasked()); stringBuilder.append(action); if (i < (mMotionEvents.size() - 1)) { stringBuilder.append(", "); } else { stringBuilder.append("]"); } } stringBuilder.append(']'); return stringBuilder.toString(); } private static String eventTypeToString(int eventType) { switch (eventType) { case GESTURE_UNKNOWN: return "GESTURE_UNKNOWN"; case GESTURE_PASSTHROUGH: return "GESTURE_PASSTHROUGH"; case GESTURE_TOUCH_EXPLORATION: return "GESTURE_TOUCH_EXPLORATION"; case GESTURE_2_FINGER_SINGLE_TAP: return "GESTURE_2_FINGER_SINGLE_TAP"; case GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD: return "GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD"; Loading Loading @@ -252,6 +294,7 @@ public final class AccessibilityGestureEvent implements Parcelable { public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeInt(mGestureId); parcel.writeInt(mDisplayId); parcel.writeParcelable(new ParceledListSlice<MotionEvent>(mMotionEvents), 0); } /** Loading core/java/android/accessibilityservice/AccessibilityService.java +23 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,29 @@ import java.util.function.Consumer; */ public abstract class AccessibilityService extends Service { /** * The user has performed a touch-exploration gesture on the touch screen without ever * triggering gesture detection. This gesture is only dispatched when {@link * AccessibilityServiceInfo#FLAG_SEND_MOTION_EVENTS} is set. * * @hide */ public static final int GESTURE_TOUCH_EXPLORATION = -2; /** * The user has performed a passthrough gesture on the touch screen without ever triggering * gesture detection. This gesture is only dispatched when {@link * AccessibilityServiceInfo#FLAG_SEND_MOTION_EVENTS} is set. * @hide */ public static final int GESTURE_PASSTHROUGH = -1; /** * The user has performed an unrecognized gesture on the touch screen. This gesture is only * dispatched when {@link AccessibilityServiceInfo#FLAG_SEND_MOTION_EVENTS} is set. */ public static final int GESTURE_UNKNOWN = 0; /** * The user has performed a swipe up gesture on the touch screen. */ Loading core/java/android/accessibilityservice/AccessibilityServiceInfo.java +16 −0 Original line number Diff line number Diff line Loading @@ -376,6 +376,20 @@ public class AccessibilityServiceInfo implements Parcelable { */ public static final int FLAG_REQUEST_2_FINGER_PASSTHROUGH = 0x0002000; /** * This flag requests that when when {@link #FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is enabled, a * service will receive the motion events for each successfully-detected gesture. The service * will also receive an AccessibilityGestureEvent of type GESTURE_INVALID for each cancelled * gesture along with its motion events. A service will receive a gesture of type * GESTURE_PASSTHROUGH and accompanying motion events for every passthrough gesture that does * not start gesture detection. This information can be used to collect instances of improper * gesture detection behavior and relay that information to framework developers. If {@link * #FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is disabled this flag has no effect. * * @see #FLAG_REQUEST_TOUCH_EXPLORATION_MODE */ public static final int FLAG_SEND_MOTION_EVENTS = 0x0004000; /** {@hide} */ public static final int FLAG_FORCE_DIRECT_BOOT_AWARE = 0x00010000; Loading Loading @@ -1276,6 +1290,8 @@ public class AccessibilityServiceInfo implements Parcelable { return "FLAG_REQUEST_MULTI_FINGER_GESTURES"; case FLAG_REQUEST_2_FINGER_PASSTHROUGH: return "FLAG_REQUEST_2_FINGER_PASSTHROUGH"; case FLAG_SEND_MOTION_EVENTS: return "FLAG_SEND_MOTION_EVENTS"; case FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY: return "FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY"; case FLAG_REPORT_VIEW_IDS: Loading core/res/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -3748,6 +3748,7 @@ <flag name="flagServiceHandlesDoubleTap" value="0x00000800" /> <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_MULTI_FINGER_GESTURES}. --> <flag name="flagRequestMultiFingerGestures" value="0x00001000" /> <flag name="flagSendMotionEvents" value="0x0004000" /> </attr> <!-- Component name of an activity that allows the user to modify the settings for this service. This setting cannot be changed at runtime. --> Loading Loading
api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -2851,6 +2851,7 @@ package android.accessibilityservice { method public int describeContents(); method public int getDisplayId(); method public int getGestureId(); method @NonNull public java.util.List<android.view.MotionEvent> getMotionEvents(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityGestureEvent> CREATOR; } Loading Loading @@ -2932,6 +2933,7 @@ package android.accessibilityservice { field public static final int GESTURE_SWIPE_UP_AND_DOWN = 7; // 0x7 field public static final int GESTURE_SWIPE_UP_AND_LEFT = 13; // 0xd field public static final int GESTURE_SWIPE_UP_AND_RIGHT = 14; // 0xe field public static final int GESTURE_UNKNOWN = 0; // 0x0 field public static final int GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS = 14; // 0xe field public static final int GLOBAL_ACTION_ACCESSIBILITY_BUTTON = 11; // 0xb field public static final int GLOBAL_ACTION_ACCESSIBILITY_BUTTON_CHOOSER = 12; // 0xc Loading Loading @@ -3047,6 +3049,7 @@ package android.accessibilityservice { field public static final int FLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK = 1024; // 0x400 field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4 field public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 64; // 0x40 field public static final int FLAG_SEND_MOTION_EVENTS = 16384; // 0x4000 field public static final int FLAG_SERVICE_HANDLES_DOUBLE_TAP = 2048; // 0x800 field public int eventTypes; field public int feedbackType;
core/java/android/accessibilityservice/AccessibilityGestureEvent.java +45 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import static android.accessibilityservice.AccessibilityService.GESTURE_4_FINGER import static android.accessibilityservice.AccessibilityService.GESTURE_4_FINGER_TRIPLE_TAP; import static android.accessibilityservice.AccessibilityService.GESTURE_DOUBLE_TAP; import static android.accessibilityservice.AccessibilityService.GESTURE_DOUBLE_TAP_AND_HOLD; import static android.accessibilityservice.AccessibilityService.GESTURE_PASSTHROUGH; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_DOWN; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_DOWN_AND_LEFT; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_DOWN_AND_RIGHT; Loading @@ -62,15 +63,21 @@ import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP_AND_DOWN; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP_AND_LEFT; import static android.accessibilityservice.AccessibilityService.GESTURE_SWIPE_UP_AND_RIGHT; import static android.accessibilityservice.AccessibilityService.GESTURE_TOUCH_EXPLORATION; import static android.accessibilityservice.AccessibilityService.GESTURE_UNKNOWN; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.TestApi; import android.content.pm.ParceledListSlice; import android.os.Parcel; import android.os.Parcelable; import android.view.MotionEvent; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; /** * This class describes the gesture event including gesture id and which display it happens Loading @@ -87,6 +94,8 @@ public final class AccessibilityGestureEvent implements Parcelable { /** @hide */ @IntDef(prefix = { "GESTURE_" }, value = { GESTURE_UNKNOWN, GESTURE_TOUCH_EXPLORATION, GESTURE_2_FINGER_SINGLE_TAP, GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD, GESTURE_2_FINGER_DOUBLE_TAP, Loading Loading @@ -139,17 +148,27 @@ public final class AccessibilityGestureEvent implements Parcelable { @GestureId private final int mGestureId; private final int mDisplayId; private List<MotionEvent> mMotionEvents = new ArrayList<>(); /** @hide */ @TestApi public AccessibilityGestureEvent(int gestureId, int displayId) { public AccessibilityGestureEvent( int gestureId, int displayId, @NonNull List<MotionEvent> motionEvents) { mGestureId = gestureId; mDisplayId = displayId; mMotionEvents.addAll(motionEvents); } /** @hide */ @TestApi public AccessibilityGestureEvent(int gestureId, int displayId) { this(gestureId, displayId, new ArrayList<MotionEvent>()); } private AccessibilityGestureEvent(@NonNull Parcel parcel) { mGestureId = parcel.readInt(); mDisplayId = parcel.readInt(); ParceledListSlice<MotionEvent> slice = parcel.readParcelable(getClass().getClassLoader()); mMotionEvents = slice.getList(); } /** Loading @@ -172,6 +191,15 @@ public final class AccessibilityGestureEvent implements Parcelable { return mGestureId; } /** * Returns the motion events that lead to this gesture. * */ @NonNull public List<MotionEvent> getMotionEvents() { return mMotionEvents; } @NonNull @Override public String toString() { Loading @@ -179,12 +207,26 @@ public final class AccessibilityGestureEvent implements Parcelable { stringBuilder.append("gestureId: ").append(eventTypeToString(mGestureId)); stringBuilder.append(", "); stringBuilder.append("displayId: ").append(mDisplayId); stringBuilder.append(", "); stringBuilder.append("Motion Events: ["); for (int i = 0; i < mMotionEvents.size(); ++i) { String action = MotionEvent.actionToString(mMotionEvents.get(i).getActionMasked()); stringBuilder.append(action); if (i < (mMotionEvents.size() - 1)) { stringBuilder.append(", "); } else { stringBuilder.append("]"); } } stringBuilder.append(']'); return stringBuilder.toString(); } private static String eventTypeToString(int eventType) { switch (eventType) { case GESTURE_UNKNOWN: return "GESTURE_UNKNOWN"; case GESTURE_PASSTHROUGH: return "GESTURE_PASSTHROUGH"; case GESTURE_TOUCH_EXPLORATION: return "GESTURE_TOUCH_EXPLORATION"; case GESTURE_2_FINGER_SINGLE_TAP: return "GESTURE_2_FINGER_SINGLE_TAP"; case GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD: return "GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD"; Loading Loading @@ -252,6 +294,7 @@ public final class AccessibilityGestureEvent implements Parcelable { public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeInt(mGestureId); parcel.writeInt(mDisplayId); parcel.writeParcelable(new ParceledListSlice<MotionEvent>(mMotionEvents), 0); } /** Loading
core/java/android/accessibilityservice/AccessibilityService.java +23 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,29 @@ import java.util.function.Consumer; */ public abstract class AccessibilityService extends Service { /** * The user has performed a touch-exploration gesture on the touch screen without ever * triggering gesture detection. This gesture is only dispatched when {@link * AccessibilityServiceInfo#FLAG_SEND_MOTION_EVENTS} is set. * * @hide */ public static final int GESTURE_TOUCH_EXPLORATION = -2; /** * The user has performed a passthrough gesture on the touch screen without ever triggering * gesture detection. This gesture is only dispatched when {@link * AccessibilityServiceInfo#FLAG_SEND_MOTION_EVENTS} is set. * @hide */ public static final int GESTURE_PASSTHROUGH = -1; /** * The user has performed an unrecognized gesture on the touch screen. This gesture is only * dispatched when {@link AccessibilityServiceInfo#FLAG_SEND_MOTION_EVENTS} is set. */ public static final int GESTURE_UNKNOWN = 0; /** * The user has performed a swipe up gesture on the touch screen. */ Loading
core/java/android/accessibilityservice/AccessibilityServiceInfo.java +16 −0 Original line number Diff line number Diff line Loading @@ -376,6 +376,20 @@ public class AccessibilityServiceInfo implements Parcelable { */ public static final int FLAG_REQUEST_2_FINGER_PASSTHROUGH = 0x0002000; /** * This flag requests that when when {@link #FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is enabled, a * service will receive the motion events for each successfully-detected gesture. The service * will also receive an AccessibilityGestureEvent of type GESTURE_INVALID for each cancelled * gesture along with its motion events. A service will receive a gesture of type * GESTURE_PASSTHROUGH and accompanying motion events for every passthrough gesture that does * not start gesture detection. This information can be used to collect instances of improper * gesture detection behavior and relay that information to framework developers. If {@link * #FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is disabled this flag has no effect. * * @see #FLAG_REQUEST_TOUCH_EXPLORATION_MODE */ public static final int FLAG_SEND_MOTION_EVENTS = 0x0004000; /** {@hide} */ public static final int FLAG_FORCE_DIRECT_BOOT_AWARE = 0x00010000; Loading Loading @@ -1276,6 +1290,8 @@ public class AccessibilityServiceInfo implements Parcelable { return "FLAG_REQUEST_MULTI_FINGER_GESTURES"; case FLAG_REQUEST_2_FINGER_PASSTHROUGH: return "FLAG_REQUEST_2_FINGER_PASSTHROUGH"; case FLAG_SEND_MOTION_EVENTS: return "FLAG_SEND_MOTION_EVENTS"; case FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY: return "FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY"; case FLAG_REPORT_VIEW_IDS: Loading
core/res/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -3748,6 +3748,7 @@ <flag name="flagServiceHandlesDoubleTap" value="0x00000800" /> <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_MULTI_FINGER_GESTURES}. --> <flag name="flagRequestMultiFingerGestures" value="0x00001000" /> <flag name="flagSendMotionEvents" value="0x0004000" /> </attr> <!-- Component name of an activity that allows the user to modify the settings for this service. This setting cannot be changed at runtime. --> Loading