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

Commit 6a34da5a authored by ryanlwlin's avatar ryanlwlin
Browse files

Don't notify display removed if it's a private virtual display

Some operation will be done When displays are removed/Added,
but virtual private display should be excluded.

Bug: 148760652
Test: manual test:1.Enable the magnification from a11y setting
2. Enable the select to speak and read text on images
3.Tap the a11y shortcut to select to speak the content
4. check if the content is selected correctly.
Change-Id: I8e0fbc4da7cbb6b9c5bf5366115b3863be5243bb
parent c4d21d43
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -2875,11 +2875,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        @Override
        public void onDisplayRemoved(int displayId) {
            synchronized (mLock) {
                for (int i = 0; i < mDisplaysList.size(); i++) {
                    if (mDisplaysList.get(i).getDisplayId() == displayId) {
                        mDisplaysList.remove(i);
                        break;
                    }
                if (!removeDisplayFromList(displayId)) {
                    return;
                }
                if (mInputFilter != null) {
                    mInputFilter.onDisplayChanged();
@@ -2899,6 +2896,17 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            mA11yWindowManager.stopTrackingWindows(displayId);
        }

        @GuardedBy("mLock")
        private boolean removeDisplayFromList(int displayId) {
            for (int i = 0; i < mDisplaysList.size(); i++) {
                if (mDisplaysList.get(i).getDisplayId() == displayId) {
                    mDisplaysList.remove(i);
                    return true;
                }
            }
            return false;
        }

        @Override
        public void onDisplayChanged(int displayId) {
            /* do nothing */
@@ -2910,8 +2918,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            }
            // Private virtual displays are created by the ap and is not allowed to access by other
            // aps. We assume we could ignore them.
            if ((display.getType() == Display.TYPE_VIRTUAL
                    && (display.getFlags() & Display.FLAG_PRIVATE) != 0)) {
            if (display.getType() == Display.TYPE_VIRTUAL
                    && (display.getFlags() & Display.FLAG_PRIVATE) != 0) {
                return false;
            }
            return true;