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

Commit 846522ce authored by Phil Weaver's avatar Phil Weaver
Browse files

Clean up UiAutomation working alongside a11y.

Fix two bugs: one where Instrumentation did not properly
handle destroyed UiAutomations, another where UiAutomation
did not properly disable running accessibility services.

Change-Id: I1773dbd373f4d5b0e7c9917ff18d8d9b1a0e07c7
parent cc83ea79
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1842,14 +1842,11 @@ public class Instrumentation {
     * @see UiAutomation
     */
    public UiAutomation getUiAutomation() {
        if (mUiAutomationConnection != null) {
            if (mUiAutomation == null) {
        if ((mUiAutomation == null) || (mUiAutomation.isDestroyed())) {
            return getUiAutomation(0);
        }
        return mUiAutomation;
    }
        return null;
    }

    /**
     * Gets the {@link UiAutomation} instance with flags set.
+1 −2
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -650,7 +649,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            userState.mUiAutomationFlags = flags;
            userState.mIsAccessibilityEnabled = true;
            userState.mInstalledServices.add(accessibilityServiceInfo);
            if (userState.isUiAutomationSuppressingOtherServices()) {
            if ((flags & UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES) == 0) {
                // Set the temporary state.
                userState.mIsTouchExplorationEnabled = false;
                userState.mIsEnhancedWebAccessibilityEnabled = false;