Loading services/core/java/com/android/server/wm/DisplayContent.java +11 −5 Original line number Diff line number Diff line Loading @@ -980,12 +980,18 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo if (prevDc == this) { return; } if (prevDc != null && prevDc.mTokenMap.remove(token.token) != null && token.asAppWindowToken() == null) { // Removed the token from the map, but made sure it's not an app token before removing // from parent. if (prevDc != null) { if (prevDc.mTokenMap.remove(token.token) != null && token.asAppWindowToken() == null) { // Removed the token from the map, but made sure it's not an app token before // removing from parent. token.getParent().removeChild(token); } if (prevDc.mLastFocus == mCurrentFocus) { // The window has become the focus of this display, so it should not be notified // that it lost focus from the previous display. prevDc.mLastFocus = null; } } addWindowToken(token.token, token); } Loading services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java +12 −0 Original line number Diff line number Diff line Loading @@ -548,6 +548,18 @@ public class DisplayContentTests extends WindowTestsBase { .setDisplayInfoOverrideFromWindowManager(dc.getDisplayId(), null); } @Test public void testClearLastFocusWhenReparentingFocusedWindow() { final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); final WindowState window = createWindow(null /* parent */, TYPE_BASE_APPLICATION, defaultDisplay, "window"); defaultDisplay.mLastFocus = window; mDisplayContent.mCurrentFocus = window; mDisplayContent.reParentWindowToken(window.mToken); assertNull(defaultDisplay.mLastFocus); } @Test public void testGetPreferredOptionsPanelGravityFromDifferentDisplays() { final DisplayContent portraitDisplay = createNewDisplay(); Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +11 −5 Original line number Diff line number Diff line Loading @@ -980,12 +980,18 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo if (prevDc == this) { return; } if (prevDc != null && prevDc.mTokenMap.remove(token.token) != null && token.asAppWindowToken() == null) { // Removed the token from the map, but made sure it's not an app token before removing // from parent. if (prevDc != null) { if (prevDc.mTokenMap.remove(token.token) != null && token.asAppWindowToken() == null) { // Removed the token from the map, but made sure it's not an app token before // removing from parent. token.getParent().removeChild(token); } if (prevDc.mLastFocus == mCurrentFocus) { // The window has become the focus of this display, so it should not be notified // that it lost focus from the previous display. prevDc.mLastFocus = null; } } addWindowToken(token.token, token); } Loading
services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java +12 −0 Original line number Diff line number Diff line Loading @@ -548,6 +548,18 @@ public class DisplayContentTests extends WindowTestsBase { .setDisplayInfoOverrideFromWindowManager(dc.getDisplayId(), null); } @Test public void testClearLastFocusWhenReparentingFocusedWindow() { final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); final WindowState window = createWindow(null /* parent */, TYPE_BASE_APPLICATION, defaultDisplay, "window"); defaultDisplay.mLastFocus = window; mDisplayContent.mCurrentFocus = window; mDisplayContent.reParentWindowToken(window.mToken); assertNull(defaultDisplay.mLastFocus); } @Test public void testGetPreferredOptionsPanelGravityFromDifferentDisplays() { final DisplayContent portraitDisplay = createNewDisplay(); Loading