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

Commit 074d27dd authored by Svetoslav's avatar Svetoslav Committed by Android (Google) Code Review
Browse files

Merge "Fix the global gesture to enable accessibility." into lmp-dev

parents e37679b2 dc6d1a9c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public class EnableAccessibilityController {


    private final Context mContext;
    private final Runnable mOnAccessibilityEnabledCallback;
    private final UserManager mUserManager;
    private final TextToSpeech mTts;
    private final Ringtone mTone;
@@ -97,8 +98,9 @@ public class EnableAccessibilityController {
    private float mSecondPointerDownX;
    private float mSecondPointerDownY;

    public EnableAccessibilityController(Context context) {
    public EnableAccessibilityController(Context context, Runnable onAccessibilityEnabledCallback) {
        mContext = context;
        mOnAccessibilityEnabledCallback = onAccessibilityEnabledCallback;
        mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        mTts = new TextToSpeech(context, new TextToSpeech.OnInitListener() {
            @Override
@@ -275,5 +277,7 @@ public class EnableAccessibilityController {
                /* ignore */
            }
        }

        mOnAccessibilityEnabledCallback.run();
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -1073,7 +1073,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
            // is dismissed on the first down while the global gesture is a long press
            // with two fingers anywhere on the screen.
            if (EnableAccessibilityController.canEnableAccessibilityViaGesture(mContext)) {
                mEnableAccessibilityController = new EnableAccessibilityController(mContext);
                mEnableAccessibilityController = new EnableAccessibilityController(mContext,
                        new Runnable() {
                    @Override
                    public void run() {
                        dismiss();
                    }
                });
                super.setCanceledOnTouchOutside(false);
            } else {
                mEnableAccessibilityController = null;
+1 −0
Original line number Diff line number Diff line
@@ -708,6 +708,7 @@ class TouchExplorer implements EventStreamTransformation {
                     // Send an event to the end of the drag gesture.
                     sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
                 }
                 mCurrentState = STATE_TOUCH_EXPLORING;
            } break;
            case MotionEvent.ACTION_UP: {
                mAms.onTouchInteractionEnd();