Loading core/java/android/app/servertransaction/WindowTokenClientController.java +10 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import static android.view.WindowManagerGlobal.getWindowManagerService; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; import android.app.IApplicationThread; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; Loading @@ -46,6 +48,8 @@ public class WindowTokenClientController { private static WindowTokenClientController sController; private final Object mLock = new Object(); private final IApplicationThread mAppThread = ActivityThread.currentActivityThread() .getApplicationThread(); /** Mapping from a client defined token to the {@link WindowTokenClient} it represents. */ @GuardedBy("mLock") Loading Loading @@ -84,8 +88,8 @@ public class WindowTokenClientController { @WindowType int type, int displayId, @Nullable Bundle options) { final Configuration configuration; try { configuration = getWindowManagerService() .attachWindowContextToDisplayArea(client, type, displayId, options); configuration = getWindowManagerService().attachWindowContextToDisplayArea( mAppThread, client, type, displayId, options); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -111,7 +115,7 @@ public class WindowTokenClientController { } final Configuration configuration; try { configuration = wms.attachToDisplayContent(client, displayId); configuration = wms.attachWindowContextToDisplayContent(mAppThread, client, displayId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -131,7 +135,8 @@ public class WindowTokenClientController { public void attachToWindowToken(@NonNull WindowTokenClient client, @NonNull IBinder windowToken) { try { getWindowManagerService().attachWindowContextToWindowToken(client, windowToken); getWindowManagerService().attachWindowContextToWindowToken( mAppThread, client, windowToken); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -149,7 +154,7 @@ public class WindowTokenClientController { } } try { getWindowManagerService().detachWindowContextFromWindowContainer(client); getWindowManagerService().detachWindowContext(client); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading core/java/android/view/IWindowManager.aidl +11 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.policy.IKeyguardDismissCallback; import com.android.internal.policy.IKeyguardLockedStateListener; import com.android.internal.policy.IShortcutService; import android.app.IApplicationThread; import android.app.IAssistDataReceiver; import android.content.ComponentName; import android.content.res.CompatibilityInfo; Loading Loading @@ -850,6 +851,7 @@ interface IWindowManager * system server. {@link #attachWindowContextToWindowToken(IBinder, IBinder)} could be used in * this case to attach the WindowContext to the WindowToken.</p> * * @param appThread the process that the window context is on. * @param clientToken {@link android.window.WindowContext#getWindowContextToken() * the WindowContext's token} * @param type Window type of the window context Loading @@ -859,8 +861,8 @@ interface IWindowManager * @return the DisplayArea's {@link android.app.res.Configuration} if the WindowContext is * attached to the DisplayArea successfully. {@code null}, otherwise. */ Configuration attachWindowContextToDisplayArea(IBinder clientToken, int type, int displayId, in Bundle options); @nullable Configuration attachWindowContextToDisplayArea(in IApplicationThread appThread, IBinder clientToken, int type, int displayId, in @nullable Bundle options); /** * Attaches a {@link android.window.WindowContext} to a {@code WindowToken}. Loading @@ -872,6 +874,7 @@ interface IWindowManager * {@link android.window.WindowTokenClient#attachContext(Context)} * </p> * * @param appThread the process that the window context is on. * @param clientToken {@link android.window.WindowContext#getWindowContextToken() * the WindowContext's token} * @param token the WindowToken to attach Loading @@ -881,7 +884,8 @@ interface IWindowManager * * @see #attachWindowContextToDisplayArea(IBinder, int, int, Bundle) */ void attachWindowContextToWindowToken(IBinder clientToken, IBinder token); void attachWindowContextToWindowToken(in IApplicationThread appThread, IBinder clientToken, IBinder token); /** * Attaches a {@code clientToken} to associate with DisplayContent. Loading @@ -890,6 +894,7 @@ interface IWindowManager * {@link android.window.WindowTokenClient#attachContext(Context)} * </p> * * @param appThread the process that the window context is on. * @param clientToken {@link android.window.WindowContext#getWindowContextToken() * the WindowContext's token} * @param displayId The display associated with the window context Loading @@ -898,7 +903,8 @@ interface IWindowManager * attached to the DisplayContent successfully. {@code null}, otherwise. * @throws android.view.WindowManager.InvalidDisplayException if the display ID is invalid */ Configuration attachToDisplayContent(IBinder clientToken, int displayId); @nullable Configuration attachWindowContextToDisplayContent(in IApplicationThread appThread, IBinder clientToken, int displayId); /** * Detaches {@link android.window.WindowContext} from the window manager node it's currently Loading @@ -906,7 +912,7 @@ interface IWindowManager * * @param clientToken the window context's token */ void detachWindowContextFromWindowContainer(IBinder clientToken); void detachWindowContext(IBinder clientToken); /** * Registers a listener, which is to be called whenever cross-window blur is enabled/disabled. Loading core/java/android/window/WindowContextController.java +1 −1 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ public class WindowContextController { * {@link #attachToDisplayArea(int, int, Bundle)}. * * @see WindowProviderService#attachToWindowToken(IBinder)) * @see IWindowManager#attachWindowContextToWindowToken(IBinder, IBinder) * @see IWindowManager#attachWindowContextToWindowToken */ public void attachToWindowToken(IBinder windowToken) { if (mAttachedToDisplayArea != AttachStatus.STATUS_ATTACHED) { Loading core/java/android/window/WindowTokenClient.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ import java.lang.ref.WeakReference; * {@link Context#getWindowContextToken() the token of non-Activity UI Contexts}. * * @see WindowContext * @see android.view.IWindowManager#attachWindowContextToDisplayArea(IBinder, int, int, Bundle) * @see android.view.IWindowManager#attachWindowContextToDisplayArea * * @hide */ Loading core/tests/coretests/src/android/app/servertransaction/WindowTokenClientControllerTest.java +28 −23 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static org.mockito.Mockito.verify; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import android.app.ActivityThread; import android.content.res.Configuration; import android.os.IBinder; import android.os.RemoteException; Loading Loading @@ -87,16 +88,17 @@ public class WindowTokenClientControllerTest { @Test public void testAttachToDisplayArea() throws RemoteException { doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); assertFalse(mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */)); verify(mWindowManagerService).attachWindowContextToDisplayArea(mWindowTokenClient, verify(mWindowManagerService).attachWindowContextToDisplayArea( ActivityThread.currentActivityThread().getApplicationThread(), mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */); verify(mWindowTokenClient, never()).onConfigurationChanged(any(), anyInt(), anyBoolean()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); assertTrue(mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */)); Loading @@ -108,36 +110,38 @@ public class WindowTokenClientControllerTest { public void testAttachToDisplayArea_detachIfNeeded() throws RemoteException { mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService).detachWindowContext(any()); } @Test public void testAttachToDisplayContent() throws RemoteException { doReturn(null).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); assertFalse(mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY)); verify(mWindowManagerService).attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY); verify(mWindowManagerService).attachWindowContextToDisplayContent( ActivityThread.currentActivityThread().getApplicationThread(), mWindowTokenClient, DEFAULT_DISPLAY); verify(mWindowTokenClient, never()).onConfigurationChanged(any(), anyInt(), anyBoolean()); doReturn(mConfiguration).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); assertTrue(mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY)); verify(mWindowTokenClient).onConfigurationChanged(mConfiguration, DEFAULT_DISPLAY, Loading @@ -148,28 +152,29 @@ public class WindowTokenClientControllerTest { public void testAttachToDisplayContent_detachIfNeeded() throws RemoteException { mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(null).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(mConfiguration).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService).detachWindowContext(any()); } @Test public void testAttachToWindowToken() throws RemoteException { mController.attachToWindowToken(mWindowTokenClient, mWindowToken); verify(mWindowManagerService).attachWindowContextToWindowToken(mWindowTokenClient, verify(mWindowManagerService).attachWindowContextToWindowToken( ActivityThread.currentActivityThread().getApplicationThread(), mWindowTokenClient, mWindowToken); } Loading @@ -177,12 +182,12 @@ public class WindowTokenClientControllerTest { public void testAttachToWindowToken_detachIfNeeded() throws RemoteException { mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); mController.attachToWindowToken(mWindowTokenClient, mWindowToken); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService).detachWindowContext(any()); } @Test Loading Loading
core/java/android/app/servertransaction/WindowTokenClientController.java +10 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import static android.view.WindowManagerGlobal.getWindowManagerService; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; import android.app.IApplicationThread; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; Loading @@ -46,6 +48,8 @@ public class WindowTokenClientController { private static WindowTokenClientController sController; private final Object mLock = new Object(); private final IApplicationThread mAppThread = ActivityThread.currentActivityThread() .getApplicationThread(); /** Mapping from a client defined token to the {@link WindowTokenClient} it represents. */ @GuardedBy("mLock") Loading Loading @@ -84,8 +88,8 @@ public class WindowTokenClientController { @WindowType int type, int displayId, @Nullable Bundle options) { final Configuration configuration; try { configuration = getWindowManagerService() .attachWindowContextToDisplayArea(client, type, displayId, options); configuration = getWindowManagerService().attachWindowContextToDisplayArea( mAppThread, client, type, displayId, options); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -111,7 +115,7 @@ public class WindowTokenClientController { } final Configuration configuration; try { configuration = wms.attachToDisplayContent(client, displayId); configuration = wms.attachWindowContextToDisplayContent(mAppThread, client, displayId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -131,7 +135,8 @@ public class WindowTokenClientController { public void attachToWindowToken(@NonNull WindowTokenClient client, @NonNull IBinder windowToken) { try { getWindowManagerService().attachWindowContextToWindowToken(client, windowToken); getWindowManagerService().attachWindowContextToWindowToken( mAppThread, client, windowToken); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -149,7 +154,7 @@ public class WindowTokenClientController { } } try { getWindowManagerService().detachWindowContextFromWindowContainer(client); getWindowManagerService().detachWindowContext(client); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
core/java/android/view/IWindowManager.aidl +11 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.policy.IKeyguardDismissCallback; import com.android.internal.policy.IKeyguardLockedStateListener; import com.android.internal.policy.IShortcutService; import android.app.IApplicationThread; import android.app.IAssistDataReceiver; import android.content.ComponentName; import android.content.res.CompatibilityInfo; Loading Loading @@ -850,6 +851,7 @@ interface IWindowManager * system server. {@link #attachWindowContextToWindowToken(IBinder, IBinder)} could be used in * this case to attach the WindowContext to the WindowToken.</p> * * @param appThread the process that the window context is on. * @param clientToken {@link android.window.WindowContext#getWindowContextToken() * the WindowContext's token} * @param type Window type of the window context Loading @@ -859,8 +861,8 @@ interface IWindowManager * @return the DisplayArea's {@link android.app.res.Configuration} if the WindowContext is * attached to the DisplayArea successfully. {@code null}, otherwise. */ Configuration attachWindowContextToDisplayArea(IBinder clientToken, int type, int displayId, in Bundle options); @nullable Configuration attachWindowContextToDisplayArea(in IApplicationThread appThread, IBinder clientToken, int type, int displayId, in @nullable Bundle options); /** * Attaches a {@link android.window.WindowContext} to a {@code WindowToken}. Loading @@ -872,6 +874,7 @@ interface IWindowManager * {@link android.window.WindowTokenClient#attachContext(Context)} * </p> * * @param appThread the process that the window context is on. * @param clientToken {@link android.window.WindowContext#getWindowContextToken() * the WindowContext's token} * @param token the WindowToken to attach Loading @@ -881,7 +884,8 @@ interface IWindowManager * * @see #attachWindowContextToDisplayArea(IBinder, int, int, Bundle) */ void attachWindowContextToWindowToken(IBinder clientToken, IBinder token); void attachWindowContextToWindowToken(in IApplicationThread appThread, IBinder clientToken, IBinder token); /** * Attaches a {@code clientToken} to associate with DisplayContent. Loading @@ -890,6 +894,7 @@ interface IWindowManager * {@link android.window.WindowTokenClient#attachContext(Context)} * </p> * * @param appThread the process that the window context is on. * @param clientToken {@link android.window.WindowContext#getWindowContextToken() * the WindowContext's token} * @param displayId The display associated with the window context Loading @@ -898,7 +903,8 @@ interface IWindowManager * attached to the DisplayContent successfully. {@code null}, otherwise. * @throws android.view.WindowManager.InvalidDisplayException if the display ID is invalid */ Configuration attachToDisplayContent(IBinder clientToken, int displayId); @nullable Configuration attachWindowContextToDisplayContent(in IApplicationThread appThread, IBinder clientToken, int displayId); /** * Detaches {@link android.window.WindowContext} from the window manager node it's currently Loading @@ -906,7 +912,7 @@ interface IWindowManager * * @param clientToken the window context's token */ void detachWindowContextFromWindowContainer(IBinder clientToken); void detachWindowContext(IBinder clientToken); /** * Registers a listener, which is to be called whenever cross-window blur is enabled/disabled. Loading
core/java/android/window/WindowContextController.java +1 −1 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ public class WindowContextController { * {@link #attachToDisplayArea(int, int, Bundle)}. * * @see WindowProviderService#attachToWindowToken(IBinder)) * @see IWindowManager#attachWindowContextToWindowToken(IBinder, IBinder) * @see IWindowManager#attachWindowContextToWindowToken */ public void attachToWindowToken(IBinder windowToken) { if (mAttachedToDisplayArea != AttachStatus.STATUS_ATTACHED) { Loading
core/java/android/window/WindowTokenClient.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ import java.lang.ref.WeakReference; * {@link Context#getWindowContextToken() the token of non-Activity UI Contexts}. * * @see WindowContext * @see android.view.IWindowManager#attachWindowContextToDisplayArea(IBinder, int, int, Bundle) * @see android.view.IWindowManager#attachWindowContextToDisplayArea * * @hide */ Loading
core/tests/coretests/src/android/app/servertransaction/WindowTokenClientControllerTest.java +28 −23 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static org.mockito.Mockito.verify; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import android.app.ActivityThread; import android.content.res.Configuration; import android.os.IBinder; import android.os.RemoteException; Loading Loading @@ -87,16 +88,17 @@ public class WindowTokenClientControllerTest { @Test public void testAttachToDisplayArea() throws RemoteException { doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); assertFalse(mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */)); verify(mWindowManagerService).attachWindowContextToDisplayArea(mWindowTokenClient, verify(mWindowManagerService).attachWindowContextToDisplayArea( ActivityThread.currentActivityThread().getApplicationThread(), mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */); verify(mWindowTokenClient, never()).onConfigurationChanged(any(), anyInt(), anyBoolean()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); assertTrue(mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */)); Loading @@ -108,36 +110,38 @@ public class WindowTokenClientControllerTest { public void testAttachToDisplayArea_detachIfNeeded() throws RemoteException { mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayArea( any(), anyInt(), anyInt(), any()); any(), any(), anyInt(), anyInt(), any()); mController.attachToDisplayArea(mWindowTokenClient, TYPE_APPLICATION_OVERLAY, DEFAULT_DISPLAY, null /* options */); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService).detachWindowContext(any()); } @Test public void testAttachToDisplayContent() throws RemoteException { doReturn(null).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); assertFalse(mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY)); verify(mWindowManagerService).attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY); verify(mWindowManagerService).attachWindowContextToDisplayContent( ActivityThread.currentActivityThread().getApplicationThread(), mWindowTokenClient, DEFAULT_DISPLAY); verify(mWindowTokenClient, never()).onConfigurationChanged(any(), anyInt(), anyBoolean()); doReturn(mConfiguration).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); assertTrue(mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY)); verify(mWindowTokenClient).onConfigurationChanged(mConfiguration, DEFAULT_DISPLAY, Loading @@ -148,28 +152,29 @@ public class WindowTokenClientControllerTest { public void testAttachToDisplayContent_detachIfNeeded() throws RemoteException { mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(null).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(null).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); doReturn(mConfiguration).when(mWindowManagerService).attachToDisplayContent( any(), anyInt()); doReturn(mConfiguration).when(mWindowManagerService).attachWindowContextToDisplayContent( any(), any(), anyInt()); mController.attachToDisplayContent(mWindowTokenClient, DEFAULT_DISPLAY); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService).detachWindowContext(any()); } @Test public void testAttachToWindowToken() throws RemoteException { mController.attachToWindowToken(mWindowTokenClient, mWindowToken); verify(mWindowManagerService).attachWindowContextToWindowToken(mWindowTokenClient, verify(mWindowManagerService).attachWindowContextToWindowToken( ActivityThread.currentActivityThread().getApplicationThread(), mWindowTokenClient, mWindowToken); } Loading @@ -177,12 +182,12 @@ public class WindowTokenClientControllerTest { public void testAttachToWindowToken_detachIfNeeded() throws RemoteException { mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService, never()).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService, never()).detachWindowContext(any()); mController.attachToWindowToken(mWindowTokenClient, mWindowToken); mController.detachIfNeeded(mWindowTokenClient); verify(mWindowManagerService).detachWindowContextFromWindowContainer(any()); verify(mWindowManagerService).detachWindowContext(any()); } @Test Loading