Loading services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +0 −9 Original line number Diff line number Diff line Loading @@ -385,15 +385,6 @@ public abstract class ActivityTaskManagerInternal { } } /** * Set the corresponding display information for the process global configuration. To be called * when we need to show IME on a different display. * * @param pid The process id associated with the IME window. * @param displayId The ID of the display showing the IME. */ public abstract void onImeWindowSetOnDisplay(int pid, int displayId); public abstract void sendActivityResult(int callingUid, IBinder activityToken, String resultWho, int requestCode, int resultCode, Intent data); public abstract void clearPendingResultForActivity( Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +28 −38 Original line number Diff line number Diff line Loading @@ -5014,6 +5014,34 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } /** * Sets the corresponding {@link DisplayArea} information for the process global * configuration. To be called when we need to show IME on a different {@link DisplayArea} * or display. * * @param pid The process id associated with the IME window. * @param imeContainer The DisplayArea that contains the IME window. */ void onImeWindowSetOnDisplayArea(final int pid, @NonNull final DisplayArea imeContainer) { // Don't update process-level configuration for Multi-Client IME process since other // IMEs on other displays will also receive this configuration change due to IME // services use the same application config/context. if (InputMethodSystemProperty.MULTI_CLIENT_IME_ENABLED) return; if (pid == MY_PID || pid < 0) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display configuration for system/invalid process."); return; } final WindowProcessController process = mProcessMap.getProcess(pid); if (process == null) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display " + "configuration for invalid process, pid=%d", pid); return; } process.registerDisplayAreaConfigurationListener(imeContainer); } final class H extends Handler { static final int REPORT_TIME_TRACKER_MSG = 1; Loading Loading @@ -5517,44 +5545,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } /** * Set the corresponding display information for the process global configuration. To be * called when we need to show IME on a different display. * * @param pid The process id associated with the IME window. * @param displayId The ID of the display showing the IME. */ @Override public void onImeWindowSetOnDisplay(final int pid, final int displayId) { // Don't update process-level configuration for Multi-Client IME process since other // IMEs on other displays will also receive this configuration change due to IME // services use the same application config/context. if (InputMethodSystemProperty.MULTI_CLIENT_IME_ENABLED) return; if (pid == MY_PID || pid < 0) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display configuration for system/invalid process."); return; } synchronized (mGlobalLock) { final DisplayContent displayContent = mRootWindowContainer.getDisplayContent(displayId); if (displayContent == null) { // Call might come when display is not yet added or has been removed. ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display " + "configuration for non-existing displayId=%d", displayId); return; } final WindowProcessController process = mProcessMap.getProcess(pid); if (process == null) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display " + "configuration for invalid process, pid=%d", pid); return; } process.registerDisplayConfigurationListener(displayContent); } } @Override public void sendActivityResult(int callingUid, IBinder activityToken, String resultWho, int requestCode, int resultCode, Intent data) { Loading services/core/java/com/android/server/wm/DisplayContent.java +15 −16 Original line number Diff line number Diff line Loading @@ -257,7 +257,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp @Retention(RetentionPolicy.SOURCE) @interface ForceScalingMode {} ActivityTaskManagerService mAtmService; final ActivityTaskManagerService mAtmService; /** * Unique logical identifier of this display. Loading Loading @@ -294,7 +294,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // window containers together and move them in-sync if/when needed. We use a subclass of // WindowContainer which is omitted from screen magnification, as the IME is never magnified. // TODO(display-area): is "no magnification" in the comment still true? private final ImeContainer mImeWindowsContainers = new ImeContainer(mWmService); private final ImeContainer mImeWindowsContainer = new ImeContainer(mWmService); @VisibleForTesting final DisplayAreaPolicy mDisplayAreaPolicy; Loading Loading @@ -1028,7 +1028,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Setup the policy and build the display area hierarchy. mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate( mWmService, this /* content */, this /* root */, mImeWindowsContainers); mWmService, this /* content */, this /* root */, mImeWindowsContainer); final List<DisplayArea<? extends WindowContainer>> areas = mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); Loading Loading @@ -1125,7 +1125,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp switch (token.windowType) { case TYPE_INPUT_METHOD: case TYPE_INPUT_METHOD_DIALOG: mImeWindowsContainers.addChild(token); mImeWindowsContainer.addChild(token); break; default: mDisplayAreaPolicy.addWindow(token); Loading Loading @@ -2410,7 +2410,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } boolean forAllImeWindows(ToBooleanFunction<WindowState> callback, boolean traverseTopToBottom) { return mImeWindowsContainers.forAllWindowForce(callback, traverseTopToBottom); return mImeWindowsContainer.forAllWindowForce(callback, traverseTopToBottom); } /** Loading Loading @@ -3501,8 +3501,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Update display configuration for IME process. if (mInputMethodWindow != null) { final int imePid = mInputMethodWindow.mSession.mPid; mWmService.mAtmInternal.onImeWindowSetOnDisplay(imePid, mInputMethodWindow.getDisplayId()); mAtmService.onImeWindowSetOnDisplayArea(imePid, mImeWindowsContainer); } mInsetsStateController.getSourceProvider(ITYPE_IME).setWindow(win, mDisplayPolicy.getImeSourceFrameProvider(), null /* imeFrameProvider */); Loading Loading @@ -3733,7 +3732,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (targetRoot != null) { // Reposition the IME container to the target root to get the correct bounds and // config. targetRoot.placeImeContainer(mImeWindowsContainers); targetRoot.placeImeContainer(mImeWindowsContainer); } } // 2. Reparent the IME container surface to either the input target app, or the IME window Loading Loading @@ -3784,7 +3783,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final SurfaceControl newParent = computeImeParent(); if (newParent != null && newParent != mInputMethodSurfaceParent) { mInputMethodSurfaceParent = newParent; getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent); getPendingTransaction().reparent(mImeWindowsContainer.mSurfaceControl, newParent); scheduleAnimation(); } } Loading Loading @@ -3821,7 +3820,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } // Otherwise, we just attach it to where the display area policy put it. return mImeWindowsContainers.getParent().getSurfaceControl(); return mImeWindowsContainer.getParent().getSurfaceControl(); } void setLayoutNeeded() { Loading Loading @@ -4569,7 +4568,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp @Override void assignChildLayers(SurfaceControl.Transaction t) { mImeWindowsContainers.setNeedsLayer(); mImeWindowsContainer.setNeedsLayer(); final WindowState imeTarget = mImeLayeringTarget; // In the case where we have an IME target that is not in split-screen mode IME // assignment is easy. We just need the IME to go directly above the target. This way Loading @@ -4592,7 +4591,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp !(imeTarget.inMultiWindowMode() || imeTarget.mToken.isAppTransitioning()) && ( imeTarget.getSurfaceControl() != null))) { mImeWindowsContainers.assignRelativeLayer(t, imeTarget.getSurfaceControl(), mImeWindowsContainer.assignRelativeLayer(t, imeTarget.getSurfaceControl(), // TODO: We need to use an extra level on the app surface to ensure // this is always above SurfaceView but always below attached window. 1); Loading @@ -4600,7 +4599,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // The IME surface parent may not be its window parent's surface // (@see #computeImeParent), so set relative layer here instead of letting the window // parent to assign layer. mImeWindowsContainers.assignRelativeLayer(t, mInputMethodSurfaceParent, 1); mImeWindowsContainer.assignRelativeLayer(t, mInputMethodSurfaceParent, 1); } super.assignChildLayers(t); } Loading @@ -4615,8 +4614,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp * with {@link WindowState#assignLayer} */ void assignRelativeLayerForImeTargetChild(SurfaceControl.Transaction t, WindowContainer child) { mImeWindowsContainers.setNeedsLayer(); child.assignRelativeLayer(t, mImeWindowsContainers.getSurfaceControl(), 1); mImeWindowsContainer.setNeedsLayer(); child.assignRelativeLayer(t, mImeWindowsContainer.getSurfaceControl(), 1); } @Override Loading Loading @@ -4883,7 +4882,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } DisplayArea.Tokens getImeContainer() { return mImeWindowsContainers; return mImeWindowsContainer; } SurfaceControl getOverlayLayer() { Loading services/core/java/com/android/server/wm/WindowProcessController.java +37 −31 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; import static android.os.Build.VERSION_CODES.Q; import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS; import static android.view.Display.INVALID_DISPLAY; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION; import static com.android.internal.util.Preconditions.checkArgument; Loading Loading @@ -201,8 +200,13 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio private final Configuration mLastReportedConfiguration = new Configuration(); /** Whether the process configuration is waiting to be dispatched to the process. */ private boolean mHasPendingConfigurationChange; // Registered display id as a listener to override config change private int mDisplayId; /** * Registered {@link DisplayArea} as a listener to override config changes. {@code null} if not * registered. */ @Nullable private DisplayArea mDisplayArea; private ActivityRecord mConfigActivityRecord; // Whether the activity config override is allowed for this process. private volatile boolean mIsActivityConfigOverrideAllowed = true; Loading Loading @@ -252,7 +256,6 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio mOwner = owner; mListener = listener; mAtm = atm; mDisplayId = INVALID_DISPLAY; mBackgroundActivityStartCallback = mAtm.getBackgroundActivityStartCallback(); boolean isSysUiPackage = info.packageName.equals( Loading Loading @@ -393,9 +396,9 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio return mPendingUiClean; } /** @return {@code true} if the process registered to a display as a config listener. */ boolean registeredForDisplayConfigChanges() { return mDisplayId != INVALID_DISPLAY; /** @return {@code true} if the process registered to a display area as a config listener. */ boolean registeredForDisplayAreaConfigChanges() { return mDisplayArea != null; } /** @return {@code true} if the process registered to an activity as a config listener. */ Loading Loading @@ -443,11 +446,14 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio return mRequiredAbi; } /** Returns ID of display overriding the configuration for this process, or * INVALID_DISPLAY if no display is overriding. */ /** * Registered {@link DisplayArea} as a listener to override config changes. {@code null} if not * registered. */ @VisibleForTesting int getDisplayId() { return mDisplayId; @Nullable DisplayArea getDisplayArea() { return mDisplayArea; } public void setDebugging(boolean debugging) { Loading Loading @@ -1317,29 +1323,22 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio return hasVisibleActivities; } void registerDisplayConfigurationListener(DisplayContent displayContent) { if (displayContent == null) { void registerDisplayAreaConfigurationListener(@Nullable DisplayArea displayArea) { if (displayArea == null || displayArea.containsListener(this)) { return; } // A process can only register to one display to listen to the override configuration // change. Unregister existing listener if it has one before register the new one. unregisterDisplayConfigurationListener(); unregisterActivityConfigurationListener(); mDisplayId = displayContent.mDisplayId; displayContent.registerConfigurationChangeListener(this); unregisterConfigurationListeners(); mDisplayArea = displayArea; displayArea.registerConfigurationChangeListener(this); } @VisibleForTesting void unregisterDisplayConfigurationListener() { if (mDisplayId == INVALID_DISPLAY) { void unregisterDisplayAreaConfigurationListener() { if (mDisplayArea == null) { return; } final DisplayContent displayContent = mAtm.mRootWindowContainer.getDisplayContent(mDisplayId); if (displayContent != null) { displayContent.unregisterConfigurationChangeListener(this); } mDisplayId = INVALID_DISPLAY; mDisplayArea.unregisterConfigurationChangeListener(this); mDisplayArea = null; onMergedOverrideConfigurationChanged(Configuration.EMPTY); } Loading @@ -1349,10 +1348,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio || !mIsActivityConfigOverrideAllowed) { return; } // A process can only register to one activityRecord to listen to the override configuration // change. Unregister existing listener if it has one before register the new one. unregisterDisplayConfigurationListener(); unregisterActivityConfigurationListener(); unregisterConfigurationListeners(); mConfigActivityRecord = activityRecord; activityRecord.registerConfigurationChangeListener(this); } Loading @@ -1366,6 +1362,16 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio onMergedOverrideConfigurationChanged(Configuration.EMPTY); } /** * A process can only register to one {@link WindowContainer} to listen to the override * configuration changes. Unregisters the existing listener if it has one before registers a * new one. */ private void unregisterConfigurationListeners() { unregisterActivityConfigurationListener(); unregisterDisplayAreaConfigurationListener(); } /** * Check if activity configuration override for the activity process needs an update and perform * if needed. By default we try to override the process configuration to match the top activity Loading services/core/java/com/android/server/wm/WindowState.java +12 −12 Original line number Diff line number Diff line Loading @@ -725,7 +725,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP static final int BLAST_TIMEOUT_DURATION = 5000; /* milliseconds */ private final WindowProcessController mWpcForDisplayConfigChanges; private final WindowProcessController mWpcForDisplayAreaConfigChanges; /** * Returns the visibility of the given {@link InternalInsetsType type} requested by the client. Loading Loading @@ -917,7 +917,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mBaseLayer = 0; mSubLayer = 0; mWinAnimator = null; mWpcForDisplayConfigChanges = null; mWpcForDisplayAreaConfigChanges = null; return; } mDeathRecipient = deathRecipient; Loading Loading @@ -971,8 +971,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP parentWindow.addChild(this, sWindowSubLayerComparator); } // System process or invalid process cannot register to display config change. mWpcForDisplayConfigChanges = (s.mPid == MY_PID || s.mPid < 0) // System process or invalid process cannot register to display area config change. mWpcForDisplayAreaConfigChanges = (s.mPid == MY_PID || s.mPid < 0) ? null : service.mAtmService.getProcessController(s.mPid, s.mUid); } Loading Loading @@ -3533,9 +3533,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mActivityRecord.mFrozenMergedConfig.peek(); } // If the process has not registered to any display to listen to the configuration change, // we can simply return the mFullConfiguration as default. if (!registeredForDisplayConfigChanges()) { // If the process has not registered to any display area to listen to the configuration // change, we can simply return the mFullConfiguration as default. if (!registeredForDisplayAreaConfigChanges()) { return super.getConfiguration(); } Loading @@ -3546,13 +3546,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mTempConfiguration; } /** @return {@code true} if the process registered to a display as a config listener. */ private boolean registeredForDisplayConfigChanges() { /** @return {@code true} if the process registered to a display area as a config listener. */ private boolean registeredForDisplayAreaConfigChanges() { final WindowState parentWindow = getParentWindow(); final WindowProcessController wpc = parentWindow != null ? parentWindow.mWpcForDisplayConfigChanges : mWpcForDisplayConfigChanges; return wpc != null && wpc.registeredForDisplayConfigChanges(); ? parentWindow.mWpcForDisplayAreaConfigChanges : mWpcForDisplayAreaConfigChanges; return wpc != null && wpc.registeredForDisplayAreaConfigChanges(); } void fillClientWindowFrames(ClientWindowFrames outFrames) { Loading Loading
services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +0 −9 Original line number Diff line number Diff line Loading @@ -385,15 +385,6 @@ public abstract class ActivityTaskManagerInternal { } } /** * Set the corresponding display information for the process global configuration. To be called * when we need to show IME on a different display. * * @param pid The process id associated with the IME window. * @param displayId The ID of the display showing the IME. */ public abstract void onImeWindowSetOnDisplay(int pid, int displayId); public abstract void sendActivityResult(int callingUid, IBinder activityToken, String resultWho, int requestCode, int resultCode, Intent data); public abstract void clearPendingResultForActivity( Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +28 −38 Original line number Diff line number Diff line Loading @@ -5014,6 +5014,34 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } /** * Sets the corresponding {@link DisplayArea} information for the process global * configuration. To be called when we need to show IME on a different {@link DisplayArea} * or display. * * @param pid The process id associated with the IME window. * @param imeContainer The DisplayArea that contains the IME window. */ void onImeWindowSetOnDisplayArea(final int pid, @NonNull final DisplayArea imeContainer) { // Don't update process-level configuration for Multi-Client IME process since other // IMEs on other displays will also receive this configuration change due to IME // services use the same application config/context. if (InputMethodSystemProperty.MULTI_CLIENT_IME_ENABLED) return; if (pid == MY_PID || pid < 0) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display configuration for system/invalid process."); return; } final WindowProcessController process = mProcessMap.getProcess(pid); if (process == null) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display " + "configuration for invalid process, pid=%d", pid); return; } process.registerDisplayAreaConfigurationListener(imeContainer); } final class H extends Handler { static final int REPORT_TIME_TRACKER_MSG = 1; Loading Loading @@ -5517,44 +5545,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } /** * Set the corresponding display information for the process global configuration. To be * called when we need to show IME on a different display. * * @param pid The process id associated with the IME window. * @param displayId The ID of the display showing the IME. */ @Override public void onImeWindowSetOnDisplay(final int pid, final int displayId) { // Don't update process-level configuration for Multi-Client IME process since other // IMEs on other displays will also receive this configuration change due to IME // services use the same application config/context. if (InputMethodSystemProperty.MULTI_CLIENT_IME_ENABLED) return; if (pid == MY_PID || pid < 0) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display configuration for system/invalid process."); return; } synchronized (mGlobalLock) { final DisplayContent displayContent = mRootWindowContainer.getDisplayContent(displayId); if (displayContent == null) { // Call might come when display is not yet added or has been removed. ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display " + "configuration for non-existing displayId=%d", displayId); return; } final WindowProcessController process = mProcessMap.getProcess(pid); if (process == null) { ProtoLog.w(WM_DEBUG_CONFIGURATION, "Trying to update display " + "configuration for invalid process, pid=%d", pid); return; } process.registerDisplayConfigurationListener(displayContent); } } @Override public void sendActivityResult(int callingUid, IBinder activityToken, String resultWho, int requestCode, int resultCode, Intent data) { Loading
services/core/java/com/android/server/wm/DisplayContent.java +15 −16 Original line number Diff line number Diff line Loading @@ -257,7 +257,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp @Retention(RetentionPolicy.SOURCE) @interface ForceScalingMode {} ActivityTaskManagerService mAtmService; final ActivityTaskManagerService mAtmService; /** * Unique logical identifier of this display. Loading Loading @@ -294,7 +294,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // window containers together and move them in-sync if/when needed. We use a subclass of // WindowContainer which is omitted from screen magnification, as the IME is never magnified. // TODO(display-area): is "no magnification" in the comment still true? private final ImeContainer mImeWindowsContainers = new ImeContainer(mWmService); private final ImeContainer mImeWindowsContainer = new ImeContainer(mWmService); @VisibleForTesting final DisplayAreaPolicy mDisplayAreaPolicy; Loading Loading @@ -1028,7 +1028,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Setup the policy and build the display area hierarchy. mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate( mWmService, this /* content */, this /* root */, mImeWindowsContainers); mWmService, this /* content */, this /* root */, mImeWindowsContainer); final List<DisplayArea<? extends WindowContainer>> areas = mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); Loading Loading @@ -1125,7 +1125,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp switch (token.windowType) { case TYPE_INPUT_METHOD: case TYPE_INPUT_METHOD_DIALOG: mImeWindowsContainers.addChild(token); mImeWindowsContainer.addChild(token); break; default: mDisplayAreaPolicy.addWindow(token); Loading Loading @@ -2410,7 +2410,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } boolean forAllImeWindows(ToBooleanFunction<WindowState> callback, boolean traverseTopToBottom) { return mImeWindowsContainers.forAllWindowForce(callback, traverseTopToBottom); return mImeWindowsContainer.forAllWindowForce(callback, traverseTopToBottom); } /** Loading Loading @@ -3501,8 +3501,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Update display configuration for IME process. if (mInputMethodWindow != null) { final int imePid = mInputMethodWindow.mSession.mPid; mWmService.mAtmInternal.onImeWindowSetOnDisplay(imePid, mInputMethodWindow.getDisplayId()); mAtmService.onImeWindowSetOnDisplayArea(imePid, mImeWindowsContainer); } mInsetsStateController.getSourceProvider(ITYPE_IME).setWindow(win, mDisplayPolicy.getImeSourceFrameProvider(), null /* imeFrameProvider */); Loading Loading @@ -3733,7 +3732,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (targetRoot != null) { // Reposition the IME container to the target root to get the correct bounds and // config. targetRoot.placeImeContainer(mImeWindowsContainers); targetRoot.placeImeContainer(mImeWindowsContainer); } } // 2. Reparent the IME container surface to either the input target app, or the IME window Loading Loading @@ -3784,7 +3783,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final SurfaceControl newParent = computeImeParent(); if (newParent != null && newParent != mInputMethodSurfaceParent) { mInputMethodSurfaceParent = newParent; getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent); getPendingTransaction().reparent(mImeWindowsContainer.mSurfaceControl, newParent); scheduleAnimation(); } } Loading Loading @@ -3821,7 +3820,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } // Otherwise, we just attach it to where the display area policy put it. return mImeWindowsContainers.getParent().getSurfaceControl(); return mImeWindowsContainer.getParent().getSurfaceControl(); } void setLayoutNeeded() { Loading Loading @@ -4569,7 +4568,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp @Override void assignChildLayers(SurfaceControl.Transaction t) { mImeWindowsContainers.setNeedsLayer(); mImeWindowsContainer.setNeedsLayer(); final WindowState imeTarget = mImeLayeringTarget; // In the case where we have an IME target that is not in split-screen mode IME // assignment is easy. We just need the IME to go directly above the target. This way Loading @@ -4592,7 +4591,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp !(imeTarget.inMultiWindowMode() || imeTarget.mToken.isAppTransitioning()) && ( imeTarget.getSurfaceControl() != null))) { mImeWindowsContainers.assignRelativeLayer(t, imeTarget.getSurfaceControl(), mImeWindowsContainer.assignRelativeLayer(t, imeTarget.getSurfaceControl(), // TODO: We need to use an extra level on the app surface to ensure // this is always above SurfaceView but always below attached window. 1); Loading @@ -4600,7 +4599,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // The IME surface parent may not be its window parent's surface // (@see #computeImeParent), so set relative layer here instead of letting the window // parent to assign layer. mImeWindowsContainers.assignRelativeLayer(t, mInputMethodSurfaceParent, 1); mImeWindowsContainer.assignRelativeLayer(t, mInputMethodSurfaceParent, 1); } super.assignChildLayers(t); } Loading @@ -4615,8 +4614,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp * with {@link WindowState#assignLayer} */ void assignRelativeLayerForImeTargetChild(SurfaceControl.Transaction t, WindowContainer child) { mImeWindowsContainers.setNeedsLayer(); child.assignRelativeLayer(t, mImeWindowsContainers.getSurfaceControl(), 1); mImeWindowsContainer.setNeedsLayer(); child.assignRelativeLayer(t, mImeWindowsContainer.getSurfaceControl(), 1); } @Override Loading Loading @@ -4883,7 +4882,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } DisplayArea.Tokens getImeContainer() { return mImeWindowsContainers; return mImeWindowsContainer; } SurfaceControl getOverlayLayer() { Loading
services/core/java/com/android/server/wm/WindowProcessController.java +37 −31 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; import static android.os.Build.VERSION_CODES.Q; import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS; import static android.view.Display.INVALID_DISPLAY; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION; import static com.android.internal.util.Preconditions.checkArgument; Loading Loading @@ -201,8 +200,13 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio private final Configuration mLastReportedConfiguration = new Configuration(); /** Whether the process configuration is waiting to be dispatched to the process. */ private boolean mHasPendingConfigurationChange; // Registered display id as a listener to override config change private int mDisplayId; /** * Registered {@link DisplayArea} as a listener to override config changes. {@code null} if not * registered. */ @Nullable private DisplayArea mDisplayArea; private ActivityRecord mConfigActivityRecord; // Whether the activity config override is allowed for this process. private volatile boolean mIsActivityConfigOverrideAllowed = true; Loading Loading @@ -252,7 +256,6 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio mOwner = owner; mListener = listener; mAtm = atm; mDisplayId = INVALID_DISPLAY; mBackgroundActivityStartCallback = mAtm.getBackgroundActivityStartCallback(); boolean isSysUiPackage = info.packageName.equals( Loading Loading @@ -393,9 +396,9 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio return mPendingUiClean; } /** @return {@code true} if the process registered to a display as a config listener. */ boolean registeredForDisplayConfigChanges() { return mDisplayId != INVALID_DISPLAY; /** @return {@code true} if the process registered to a display area as a config listener. */ boolean registeredForDisplayAreaConfigChanges() { return mDisplayArea != null; } /** @return {@code true} if the process registered to an activity as a config listener. */ Loading Loading @@ -443,11 +446,14 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio return mRequiredAbi; } /** Returns ID of display overriding the configuration for this process, or * INVALID_DISPLAY if no display is overriding. */ /** * Registered {@link DisplayArea} as a listener to override config changes. {@code null} if not * registered. */ @VisibleForTesting int getDisplayId() { return mDisplayId; @Nullable DisplayArea getDisplayArea() { return mDisplayArea; } public void setDebugging(boolean debugging) { Loading Loading @@ -1317,29 +1323,22 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio return hasVisibleActivities; } void registerDisplayConfigurationListener(DisplayContent displayContent) { if (displayContent == null) { void registerDisplayAreaConfigurationListener(@Nullable DisplayArea displayArea) { if (displayArea == null || displayArea.containsListener(this)) { return; } // A process can only register to one display to listen to the override configuration // change. Unregister existing listener if it has one before register the new one. unregisterDisplayConfigurationListener(); unregisterActivityConfigurationListener(); mDisplayId = displayContent.mDisplayId; displayContent.registerConfigurationChangeListener(this); unregisterConfigurationListeners(); mDisplayArea = displayArea; displayArea.registerConfigurationChangeListener(this); } @VisibleForTesting void unregisterDisplayConfigurationListener() { if (mDisplayId == INVALID_DISPLAY) { void unregisterDisplayAreaConfigurationListener() { if (mDisplayArea == null) { return; } final DisplayContent displayContent = mAtm.mRootWindowContainer.getDisplayContent(mDisplayId); if (displayContent != null) { displayContent.unregisterConfigurationChangeListener(this); } mDisplayId = INVALID_DISPLAY; mDisplayArea.unregisterConfigurationChangeListener(this); mDisplayArea = null; onMergedOverrideConfigurationChanged(Configuration.EMPTY); } Loading @@ -1349,10 +1348,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio || !mIsActivityConfigOverrideAllowed) { return; } // A process can only register to one activityRecord to listen to the override configuration // change. Unregister existing listener if it has one before register the new one. unregisterDisplayConfigurationListener(); unregisterActivityConfigurationListener(); unregisterConfigurationListeners(); mConfigActivityRecord = activityRecord; activityRecord.registerConfigurationChangeListener(this); } Loading @@ -1366,6 +1362,16 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio onMergedOverrideConfigurationChanged(Configuration.EMPTY); } /** * A process can only register to one {@link WindowContainer} to listen to the override * configuration changes. Unregisters the existing listener if it has one before registers a * new one. */ private void unregisterConfigurationListeners() { unregisterActivityConfigurationListener(); unregisterDisplayAreaConfigurationListener(); } /** * Check if activity configuration override for the activity process needs an update and perform * if needed. By default we try to override the process configuration to match the top activity Loading
services/core/java/com/android/server/wm/WindowState.java +12 −12 Original line number Diff line number Diff line Loading @@ -725,7 +725,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP static final int BLAST_TIMEOUT_DURATION = 5000; /* milliseconds */ private final WindowProcessController mWpcForDisplayConfigChanges; private final WindowProcessController mWpcForDisplayAreaConfigChanges; /** * Returns the visibility of the given {@link InternalInsetsType type} requested by the client. Loading Loading @@ -917,7 +917,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mBaseLayer = 0; mSubLayer = 0; mWinAnimator = null; mWpcForDisplayConfigChanges = null; mWpcForDisplayAreaConfigChanges = null; return; } mDeathRecipient = deathRecipient; Loading Loading @@ -971,8 +971,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP parentWindow.addChild(this, sWindowSubLayerComparator); } // System process or invalid process cannot register to display config change. mWpcForDisplayConfigChanges = (s.mPid == MY_PID || s.mPid < 0) // System process or invalid process cannot register to display area config change. mWpcForDisplayAreaConfigChanges = (s.mPid == MY_PID || s.mPid < 0) ? null : service.mAtmService.getProcessController(s.mPid, s.mUid); } Loading Loading @@ -3533,9 +3533,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mActivityRecord.mFrozenMergedConfig.peek(); } // If the process has not registered to any display to listen to the configuration change, // we can simply return the mFullConfiguration as default. if (!registeredForDisplayConfigChanges()) { // If the process has not registered to any display area to listen to the configuration // change, we can simply return the mFullConfiguration as default. if (!registeredForDisplayAreaConfigChanges()) { return super.getConfiguration(); } Loading @@ -3546,13 +3546,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mTempConfiguration; } /** @return {@code true} if the process registered to a display as a config listener. */ private boolean registeredForDisplayConfigChanges() { /** @return {@code true} if the process registered to a display area as a config listener. */ private boolean registeredForDisplayAreaConfigChanges() { final WindowState parentWindow = getParentWindow(); final WindowProcessController wpc = parentWindow != null ? parentWindow.mWpcForDisplayConfigChanges : mWpcForDisplayConfigChanges; return wpc != null && wpc.registeredForDisplayConfigChanges(); ? parentWindow.mWpcForDisplayAreaConfigChanges : mWpcForDisplayAreaConfigChanges; return wpc != null && wpc.registeredForDisplayAreaConfigChanges(); } void fillClientWindowFrames(ClientWindowFrames outFrames) { Loading