@@ -827,7 +827,7 @@ private void notifyAccessibilityServicesDelayedLocked(AccessibilityEvent event,
827827 private void tryAddServiceLocked (Service service , int userId ) {
828828 try {
829829 UserState userState = getUserStateLocked (userId );
830- if (userState .mServices .contains (service ) || ! service . isConfigured () ) {
830+ if (userState .mServices .contains (service )) {
831831 return ;
832832 }
833833 service .linkToOwnDeath ();
@@ -876,7 +876,7 @@ private boolean tryRemoveServiceLocked(Service service) {
876876 private boolean canDispathEventLocked (Service service , AccessibilityEvent event ,
877877 int handledFeedbackTypes ) {
878878
879- if (!service .isConfigured ()) {
879+ if (!service .canReceiveEvents ()) {
880880 return false ;
881881 }
882882
@@ -1192,7 +1192,8 @@ private void handleTouchExplorationGrantedAccessibilityServicesChangedLocked(
11921192
11931193 private void tryEnableTouchExplorationLocked (final Service service ) {
11941194 UserState userState = getUserStateLocked (service .mUserId );
1195- if (!userState .mIsTouchExplorationEnabled && service .mRequestTouchExplorationMode ) {
1195+ if (!userState .mIsTouchExplorationEnabled && service .mRequestTouchExplorationMode
1196+ && service .canReceiveEvents ()) {
11961197 final boolean canToggleTouchExploration =
11971198 userState .mTouchExplorationGrantedServices .contains (service .mComponentName );
11981199 if (!service .mIsAutomation && !canToggleTouchExploration ) {
@@ -1205,6 +1206,9 @@ private void tryEnableTouchExplorationLocked(final Service service) {
12051206 }
12061207
12071208 private void tryDisableTouchExplorationLocked (Service service ) {
1209+ if (!service .canReceiveEvents ()) {
1210+ return ;
1211+ }
12081212 UserState userState = getUserStateLocked (service .mUserId );
12091213 if (userState .mIsTouchExplorationEnabled ) {
12101214 final int serviceCount = userState .mServices .size ();
@@ -1464,7 +1468,7 @@ public void setDynamicallyConfigurableProperties(AccessibilityServiceInfo info)
14641468 // If this service is up and running we may have to enable touch
14651469 // exploration, otherwise this will happen when the service connects.
14661470 synchronized (mLock ) {
1467- if (isConfigured ()) {
1471+ if (canReceiveEvents ()) {
14681472 if (mRequestTouchExplorationMode ) {
14691473 tryEnableTouchExplorationLocked (this );
14701474 } else {
@@ -1505,13 +1509,7 @@ public boolean unbind() {
15051509 return false ;
15061510 }
15071511
1508- /**
1509- * Returns if the service is configured i.e. at least event types of interest
1510- * and feedback type must be set.
1511- *
1512- * @return True if the service is configured, false otherwise.
1513- */
1514- public boolean isConfigured () {
1512+ public boolean canReceiveEvents () {
15151513 return (mEventTypes != 0 && mFeedbackType != 0 && mService != null );
15161514 }
15171515
0 commit comments