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

Commit b94ac547 authored by Abirami Kalyan's avatar Abirami Kalyan
Browse files

Create gesture utils java library

Test: Manual

Bug: 312652056

Change-Id: I63ec51b3d842527f88406813e26494f7d3a30f25
parent 0cd20302
Loading
Loading
Loading
Loading
+16 −0
Original line number 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 {
    name: "com_android_server_accessibility_flags",
    package: "com.android.server.accessibility",
+3 −3
Original line number 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
 * when a gesture starts or completes.
 */
class GestureManifold implements GestureMatcher.StateChangeListener {
public class GestureManifold implements GestureMatcher.StateChangeListener {

    private static final String LOG_TAG = "GestureManifold";

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

    GestureManifold(Context context, Listener listener, TouchState state, Handler handler) {
    public GestureManifold(Context context, Listener listener, TouchState state, Handler handler) {
        mContext = context;
        mHandler = handler;
        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
     *     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 (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                // Validity safeguard: if touch state is clear, then matchers should always be clear