Loading services/core/java/com/android/server/wm/WindowManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -2610,7 +2610,8 @@ public class WindowManagerService extends IWindowManager.Stub if (type == TYPE_WALLPAPER) { new WallpaperWindowToken(this, binder, true, dc, callerCanManageAppTokens); } else { new WindowToken(this, binder, type, true, dc, callerCanManageAppTokens); new WindowToken(this, binder, type, true, dc, callerCanManageAppTokens, false /* roundedCornerOverlay */, fromClientToken); } } } finally { Loading services/core/java/com/android/server/wm/WindowToken.java +6 −4 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.InsetsState; import android.view.SurfaceControl; import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.server.policy.WindowManagerPolicy; import com.android.server.protolog.common.ProtoLog; Loading Loading @@ -99,7 +100,8 @@ class WindowToken extends WindowContainer<WindowState> { private Configuration mLastReportedConfig; private int mLastReportedDisplay = INVALID_DISPLAY; private final boolean mFromClientToken; @VisibleForTesting final boolean mFromClientToken; /** * Used to fix the transform of the token to be rotated to a rotation different than it's Loading Loading @@ -180,13 +182,13 @@ class WindowToken extends WindowContainer<WindowState> { WindowToken(WindowManagerService service, IBinder _token, int type, boolean persistOnEmpty, DisplayContent dc, boolean ownerCanManageAppTokens) { this(service, _token, type, persistOnEmpty, dc, ownerCanManageAppTokens, false /* roundedCornersOverlay */); false /* roundedCornerOverlay */); } WindowToken(WindowManagerService service, IBinder _token, int type, boolean persistOnEmpty, DisplayContent dc, boolean ownerCanManageAppTokens, boolean fromClientToken) { DisplayContent dc, boolean ownerCanManageAppTokens, boolean roundedCornerOverlay) { this(service, _token, type, persistOnEmpty, dc, ownerCanManageAppTokens, false /* roundedCornersOverlay */, fromClientToken); roundedCornerOverlay, false /* fromClientToken */); } WindowToken(WindowManagerService service, IBinder _token, int type, boolean persistOnEmpty, Loading services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +28 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,16 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import android.content.pm.PackageManager; import android.os.IBinder; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; Loading Loading @@ -57,4 +64,25 @@ public class WindowManagerServiceTests extends WindowTestsBase { return getInstrumentation().getTargetContext().getPackageManager().hasSystemFeature( PackageManager.FEATURE_AUTOMOTIVE); } @Test public void testAddWindowToken() { IBinder token = mock(IBinder.class); mWm.addWindowToken(token, TYPE_TOAST, mDisplayContent.getDisplayId()); WindowToken windowToken = mWm.mRoot.getWindowToken(token); assertFalse(windowToken.mRoundedCornerOverlay); assertFalse(windowToken.mFromClientToken); } @Test public void testAddWindowTokenWithOptions() { IBinder token = mock(IBinder.class); mWm.addWindowTokenWithOptions(token, TYPE_TOAST, mDisplayContent.getDisplayId(), null /* options */, null /* options */); WindowToken windowToken = mWm.mRoot.getWindowToken(token); assertFalse(windowToken.mRoundedCornerOverlay); assertTrue(windowToken.mFromClientToken); } } services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java +26 −0 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import android.os.IBinder; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; Loading Loading @@ -129,4 +131,28 @@ public class WindowTokenTests extends WindowTestsBase { // Verify that the token windows are no longer attached to it. assertEquals(0, token.getWindowsCount()); } /** * Test that {@link WindowToken} constructor parameters is set with expectation. */ @Test public void testWindowTokenConstructorSanity() { WindowToken token = new WindowToken(mDisplayContent.mWmService, mock(IBinder.class), TYPE_TOAST, true /* persistOnEmpty */, mDisplayContent, true /* ownerCanManageAppTokens */); assertFalse(token.mRoundedCornerOverlay); assertFalse(token.mFromClientToken); token = new WindowToken(mDisplayContent.mWmService, mock(IBinder.class), TYPE_TOAST, true /* persistOnEmpty */, mDisplayContent, true /* ownerCanManageAppTokens */, true /* roundedCornerOverlay */); assertTrue(token.mRoundedCornerOverlay); assertFalse(token.mFromClientToken); token = new WindowToken(mDisplayContent.mWmService, mock(IBinder.class), TYPE_TOAST, true /* persistOnEmpty */, mDisplayContent, true /* ownerCanManageAppTokens */, true /* roundedCornerOverlay */, true /* fromClientToken */); assertTrue(token.mRoundedCornerOverlay); assertTrue(token.mFromClientToken); } } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -2610,7 +2610,8 @@ public class WindowManagerService extends IWindowManager.Stub if (type == TYPE_WALLPAPER) { new WallpaperWindowToken(this, binder, true, dc, callerCanManageAppTokens); } else { new WindowToken(this, binder, type, true, dc, callerCanManageAppTokens); new WindowToken(this, binder, type, true, dc, callerCanManageAppTokens, false /* roundedCornerOverlay */, fromClientToken); } } } finally { Loading
services/core/java/com/android/server/wm/WindowToken.java +6 −4 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.InsetsState; import android.view.SurfaceControl; import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.server.policy.WindowManagerPolicy; import com.android.server.protolog.common.ProtoLog; Loading Loading @@ -99,7 +100,8 @@ class WindowToken extends WindowContainer<WindowState> { private Configuration mLastReportedConfig; private int mLastReportedDisplay = INVALID_DISPLAY; private final boolean mFromClientToken; @VisibleForTesting final boolean mFromClientToken; /** * Used to fix the transform of the token to be rotated to a rotation different than it's Loading Loading @@ -180,13 +182,13 @@ class WindowToken extends WindowContainer<WindowState> { WindowToken(WindowManagerService service, IBinder _token, int type, boolean persistOnEmpty, DisplayContent dc, boolean ownerCanManageAppTokens) { this(service, _token, type, persistOnEmpty, dc, ownerCanManageAppTokens, false /* roundedCornersOverlay */); false /* roundedCornerOverlay */); } WindowToken(WindowManagerService service, IBinder _token, int type, boolean persistOnEmpty, DisplayContent dc, boolean ownerCanManageAppTokens, boolean fromClientToken) { DisplayContent dc, boolean ownerCanManageAppTokens, boolean roundedCornerOverlay) { this(service, _token, type, persistOnEmpty, dc, ownerCanManageAppTokens, false /* roundedCornersOverlay */, fromClientToken); roundedCornerOverlay, false /* fromClientToken */); } WindowToken(WindowManagerService service, IBinder _token, int type, boolean persistOnEmpty, Loading
services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +28 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,16 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import android.content.pm.PackageManager; import android.os.IBinder; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; Loading Loading @@ -57,4 +64,25 @@ public class WindowManagerServiceTests extends WindowTestsBase { return getInstrumentation().getTargetContext().getPackageManager().hasSystemFeature( PackageManager.FEATURE_AUTOMOTIVE); } @Test public void testAddWindowToken() { IBinder token = mock(IBinder.class); mWm.addWindowToken(token, TYPE_TOAST, mDisplayContent.getDisplayId()); WindowToken windowToken = mWm.mRoot.getWindowToken(token); assertFalse(windowToken.mRoundedCornerOverlay); assertFalse(windowToken.mFromClientToken); } @Test public void testAddWindowTokenWithOptions() { IBinder token = mock(IBinder.class); mWm.addWindowTokenWithOptions(token, TYPE_TOAST, mDisplayContent.getDisplayId(), null /* options */, null /* options */); WindowToken windowToken = mWm.mRoot.getWindowToken(token); assertFalse(windowToken.mRoundedCornerOverlay); assertTrue(windowToken.mFromClientToken); } }
services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java +26 −0 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import android.os.IBinder; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; Loading Loading @@ -129,4 +131,28 @@ public class WindowTokenTests extends WindowTestsBase { // Verify that the token windows are no longer attached to it. assertEquals(0, token.getWindowsCount()); } /** * Test that {@link WindowToken} constructor parameters is set with expectation. */ @Test public void testWindowTokenConstructorSanity() { WindowToken token = new WindowToken(mDisplayContent.mWmService, mock(IBinder.class), TYPE_TOAST, true /* persistOnEmpty */, mDisplayContent, true /* ownerCanManageAppTokens */); assertFalse(token.mRoundedCornerOverlay); assertFalse(token.mFromClientToken); token = new WindowToken(mDisplayContent.mWmService, mock(IBinder.class), TYPE_TOAST, true /* persistOnEmpty */, mDisplayContent, true /* ownerCanManageAppTokens */, true /* roundedCornerOverlay */); assertTrue(token.mRoundedCornerOverlay); assertFalse(token.mFromClientToken); token = new WindowToken(mDisplayContent.mWmService, mock(IBinder.class), TYPE_TOAST, true /* persistOnEmpty */, mDisplayContent, true /* ownerCanManageAppTokens */, true /* roundedCornerOverlay */, true /* fromClientToken */); assertTrue(token.mRoundedCornerOverlay); assertTrue(token.mFromClientToken); } }