Loading services/core/java/com/android/server/wm/DisplayContent.java +37 −5 Original line number Original line Diff line number Diff line Loading @@ -4295,7 +4295,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return target; return target; } } if (android.view.inputmethod.Flags.refactorInsetsController()) { if (android.view.inputmethod.Flags.refactorInsetsController()) { final DisplayContent defaultDc = mWmService.getDefaultDisplayContentLocked(); final DisplayContent defaultDc = getUserMainDisplayContent(); return defaultDc.mRemoteInsetsControlTarget; return defaultDc.mRemoteInsetsControlTarget; } else { } else { return getImeFallback(); return getImeFallback(); Loading @@ -4305,11 +4305,26 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp InsetsControlTarget getImeFallback() { InsetsControlTarget getImeFallback() { // host is in non-default display that doesn't support system decor, default to // host is in non-default display that doesn't support system decor, default to // default display's StatusBar to control IME (when available), else let system control it. // default display's StatusBar to control IME (when available), else let system control it. final DisplayContent defaultDc = mWmService.getDefaultDisplayContentLocked(); final DisplayContent defaultDc = getUserMainDisplayContent(); WindowState statusBar = defaultDc.getDisplayPolicy().getStatusBar(); final WindowState statusBar = defaultDc.getDisplayPolicy().getStatusBar(); return statusBar != null ? statusBar : defaultDc.mRemoteInsetsControlTarget; return statusBar != null ? statusBar : defaultDc.mRemoteInsetsControlTarget; } } private DisplayContent getUserMainDisplayContent() { final DisplayContent defaultDc; if (android.view.inputmethod.Flags.fallbackDisplayForSecondaryUserOnSecondaryDisplay()) { final int userId = mWmService.mUmInternal.getUserAssignedToDisplay(mDisplayId); defaultDc = mWmService.getUserMainDisplayContentLocked(userId); if (defaultDc == null) { throw new IllegalStateException( "No default display was assigned to user " + userId); } } else { defaultDc = mWmService.getDefaultDisplayContentLocked(); } return defaultDc; } /** /** * Returns the corresponding IME insets control target according the IME target type. * Returns the corresponding IME insets control target according the IME target type. * * Loading Loading @@ -4845,10 +4860,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // The control target could be the RemoteInsetsControlTarget (if the focussed // The control target could be the RemoteInsetsControlTarget (if the focussed // view is on a virtual display that can not show the IME (and therefore it will // view is on a virtual display that can not show the IME (and therefore it will // be shown on the default display) // be shown on the default display) if (android.view.inputmethod.Flags .fallbackDisplayForSecondaryUserOnSecondaryDisplay()) { if (isUserMainDisplay() && mRemoteInsetsControlTarget != null) { return mRemoteInsetsControlTarget; } } else { if (isDefaultDisplay && mRemoteInsetsControlTarget != null) { if (isDefaultDisplay && mRemoteInsetsControlTarget != null) { return mRemoteInsetsControlTarget; return mRemoteInsetsControlTarget; } } } } } return null; return null; } } Loading @@ -4861,6 +4883,16 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } } } /** * Returns {@code true} if {@link #mDisplayId} corresponds to the user's main display. * * <p>Visible background users may have other than DEFAULT_DISPLAY marked as their main display. */ private boolean isUserMainDisplay() { final int userId = mWmService.mUmInternal.getUserAssignedToDisplay(mDisplayId); return mDisplayId == mWmService.mUmInternal.getMainDisplayAssignedToUser(userId); } /** /** * Computes the window the IME should be attached to. * Computes the window the IME should be attached to. */ */ Loading services/core/java/com/android/server/wm/WindowManagerService.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -7473,6 +7473,23 @@ public class WindowManagerService extends IWindowManager.Stub return mRoot.getDisplayContent(DEFAULT_DISPLAY); return mRoot.getDisplayContent(DEFAULT_DISPLAY); } } /** * Returns the main display content for the user passed as parameter. * * <p>Visible background users may have their own designated main display, distinct from the * system default display (DEFAULT_DISPLAY). Visible background users operate independently * with their own main displays. These secondary user main displays host the secondary home * activities. */ @Nullable DisplayContent getUserMainDisplayContentLocked(@UserIdInt int userId) { final int userMainDisplayId = mUmInternal.getMainDisplayAssignedToUser(userId); if (userMainDisplayId == -1) { return null; } return mRoot.getDisplayContent(userMainDisplayId); } public void onOverlayChanged() { public void onOverlayChanged() { // Post to display thread so it can get the latest display info. // Post to display thread so it can get the latest display info. mH.post(() -> { mH.post(() -> { Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +37 −5 Original line number Original line Diff line number Diff line Loading @@ -4295,7 +4295,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return target; return target; } } if (android.view.inputmethod.Flags.refactorInsetsController()) { if (android.view.inputmethod.Flags.refactorInsetsController()) { final DisplayContent defaultDc = mWmService.getDefaultDisplayContentLocked(); final DisplayContent defaultDc = getUserMainDisplayContent(); return defaultDc.mRemoteInsetsControlTarget; return defaultDc.mRemoteInsetsControlTarget; } else { } else { return getImeFallback(); return getImeFallback(); Loading @@ -4305,11 +4305,26 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp InsetsControlTarget getImeFallback() { InsetsControlTarget getImeFallback() { // host is in non-default display that doesn't support system decor, default to // host is in non-default display that doesn't support system decor, default to // default display's StatusBar to control IME (when available), else let system control it. // default display's StatusBar to control IME (when available), else let system control it. final DisplayContent defaultDc = mWmService.getDefaultDisplayContentLocked(); final DisplayContent defaultDc = getUserMainDisplayContent(); WindowState statusBar = defaultDc.getDisplayPolicy().getStatusBar(); final WindowState statusBar = defaultDc.getDisplayPolicy().getStatusBar(); return statusBar != null ? statusBar : defaultDc.mRemoteInsetsControlTarget; return statusBar != null ? statusBar : defaultDc.mRemoteInsetsControlTarget; } } private DisplayContent getUserMainDisplayContent() { final DisplayContent defaultDc; if (android.view.inputmethod.Flags.fallbackDisplayForSecondaryUserOnSecondaryDisplay()) { final int userId = mWmService.mUmInternal.getUserAssignedToDisplay(mDisplayId); defaultDc = mWmService.getUserMainDisplayContentLocked(userId); if (defaultDc == null) { throw new IllegalStateException( "No default display was assigned to user " + userId); } } else { defaultDc = mWmService.getDefaultDisplayContentLocked(); } return defaultDc; } /** /** * Returns the corresponding IME insets control target according the IME target type. * Returns the corresponding IME insets control target according the IME target type. * * Loading Loading @@ -4845,10 +4860,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // The control target could be the RemoteInsetsControlTarget (if the focussed // The control target could be the RemoteInsetsControlTarget (if the focussed // view is on a virtual display that can not show the IME (and therefore it will // view is on a virtual display that can not show the IME (and therefore it will // be shown on the default display) // be shown on the default display) if (android.view.inputmethod.Flags .fallbackDisplayForSecondaryUserOnSecondaryDisplay()) { if (isUserMainDisplay() && mRemoteInsetsControlTarget != null) { return mRemoteInsetsControlTarget; } } else { if (isDefaultDisplay && mRemoteInsetsControlTarget != null) { if (isDefaultDisplay && mRemoteInsetsControlTarget != null) { return mRemoteInsetsControlTarget; return mRemoteInsetsControlTarget; } } } } } return null; return null; } } Loading @@ -4861,6 +4883,16 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } } } /** * Returns {@code true} if {@link #mDisplayId} corresponds to the user's main display. * * <p>Visible background users may have other than DEFAULT_DISPLAY marked as their main display. */ private boolean isUserMainDisplay() { final int userId = mWmService.mUmInternal.getUserAssignedToDisplay(mDisplayId); return mDisplayId == mWmService.mUmInternal.getMainDisplayAssignedToUser(userId); } /** /** * Computes the window the IME should be attached to. * Computes the window the IME should be attached to. */ */ Loading
services/core/java/com/android/server/wm/WindowManagerService.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -7473,6 +7473,23 @@ public class WindowManagerService extends IWindowManager.Stub return mRoot.getDisplayContent(DEFAULT_DISPLAY); return mRoot.getDisplayContent(DEFAULT_DISPLAY); } } /** * Returns the main display content for the user passed as parameter. * * <p>Visible background users may have their own designated main display, distinct from the * system default display (DEFAULT_DISPLAY). Visible background users operate independently * with their own main displays. These secondary user main displays host the secondary home * activities. */ @Nullable DisplayContent getUserMainDisplayContentLocked(@UserIdInt int userId) { final int userMainDisplayId = mUmInternal.getMainDisplayAssignedToUser(userId); if (userMainDisplayId == -1) { return null; } return mRoot.getDisplayContent(userMainDisplayId); } public void onOverlayChanged() { public void onOverlayChanged() { // Post to display thread so it can get the latest display info. // Post to display thread so it can get the latest display info. mH.post(() -> { mH.post(() -> { Loading