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

Commit e3929e99 authored by Daniel Norman's avatar Daniel Norman Committed by Android (Google) Code Review
Browse files

Merge "Remove usage of bugfix flag add_window_token_without_lock" into main

parents bfae0bf2 a9c5fb0e
Loading
Loading
Loading
Loading
+27 −45
Original line number Diff line number Diff line
@@ -5225,7 +5225,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        private int mSystemUiUid = 0;

        AccessibilityDisplayListener(Context context, Handler handler) {
            if (Flags.addWindowTokenWithoutLock()) {
            // Avoid concerns about one thread adding displays while another thread removes
            // them by ensuring the looper is the main looper and the DisplayListener
            // callbacks are always executed on the one main thread.
@@ -5237,7 +5236,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            } else if (!isMainHandler) {
                Slog.e(LOG_TAG, errorMessage);
            }
            }

            mDisplayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
            mDisplayManager.registerDisplayListener(this, handler);
@@ -5280,7 +5278,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub

        @Override
        public void onDisplayAdded(int displayId) {
            if (Flags.addWindowTokenWithoutLock()) {
            final boolean isMainThread = Looper.getMainLooper().isCurrentThread();
            final String errorMessage = "onDisplayAdded must be called from the main thread";
            if (Build.IS_USERDEBUG || Build.IS_ENG) {
@@ -5288,7 +5285,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            } else if (!isMainThread) {
                Slog.e(LOG_TAG, errorMessage);
            }
            }
            final Display display = mDisplayManager.getDisplay(displayId);
            if (!isValidDisplay(display)) {
                return;
@@ -5303,22 +5299,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    mInputFilter.onDisplayAdded(display);
                }
                AccessibilityUserState userState = getCurrentUserStateLocked();
                if (Flags.addWindowTokenWithoutLock()) {
                services = new ArrayList<>(userState.mBoundServices);
                } else {
                    services = userState.mBoundServices;
                    if (displayId != Display.DEFAULT_DISPLAY) {
                        for (int i = 0; i < services.size(); i++) {
                            AccessibilityServiceConnection boundClient = services.get(i);
                            boundClient.addWindowTokenForDisplay(displayId);
                        }
                    }
                }
                updateMagnificationLocked(userState);
                updateWindowsForAccessibilityCallbackLocked(userState);
                notifyClearAccessibilityCacheLocked();
            }
            if (Flags.addWindowTokenWithoutLock()) {
            if (displayId != Display.DEFAULT_DISPLAY) {
                for (int i = 0; i < services.size(); i++) {
                    AccessibilityServiceConnection boundClient = services.get(i);
@@ -5326,11 +5311,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                }
            }
        }
        }

        @Override
        public void onDisplayRemoved(int displayId) {
            if (Flags.addWindowTokenWithoutLock()) {
            final boolean isMainThread = Looper.getMainLooper().isCurrentThread();
            final String errorMessage = "onDisplayRemoved must be called from the main thread";
            if (Build.IS_USERDEBUG || Build.IS_ENG) {
@@ -5338,7 +5321,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            } else if (!isMainThread) {
                Slog.e(LOG_TAG, errorMessage);
            }
            }
            synchronized (mLock) {
                if (!removeDisplayFromList(displayId)) {
                    return;
+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
    @Override
    public void onServiceConnected(ComponentName componentName, IBinder service) {
        AccessibilityUserState userState = mUserStateWeakReference.get();
        if (userState != null && Flags.addWindowTokenWithoutLock()) {
        if (userState != null) {
            addWindowTokensForAllDisplays();
        }
        synchronized (mLock) {
+0 −3
Original line number Diff line number Diff line
@@ -243,9 +243,6 @@ class AccessibilityUserState {

    void addServiceLocked(AccessibilityServiceConnection serviceConnection) {
        if (!mBoundServices.contains(serviceConnection)) {
            if (!Flags.addWindowTokenWithoutLock()) {
                serviceConnection.addWindowTokensForAllDisplays();
            }
            mBoundServices.add(serviceConnection);
            mComponentNameToServiceMap.put(serviceConnection.getComponentName(), serviceConnection);
            mServiceInfoChangeListener.onServiceInfoChangedLocked(this);
+1 −6
Original line number Diff line number Diff line
@@ -136,9 +136,6 @@ class UiAutomationManager {
            return;
        }

        if (!Flags.addWindowTokenWithoutLock()) {
            mUiAutomationService.addWindowTokensForAllDisplays();
        }
        // UiAutomationService#connectServiceUnknownThread posts to a handler
        // so this call should return immediately.
        mUiAutomationService.connectServiceUnknownThread();
@@ -286,9 +283,7 @@ class UiAutomationManager {
                    // If the serviceInterface is null, the UiAutomation has been shut down on
                    // another thread.
                    if (serviceInterface != null) {
                        if (Flags.addWindowTokenWithoutLock()) {
                        mUiAutomationService.addWindowTokensForAllDisplays();
                        }
                        if (mTrace.isA11yTracingEnabledForTypes(
                                AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CLIENT)) {
                            mTrace.logTrace("UiAutomationService.connectServiceUnknownThread",
+0 −1
Original line number Diff line number Diff line
@@ -208,7 +208,6 @@ public class AccessibilityServiceConnectionTest {
    }

    @Test
    @RequiresFlagsEnabled(Flags.FLAG_ADD_WINDOW_TOKEN_WITHOUT_LOCK)
    public void onServiceConnected_addsWindowTokens() {
        setServiceBinding(COMPONENT_NAME);
        mConnection.bindLocked();
Loading