Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54b89873 authored by Idriss Juhoor's avatar Idriss Juhoor Committed by Android (Google) Code Review
Browse files

Merge "Create gesture utils java library" into main

parents c7762bd4 b94ac547
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,22 @@ java_library_static {
    ],
    ],
}
}


java_library_static {
    name: "AccessibilityGestureUtils",
    srcs: [
        "java/**/gestures/GestureMatcher.java",
        "java/**/gestures/GestureManifold.java",
        "java/**/gestures/MultiFingerMultiTap.java",
        "java/**/gestures/TouchState.java",
    ],
    static_libs: [
        "services.accessibility",
    ],
    libs: [
        "androidx.annotation_annotation",
    ],
}

aconfig_declarations {
aconfig_declarations {
    name: "com_android_server_accessibility_flags",
    name: "com_android_server_accessibility_flags",
    package: "com.android.server.accessibility",
    package: "com.android.server.accessibility",
+3 −3
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ import java.util.List;
 * detector. Gesture matchers are tied to a single gesture. It calls listener callback functions
 * detector. Gesture matchers are tied to a single gesture. It calls listener callback functions
 * when a gesture starts or completes.
 * when a gesture starts or completes.
 */
 */
class GestureManifold implements GestureMatcher.StateChangeListener {
public class GestureManifold implements GestureMatcher.StateChangeListener {


    private static final String LOG_TAG = "GestureManifold";
    private static final String LOG_TAG = "GestureManifold";


@@ -111,7 +111,7 @@ class GestureManifold implements GestureMatcher.StateChangeListener {
    // Shared state information.
    // Shared state information.
    private TouchState mState;
    private TouchState mState;


    GestureManifold(Context context, Listener listener, TouchState state, Handler handler) {
    public GestureManifold(Context context, Listener listener, TouchState state, Handler handler) {
        mContext = context;
        mContext = context;
        mHandler = handler;
        mHandler = handler;
        mListener = listener;
        mListener = listener;
@@ -222,7 +222,7 @@ class GestureManifold implements GestureMatcher.StateChangeListener {
     * @return True if the event has been appropriately handled by the gesture manifold and related
     * @return True if the event has been appropriately handled by the gesture manifold and related
     *     callback functions, false if it should be handled further by the calling function.
     *     callback functions, false if it should be handled further by the calling function.
     */
     */
    boolean onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
    public boolean onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
        if (mState.isClear()) {
        if (mState.isClear()) {
            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                // Validity safeguard: if touch state is clear, then matchers should always be clear
                // Validity safeguard: if touch state is clear, then matchers should always be clear