diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2022-04-09 06:28:52 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-04-09 06:28:52 +0000 |
| commit | c7600cee15ce85a6409662f8554bff3bef0f3777 (patch) | |
| tree | 9d6ba19236571b365ebbca79ba9d09036c74382a /core/java/android | |
| parent | 8459b0ce148863427952d2d2fa54ac0b0202e6b7 (diff) | |
| parent | 7cb26674cc6b37e11c4683a82b4674761e90aa94 (diff) | |
Merge "TouchExplorer: allow service to initiate touch exploration and there are no pointers on the screen" into tm-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/accessibilityservice/TouchInteractionController.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/android/accessibilityservice/TouchInteractionController.java b/core/java/android/accessibilityservice/TouchInteractionController.java index 735df805b872..af00f316de7b 100644 --- a/core/java/android/accessibilityservice/TouchInteractionController.java +++ b/core/java/android/accessibilityservice/TouchInteractionController.java @@ -262,7 +262,7 @@ public final class TouchInteractionController { * interaction. */ public void requestTouchExploration() { - checkState(); + validateTransitionRequest(); final IAccessibilityServiceConnection connection = AccessibilityInteractionClient.getInstance() .getConnection(mService.getConnectionId()); @@ -288,7 +288,7 @@ public final class TouchInteractionController { * @throws IllegalArgumentException if the pointer id is outside of the allowed range. */ public void requestDragging(int pointerId) { - checkState(); + validateTransitionRequest(); if (pointerId < 0 || pointerId > MAX_POINTER_COUNT) { throw new IllegalArgumentException("Invalid pointer id: " + pointerId); } @@ -313,7 +313,7 @@ public final class TouchInteractionController { * the duration of this interaction. */ public void requestDelegating() { - checkState(); + validateTransitionRequest(); final IAccessibilityServiceConnection connection = AccessibilityInteractionClient.getInstance() .getConnection(mService.getConnectionId()); @@ -371,14 +371,14 @@ public final class TouchInteractionController { } } - private void checkState() { + private void validateTransitionRequest() { if (!mServiceDetectsGestures || mCallbacks.size() == 0) { throw new IllegalStateException( "State transitions are not allowed without first adding a callback."); } - if (mState != STATE_TOUCH_INTERACTING && mState != STATE_DRAGGING) { + if ((mState == STATE_DELEGATING || mState == STATE_TOUCH_EXPLORING)) { throw new IllegalStateException( - "State transitions are not allowed in " + stateToString(mState)); + "State transition requests are not allowed in " + stateToString(mState)); } } |
