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

Commit 2205d204 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "System accessibility state update postponed if UI test autmation is running." into jb-dev

parents 8871403a 4074e8a3
Loading
Loading
Loading
Loading
+42 −21
Original line number Diff line number Diff line
@@ -191,10 +191,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            @Override
            public void onSomePackagesChanged() {
                synchronized (mLock) {
                    // We will update when the automation service dies.
                    if (mUiAutomationService == null) {
                        populateAccessibilityServiceListLocked();
                        manageServicesLocked();
                    }
                }
            }

            @Override
            public void onPackageRemoved(String packageName, int uid) {
@@ -242,12 +245,15 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            public void onReceive(Context context, Intent intent) {
                if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
                    synchronized (mLock) {
                        // We will update when the automation service dies.
                        if (mUiAutomationService == null) {
                            populateAccessibilityServiceListLocked();
                            handleAccessibilityEnabledSettingChangedLocked();
                            handleTouchExplorationEnabledSettingChangedLocked();
                            updateInputFilterLocked();
                            sendStateToClientsLocked();
                        }
                    }

                    return;
                }
@@ -294,11 +300,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                public void onChange(boolean selfChange) {
                    super.onChange(selfChange);
                    synchronized (mLock) {
                        // We will update when the automation service dies.
                        if (mUiAutomationService == null) {
                            handleAccessibilityEnabledSettingChangedLocked();
                            updateInputFilterLocked();
                            sendStateToClientsLocked();
                        }
                    }
                }
            });

        Uri touchExplorationRequestedUri = Settings.Secure.getUriFor(
@@ -309,11 +318,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                    public void onChange(boolean selfChange) {
                        super.onChange(selfChange);
                        synchronized (mLock) {
                            // We will update when the automation service dies.
                            if (mUiAutomationService == null) {
                                handleTouchExplorationEnabledSettingChangedLocked();
                                updateInputFilterLocked();
                                sendStateToClientsLocked();
                            }
                        }
                    }
                });

        Uri accessibilityServicesUri =
@@ -324,9 +336,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                public void onChange(boolean selfChange) {
                    super.onChange(selfChange);
                    synchronized (mLock) {
                        // We will update when the automation service dies.
                        if (mUiAutomationService == null) {
                            manageServicesLocked();
                        }
                    }
                }
            });
    }

@@ -747,10 +762,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
     * Manages services by starting enabled ones and stopping disabled ones.
     */
    private void manageServicesLocked() {
        // While the UI automation service is running it takes over.
        if (mUiAutomationService != null) {
            return;
        }
        populateEnabledServicesLocked(mEnabledServices);
        final int enabledInstalledServicesCount = updateServicesStateLocked(mInstalledServices,
                mEnabledServices);
@@ -926,8 +937,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {

    private void tryEnableTouchExploration(final Service service) {
        if (!mIsTouchExplorationEnabled && service.mRequestTouchExplorationMode) {
            if (!service.mIsAutomation) {
                mMainHandler.obtainMessage(MSG_SHOW_ENABLE_TOUCH_EXPLORATION_DIALOG,
                        service).sendToTarget();
            } else {
                Settings.Secure.putInt(mContext.getContentResolver(),
                        Settings.Secure.TOUCH_EXPLORATION_ENABLED, 1);
            }
        }
    }

@@ -1479,10 +1495,15 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                // the state based on values in the settings database.
                if (mIsAutomation) {
                    mUiAutomationService = null;

                    handleAccessibilityEnabledSettingChangedLocked();
                    sendStateToClientsLocked();

                    handleTouchExplorationEnabledSettingChangedLocked();
                    updateInputFilterLocked();
                    sendStateToClientsLocked();

                    populateAccessibilityServiceListLocked();
                    manageServicesLocked();
                }
            }
        }