Loading core/java/android/view/IWindowManager.aidl +14 −0 Original line number Diff line number Diff line Loading @@ -953,4 +953,18 @@ interface IWindowManager * means the recents app can control the SystemUI flags, and vice-versa. */ void setRecentsAppBehindSystemBars(boolean behindSystemBars); /** * Gets the background color of the letterbox. Considered invalid if the background has * multiple colors {@link #isLetterboxBackgroundMultiColored}. Should be called by SystemUI when * computing the letterbox appearance for status bar treatment. */ int getLetterboxBackgroundColorInArgb(); /** * Whether the outer area of the letterbox has multiple colors (e.g. blurred background). * Should be called by SystemUI when computing the letterbox appearance for status bar * treatment. */ boolean isLetterboxBackgroundMultiColored(); } services/core/java/com/android/server/wm/LetterboxConfiguration.java +1 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,7 @@ final class LetterboxConfiguration { /** * Gets color of letterbox background which is used when {@link * #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as * fallback for other backfround types. * fallback for other background types. */ Color getLetterboxBackgroundColor() { if (mLetterboxBackgroundColorOverride != null) { Loading services/core/java/com/android/server/wm/WindowManagerService.java +33 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,10 @@ import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_W import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY; import static com.android.server.wm.DisplayContent.IME_TARGET_CONTROL; import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_SOLID_COLOR; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_WALLPAPER; import static com.android.server.wm.RootWindowContainer.MATCH_ATTACHED_TASK_OR_RECENT_TASKS; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; Loading Loading @@ -9252,4 +9256,33 @@ public class WindowManagerService extends IWindowManager.Stub Binder.restoreCallingIdentity(token); } } /** * Gets the background color of the letterbox. Considered invalid if the background has * multiple colors {@link #isLetterboxBackgroundMultiColored} */ @Override public int getLetterboxBackgroundColorInArgb() { return mLetterboxConfiguration.getLetterboxBackgroundColor().toArgb(); } /** * Whether the outer area of the letterbox has multiple colors (e.g. blurred background). */ @Override public boolean isLetterboxBackgroundMultiColored() { @LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType = mLetterboxConfiguration.getLetterboxBackgroundType(); switch (letterboxBackgroundType) { case LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING: case LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND: case LETTERBOX_BACKGROUND_WALLPAPER: return true; case LETTERBOX_BACKGROUND_SOLID_COLOR: return false; default: throw new AssertionError( "Unexpected letterbox background type: " + letterboxBackgroundType); } } } services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +22 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,10 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_SOLID_COLOR; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_WALLPAPER; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -381,6 +385,18 @@ public class WindowManagerServiceTests extends WindowTestsBase { assertThat(wct).isNull(); } @Test public void testisLetterboxBackgroundMultiColored() { assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING)).isTrue(); assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND)).isTrue(); assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_WALLPAPER)).isTrue(); assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_SOLID_COLOR)).isFalse(); } private void setupActivityWithLaunchCookie(IBinder launchCookie, WindowContainerToken wct) { final WindowContainer.RemoteToken remoteToken = mock(WindowContainer.RemoteToken.class); when(remoteToken.toWindowContainerToken()).thenReturn(wct); Loading @@ -390,4 +406,10 @@ public class WindowManagerServiceTests extends WindowTestsBase { testActivity.mLaunchCookie = launchCookie; testActivity.getTask().mRemoteToken = remoteToken; } private boolean setupLetterboxConfigurationWithBackgroundType( @LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType) { mWm.mLetterboxConfiguration.setLetterboxBackgroundType(letterboxBackgroundType); return mWm.isLetterboxBackgroundMultiColored(); } } Loading
core/java/android/view/IWindowManager.aidl +14 −0 Original line number Diff line number Diff line Loading @@ -953,4 +953,18 @@ interface IWindowManager * means the recents app can control the SystemUI flags, and vice-versa. */ void setRecentsAppBehindSystemBars(boolean behindSystemBars); /** * Gets the background color of the letterbox. Considered invalid if the background has * multiple colors {@link #isLetterboxBackgroundMultiColored}. Should be called by SystemUI when * computing the letterbox appearance for status bar treatment. */ int getLetterboxBackgroundColorInArgb(); /** * Whether the outer area of the letterbox has multiple colors (e.g. blurred background). * Should be called by SystemUI when computing the letterbox appearance for status bar * treatment. */ boolean isLetterboxBackgroundMultiColored(); }
services/core/java/com/android/server/wm/LetterboxConfiguration.java +1 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,7 @@ final class LetterboxConfiguration { /** * Gets color of letterbox background which is used when {@link * #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as * fallback for other backfround types. * fallback for other background types. */ Color getLetterboxBackgroundColor() { if (mLetterboxBackgroundColorOverride != null) { Loading
services/core/java/com/android/server/wm/WindowManagerService.java +33 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,10 @@ import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_W import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY; import static com.android.server.wm.DisplayContent.IME_TARGET_CONTROL; import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_SOLID_COLOR; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_WALLPAPER; import static com.android.server.wm.RootWindowContainer.MATCH_ATTACHED_TASK_OR_RECENT_TASKS; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; Loading Loading @@ -9252,4 +9256,33 @@ public class WindowManagerService extends IWindowManager.Stub Binder.restoreCallingIdentity(token); } } /** * Gets the background color of the letterbox. Considered invalid if the background has * multiple colors {@link #isLetterboxBackgroundMultiColored} */ @Override public int getLetterboxBackgroundColorInArgb() { return mLetterboxConfiguration.getLetterboxBackgroundColor().toArgb(); } /** * Whether the outer area of the letterbox has multiple colors (e.g. blurred background). */ @Override public boolean isLetterboxBackgroundMultiColored() { @LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType = mLetterboxConfiguration.getLetterboxBackgroundType(); switch (letterboxBackgroundType) { case LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING: case LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND: case LETTERBOX_BACKGROUND_WALLPAPER: return true; case LETTERBOX_BACKGROUND_SOLID_COLOR: return false; default: throw new AssertionError( "Unexpected letterbox background type: " + letterboxBackgroundType); } } }
services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +22 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,10 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_SOLID_COLOR; import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_WALLPAPER; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -381,6 +385,18 @@ public class WindowManagerServiceTests extends WindowTestsBase { assertThat(wct).isNull(); } @Test public void testisLetterboxBackgroundMultiColored() { assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING)).isTrue(); assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND)).isTrue(); assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_WALLPAPER)).isTrue(); assertThat(setupLetterboxConfigurationWithBackgroundType( LETTERBOX_BACKGROUND_SOLID_COLOR)).isFalse(); } private void setupActivityWithLaunchCookie(IBinder launchCookie, WindowContainerToken wct) { final WindowContainer.RemoteToken remoteToken = mock(WindowContainer.RemoteToken.class); when(remoteToken.toWindowContainerToken()).thenReturn(wct); Loading @@ -390,4 +406,10 @@ public class WindowManagerServiceTests extends WindowTestsBase { testActivity.mLaunchCookie = launchCookie; testActivity.getTask().mRemoteToken = remoteToken; } private boolean setupLetterboxConfigurationWithBackgroundType( @LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType) { mWm.mLetterboxConfiguration.setLetterboxBackgroundType(letterboxBackgroundType); return mWm.isLetterboxBackgroundMultiColored(); } }