Merge "Fix the global gesture to enable accessibility." into lmp-dev
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user