Loading services/core/java/com/android/server/wm/DisplayContent.java +7 −32 Original line number Diff line number Diff line Loading @@ -504,11 +504,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ WindowState mCurrentFocus = null; /** * The last focused window that we've notified the client that the focus is changed. */ WindowState mLastFocus = null; /** * The foreground app of this display. Windows below this app cannot be the focused window. If * the user taps on the area outside of the task of the focused app, we will notify AM about the Loading Loading @@ -1244,12 +1239,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // removing from parent. token.getParent().removeChild(token); } if (token.hasChild(prevDc.mLastFocus)) { // If the reparent window token contains previous display's last focus window, means // it will end up to gain window focus on the target display, so it should not be // notified that it lost focus from the previous display. prevDc.mLastFocus = null; } } addWindowToken(token.token, token); Loading Loading @@ -3204,9 +3193,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp pw.print(prefix); pw.print("mLayoutSeq="); pw.println(mLayoutSeq); pw.print(" mCurrentFocus="); pw.println(mCurrentFocus); if (mLastFocus != mCurrentFocus) { pw.print(" mLastFocus="); pw.println(mLastFocus); } pw.print(" mFocusedApp="); pw.println(mFocusedApp); if (mFixedRotationLaunchingApp != null) { pw.println(" mFixedRotationLaunchingApp=" + mFixedRotationLaunchingApp); Loading Loading @@ -3437,8 +3423,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } onWindowFocusChanged(oldFocus, newFocus); int focusChanged = getDisplayPolicy().focusChangedLw(oldFocus, newFocus); if (imWindowChanged && oldFocus != mInputMethodWindow) { Loading Loading @@ -3489,7 +3473,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mAccessibilityController)); } mLastFocus = mCurrentFocus; return true; } Loading @@ -3497,20 +3480,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp accessibilityController.onWindowFocusChangedNot(getDisplayId()); } private static void onWindowFocusChanged(WindowState oldFocus, WindowState newFocus) { final Task focusedTask = newFocus != null ? newFocus.getTask() : null; final Task unfocusedTask = oldFocus != null ? oldFocus.getTask() : null; if (focusedTask == unfocusedTask) { return; } if (focusedTask != null) { focusedTask.onWindowFocusChanged(true /* hasFocus */); } if (unfocusedTask != null) { unfocusedTask.onWindowFocusChanged(false /* hasFocus */); } } /** * Set the new focused app to this display. * Loading @@ -3534,7 +3503,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } ProtoLog.i(WM_DEBUG_FOCUS_LIGHT, "setFocusedApp %s displayId=%d Callers=%s", newFocus, getDisplayId(), Debug.getCallers(4)); final Task oldTask = mFocusedApp != null ? mFocusedApp.getTask() : null; final Task newTask = newFocus != null ? newFocus.getTask() : null; mFocusedApp = newFocus; if (oldTask != newTask) { if (oldTask != null) oldTask.onAppFocusChanged(false); if (newTask != null) newTask.onAppFocusChanged(true); } getInputMonitor().setFocusedAppLw(newFocus); updateTouchExcludeRegion(); return true; Loading Loading @@ -4230,7 +4206,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (DEBUG_INPUT_METHOD) { Slog.i(TAG_WM, "Desired input method target: " + imFocus); Slog.i(TAG_WM, "Current focus: " + mCurrentFocus + " displayId=" + mDisplayId); Slog.i(TAG_WM, "Last focus: " + mLastFocus + " displayId=" + mDisplayId); } if (DEBUG_INPUT_METHOD) { Loading services/core/java/com/android/server/wm/Task.java +4 −5 Original line number Diff line number Diff line Loading @@ -4314,10 +4314,10 @@ class Task extends TaskFragment { * @return true if the task is currently focused. */ private boolean isFocused() { if (mDisplayContent == null || mDisplayContent.mCurrentFocus == null) { if (mDisplayContent == null || mDisplayContent.mFocusedApp == null) { return false; } return mDisplayContent.mCurrentFocus.getTask() == this; return mDisplayContent.mFocusedApp.getTask() == this; } /** Loading Loading @@ -4374,10 +4374,9 @@ class Task extends TaskFragment { * Called on the task of a window which gained or lost focus. * @param hasFocus */ void onWindowFocusChanged(boolean hasFocus) { void onAppFocusChanged(boolean hasFocus) { updateShadowsRadius(hasFocus, getSyncTransaction()); // TODO(b/180525887): Un-comment once there is resolution on the bug. // dispatchTaskInfoChangedIfNeeded(false /* force */); dispatchTaskInfoChangedIfNeeded(false /* force */); } void onPictureInPictureParamsChanged() { Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +0 −13 Original line number Diff line number Diff line Loading @@ -871,19 +871,6 @@ public class DisplayContentTests extends WindowTestsBase { .setDisplayInfoOverrideFromWindowManager(dc.getDisplayId(), null); } @UseTestDisplay @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 +7 −32 Original line number Diff line number Diff line Loading @@ -504,11 +504,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ WindowState mCurrentFocus = null; /** * The last focused window that we've notified the client that the focus is changed. */ WindowState mLastFocus = null; /** * The foreground app of this display. Windows below this app cannot be the focused window. If * the user taps on the area outside of the task of the focused app, we will notify AM about the Loading Loading @@ -1244,12 +1239,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // removing from parent. token.getParent().removeChild(token); } if (token.hasChild(prevDc.mLastFocus)) { // If the reparent window token contains previous display's last focus window, means // it will end up to gain window focus on the target display, so it should not be // notified that it lost focus from the previous display. prevDc.mLastFocus = null; } } addWindowToken(token.token, token); Loading Loading @@ -3204,9 +3193,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp pw.print(prefix); pw.print("mLayoutSeq="); pw.println(mLayoutSeq); pw.print(" mCurrentFocus="); pw.println(mCurrentFocus); if (mLastFocus != mCurrentFocus) { pw.print(" mLastFocus="); pw.println(mLastFocus); } pw.print(" mFocusedApp="); pw.println(mFocusedApp); if (mFixedRotationLaunchingApp != null) { pw.println(" mFixedRotationLaunchingApp=" + mFixedRotationLaunchingApp); Loading Loading @@ -3437,8 +3423,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } onWindowFocusChanged(oldFocus, newFocus); int focusChanged = getDisplayPolicy().focusChangedLw(oldFocus, newFocus); if (imWindowChanged && oldFocus != mInputMethodWindow) { Loading Loading @@ -3489,7 +3473,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mAccessibilityController)); } mLastFocus = mCurrentFocus; return true; } Loading @@ -3497,20 +3480,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp accessibilityController.onWindowFocusChangedNot(getDisplayId()); } private static void onWindowFocusChanged(WindowState oldFocus, WindowState newFocus) { final Task focusedTask = newFocus != null ? newFocus.getTask() : null; final Task unfocusedTask = oldFocus != null ? oldFocus.getTask() : null; if (focusedTask == unfocusedTask) { return; } if (focusedTask != null) { focusedTask.onWindowFocusChanged(true /* hasFocus */); } if (unfocusedTask != null) { unfocusedTask.onWindowFocusChanged(false /* hasFocus */); } } /** * Set the new focused app to this display. * Loading @@ -3534,7 +3503,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } ProtoLog.i(WM_DEBUG_FOCUS_LIGHT, "setFocusedApp %s displayId=%d Callers=%s", newFocus, getDisplayId(), Debug.getCallers(4)); final Task oldTask = mFocusedApp != null ? mFocusedApp.getTask() : null; final Task newTask = newFocus != null ? newFocus.getTask() : null; mFocusedApp = newFocus; if (oldTask != newTask) { if (oldTask != null) oldTask.onAppFocusChanged(false); if (newTask != null) newTask.onAppFocusChanged(true); } getInputMonitor().setFocusedAppLw(newFocus); updateTouchExcludeRegion(); return true; Loading Loading @@ -4230,7 +4206,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (DEBUG_INPUT_METHOD) { Slog.i(TAG_WM, "Desired input method target: " + imFocus); Slog.i(TAG_WM, "Current focus: " + mCurrentFocus + " displayId=" + mDisplayId); Slog.i(TAG_WM, "Last focus: " + mLastFocus + " displayId=" + mDisplayId); } if (DEBUG_INPUT_METHOD) { Loading
services/core/java/com/android/server/wm/Task.java +4 −5 Original line number Diff line number Diff line Loading @@ -4314,10 +4314,10 @@ class Task extends TaskFragment { * @return true if the task is currently focused. */ private boolean isFocused() { if (mDisplayContent == null || mDisplayContent.mCurrentFocus == null) { if (mDisplayContent == null || mDisplayContent.mFocusedApp == null) { return false; } return mDisplayContent.mCurrentFocus.getTask() == this; return mDisplayContent.mFocusedApp.getTask() == this; } /** Loading Loading @@ -4374,10 +4374,9 @@ class Task extends TaskFragment { * Called on the task of a window which gained or lost focus. * @param hasFocus */ void onWindowFocusChanged(boolean hasFocus) { void onAppFocusChanged(boolean hasFocus) { updateShadowsRadius(hasFocus, getSyncTransaction()); // TODO(b/180525887): Un-comment once there is resolution on the bug. // dispatchTaskInfoChangedIfNeeded(false /* force */); dispatchTaskInfoChangedIfNeeded(false /* force */); } void onPictureInPictureParamsChanged() { Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +0 −13 Original line number Diff line number Diff line Loading @@ -871,19 +871,6 @@ public class DisplayContentTests extends WindowTestsBase { .setDisplayInfoOverrideFromWindowManager(dc.getDisplayId(), null); } @UseTestDisplay @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