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

Commit 687fb4bc authored by Ryan Lin's avatar Ryan Lin Committed by Android (Google) Code Review
Browse files

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

parents 16c028fe 6a34da5a
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -2879,11 +2879,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();
@@ -2903,6 +2900,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 */
@@ -2914,8 +2922,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;