Loading data/etc/services.core.protolog.json +18 −18 Original line number Diff line number Diff line Loading @@ -427,12 +427,6 @@ "group": "WM_DEBUG_BACK_PREVIEW", "at": "com\/android\/server\/wm\/BackNavigationController.java" }, "-1715268616": { "message": "Last window, removing starting window %s", "level": "VERBOSE", "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "-1710206702": { "message": "Display id=%d is frozen while keyguard locked, return %d", "level": "VERBOSE", Loading Loading @@ -463,6 +457,12 @@ "group": "WM_DEBUG_TASKS", "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java" }, "-1671601441": { "message": "attachWindowContextToDisplayContent: calling from non-existing process pid=%d uid=%d", "level": "WARN", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "-1670695197": { "message": "Attempted to add presentation window to a non-suitable display. Aborting.", "level": "WARN", Loading Loading @@ -1225,6 +1225,12 @@ "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/WindowState.java" }, "-961053385": { "message": "attachWindowContextToDisplayArea: calling from non-existing process pid=%d uid=%d", "level": "WARN", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "-957060823": { "message": "Moving to PAUSING: %s", "level": "VERBOSE", Loading Loading @@ -4057,12 +4063,6 @@ "group": "WM_DEBUG_WINDOW_TRANSITIONS", "at": "com\/android\/server\/wm\/Transition.java" }, "1671994402": { "message": "Nulling last startingData", "level": "VERBOSE", "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1674747211": { "message": "%s forcing orientation to %d for display id=%d", "level": "VERBOSE", Loading Loading @@ -4243,12 +4243,6 @@ "group": "WM_DEBUG_ORIENTATION", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1853793312": { "message": "Notify removed startingWindow %s", "level": "VERBOSE", "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1856783490": { "message": "resumeTopActivity: Restarting %s", "level": "DEBUG", Loading Loading @@ -4279,6 +4273,12 @@ "group": "WM_DEBUG_ORIENTATION", "at": "com\/android\/server\/wm\/DisplayContent.java" }, "1879463933": { "message": "attachWindowContextToWindowToken: calling from non-existing process pid=%d uid=%d", "level": "WARN", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "1891501279": { "message": "cancelAnimation(): reason=%s", "level": "DEBUG", Loading services/core/java/com/android/server/wm/DisplayContent.java +3 −1 Original line number Diff line number Diff line Loading @@ -5422,8 +5422,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Attach the SystemUiContext to this DisplayContent the get latest configuration. // Note that the SystemUiContext will be removed automatically if this DisplayContent // is detached. final WindowProcessController wpc = mAtmService.getProcessController( getDisplayUiContext().getIApplicationThread()); mWmService.mWindowContextListenerController.registerWindowContainerListener( getDisplayUiContext().getWindowContextToken(), this, SYSTEM_UID, wpc, getDisplayUiContext().getWindowContextToken(), this, SYSTEM_UID, INVALID_WINDOW_TYPE, null /* options */); } } Loading services/core/java/com/android/server/wm/WindowContextListenerController.java +37 −14 Original line number Diff line number Diff line Loading @@ -69,22 +69,24 @@ class WindowContextListenerController { final ArrayMap<IBinder, WindowContextListenerImpl> mListeners = new ArrayMap<>(); /** * @see #registerWindowContainerListener(IBinder, WindowContainer, int, int, Bundle, boolean) * @see #registerWindowContainerListener(WindowProcessController, IBinder, WindowContainer, int, * int, Bundle, boolean) */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { registerWindowContainerListener(clientToken, container, ownerUid, type, options, void registerWindowContainerListener(@NonNull WindowProcessController wpc, @NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { registerWindowContainerListener(wpc, clientToken, container, ownerUid, type, options, true /* shouDispatchConfigWhenRegistering */); } /** * Registers the listener to a {@code container} which is associated with * a {@code clientToken}, which is a {@link android.window.WindowContext} representation. If the * a {@code clientToken}, which is a {@link WindowContext} representation. If the * listener associated with {@code clientToken} hasn't been initialized yet, create one * {@link WindowContextListenerImpl}. Otherwise, the listener associated with * {@code clientToken} switches to listen to the {@code container}. * * @param wpc the process that we should send the window configuration change to * @param clientToken the token to associate with the listener * @param container the {@link WindowContainer} which the listener is going to listen to. * @param ownerUid the caller UID Loading @@ -94,17 +96,30 @@ class WindowContextListenerController { * {@code container}'s config will dispatch to the client side when * registering the {@link WindowContextListenerImpl} */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options, boolean shouDispatchConfigWhenRegistering) { void registerWindowContainerListener(@NonNull WindowProcessController wpc, @NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options, boolean shouDispatchConfigWhenRegistering) { WindowContextListenerImpl listener = mListeners.get(clientToken); if (listener == null) { listener = new WindowContextListenerImpl(clientToken, container, ownerUid, type, listener = new WindowContextListenerImpl(wpc, clientToken, container, ownerUid, type, options); listener.register(shouDispatchConfigWhenRegistering); } else { listener.updateContainer(container); updateContainerForWindowContextListener(clientToken, container); } } /** * Updates the {@link WindowContainer} that an existing {@link WindowContext} is listening to. */ void updateContainerForWindowContextListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container) { final WindowContextListenerImpl listener = mListeners.get(clientToken); if (listener == null) { throw new IllegalArgumentException("Can't find listener for " + clientToken); } listener.updateContainer(container); } void unregisterWindowContainerListener(IBinder clientToken) { Loading Loading @@ -189,9 +204,13 @@ class WindowContextListenerController { @VisibleForTesting class WindowContextListenerImpl implements WindowContainerListener { @NonNull private final IWindowToken mClientToken; @NonNull private final WindowProcessController mWpc; @NonNull private final IWindowToken mClientToken; private final int mOwnerUid; @NonNull private WindowContainer<?> mContainer; @NonNull private WindowContainer<?> mContainer; /** * The options from {@link Context#createWindowContext(int, Bundle)}. * <p>It can be used for choosing the {@link DisplayArea} where the window context Loading @@ -207,8 +226,10 @@ class WindowContextListenerController { private boolean mHasPendingConfiguration; private WindowContextListenerImpl(IBinder clientToken, WindowContainer<?> container, private WindowContextListenerImpl(@NonNull WindowProcessController wpc, @NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { mWpc = Objects.requireNonNull(wpc); mClientToken = IWindowToken.Stub.asInterface(clientToken); mContainer = Objects.requireNonNull(container); mOwnerUid = ownerUid; Loading Loading @@ -308,6 +329,7 @@ class WindowContextListenerController { mLastReportedDisplay = displayId; try { // TODO(b/290876897): migrate to dispatch through wpc mClientToken.onConfigurationChanged(config, displayId); } catch (RemoteException e) { ProtoLog.w(WM_ERROR, "Could not report config changes to the window token client."); Loading Loading @@ -337,6 +359,7 @@ class WindowContextListenerController { } mDeathRecipient.unlinkToDeath(); try { // TODO(b/290876897): migrate to dispatch through wpc mClientToken.onWindowTokenRemoved(); } catch (RemoteException e) { ProtoLog.w(WM_ERROR, "Could not report token removal to the window token client."); Loading services/core/java/com/android/server/wm/WindowManagerService.java +29 −7 Original line number Diff line number Diff line Loading @@ -1698,8 +1698,8 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_INVALID_TYPE; } } else { mWindowContextListenerController.registerWindowContainerListener( windowContextToken, token, callingUid, type, options); mWindowContextListenerController.updateContainerForWindowContextListener( windowContextToken, token); } } Loading Loading @@ -2744,10 +2744,17 @@ public class WindowManagerService extends IWindowManager.Stub Objects.requireNonNull(clientToken); final boolean callerCanManageAppTokens = checkCallingPermission(MANAGE_APP_TOKENS, "attachWindowContextToDisplayArea", false /* printLog */); final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { final WindowProcessController wpc = mAtmService.getProcessController(appThread); if (wpc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToDisplayArea: calling from" + " non-existing process pid=%d uid=%d", callingPid, callingUid); return null; } final DisplayContent dc = mRoot.getDisplayContentOrCreate(displayId); if (dc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToDisplayArea: trying to attach" Loading @@ -2758,8 +2765,9 @@ public class WindowManagerService extends IWindowManager.Stub // the feature b/155340867 is completed. final DisplayArea<?> da = dc.findAreaForWindowType(type, options, callerCanManageAppTokens, false /* roundedCornerOverlay */); mWindowContextListenerController.registerWindowContainerListener(clientToken, da, callingUid, type, options, false /* shouDispatchConfigWhenRegistering */); mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, da, callingUid, type, options, false /* shouDispatchConfigWhenRegistering */); return da.getConfiguration(); } } finally { Loading @@ -2773,10 +2781,17 @@ public class WindowManagerService extends IWindowManager.Stub @NonNull IBinder clientToken, int displayId) { Objects.requireNonNull(appThread); Objects.requireNonNull(clientToken); final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { final WindowProcessController wpc = mAtmService.getProcessController(appThread); if (wpc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToDisplayContent: calling from" + " non-existing process pid=%d uid=%d", callingPid, callingUid); return null; } // We use "getDisplayContent" instead of "getDisplayContentOrCreate" because // this method may be called in DisplayPolicy's constructor and may cause // infinite loop. In this scenario, we early return here and switch to do the Loading @@ -2793,8 +2808,8 @@ public class WindowManagerService extends IWindowManager.Stub return null; } mWindowContextListenerController.registerWindowContainerListener(clientToken, dc, callingUid, INVALID_WINDOW_TYPE, null /* options */, mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, dc, callingUid, INVALID_WINDOW_TYPE, null /* options */, false /* shouDispatchConfigWhenRegistering */); return dc.getConfiguration(); } Loading @@ -2811,10 +2826,17 @@ public class WindowManagerService extends IWindowManager.Stub Objects.requireNonNull(token); final boolean callerCanManageAppTokens = checkCallingPermission(MANAGE_APP_TOKENS, "attachWindowContextToWindowToken", false /* printLog */); final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { final WindowProcessController wpc = mAtmService.getProcessController(appThread); if (wpc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToWindowToken: calling from" + " non-existing process pid=%d uid=%d", callingPid, callingUid); return; } final WindowToken windowToken = mRoot.getWindowToken(token); if (windowToken == null) { ProtoLog.w(WM_ERROR, "Then token:%s is invalid. It might be " Loading @@ -2835,7 +2857,7 @@ public class WindowManagerService extends IWindowManager.Stub callerCanManageAppTokens, callingUid)) { return; } mWindowContextListenerController.registerWindowContainerListener(clientToken, mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, windowToken, callingUid, windowToken.windowType, windowToken.mOptions); } } finally { Loading services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import android.app.ActivityThread; import android.app.IApplicationThread; import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; Loading Loading @@ -91,10 +92,12 @@ public class InputMethodDialogWindowContextTest extends WindowTestsBase { spyOn(mIWindowManager); doAnswer(invocation -> { Object[] args = invocation.getArguments(); IApplicationThread appThread = (IApplicationThread) args[0]; IBinder clientToken = (IBinder) args[1]; int displayId = (int) args[3]; DisplayContent dc = mWm.mRoot.getDisplayContent(displayId); mWm.mWindowContextListenerController.registerWindowContainerListener(clientToken, final WindowProcessController wpc = mAtm.getProcessController(appThread); mWm.mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, dc.getImeContainer(), 1000 /* ownerUid */, TYPE_INPUT_METHOD_DIALOG, null /* options */); return dc.getImeContainer().getConfiguration(); Loading Loading
data/etc/services.core.protolog.json +18 −18 Original line number Diff line number Diff line Loading @@ -427,12 +427,6 @@ "group": "WM_DEBUG_BACK_PREVIEW", "at": "com\/android\/server\/wm\/BackNavigationController.java" }, "-1715268616": { "message": "Last window, removing starting window %s", "level": "VERBOSE", "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "-1710206702": { "message": "Display id=%d is frozen while keyguard locked, return %d", "level": "VERBOSE", Loading Loading @@ -463,6 +457,12 @@ "group": "WM_DEBUG_TASKS", "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java" }, "-1671601441": { "message": "attachWindowContextToDisplayContent: calling from non-existing process pid=%d uid=%d", "level": "WARN", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "-1670695197": { "message": "Attempted to add presentation window to a non-suitable display. Aborting.", "level": "WARN", Loading Loading @@ -1225,6 +1225,12 @@ "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/WindowState.java" }, "-961053385": { "message": "attachWindowContextToDisplayArea: calling from non-existing process pid=%d uid=%d", "level": "WARN", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "-957060823": { "message": "Moving to PAUSING: %s", "level": "VERBOSE", Loading Loading @@ -4057,12 +4063,6 @@ "group": "WM_DEBUG_WINDOW_TRANSITIONS", "at": "com\/android\/server\/wm\/Transition.java" }, "1671994402": { "message": "Nulling last startingData", "level": "VERBOSE", "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1674747211": { "message": "%s forcing orientation to %d for display id=%d", "level": "VERBOSE", Loading Loading @@ -4243,12 +4243,6 @@ "group": "WM_DEBUG_ORIENTATION", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1853793312": { "message": "Notify removed startingWindow %s", "level": "VERBOSE", "group": "WM_DEBUG_STARTING_WINDOW", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1856783490": { "message": "resumeTopActivity: Restarting %s", "level": "DEBUG", Loading Loading @@ -4279,6 +4273,12 @@ "group": "WM_DEBUG_ORIENTATION", "at": "com\/android\/server\/wm\/DisplayContent.java" }, "1879463933": { "message": "attachWindowContextToWindowToken: calling from non-existing process pid=%d uid=%d", "level": "WARN", "group": "WM_ERROR", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, "1891501279": { "message": "cancelAnimation(): reason=%s", "level": "DEBUG", Loading
services/core/java/com/android/server/wm/DisplayContent.java +3 −1 Original line number Diff line number Diff line Loading @@ -5422,8 +5422,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Attach the SystemUiContext to this DisplayContent the get latest configuration. // Note that the SystemUiContext will be removed automatically if this DisplayContent // is detached. final WindowProcessController wpc = mAtmService.getProcessController( getDisplayUiContext().getIApplicationThread()); mWmService.mWindowContextListenerController.registerWindowContainerListener( getDisplayUiContext().getWindowContextToken(), this, SYSTEM_UID, wpc, getDisplayUiContext().getWindowContextToken(), this, SYSTEM_UID, INVALID_WINDOW_TYPE, null /* options */); } } Loading
services/core/java/com/android/server/wm/WindowContextListenerController.java +37 −14 Original line number Diff line number Diff line Loading @@ -69,22 +69,24 @@ class WindowContextListenerController { final ArrayMap<IBinder, WindowContextListenerImpl> mListeners = new ArrayMap<>(); /** * @see #registerWindowContainerListener(IBinder, WindowContainer, int, int, Bundle, boolean) * @see #registerWindowContainerListener(WindowProcessController, IBinder, WindowContainer, int, * int, Bundle, boolean) */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { registerWindowContainerListener(clientToken, container, ownerUid, type, options, void registerWindowContainerListener(@NonNull WindowProcessController wpc, @NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { registerWindowContainerListener(wpc, clientToken, container, ownerUid, type, options, true /* shouDispatchConfigWhenRegistering */); } /** * Registers the listener to a {@code container} which is associated with * a {@code clientToken}, which is a {@link android.window.WindowContext} representation. If the * a {@code clientToken}, which is a {@link WindowContext} representation. If the * listener associated with {@code clientToken} hasn't been initialized yet, create one * {@link WindowContextListenerImpl}. Otherwise, the listener associated with * {@code clientToken} switches to listen to the {@code container}. * * @param wpc the process that we should send the window configuration change to * @param clientToken the token to associate with the listener * @param container the {@link WindowContainer} which the listener is going to listen to. * @param ownerUid the caller UID Loading @@ -94,17 +96,30 @@ class WindowContextListenerController { * {@code container}'s config will dispatch to the client side when * registering the {@link WindowContextListenerImpl} */ void registerWindowContainerListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options, boolean shouDispatchConfigWhenRegistering) { void registerWindowContainerListener(@NonNull WindowProcessController wpc, @NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options, boolean shouDispatchConfigWhenRegistering) { WindowContextListenerImpl listener = mListeners.get(clientToken); if (listener == null) { listener = new WindowContextListenerImpl(clientToken, container, ownerUid, type, listener = new WindowContextListenerImpl(wpc, clientToken, container, ownerUid, type, options); listener.register(shouDispatchConfigWhenRegistering); } else { listener.updateContainer(container); updateContainerForWindowContextListener(clientToken, container); } } /** * Updates the {@link WindowContainer} that an existing {@link WindowContext} is listening to. */ void updateContainerForWindowContextListener(@NonNull IBinder clientToken, @NonNull WindowContainer<?> container) { final WindowContextListenerImpl listener = mListeners.get(clientToken); if (listener == null) { throw new IllegalArgumentException("Can't find listener for " + clientToken); } listener.updateContainer(container); } void unregisterWindowContainerListener(IBinder clientToken) { Loading Loading @@ -189,9 +204,13 @@ class WindowContextListenerController { @VisibleForTesting class WindowContextListenerImpl implements WindowContainerListener { @NonNull private final IWindowToken mClientToken; @NonNull private final WindowProcessController mWpc; @NonNull private final IWindowToken mClientToken; private final int mOwnerUid; @NonNull private WindowContainer<?> mContainer; @NonNull private WindowContainer<?> mContainer; /** * The options from {@link Context#createWindowContext(int, Bundle)}. * <p>It can be used for choosing the {@link DisplayArea} where the window context Loading @@ -207,8 +226,10 @@ class WindowContextListenerController { private boolean mHasPendingConfiguration; private WindowContextListenerImpl(IBinder clientToken, WindowContainer<?> container, private WindowContextListenerImpl(@NonNull WindowProcessController wpc, @NonNull IBinder clientToken, @NonNull WindowContainer<?> container, int ownerUid, @WindowType int type, @Nullable Bundle options) { mWpc = Objects.requireNonNull(wpc); mClientToken = IWindowToken.Stub.asInterface(clientToken); mContainer = Objects.requireNonNull(container); mOwnerUid = ownerUid; Loading Loading @@ -308,6 +329,7 @@ class WindowContextListenerController { mLastReportedDisplay = displayId; try { // TODO(b/290876897): migrate to dispatch through wpc mClientToken.onConfigurationChanged(config, displayId); } catch (RemoteException e) { ProtoLog.w(WM_ERROR, "Could not report config changes to the window token client."); Loading Loading @@ -337,6 +359,7 @@ class WindowContextListenerController { } mDeathRecipient.unlinkToDeath(); try { // TODO(b/290876897): migrate to dispatch through wpc mClientToken.onWindowTokenRemoved(); } catch (RemoteException e) { ProtoLog.w(WM_ERROR, "Could not report token removal to the window token client."); Loading
services/core/java/com/android/server/wm/WindowManagerService.java +29 −7 Original line number Diff line number Diff line Loading @@ -1698,8 +1698,8 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_INVALID_TYPE; } } else { mWindowContextListenerController.registerWindowContainerListener( windowContextToken, token, callingUid, type, options); mWindowContextListenerController.updateContainerForWindowContextListener( windowContextToken, token); } } Loading Loading @@ -2744,10 +2744,17 @@ public class WindowManagerService extends IWindowManager.Stub Objects.requireNonNull(clientToken); final boolean callerCanManageAppTokens = checkCallingPermission(MANAGE_APP_TOKENS, "attachWindowContextToDisplayArea", false /* printLog */); final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { final WindowProcessController wpc = mAtmService.getProcessController(appThread); if (wpc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToDisplayArea: calling from" + " non-existing process pid=%d uid=%d", callingPid, callingUid); return null; } final DisplayContent dc = mRoot.getDisplayContentOrCreate(displayId); if (dc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToDisplayArea: trying to attach" Loading @@ -2758,8 +2765,9 @@ public class WindowManagerService extends IWindowManager.Stub // the feature b/155340867 is completed. final DisplayArea<?> da = dc.findAreaForWindowType(type, options, callerCanManageAppTokens, false /* roundedCornerOverlay */); mWindowContextListenerController.registerWindowContainerListener(clientToken, da, callingUid, type, options, false /* shouDispatchConfigWhenRegistering */); mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, da, callingUid, type, options, false /* shouDispatchConfigWhenRegistering */); return da.getConfiguration(); } } finally { Loading @@ -2773,10 +2781,17 @@ public class WindowManagerService extends IWindowManager.Stub @NonNull IBinder clientToken, int displayId) { Objects.requireNonNull(appThread); Objects.requireNonNull(clientToken); final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { final WindowProcessController wpc = mAtmService.getProcessController(appThread); if (wpc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToDisplayContent: calling from" + " non-existing process pid=%d uid=%d", callingPid, callingUid); return null; } // We use "getDisplayContent" instead of "getDisplayContentOrCreate" because // this method may be called in DisplayPolicy's constructor and may cause // infinite loop. In this scenario, we early return here and switch to do the Loading @@ -2793,8 +2808,8 @@ public class WindowManagerService extends IWindowManager.Stub return null; } mWindowContextListenerController.registerWindowContainerListener(clientToken, dc, callingUid, INVALID_WINDOW_TYPE, null /* options */, mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, dc, callingUid, INVALID_WINDOW_TYPE, null /* options */, false /* shouDispatchConfigWhenRegistering */); return dc.getConfiguration(); } Loading @@ -2811,10 +2826,17 @@ public class WindowManagerService extends IWindowManager.Stub Objects.requireNonNull(token); final boolean callerCanManageAppTokens = checkCallingPermission(MANAGE_APP_TOKENS, "attachWindowContextToWindowToken", false /* printLog */); final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { final WindowProcessController wpc = mAtmService.getProcessController(appThread); if (wpc == null) { ProtoLog.w(WM_ERROR, "attachWindowContextToWindowToken: calling from" + " non-existing process pid=%d uid=%d", callingPid, callingUid); return; } final WindowToken windowToken = mRoot.getWindowToken(token); if (windowToken == null) { ProtoLog.w(WM_ERROR, "Then token:%s is invalid. It might be " Loading @@ -2835,7 +2857,7 @@ public class WindowManagerService extends IWindowManager.Stub callerCanManageAppTokens, callingUid)) { return; } mWindowContextListenerController.registerWindowContainerListener(clientToken, mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, windowToken, callingUid, windowToken.windowType, windowToken.mOptions); } } finally { Loading
services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import android.app.ActivityThread; import android.app.IApplicationThread; import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; Loading Loading @@ -91,10 +92,12 @@ public class InputMethodDialogWindowContextTest extends WindowTestsBase { spyOn(mIWindowManager); doAnswer(invocation -> { Object[] args = invocation.getArguments(); IApplicationThread appThread = (IApplicationThread) args[0]; IBinder clientToken = (IBinder) args[1]; int displayId = (int) args[3]; DisplayContent dc = mWm.mRoot.getDisplayContent(displayId); mWm.mWindowContextListenerController.registerWindowContainerListener(clientToken, final WindowProcessController wpc = mAtm.getProcessController(appThread); mWm.mWindowContextListenerController.registerWindowContainerListener(wpc, clientToken, dc.getImeContainer(), 1000 /* ownerUid */, TYPE_INPUT_METHOD_DIALOG, null /* options */); return dc.getImeContainer().getConfiguration(); Loading