diff options
| author | 2019-12-19 17:19:32 -0800 | |
|---|---|---|
| committer | 2019-12-19 17:43:32 -0800 | |
| commit | e577f7855219e68ef57232affb9c4755a065c99f (patch) | |
| tree | a8d5a6bacbbad8e413843ed7658546c375433bf7 | |
| parent | 41df8e465cb2a068f2ed443bedef13155d7e781a (diff) | |
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
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/wm/DisplayWindowController.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayWindowController.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayWindowController.java index aa56ffb18554..aed90eb7310d 100644 --- a/packages/SystemUI/src/com/android/systemui/wm/DisplayWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayWindowController.java @@ -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); } |