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

Commit e577f785 authored by Evan Rosky's avatar Evan Rosky
Browse files

Don't monitor private displays

If there are displays marked private that belong to other
processes, it doesn't make sense for systemui to be aware of
them.

Bug: 146566787
Test: Multi-display CTS tests pass
Change-Id: I8f6c3e3159bb008ba451cd280ee379f313e0629a
parent 41df8e46
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -99,13 +99,17 @@ public class DisplayWindowController {
                            if (mDisplays.get(displayId) != null) {
                                return;
                            }
                            Display display = getDisplay(displayId);
                            if (display == null) {
                                // It's likely that the display is private to some app and thus not
                                // accessible by system-ui.
                                return;
                            }
                            DisplayRecord record = new DisplayRecord();
                            record.mDisplayId = displayId;
                            // TODO(b/146566787): disabled for MultiDisplayActivityLaunchTests
                            // Display display = getDisplay(displayId);
                            // record.mContext = (displayId == Display.DEFAULT_DISPLAY) ? mContext
                            //         : mContext.createDisplayContext(display);
                            // record.mDisplayLayout = new DisplayLayout(record.mContext, display);
                            record.mContext = (displayId == Display.DEFAULT_DISPLAY) ? mContext
                                    : mContext.createDisplayContext(display);
                            record.mDisplayLayout = new DisplayLayout(record.mContext, display);
                            mDisplays.put(displayId, record);
                            for (int i = 0; i < mDisplayChangedListeners.size(); ++i) {
                                mDisplayChangedListeners.get(i).onDisplayAdded(displayId);
@@ -124,14 +128,13 @@ public class DisplayWindowController {
                                        + " display.");
                                return;
                            }
                            // TODO(b/146566787): disabled for MultiDisplaySystemDecorationTests
                            // Display display = getDisplay(displayId);
                            // Context perDisplayContext = mContext;
                            // if (displayId != Display.DEFAULT_DISPLAY) {
                            //     perDisplayContext = mContext.createDisplayContext(display);
                            // }
                            // dr.mContext = perDisplayContext.createConfigurationContext(newConfig);
                            // dr.mDisplayLayout = new DisplayLayout(dr.mContext, display);
                            Display display = getDisplay(displayId);
                            Context perDisplayContext = mContext;
                            if (displayId != Display.DEFAULT_DISPLAY) {
                                perDisplayContext = mContext.createDisplayContext(display);
                            }
                            dr.mContext = perDisplayContext.createConfigurationContext(newConfig);
                            dr.mDisplayLayout = new DisplayLayout(dr.mContext, display);
                            for (int i = 0; i < mDisplayChangedListeners.size(); ++i) {
                                mDisplayChangedListeners.get(i).onDisplayConfigurationChanged(
                                        displayId, newConfig);
@@ -144,6 +147,9 @@ public class DisplayWindowController {
                public void onDisplayRemoved(int displayId) {
                    mHandler.post(() -> {
                        synchronized (mDisplays) {
                            if (mDisplays.get(displayId) == null) {
                                return;
                            }
                            for (int i = mDisplayChangedListeners.size() - 1; i >= 0; --i) {
                                mDisplayChangedListeners.get(i).onDisplayRemoved(displayId);
                            }