Merge "Enable blur letterbox wallpaper behind flags" into udc-qpr-dev am: 9c84b51754
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23874759 Change-Id: I8d26028646ec316ad449df8546c81872ff56e48c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2022 The Android Open Source Project
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License.
|
|
||||||
-->
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:color="@color/system_neutral1_500" android:lStar="5" />
|
|
||||||
</selector>
|
|
||||||
@@ -5577,13 +5577,13 @@
|
|||||||
|
|
||||||
<!-- Blur radius for the Option 3 in R.integer.config_letterboxBackgroundType. Values < 0 are
|
<!-- Blur radius for the Option 3 in R.integer.config_letterboxBackgroundType. Values < 0 are
|
||||||
ignored and 0 is used. -->
|
ignored and 0 is used. -->
|
||||||
<dimen name="config_letterboxBackgroundWallpaperBlurRadius">31dp</dimen>
|
<dimen name="config_letterboxBackgroundWallpaperBlurRadius">24dp</dimen>
|
||||||
|
|
||||||
<!-- Alpha of a black translucent scrim showed over wallpaper letterbox background when
|
<!-- Alpha of a black translucent scrim showed over wallpaper letterbox background when
|
||||||
the Option 3 is selected for R.integer.config_letterboxBackgroundType.
|
the Option 3 is selected for R.integer.config_letterboxBackgroundType.
|
||||||
Values < 0 or >= 1 are ignored and 0.0 (transparent) is used instead. -->
|
Values < 0 or >= 1 are ignored and 0.0 (transparent) is used instead. -->
|
||||||
<item name="config_letterboxBackgroundWallaperDarkScrimAlpha" format="float" type="dimen">
|
<item name="config_letterboxBackgroundWallaperDarkScrimAlpha" format="float" type="dimen">
|
||||||
0.5
|
0.68
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<!-- Corners appearance of the letterbox background.
|
<!-- Corners appearance of the letterbox background.
|
||||||
@@ -5608,7 +5608,7 @@
|
|||||||
but isn't supported on the device or both dark scrim alpha and blur radius aren't
|
but isn't supported on the device or both dark scrim alpha and blur radius aren't
|
||||||
provided.
|
provided.
|
||||||
-->
|
-->
|
||||||
<color name="config_letterboxBackgroundColor">@color/letterbox_background</color>
|
<color name="config_letterboxBackgroundColor">@color/system_on_secondary_fixed</color>
|
||||||
|
|
||||||
<!-- Horizontal position of a center of the letterboxed app window.
|
<!-- Horizontal position of a center of the letterboxed app window.
|
||||||
0 corresponds to the left side of the screen and 1 to the right side. If given value < 0
|
0 corresponds to the left side of the screen and 1 to the right side. If given value < 0
|
||||||
|
|||||||
@@ -85,6 +85,13 @@ final class LetterboxConfiguration {
|
|||||||
// TODO(b/288142656): Enable user aspect ratio settings by default.
|
// TODO(b/288142656): Enable user aspect ratio settings by default.
|
||||||
private static final boolean DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_SETTINGS = false;
|
private static final boolean DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_SETTINGS = false;
|
||||||
|
|
||||||
|
// Whether the letterbox wallpaper style is enabled by default
|
||||||
|
private static final String KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER =
|
||||||
|
"enable_letterbox_background_wallpaper";
|
||||||
|
|
||||||
|
// TODO(b/290048978): Enable wallpaper as default letterbox background.
|
||||||
|
private static final boolean DEFAULT_VALUE_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override of aspect ratio for fixed orientation letterboxing that is set via ADB with
|
* Override of aspect ratio for fixed orientation letterboxing that is set via ADB with
|
||||||
* set-fixed-orientation-letterbox-aspect-ratio or via {@link
|
* set-fixed-orientation-letterbox-aspect-ratio or via {@link
|
||||||
@@ -101,9 +108,16 @@ final class LetterboxConfiguration {
|
|||||||
|
|
||||||
/** Enum for Letterbox background type. */
|
/** Enum for Letterbox background type. */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({LETTERBOX_BACKGROUND_SOLID_COLOR, LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND,
|
@IntDef({LETTERBOX_BACKGROUND_OVERRIDE_UNSET,
|
||||||
LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING, LETTERBOX_BACKGROUND_WALLPAPER})
|
LETTERBOX_BACKGROUND_SOLID_COLOR,
|
||||||
|
LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND,
|
||||||
|
LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING,
|
||||||
|
LETTERBOX_BACKGROUND_WALLPAPER})
|
||||||
@interface LetterboxBackgroundType {};
|
@interface LetterboxBackgroundType {};
|
||||||
|
|
||||||
|
/** No letterbox background style set. Using the one defined by DeviceConfig. */
|
||||||
|
static final int LETTERBOX_BACKGROUND_OVERRIDE_UNSET = -1;
|
||||||
|
|
||||||
/** Solid background using color specified in R.color.config_letterboxBackgroundColor. */
|
/** Solid background using color specified in R.color.config_letterboxBackgroundColor. */
|
||||||
static final int LETTERBOX_BACKGROUND_SOLID_COLOR = 0;
|
static final int LETTERBOX_BACKGROUND_SOLID_COLOR = 0;
|
||||||
|
|
||||||
@@ -183,14 +197,14 @@ final class LetterboxConfiguration {
|
|||||||
@Nullable private Integer mLetterboxBackgroundColorResourceIdOverride;
|
@Nullable private Integer mLetterboxBackgroundColorResourceIdOverride;
|
||||||
|
|
||||||
@LetterboxBackgroundType
|
@LetterboxBackgroundType
|
||||||
private int mLetterboxBackgroundType;
|
private final int mLetterboxBackgroundType;
|
||||||
|
|
||||||
// Blur radius for LETTERBOX_BACKGROUND_WALLPAPER option in mLetterboxBackgroundType.
|
// Blur radius for LETTERBOX_BACKGROUND_WALLPAPER option from getLetterboxBackgroundType().
|
||||||
// Values <= 0 are ignored and 0 is used instead.
|
// Values <= 0 are ignored and 0 is used instead.
|
||||||
private int mLetterboxBackgroundWallpaperBlurRadius;
|
private int mLetterboxBackgroundWallpaperBlurRadiusPx;
|
||||||
|
|
||||||
// Alpha of a black scrim shown over wallpaper letterbox background when
|
// Alpha of a black scrim shown over wallpaper letterbox background when
|
||||||
// LETTERBOX_BACKGROUND_WALLPAPER option is selected for mLetterboxBackgroundType.
|
// LETTERBOX_BACKGROUND_WALLPAPER option is returned from getLetterboxBackgroundType().
|
||||||
// Values < 0 or >= 1 are ignored and 0.0 (transparent) is used instead.
|
// Values < 0 or >= 1 are ignored and 0.0 (transparent) is used instead.
|
||||||
private float mLetterboxBackgroundWallpaperDarkScrimAlpha;
|
private float mLetterboxBackgroundWallpaperDarkScrimAlpha;
|
||||||
|
|
||||||
@@ -252,6 +266,11 @@ final class LetterboxConfiguration {
|
|||||||
// Allows to enable user aspect ratio settings ignoring flags.
|
// Allows to enable user aspect ratio settings ignoring flags.
|
||||||
private boolean mUserAppAspectRatioSettingsOverrideEnabled;
|
private boolean mUserAppAspectRatioSettingsOverrideEnabled;
|
||||||
|
|
||||||
|
// The override for letterbox background type in case it's different from
|
||||||
|
// LETTERBOX_BACKGROUND_OVERRIDE_UNSET
|
||||||
|
@LetterboxBackgroundType
|
||||||
|
private int mLetterboxBackgroundTypeOverride = LETTERBOX_BACKGROUND_OVERRIDE_UNSET;
|
||||||
|
|
||||||
// Whether we should use split screen aspect ratio for the activity when camera compat treatment
|
// Whether we should use split screen aspect ratio for the activity when camera compat treatment
|
||||||
// is enabled and activity is connected to the camera in fullscreen.
|
// is enabled and activity is connected to the camera in fullscreen.
|
||||||
private final boolean mIsCameraCompatSplitScreenAspectRatioEnabled;
|
private final boolean mIsCameraCompatSplitScreenAspectRatioEnabled;
|
||||||
@@ -294,10 +313,10 @@ final class LetterboxConfiguration {
|
|||||||
|
|
||||||
mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat(
|
mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat(
|
||||||
R.dimen.config_fixedOrientationLetterboxAspectRatio);
|
R.dimen.config_fixedOrientationLetterboxAspectRatio);
|
||||||
|
mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(mContext);
|
||||||
mLetterboxActivityCornersRadius = mContext.getResources().getInteger(
|
mLetterboxActivityCornersRadius = mContext.getResources().getInteger(
|
||||||
R.integer.config_letterboxActivityCornersRadius);
|
R.integer.config_letterboxActivityCornersRadius);
|
||||||
mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(mContext);
|
mLetterboxBackgroundWallpaperBlurRadiusPx = mContext.getResources().getDimensionPixelSize(
|
||||||
mLetterboxBackgroundWallpaperBlurRadius = mContext.getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
|
R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
|
||||||
mLetterboxBackgroundWallpaperDarkScrimAlpha = mContext.getResources().getFloat(
|
mLetterboxBackgroundWallpaperDarkScrimAlpha = mContext.getResources().getFloat(
|
||||||
R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha);
|
R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha);
|
||||||
@@ -359,6 +378,8 @@ final class LetterboxConfiguration {
|
|||||||
DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_SETTINGS,
|
DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_SETTINGS,
|
||||||
mContext.getResources().getBoolean(
|
mContext.getResources().getBoolean(
|
||||||
R.bool.config_appCompatUserAppAspectRatioSettingsIsEnabled))
|
R.bool.config_appCompatUserAppAspectRatioSettingsIsEnabled))
|
||||||
|
.addDeviceConfigEntry(KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER,
|
||||||
|
DEFAULT_VALUE_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER, /* enabled */ true)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,25 +518,39 @@ final class LetterboxConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets {@link LetterboxBackgroundType} specified in {@link
|
* Gets {@link LetterboxBackgroundType} specified via ADB command or the default one.
|
||||||
* com.android.internal.R.integer.config_letterboxBackgroundType} or over via ADB command.
|
|
||||||
*/
|
*/
|
||||||
@LetterboxBackgroundType
|
@LetterboxBackgroundType
|
||||||
int getLetterboxBackgroundType() {
|
int getLetterboxBackgroundType() {
|
||||||
return mLetterboxBackgroundType;
|
return mLetterboxBackgroundTypeOverride != LETTERBOX_BACKGROUND_OVERRIDE_UNSET
|
||||||
|
? mLetterboxBackgroundTypeOverride
|
||||||
|
: getDefaultLetterboxBackgroundType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets letterbox background type. */
|
/** Overrides the letterbox background type. */
|
||||||
void setLetterboxBackgroundType(@LetterboxBackgroundType int backgroundType) {
|
void setLetterboxBackgroundTypeOverride(@LetterboxBackgroundType int backgroundType) {
|
||||||
mLetterboxBackgroundType = backgroundType;
|
mLetterboxBackgroundTypeOverride = backgroundType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets cletterbox background type to {@link
|
* Resets letterbox background type value depending on the
|
||||||
* com.android.internal.R.integer.config_letterboxBackgroundType}.
|
* {@link #KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER} built time and runtime flags.
|
||||||
|
*
|
||||||
|
* <p>If enabled, the letterbox background type value is set toZ
|
||||||
|
* {@link #LETTERBOX_BACKGROUND_WALLPAPER}. When disabled the letterbox background type value
|
||||||
|
* comes from {@link R.integer.config_letterboxBackgroundType}.
|
||||||
*/
|
*/
|
||||||
void resetLetterboxBackgroundType() {
|
void resetLetterboxBackgroundType() {
|
||||||
mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(mContext);
|
mLetterboxBackgroundTypeOverride = LETTERBOX_BACKGROUND_OVERRIDE_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER if the DeviceConfig flag is enabled
|
||||||
|
// or the value in com.android.internal.R.integer.config_letterboxBackgroundType if the flag
|
||||||
|
// is disabled.
|
||||||
|
@LetterboxBackgroundType
|
||||||
|
private int getDefaultLetterboxBackgroundType() {
|
||||||
|
return mDeviceConfig.getFlagValue(KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER)
|
||||||
|
? LETTERBOX_BACKGROUND_WALLPAPER : mLetterboxBackgroundType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a string representing the given {@link LetterboxBackgroundType}. */
|
/** Returns a string representing the given {@link LetterboxBackgroundType}. */
|
||||||
@@ -548,7 +583,7 @@ final class LetterboxConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides alpha of a black scrim shown over wallpaper for {@link
|
* Overrides alpha of a black scrim shown over wallpaper for {@link
|
||||||
* #LETTERBOX_BACKGROUND_WALLPAPER} option in {@link mLetterboxBackgroundType}.
|
* #LETTERBOX_BACKGROUND_WALLPAPER} option returned from {@link getLetterboxBackgroundType()}.
|
||||||
*
|
*
|
||||||
* <p>If given value is < 0 or >= 1, both it and a value of {@link
|
* <p>If given value is < 0 or >= 1, both it and a value of {@link
|
||||||
* com.android.internal.R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha} are ignored
|
* com.android.internal.R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha} are ignored
|
||||||
@@ -575,33 +610,33 @@ final class LetterboxConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides blur radius for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option in
|
* Overrides blur radius for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option from
|
||||||
* {@link mLetterboxBackgroundType}.
|
* {@link getLetterboxBackgroundType()}.
|
||||||
*
|
*
|
||||||
* <p> If given value <= 0, both it and a value of {@link
|
* <p> If given value <= 0, both it and a value of {@link
|
||||||
* com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius} are ignored
|
* com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius} are ignored
|
||||||
* and 0 is used instead.
|
* and 0 is used instead.
|
||||||
*/
|
*/
|
||||||
void setLetterboxBackgroundWallpaperBlurRadius(int radius) {
|
void setLetterboxBackgroundWallpaperBlurRadiusPx(int radius) {
|
||||||
mLetterboxBackgroundWallpaperBlurRadius = radius;
|
mLetterboxBackgroundWallpaperBlurRadiusPx = radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets blur raidus for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option in {@link
|
* Resets blur raidus for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option returned by {@link
|
||||||
* mLetterboxBackgroundType} to {@link
|
* getLetterboxBackgroundType()} to {@link
|
||||||
* com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius}.
|
* com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius}.
|
||||||
*/
|
*/
|
||||||
void resetLetterboxBackgroundWallpaperBlurRadius() {
|
void resetLetterboxBackgroundWallpaperBlurRadiusPx() {
|
||||||
mLetterboxBackgroundWallpaperBlurRadius = mContext.getResources().getDimensionPixelSize(
|
mLetterboxBackgroundWallpaperBlurRadiusPx = mContext.getResources().getDimensionPixelSize(
|
||||||
com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
|
com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets blur raidus for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option in {@link
|
* Gets blur raidus for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option returned by {@link
|
||||||
* mLetterboxBackgroundType}.
|
* getLetterboxBackgroundType()}.
|
||||||
*/
|
*/
|
||||||
int getLetterboxBackgroundWallpaperBlurRadius() {
|
int getLetterboxBackgroundWallpaperBlurRadiusPx() {
|
||||||
return mLetterboxBackgroundWallpaperBlurRadius;
|
return mLetterboxBackgroundWallpaperBlurRadiusPx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -894,7 +894,7 @@ final class LetterboxUiController {
|
|||||||
this::shouldLetterboxHaveRoundedCorners,
|
this::shouldLetterboxHaveRoundedCorners,
|
||||||
this::getLetterboxBackgroundColor,
|
this::getLetterboxBackgroundColor,
|
||||||
this::hasWallpaperBackgroundForLetterbox,
|
this::hasWallpaperBackgroundForLetterbox,
|
||||||
this::getLetterboxWallpaperBlurRadius,
|
this::getLetterboxWallpaperBlurRadiusPx,
|
||||||
this::getLetterboxWallpaperDarkScrimAlpha,
|
this::getLetterboxWallpaperDarkScrimAlpha,
|
||||||
this::handleHorizontalDoubleTap,
|
this::handleHorizontalDoubleTap,
|
||||||
this::handleVerticalDoubleTap,
|
this::handleVerticalDoubleTap,
|
||||||
@@ -1315,7 +1315,7 @@ final class LetterboxUiController {
|
|||||||
case LETTERBOX_BACKGROUND_WALLPAPER:
|
case LETTERBOX_BACKGROUND_WALLPAPER:
|
||||||
if (hasWallpaperBackgroundForLetterbox()) {
|
if (hasWallpaperBackgroundForLetterbox()) {
|
||||||
// Color is used for translucent scrim that dims wallpaper.
|
// Color is used for translucent scrim that dims wallpaper.
|
||||||
return Color.valueOf(Color.BLACK);
|
return mLetterboxConfiguration.getLetterboxBackgroundColor();
|
||||||
}
|
}
|
||||||
Slog.w(TAG, "Wallpaper option is selected for letterbox background but "
|
Slog.w(TAG, "Wallpaper option is selected for letterbox background but "
|
||||||
+ "blur is not supported by a device or not supported in the current "
|
+ "blur is not supported by a device or not supported in the current "
|
||||||
@@ -1472,10 +1472,10 @@ final class LetterboxUiController {
|
|||||||
// Don't use wallpaper as a background if letterboxed for display cutout.
|
// Don't use wallpaper as a background if letterboxed for display cutout.
|
||||||
&& isLetterboxedNotForDisplayCutout(mainWindow)
|
&& isLetterboxedNotForDisplayCutout(mainWindow)
|
||||||
// Check that dark scrim alpha or blur radius are provided
|
// Check that dark scrim alpha or blur radius are provided
|
||||||
&& (getLetterboxWallpaperBlurRadius() > 0
|
&& (getLetterboxWallpaperBlurRadiusPx() > 0
|
||||||
|| getLetterboxWallpaperDarkScrimAlpha() > 0)
|
|| getLetterboxWallpaperDarkScrimAlpha() > 0)
|
||||||
// Check that blur is supported by a device if blur radius is provided.
|
// Check that blur is supported by a device if blur radius is provided.
|
||||||
&& (getLetterboxWallpaperBlurRadius() <= 0
|
&& (getLetterboxWallpaperBlurRadiusPx() <= 0
|
||||||
|| isLetterboxWallpaperBlurSupported());
|
|| isLetterboxWallpaperBlurSupported());
|
||||||
if (mShowWallpaperForLetterboxBackground != wallpaperShouldBeShown) {
|
if (mShowWallpaperForLetterboxBackground != wallpaperShouldBeShown) {
|
||||||
mShowWallpaperForLetterboxBackground = wallpaperShouldBeShown;
|
mShowWallpaperForLetterboxBackground = wallpaperShouldBeShown;
|
||||||
@@ -1483,9 +1483,9 @@ final class LetterboxUiController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLetterboxWallpaperBlurRadius() {
|
private int getLetterboxWallpaperBlurRadiusPx() {
|
||||||
int blurRadius = mLetterboxConfiguration.getLetterboxBackgroundWallpaperBlurRadius();
|
int blurRadius = mLetterboxConfiguration.getLetterboxBackgroundWallpaperBlurRadiusPx();
|
||||||
return blurRadius < 0 ? 0 : blurRadius;
|
return Math.max(blurRadius, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getLetterboxWallpaperDarkScrimAlpha() {
|
private float getLetterboxWallpaperDarkScrimAlpha() {
|
||||||
@@ -1535,7 +1535,7 @@ final class LetterboxUiController {
|
|||||||
pw.println(prefix + " letterboxBackgroundWallpaperDarkScrimAlpha="
|
pw.println(prefix + " letterboxBackgroundWallpaperDarkScrimAlpha="
|
||||||
+ getLetterboxWallpaperDarkScrimAlpha());
|
+ getLetterboxWallpaperDarkScrimAlpha());
|
||||||
pw.println(prefix + " letterboxBackgroundWallpaperBlurRadius="
|
pw.println(prefix + " letterboxBackgroundWallpaperBlurRadius="
|
||||||
+ getLetterboxWallpaperBlurRadius());
|
+ getLetterboxWallpaperBlurRadiusPx());
|
||||||
}
|
}
|
||||||
|
|
||||||
pw.println(prefix + " isHorizontalReachabilityEnabled="
|
pw.println(prefix + " isHorizontalReachabilityEnabled="
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import android.os.UserHandle;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.IWindow;
|
import android.view.IWindow;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
@@ -728,7 +729,7 @@ public class WindowManagerShellCommand extends ShellCommand {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
synchronized (mInternal.mGlobalLock) {
|
synchronized (mInternal.mGlobalLock) {
|
||||||
mLetterboxConfiguration.setLetterboxBackgroundType(backgroundType);
|
mLetterboxConfiguration.setLetterboxBackgroundTypeOverride(backgroundType);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -770,10 +771,10 @@ public class WindowManagerShellCommand extends ShellCommand {
|
|||||||
|
|
||||||
private int runSetLetterboxBackgroundWallpaperBlurRadius(PrintWriter pw)
|
private int runSetLetterboxBackgroundWallpaperBlurRadius(PrintWriter pw)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
final int radius;
|
final int radiusDp;
|
||||||
try {
|
try {
|
||||||
String arg = getNextArgRequired();
|
String arg = getNextArgRequired();
|
||||||
radius = Integer.parseInt(arg);
|
radiusDp = Integer.parseInt(arg);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
getErrPrintWriter().println("Error: blur radius format " + e);
|
getErrPrintWriter().println("Error: blur radius format " + e);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -783,7 +784,9 @@ public class WindowManagerShellCommand extends ShellCommand {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
synchronized (mInternal.mGlobalLock) {
|
synchronized (mInternal.mGlobalLock) {
|
||||||
mLetterboxConfiguration.setLetterboxBackgroundWallpaperBlurRadius(radius);
|
final int radiusPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||||
|
radiusDp, mInternal.mContext.getResources().getDisplayMetrics());
|
||||||
|
mLetterboxConfiguration.setLetterboxBackgroundWallpaperBlurRadiusPx(radiusPx);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1050,7 +1053,7 @@ public class WindowManagerShellCommand extends ShellCommand {
|
|||||||
mLetterboxConfiguration.resetLetterboxBackgroundColor();
|
mLetterboxConfiguration.resetLetterboxBackgroundColor();
|
||||||
break;
|
break;
|
||||||
case "wallpaperBlurRadius":
|
case "wallpaperBlurRadius":
|
||||||
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperBlurRadius();
|
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperBlurRadiusPx();
|
||||||
break;
|
break;
|
||||||
case "wallpaperDarkScrimAlpha":
|
case "wallpaperDarkScrimAlpha":
|
||||||
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperDarkScrimAlpha();
|
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperDarkScrimAlpha();
|
||||||
@@ -1188,7 +1191,7 @@ public class WindowManagerShellCommand extends ShellCommand {
|
|||||||
mLetterboxConfiguration.resetLetterboxActivityCornersRadius();
|
mLetterboxConfiguration.resetLetterboxActivityCornersRadius();
|
||||||
mLetterboxConfiguration.resetLetterboxBackgroundType();
|
mLetterboxConfiguration.resetLetterboxBackgroundType();
|
||||||
mLetterboxConfiguration.resetLetterboxBackgroundColor();
|
mLetterboxConfiguration.resetLetterboxBackgroundColor();
|
||||||
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperBlurRadius();
|
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperBlurRadiusPx();
|
||||||
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperDarkScrimAlpha();
|
mLetterboxConfiguration.resetLetterboxBackgroundWallpaperDarkScrimAlpha();
|
||||||
mLetterboxConfiguration.resetLetterboxHorizontalPositionMultiplier();
|
mLetterboxConfiguration.resetLetterboxHorizontalPositionMultiplier();
|
||||||
mLetterboxConfiguration.resetIsHorizontalReachabilityEnabled();
|
mLetterboxConfiguration.resetIsHorizontalReachabilityEnabled();
|
||||||
@@ -1262,7 +1265,7 @@ public class WindowManagerShellCommand extends ShellCommand {
|
|||||||
pw.println(" Background color: " + Integer.toHexString(
|
pw.println(" Background color: " + Integer.toHexString(
|
||||||
mLetterboxConfiguration.getLetterboxBackgroundColor().toArgb()));
|
mLetterboxConfiguration.getLetterboxBackgroundColor().toArgb()));
|
||||||
pw.println(" Wallpaper blur radius: "
|
pw.println(" Wallpaper blur radius: "
|
||||||
+ mLetterboxConfiguration.getLetterboxBackgroundWallpaperBlurRadius());
|
+ mLetterboxConfiguration.getLetterboxBackgroundWallpaperBlurRadiusPx());
|
||||||
pw.println(" Wallpaper dark scrim alpha: "
|
pw.println(" Wallpaper dark scrim alpha: "
|
||||||
+ mLetterboxConfiguration.getLetterboxBackgroundWallpaperDarkScrimAlpha());
|
+ mLetterboxConfiguration.getLetterboxBackgroundWallpaperDarkScrimAlpha());
|
||||||
pw.println("Is letterboxing for translucent activities enabled: "
|
pw.println("Is letterboxing for translucent activities enabled: "
|
||||||
|
|||||||
@@ -1028,7 +1028,7 @@ public class WindowManagerServiceTests extends WindowTestsBase {
|
|||||||
|
|
||||||
private boolean setupLetterboxConfigurationWithBackgroundType(
|
private boolean setupLetterboxConfigurationWithBackgroundType(
|
||||||
@LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType) {
|
@LetterboxConfiguration.LetterboxBackgroundType int letterboxBackgroundType) {
|
||||||
mWm.mLetterboxConfiguration.setLetterboxBackgroundType(letterboxBackgroundType);
|
mWm.mLetterboxConfiguration.setLetterboxBackgroundTypeOverride(letterboxBackgroundType);
|
||||||
return mWm.isLetterboxBackgroundMultiColored();
|
return mWm.isLetterboxBackgroundMultiColored();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user