Merge "Create WM letterbox background color API" into tm-qpr-dev am: 8ac996fd0d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19416409 Change-Id: I115b43baaebf59c55d2e92499848e16a91a2d280 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -953,4 +953,18 @@ interface IWindowManager
|
|||||||
* means the recents app can control the SystemUI flags, and vice-versa.
|
* means the recents app can control the SystemUI flags, and vice-versa.
|
||||||
*/
|
*/
|
||||||
void setRecentsAppBehindSystemBars(boolean behindSystemBars);
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ final class LetterboxConfiguration {
|
|||||||
/**
|
/**
|
||||||
* Gets color of letterbox background which is used when {@link
|
* Gets color of letterbox background which is used when {@link
|
||||||
* #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
|
* #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
|
||||||
* fallback for other backfround types.
|
* fallback for other background types.
|
||||||
*/
|
*/
|
||||||
Color getLetterboxBackgroundColor() {
|
Color getLetterboxBackgroundColor() {
|
||||||
if (mLetterboxBackgroundColorOverride != null) {
|
if (mLetterboxBackgroundColorOverride != null) {
|
||||||
|
|||||||
@@ -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.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_CONTROL;
|
||||||
import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING;
|
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.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_ALL;
|
||||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
|
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
|
||||||
@@ -9252,4 +9256,33 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
Binder.restoreCallingIdentity(token);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.doReturn;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
|
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;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -381,6 +385,18 @@ public class WindowManagerServiceTests extends WindowTestsBase {
|
|||||||
assertThat(wct).isNull();
|
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) {
|
private void setupActivityWithLaunchCookie(IBinder launchCookie, WindowContainerToken wct) {
|
||||||
final WindowContainer.RemoteToken remoteToken = mock(WindowContainer.RemoteToken.class);
|
final WindowContainer.RemoteToken remoteToken = mock(WindowContainer.RemoteToken.class);
|
||||||
when(remoteToken.toWindowContainerToken()).thenReturn(wct);
|
when(remoteToken.toWindowContainerToken()).thenReturn(wct);
|
||||||
@@ -390,4 +406,10 @@ public class WindowManagerServiceTests extends WindowTestsBase {
|
|||||||
testActivity.mLaunchCookie = launchCookie;
|
testActivity.mLaunchCookie = launchCookie;
|
||||||
testActivity.getTask().mRemoteToken = remoteToken;
|
testActivity.getTask().mRemoteToken = remoteToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean setupLetterboxConfigurationWithBackgroundType(
|
||||||
|
@LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType) {
|
||||||
|
mWm.mLetterboxConfiguration.setLetterboxBackgroundType(letterboxBackgroundType);
|
||||||
|
return mWm.isLetterboxBackgroundMultiColored();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user