summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/util/DisplayUtils.java54
-rw-r--r--core/java/android/view/DisplayCutout.java36
-rw-r--r--core/java/android/view/RoundedCorners.java174
-rw-r--r--core/java/com/android/internal/policy/ScreenDecorationsUtils.java23
-rw-r--r--core/res/res/values/config.xml52
-rw-r--r--core/res/res/values/dimens.xml8
-rw-r--r--core/res/res/values/symbols.xml15
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DropOutlineDrawable.java2
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt2
-rw-r--r--packages/SystemUI/res/drawable/rounded_corner_bottom_secondary.xml16
-rw-r--r--packages/SystemUI/res/drawable/rounded_corner_top_secondary.xml16
-rw-r--r--packages/SystemUI/res/drawable/rounded_secondary.xml24
-rw-r--r--packages/SystemUI/res/values/config.xml32
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/ScreenDecorations.java193
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java271
-rw-r--r--services/core/java/com/android/server/display/LocalDisplayAdapter.java5
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java2
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/display/LocalDisplayAdapterTest.java6
21 files changed, 687 insertions, 253 deletions
diff --git a/core/java/android/util/DisplayUtils.java b/core/java/android/util/DisplayUtils.java
new file mode 100644
index 000000000000..4fe7f8369f73
--- /dev/null
+++ b/core/java/android/util/DisplayUtils.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+package android.util;
+
+import android.content.res.Resources;
+
+import com.android.internal.R;
+
+/**
+ * Utils for loading resources for multi-display.
+ *
+ * @hide
+ */
+public class DisplayUtils {
+
+ /**
+ * Gets the index of the given display unique id in {@link R.array#config_displayUniqueIdArray}
+ * which is used to get the related cutout configs for that display.
+ *
+ * For multi-display device, {@link R.array#config_displayUniqueIdArray} should be set for each
+ * display if there are different type of cutouts on each display.
+ * For single display device, {@link R.array#config_displayUniqueIdArray} should not to be set
+ * and the system will load the default configs for main built-in display.
+ */
+ public static int getDisplayUniqueIdConfigIndex(Resources res, String displayUniqueId) {
+ int index = -1;
+ if (displayUniqueId == null || displayUniqueId.isEmpty()) {
+ return index;
+ }
+ final String[] ids = res.getStringArray(R.array.config_displayUniqueIdArray);
+ final int size = ids.length;
+ for (int i = 0; i < size; i++) {
+ if (displayUniqueId.equals(ids[i])) {
+ index = i;
+ break;
+ }
+ }
+ return index;
+ }
+}
diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java
index 0257e55073dc..c1a5636b7b34 100644
--- a/core/java/android/view/DisplayCutout.java
+++ b/core/java/android/view/DisplayCutout.java
@@ -39,6 +39,7 @@ import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
+import android.util.DisplayUtils;
import android.util.Pair;
import android.util.RotationUtils;
import android.util.proto.ProtoOutputStream;
@@ -874,38 +875,13 @@ public final class DisplayCutout {
}
/**
- * Gets the index of the given display unique id in {@link R.array#config_displayUniqueIdArray}
- * which is used to get the related cutout configs for that display.
- *
- * For multi-display device, {@link R.array#config_displayUniqueIdArray} should be set for each
- * display if there are different type of cutouts on each display.
- * For single display device, {@link R.array#config_displayUniqueIdArray} should not to be set
- * and the system will load the default configs for main built-in display.
- */
- private static int getDisplayCutoutConfigIndex(Resources res, String displayUniqueId) {
- int index = -1;
- if (displayUniqueId == null || displayUniqueId.isEmpty()) {
- return index;
- }
- final String[] ids = res.getStringArray(R.array.config_displayUniqueIdArray);
- final int size = ids.length;
- for (int i = 0; i < size; i++) {
- if (displayUniqueId.equals(ids[i])) {
- index = i;
- break;
- }
- }
- return index;
- }
-
- /**
* Gets the display cutout by the given display unique id.
*
* Loads the default config {@link R.string#config_mainBuiltInDisplayCutout) if
* {@link R.array#config_displayUniqueIdArray} is not set.
*/
private static String getDisplayCutoutPath(Resources res, String displayUniqueId) {
- final int index = getDisplayCutoutConfigIndex(res, displayUniqueId);
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
final String[] array = res.getStringArray(R.array.config_displayCutoutPathArray);
if (index >= 0 && index < array.length) {
return array[index];
@@ -920,7 +896,7 @@ public final class DisplayCutout {
* {@link R.array#config_displayUniqueIdArray} is not set.
*/
private static String getDisplayCutoutApproximationRect(Resources res, String displayUniqueId) {
- final int index = getDisplayCutoutConfigIndex(res, displayUniqueId);
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
final String[] array = res.getStringArray(
R.array.config_displayCutoutApproximationRectArray);
if (index >= 0 && index < array.length) {
@@ -939,7 +915,7 @@ public final class DisplayCutout {
* @hide
*/
public static boolean getMaskBuiltInDisplayCutout(Resources res, String displayUniqueId) {
- final int index = getDisplayCutoutConfigIndex(res, displayUniqueId);
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
final TypedArray array = res.obtainTypedArray(R.array.config_maskBuiltInDisplayCutoutArray);
boolean maskCutout;
if (index >= 0 && index < array.length()) {
@@ -961,7 +937,7 @@ public final class DisplayCutout {
* @hide
*/
public static boolean getFillBuiltInDisplayCutout(Resources res, String displayUniqueId) {
- final int index = getDisplayCutoutConfigIndex(res, displayUniqueId);
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
final TypedArray array = res.obtainTypedArray(R.array.config_fillBuiltInDisplayCutoutArray);
boolean fillCutout;
if (index >= 0 && index < array.length()) {
@@ -984,7 +960,7 @@ public final class DisplayCutout {
*/
private static Insets getWaterfallInsets(Resources res, String displayUniqueId) {
Insets insets;
- final int index = getDisplayCutoutConfigIndex(res, displayUniqueId);
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
final TypedArray array = res.obtainTypedArray(R.array.config_waterfallCutoutArray);
if (index >= 0 && index < array.length() && array.getResourceId(index, 0) > 0) {
final int resourceId = array.getResourceId(index, 0);
diff --git a/core/java/android/view/RoundedCorners.java b/core/java/android/view/RoundedCorners.java
index 623d9692ac80..6079d8e3f118 100644
--- a/core/java/android/view/RoundedCorners.java
+++ b/core/java/android/view/RoundedCorners.java
@@ -27,9 +27,11 @@ import static android.view.Surface.ROTATION_90;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Point;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.DisplayUtils;
import android.util.Pair;
import android.view.RoundedCorner.Position;
@@ -94,8 +96,8 @@ public class RoundedCorners implements Parcelable {
* @android:dimen/rounded_corner_radius_top and @android:dimen/rounded_corner_radius_bottom
*/
public static RoundedCorners fromResources(
- Resources res, int displayWidth, int displayHeight) {
- return fromRadii(loadRoundedCornerRadii(res), displayWidth, displayHeight);
+ Resources res, String displayUniqueId, int displayWidth, int displayHeight) {
+ return fromRadii(loadRoundedCornerRadii(res, displayUniqueId), displayWidth, displayHeight);
}
/**
@@ -140,14 +142,16 @@ public class RoundedCorners implements Parcelable {
* Loads the rounded corner radii from resources.
*
* @param res
+ * @param displayUniqueId the display unique id.
* @return a Pair of radius. The first is the top rounded corner radius and second is the
* bottom corner radius.
*/
@Nullable
- private static Pair<Integer, Integer> loadRoundedCornerRadii(Resources res) {
- final int radiusDefault = res.getDimensionPixelSize(R.dimen.rounded_corner_radius);
- final int radiusTop = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_top);
- final int radiusBottom = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_bottom);
+ private static Pair<Integer, Integer> loadRoundedCornerRadii(
+ Resources res, String displayUniqueId) {
+ final int radiusDefault = getRoundedCornerRadius(res, displayUniqueId);
+ final int radiusTop = getRoundedCornerTopRadius(res, displayUniqueId);
+ final int radiusBottom = getRoundedCornerBottomRadius(res, displayUniqueId);
if (radiusDefault == 0 && radiusTop == 0 && radiusBottom == 0) {
return null;
}
@@ -158,6 +162,164 @@ public class RoundedCorners implements Parcelable {
}
/**
+ * Gets the default rounded corner radius of a display which is determined by the
+ * given display unique id.
+ *
+ * Loads the default dimen{@link R.dimen#rounded_corner_radius} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static int getRoundedCornerRadius(Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(R.array.config_roundedCornerRadiusArray);
+ int radius;
+ if (index >= 0 && index < array.length()) {
+ radius = array.getDimensionPixelSize(index, 0);
+ } else {
+ radius = res.getDimensionPixelSize(R.dimen.rounded_corner_radius);
+ }
+ array.recycle();
+ return radius;
+ }
+
+ /**
+ * Gets the top rounded corner radius of a display which is determined by the
+ * given display unique id.
+ *
+ * Loads the default dimen{@link R.dimen#rounded_corner_radius_top} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static int getRoundedCornerTopRadius(Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(R.array.config_roundedCornerTopRadiusArray);
+ int radius;
+ if (index >= 0 && index < array.length()) {
+ radius = array.getDimensionPixelSize(index, 0);
+ } else {
+ radius = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_top);
+ }
+ array.recycle();
+ return radius;
+ }
+
+ /**
+ * Gets the bottom rounded corner radius of a display which is determined by the
+ * given display unique id.
+ *
+ * Loads the default dimen{@link R.dimen#rounded_corner_radius_bottom} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static int getRoundedCornerBottomRadius(Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(
+ R.array.config_roundedCornerBottomRadiusArray);
+ int radius;
+ if (index >= 0 && index < array.length()) {
+ radius = array.getDimensionPixelSize(index, 0);
+ } else {
+ radius = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_bottom);
+ }
+ array.recycle();
+ return radius;
+ }
+
+ /**
+ * Gets the rounded corner radius adjustment of a display which is determined by the
+ * given display unique id.
+ *
+ * Loads the default dimen{@link R.dimen#rounded_corner_radius_adjustment} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static int getRoundedCornerRadiusAdjustment(Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(
+ R.array.config_roundedCornerRadiusAdjustmentArray);
+ int radius;
+ if (index >= 0 && index < array.length()) {
+ radius = array.getDimensionPixelSize(index, 0);
+ } else {
+ radius = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_adjustment);
+ }
+ array.recycle();
+ return radius;
+ }
+
+ /**
+ * Gets the rounded corner top radius adjustment of a display which is determined by the
+ * given display unique id.
+ *
+ * Loads the default dimen{@link R.dimen#rounded_corner_radius_top_adjustment} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static int getRoundedCornerRadiusTopAdjustment(Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(
+ R.array.config_roundedCornerTopRadiusAdjustmentArray);
+ int radius;
+ if (index >= 0 && index < array.length()) {
+ radius = array.getDimensionPixelSize(index, 0);
+ } else {
+ radius = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_top_adjustment);
+ }
+ array.recycle();
+ return radius;
+ }
+
+ /**
+ * Gets the rounded corner bottom radius adjustment of a display which is determined by the
+ * given display unique id.
+ *
+ * Loads the default dimen{@link R.dimen#rounded_corner_radius_bottom_adjustment} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static int getRoundedCornerRadiusBottomAdjustment(
+ Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(
+ R.array.config_roundedCornerBottomRadiusAdjustmentArray);
+ int radius;
+ if (index >= 0 && index < array.length()) {
+ radius = array.getDimensionPixelSize(index, 0);
+ } else {
+ radius = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_bottom_adjustment);
+ }
+ array.recycle();
+ return radius;
+ }
+
+ /**
+ * Gets whether a built-in display is round.
+ *
+ * Loads the default config{@link R.bool#config_mainBuiltInDisplayIsRound} if
+ * {@link R.array#config_displayUniqueIdArray} is not set.
+ *
+ * @hide
+ */
+ public static boolean getBuiltInDisplayIsRound(Resources res, String displayUniqueId) {
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(R.array.config_builtInDisplayIsRoundArray);
+ boolean isRound;
+ if (index >= 0 && index < array.length()) {
+ isRound = array.getBoolean(index, false);
+ } else {
+ isRound = res.getBoolean(R.bool.config_mainBuiltInDisplayIsRound);
+ }
+ array.recycle();
+ return isRound;
+ }
+
+ /**
* Insets the reference frame of the rounded corners.
*
* @return a copy of this instance which has been inset
diff --git a/core/java/com/android/internal/policy/ScreenDecorationsUtils.java b/core/java/com/android/internal/policy/ScreenDecorationsUtils.java
index 52172cf04362..ec6283922807 100644
--- a/core/java/com/android/internal/policy/ScreenDecorationsUtils.java
+++ b/core/java/com/android/internal/policy/ScreenDecorationsUtils.java
@@ -16,7 +16,9 @@
package com.android.internal.policy;
+import android.content.Context;
import android.content.res.Resources;
+import android.view.RoundedCorners;
import com.android.internal.R;
@@ -29,23 +31,28 @@ public class ScreenDecorationsUtils {
* Corner radius that should be used on windows in order to cover the display.
* These values are expressed in pixels because they should not respect display or font
* scaling, this means that we don't have to reload them on config changes.
+ *
+ * Note that if the context is not an UI context(not associated with Display), it will use
+ * default display.
*/
- public static float getWindowCornerRadius(Resources resources) {
+ public static float getWindowCornerRadius(Context context) {
+ final Resources resources = context.getResources();
if (!supportsRoundedCornersOnWindows(resources)) {
return 0f;
}
-
+ // Use Context#getDisplayNoVerify() in case the context is not an UI context.
+ final String displayUniqueId = context.getDisplayNoVerify().getUniqueId();
// Radius that should be used in case top or bottom aren't defined.
- float defaultRadius = resources.getDimension(R.dimen.rounded_corner_radius)
- - resources.getDimension(R.dimen.rounded_corner_radius_adjustment);
+ float defaultRadius = RoundedCorners.getRoundedCornerRadius(resources, displayUniqueId)
+ - RoundedCorners.getRoundedCornerRadiusAdjustment(resources, displayUniqueId);
- float topRadius = resources.getDimension(R.dimen.rounded_corner_radius_top)
- - resources.getDimension(R.dimen.rounded_corner_radius_top_adjustment);
+ float topRadius = RoundedCorners.getRoundedCornerTopRadius(resources, displayUniqueId)
+ - RoundedCorners.getRoundedCornerRadiusTopAdjustment(resources, displayUniqueId);
if (topRadius == 0f) {
topRadius = defaultRadius;
}
- float bottomRadius = resources.getDimension(R.dimen.rounded_corner_radius_bottom)
- - resources.getDimension(R.dimen.rounded_corner_radius_bottom_adjustment);
+ float bottomRadius = RoundedCorners.getRoundedCornerBottomRadius(resources, displayUniqueId)
+ - RoundedCorners.getRoundedCornerRadiusBottomAdjustment(resources, displayUniqueId);
if (bottomRadius == 0f) {
bottomRadius = defaultRadius;
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 62a7f2a488d8..797ff867e00c 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -5095,6 +5095,14 @@
- config_fillBuiltInDisplayCutoutArray
- config_maskBuiltInDisplayCutoutArray
- config_waterfallCutoutArray
+ - config_roundedCornerRadiusArray
+ - config_roundedCornerTopRadiusArray
+ - config_roundedCornerBottomRadiusArray
+ - config_builtInDisplayIsRoundArray (config in SystemUI resource)
+ - config_roundedCornerMultipleRadiusArray (config in SystemUI resource)
+ - config_roundedCornerDrawableArray (config in SystemUI resource)
+ - config_roundedCornerTopDrawableArray (config in SystemUI resource)
+ - config_roundedCornerBottomDrawableArray (config in SystemUI resource)
Leave this array empty for single display device and the system will load the default main
built-in related configs.
@@ -5156,4 +5164,48 @@
This flag should be enabled only when the product does not have any UI to toggle airplane
mode like automotive devices.-->
<bool name="config_autoResetAirplaneMode">false</bool>
+
+ <bool name="config_secondaryBuiltInDisplayIsRound">@bool/config_windowIsRound</bool>
+
+ <!-- The display round config for each display in a multi-display device. -->
+ <array name="config_builtInDisplayIsRoundArray" translatable="false">
+ <item>@bool/config_mainBuiltInDisplayIsRound</item>
+ <item>@bool/config_secondaryBuiltInDisplayIsRound</item>
+ </array>
+
+ <!-- The rounded corner radius for each display in a multi-display device. -->
+ <array name="config_roundedCornerRadiusArray" translatable="false">
+ <item>@dimen/rounded_corner_radius</item>
+ <item>@dimen/secondary_rounded_corner_radius</item>
+ </array>
+
+ <!-- The top rounded corner radius for each display in a multi-display device. -->
+ <array name="config_roundedCornerTopRadiusArray" translatable="false">
+ <item>@dimen/rounded_corner_radius_top</item>
+ <item>@dimen/secondary_rounded_corner_radius_top</item>
+ </array>
+
+ <!-- The bottom rounded corner radius for each display in a multi-display device. -->
+ <array name="config_roundedCornerBottomRadiusArray" translatable="false">
+ <item>@dimen/rounded_corner_radius_bottom</item>
+ <item>@dimen/secondary_rounded_corner_radius_bottom</item>
+ </array>
+
+ <!-- The rounded corner radius adjustment for each display in a multi-display device. -->
+ <array name="config_roundedCornerRadiusAdjustmentArray" translatable="false">
+ <item>@dimen/rounded_corner_radius_adjustment</item>
+ <item>@dimen/secondary_rounded_corner_radius_adjustment</item>
+ </array>
+
+ <!-- The rounded corner radius top adjustment for each display in a multi-display device. -->
+ <array name="config_roundedCornerTopRadiusAdjustmentArray" translatable="false">
+ <item>@dimen/rounded_corner_radius_top_adjustment</item>
+ <item>@dimen/secondary_rounded_corner_radius_top_adjustment</item>
+ </array>
+
+ <!-- The rounded corner radius bottom adjustment for each display in a multi-display device. -->
+ <array name="config_roundedCornerBottomRadiusAdjustmentArray" translatable="false">
+ <item>@dimen/rounded_corner_radius_bottom_adjustment</item>
+ <item>@dimen/secondary_rounded_corner_radius_bottom_adjustment</item>
+ </array>
</resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index e8bb6067932e..618214be15a7 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -952,4 +952,12 @@
<dimen name="secondary_waterfall_display_top_edge_size">0px</dimen>
<dimen name="secondary_waterfall_display_right_edge_size">0px</dimen>
<dimen name="secondary_waterfall_display_bottom_edge_size">0px</dimen>
+
+ <!-- Rounded corner settings for secondary built-in display -->
+ <dimen name="secondary_rounded_corner_radius">0px</dimen>
+ <dimen name="secondary_rounded_corner_radius_top">0px</dimen>
+ <dimen name="secondary_rounded_corner_radius_bottom">0px</dimen>
+ <dimen name="secondary_rounded_corner_radius_adjustment">0px</dimen>
+ <dimen name="secondary_rounded_corner_radius_top_adjustment">0px</dimen>
+ <dimen name="secondary_rounded_corner_radius_bottom_adjustment">0px</dimen>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 81d4f9e1fed7..ec0e02b150eb 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -4452,4 +4452,19 @@
<java-symbol type="array" name="config_mainBuiltInDisplayWaterfallCutout" />
<java-symbol type="array" name="config_secondaryBuiltInDisplayWaterfallCutout" />
<java-symbol type="array" name="config_waterfallCutoutArray" />
+
+ <java-symbol type="dimen" name="secondary_rounded_corner_radius" />
+ <java-symbol type="dimen" name="secondary_rounded_corner_radius_top" />
+ <java-symbol type="dimen" name="secondary_rounded_corner_radius_bottom" />
+ <java-symbol type="dimen" name="secondary_rounded_corner_radius_adjustment" />
+ <java-symbol type="dimen" name="secondary_rounded_corner_radius_top_adjustment" />
+ <java-symbol type="dimen" name="secondary_rounded_corner_radius_bottom_adjustment" />
+ <java-symbol type="array" name="config_roundedCornerRadiusArray" />
+ <java-symbol type="array" name="config_roundedCornerTopRadiusArray" />
+ <java-symbol type="array" name="config_roundedCornerBottomRadiusArray" />
+ <java-symbol type="array" name="config_roundedCornerRadiusAdjustmentArray" />
+ <java-symbol type="array" name="config_roundedCornerTopRadiusAdjustmentArray" />
+ <java-symbol type="array" name="config_roundedCornerBottomRadiusAdjustmentArray" />
+ <java-symbol type="bool" name="config_secondaryBuiltInDisplayIsRound" />
+ <java-symbol type="array" name="config_builtInDisplayIsRoundArray" />
</resources>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DropOutlineDrawable.java b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DropOutlineDrawable.java
index 64f7be5be813..73deea54e52f 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DropOutlineDrawable.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DropOutlineDrawable.java
@@ -86,7 +86,7 @@ public class DropOutlineDrawable extends Drawable {
public DropOutlineDrawable(Context context) {
super();
// TODO(b/169894807): Use corner specific radii and maybe lower radius for non-edge corners
- mCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(context.getResources());
+ mCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(context);
mColor = context.getColor(R.color.drop_outline_background);
mMaxAlpha = Color.alpha(mColor);
// Initialize as hidden
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt
index 3cbe435026b5..9c1e12923b43 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt
@@ -482,7 +482,7 @@ class ActivityLaunchAnimator(
val endRadius = if (isExpandingFullyAbove) {
// Most of the time, expanding fully above the root view means expanding in full
// screen.
- ScreenDecorationsUtils.getWindowCornerRadius(context.resources)
+ ScreenDecorationsUtils.getWindowCornerRadius(context)
} else {
// This usually means we are in split screen mode, so 2 out of 4 corners will have
// a radius of 0.
diff --git a/packages/SystemUI/res/drawable/rounded_corner_bottom_secondary.xml b/packages/SystemUI/res/drawable/rounded_corner_bottom_secondary.xml
new file mode 100644
index 000000000000..5cc8d6ae470e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/rounded_corner_bottom_secondary.xml
@@ -0,0 +1,16 @@
+<!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ 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.
+-->
+<!-- Overlay this resource to change rounded_corners_bottom -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/rounded_secondary"/>
diff --git a/packages/SystemUI/res/drawable/rounded_corner_top_secondary.xml b/packages/SystemUI/res/drawable/rounded_corner_top_secondary.xml
new file mode 100644
index 000000000000..724e3ef40d43
--- /dev/null
+++ b/packages/SystemUI/res/drawable/rounded_corner_top_secondary.xml
@@ -0,0 +1,16 @@
+<!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ 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.
+-->
+<!-- Overlay this resource to change rounded_corners_top -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/rounded_secondary"/>
diff --git a/packages/SystemUI/res/drawable/rounded_secondary.xml b/packages/SystemUI/res/drawable/rounded_secondary.xml
new file mode 100644
index 000000000000..eb72fa16cb6d
--- /dev/null
+++ b/packages/SystemUI/res/drawable/rounded_secondary.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="8dp"
+ android:height="8dp"
+ android:viewportWidth="8"
+ android:viewportHeight="8">
+
+ <path
+ android:fillColor="#000000"
+ android:pathData="M8,0H0v8C0,3.6,3.6,0,8,0z" />
+
+</vector>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 9f2938e826e5..37cc42ee4b73 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -679,4 +679,36 @@
<!-- Flag to activate notification to contents feature -->
<bool name="config_notificationToContents">false</bool>
+
+ <!-- Respect drawable/rounded_secondary.xml intrinsic size for multiple radius corner path
+ customization for secondary display-->
+ <bool name="config_roundedCornerMultipleRadiusSecondary">false</bool>
+
+ <!-- Whether the rounded corners are multiple radius for each display in a multi-display device.
+ {@see com.android.internal.R.array#config_displayUniqueIdArray} -->
+ <array name="config_roundedCornerMultipleRadiusArray">
+ <item>@bool/config_roundedCornerMultipleRadius</item>
+ <item>@bool/config_roundedCornerMultipleRadiusSecondary</item>
+ </array>
+
+ <!-- The rounded corner drawable for each display in a multi-display device.
+ {@see com.android.internal.R.array#config_displayUniqueIdArray} -->
+ <array name="config_roundedCornerDrawableArray">
+ <item>@drawable/rounded</item>
+ <item>@drawable/rounded_secondary</item>
+ </array>
+
+ <!-- The top rounded corner drawable for each display in a multi-display device.
+ {@see com.android.internal.R.array#config_displayUniqueIdArray} -->
+ <array name="config_roundedCornerTopDrawableArray">
+ <item>@drawable/rounded_corner_top</item>
+ <item>@drawable/rounded_corner_top_secondary</item>
+ </array>
+
+ <!-- The bottom rounded corner drawable for each display in a multi-display device.
+ {@see com.android.internal.R.array#config_displayUniqueIdArray} -->
+ <array name="config_roundedCornerBottomDrawableArray">
+ <item>@drawable/rounded_corner_bottom</item>
+ <item>@drawable/rounded_corner_bottom_secondary</item>
+ </array>
</resources>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
index b827356e952c..196e6f335b14 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
@@ -285,8 +285,8 @@ public class QuickStepContract {
* These values are expressed in pixels because they should not respect display or font
* scaling, this means that we don't have to reload them on config changes.
*/
- public static float getWindowCornerRadius(Resources resources) {
- return ScreenDecorationsUtils.getWindowCornerRadius(resources);
+ public static float getWindowCornerRadius(Context context) {
+ return ScreenDecorationsUtils.getWindowCornerRadius(context);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index f653088e552a..b9ade0205154 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -42,6 +42,7 @@ import android.content.IntentFilter;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
@@ -59,6 +60,7 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings.Secure;
import android.util.DisplayMetrics;
+import android.util.DisplayUtils;
import android.util.Log;
import android.view.Display;
import android.view.DisplayCutout;
@@ -66,6 +68,7 @@ import android.view.DisplayCutout.BoundsPosition;
import android.view.DisplayInfo;
import android.view.Gravity;
import android.view.LayoutInflater;
+import android.view.RoundedCorners;
import android.view.Surface;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
@@ -159,6 +162,10 @@ public class ScreenDecorations extends SystemUI implements Tunable {
private boolean mIsRoundedCornerMultipleRadius;
private int mStatusBarHeightPortrait;
private int mStatusBarHeightLandscape;
+ private Drawable mRoundedCornerDrawable;
+ private Drawable mRoundedCornerDrawableTop;
+ private Drawable mRoundedCornerDrawableBottom;
+ private String mDisplayUniqueId;
private CameraAvailabilityListener.CameraTransitionCallback mCameraTransitionCallback =
new CameraAvailabilityListener.CameraTransitionCallback() {
@@ -244,10 +251,11 @@ public class ScreenDecorations extends SystemUI implements Tunable {
private void startOnScreenDecorationsThread() {
mRotation = mContext.getDisplay().getRotation();
+ mDisplayUniqueId = mContext.getDisplay().getUniqueId();
+ mIsRoundedCornerMultipleRadius = isRoundedCornerMultipleRadius(mContext, mDisplayUniqueId);
mWindowManager = mContext.getSystemService(WindowManager.class);
mDisplayManager = mContext.getSystemService(DisplayManager.class);
- mIsRoundedCornerMultipleRadius = mContext.getResources().getBoolean(
- R.bool.config_roundedCornerMultipleRadius);
+ updateRoundedCornerDrawable();
updateRoundedCornerRadii();
setupDecorations();
setupCameraListener();
@@ -287,6 +295,14 @@ public class ScreenDecorations extends SystemUI implements Tunable {
}
}
}
+ final String newUniqueId = mContext.getDisplay().getUniqueId();
+ if ((newUniqueId != null && !newUniqueId.equals(mDisplayUniqueId))
+ || (mDisplayUniqueId != null && !mDisplayUniqueId.equals(newUniqueId))) {
+ mDisplayUniqueId = newUniqueId;
+ mIsRoundedCornerMultipleRadius =
+ isRoundedCornerMultipleRadius(mContext, mDisplayUniqueId);
+ updateRoundedCornerDrawable();
+ }
updateOrientation();
}
};
@@ -474,6 +490,7 @@ public class ScreenDecorations extends SystemUI implements Tunable {
updateRoundedCornerView(pos, R.id.left);
updateRoundedCornerView(pos, R.id.right);
updateRoundedCornerSize(mRoundedDefault, mRoundedDefaultTop, mRoundedDefaultBottom);
+ updateRoundedCornerImageView();
// update cutout view rotation
if (mCutoutViews != null && mCutoutViews[pos] != null) {
@@ -677,27 +694,26 @@ public class ScreenDecorations extends SystemUI implements Tunable {
// upgrading all of the configs to contain (width, height) pairs. Instead assume that a
// device configured using the single integer config value is okay with drawing the corners
// as a square
- final int newRoundedDefault = mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.rounded_corner_radius);
- final int newRoundedDefaultTop = mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.rounded_corner_radius_top);
- final int newRoundedDefaultBottom = mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.rounded_corner_radius_bottom);
+ final int newRoundedDefault = RoundedCorners.getRoundedCornerRadius(
+ mContext.getResources(), mDisplayUniqueId);
+ final int newRoundedDefaultTop = RoundedCorners.getRoundedCornerTopRadius(
+ mContext.getResources(), mDisplayUniqueId);
+ final int newRoundedDefaultBottom = RoundedCorners.getRoundedCornerBottomRadius(
+ mContext.getResources(), mDisplayUniqueId);
final boolean changed = mRoundedDefault.x != newRoundedDefault
|| mRoundedDefaultTop.x != newRoundedDefaultTop
|| mRoundedDefaultBottom.x != newRoundedDefaultBottom;
-
if (changed) {
// If config_roundedCornerMultipleRadius set as true, ScreenDecorations respect the
// (width, height) size of drawable/rounded.xml instead of rounded_corner_radius
if (mIsRoundedCornerMultipleRadius) {
- Drawable d = mContext.getDrawable(R.drawable.rounded);
- mRoundedDefault.set(d.getIntrinsicWidth(), d.getIntrinsicHeight());
- d = mContext.getDrawable(R.drawable.rounded_corner_top);
- mRoundedDefaultTop.set(d.getIntrinsicWidth(), d.getIntrinsicHeight());
- d = mContext.getDrawable(R.drawable.rounded_corner_bottom);
- mRoundedDefaultBottom.set(d.getIntrinsicWidth(), d.getIntrinsicHeight());
+ mRoundedDefault.set(mRoundedCornerDrawable.getIntrinsicWidth(),
+ mRoundedCornerDrawable.getIntrinsicHeight());
+ mRoundedDefaultTop.set(mRoundedCornerDrawableTop.getIntrinsicWidth(),
+ mRoundedCornerDrawableTop.getIntrinsicHeight());
+ mRoundedDefaultBottom.set(mRoundedCornerDrawableBottom.getIntrinsicWidth(),
+ mRoundedCornerDrawableBottom.getIntrinsicHeight());
} else {
mRoundedDefault.set(newRoundedDefault, newRoundedDefault);
mRoundedDefaultTop.set(newRoundedDefaultTop, newRoundedDefaultTop);
@@ -707,6 +723,89 @@ public class ScreenDecorations extends SystemUI implements Tunable {
}
}
+ /**
+ * Gets whether the rounded corners are multiple radii for current display.
+ *
+ * Loads the default config {@link R.bool#config_roundedCornerMultipleRadius} if
+ * {@link com.android.internal.R.array#config_displayUniqueIdArray} is not set.
+ */
+ private static boolean isRoundedCornerMultipleRadius(Context context, String displayUniqueId) {
+ final Resources res = context.getResources();
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(
+ R.array.config_roundedCornerMultipleRadiusArray);
+ boolean isMultipleRadius;
+ if (index >= 0 && index < array.length()) {
+ isMultipleRadius = array.getBoolean(index, false);
+ } else {
+ isMultipleRadius = res.getBoolean(R.bool.config_roundedCornerMultipleRadius);
+ }
+ array.recycle();
+ return isMultipleRadius;
+ }
+
+ /**
+ * Gets the rounded corner drawable for current display.
+ *
+ * Loads the default config {@link R.drawable#rounded} if
+ * {@link com.android.internal.R.array#config_displayUniqueIdArray} is not set.
+ */
+ private static Drawable getRoundedCornerDrawable(Context context, String displayUniqueId) {
+ final Resources res = context.getResources();
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(R.array.config_roundedCornerDrawableArray);
+ Drawable drawable;
+ if (index >= 0 && index < array.length()) {
+ drawable = array.getDrawable(index);
+ } else {
+ drawable = context.getDrawable(R.drawable.rounded);
+ }
+ array.recycle();
+ return drawable;
+ }
+
+ /**
+ * Gets the rounded corner top drawable for current display.
+ *
+ * Loads the default config {@link R.drawable#rounded_corner_top} if
+ * {@link com.android.internal.R.array#config_displayUniqueIdArray} is not set.
+ */
+ private static Drawable getRoundedCornerTopDrawable(Context context, String displayUniqueId) {
+ final Resources res = context.getResources();
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(R.array.config_roundedCornerTopDrawableArray);
+ Drawable drawable;
+ if (index >= 0 && index < array.length()) {
+ drawable = array.getDrawable(index);
+ } else {
+ drawable = context.getDrawable(R.drawable.rounded_corner_top);
+ }
+ array.recycle();
+ return drawable;
+ }
+
+ /**
+ * Gets the rounded corner bottom drawable for current display.
+ *
+ * Loads the default config {@link R.drawable#rounded_corner_bottom} if
+ * {@link com.android.internal.R.array#config_displayUniqueIdArray} is not set.
+ */
+ private static Drawable getRoundedCornerBottomDrawable(
+ Context context, String displayUniqueId) {
+ final Resources res = context.getResources();
+ final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
+ final TypedArray array = res.obtainTypedArray(
+ R.array.config_roundedCornerBottomDrawableArray);
+ Drawable drawable;
+ if (index >= 0 && index < array.length()) {
+ drawable = array.getDrawable(index);
+ } else {
+ drawable = context.getDrawable(R.drawable.rounded_corner_bottom);
+ }
+ array.recycle();
+ return drawable;
+ }
+
private void updateRoundedCornerView(@BoundsPosition int pos, int id) {
final View rounded = mOverlays[pos].findViewById(id);
if (rounded == null) {
@@ -837,6 +936,51 @@ public class ScreenDecorations extends SystemUI implements Tunable {
});
}
+ private void updateRoundedCornerDrawable() {
+ mRoundedCornerDrawable = getRoundedCornerDrawable(mContext, mDisplayUniqueId);
+ mRoundedCornerDrawableTop = getRoundedCornerTopDrawable(mContext, mDisplayUniqueId);
+ mRoundedCornerDrawableBottom = getRoundedCornerBottomDrawable(mContext, mDisplayUniqueId);
+ updateRoundedCornerImageView();
+ }
+
+ private void updateRoundedCornerImageView() {
+ final Drawable top = mRoundedCornerDrawableTop != null
+ ? mRoundedCornerDrawableTop : mRoundedCornerDrawable;
+ final Drawable bottom = mRoundedCornerDrawableBottom != null
+ ? mRoundedCornerDrawableBottom : mRoundedCornerDrawable;
+
+ if (mOverlays == null) {
+ return;
+ }
+ for (int i = 0; i < BOUNDS_POSITION_LENGTH; i++) {
+ if (mOverlays[i] == null) {
+ continue;
+ }
+ ((ImageView) mOverlays[i].findViewById(R.id.left)).setImageDrawable(
+ isTopRoundedCorner(i, R.id.left) ? top : bottom);
+ ((ImageView) mOverlays[i].findViewById(R.id.right)).setImageDrawable(
+ isTopRoundedCorner(i, R.id.right) ? top : bottom);
+ }
+ }
+
+ private boolean isTopRoundedCorner(@BoundsPosition int pos, int id) {
+ switch (pos) {
+ case BOUNDS_POSITION_LEFT:
+ case BOUNDS_POSITION_RIGHT:
+ if (mRotation == ROTATION_270) {
+ return id == R.id.left ? false : true;
+ } else {
+ return id == R.id.left ? true : false;
+ }
+ case BOUNDS_POSITION_TOP:
+ return true;
+ case BOUNDS_POSITION_BOTTOM:
+ return false;
+ default:
+ throw new IllegalArgumentException("Unknown bounds position");
+ }
+ }
+
private void updateRoundedCornerSize(
Point sizeDefault,
Point sizeTop,
@@ -855,21 +999,10 @@ public class ScreenDecorations extends SystemUI implements Tunable {
if (mOverlays[i] == null) {
continue;
}
- if (i == BOUNDS_POSITION_LEFT || i == BOUNDS_POSITION_RIGHT) {
- if (mRotation == ROTATION_270) {
- setSize(mOverlays[i].findViewById(R.id.left), sizeBottom);
- setSize(mOverlays[i].findViewById(R.id.right), sizeTop);
- } else {
- setSize(mOverlays[i].findViewById(R.id.left), sizeTop);
- setSize(mOverlays[i].findViewById(R.id.right), sizeBottom);
- }
- } else if (i == BOUNDS_POSITION_TOP) {
- setSize(mOverlays[i].findViewById(R.id.left), sizeTop);
- setSize(mOverlays[i].findViewById(R.id.right), sizeTop);
- } else if (i == BOUNDS_POSITION_BOTTOM) {
- setSize(mOverlays[i].findViewById(R.id.left), sizeBottom);
- setSize(mOverlays[i].findViewById(R.id.right), sizeBottom);
- }
+ setSize(mOverlays[i].findViewById(R.id.left),
+ isTopRoundedCorner(i, R.id.left) ? sizeTop : sizeBottom);
+ setSize(mOverlays[i].findViewById(R.id.right),
+ isTopRoundedCorner(i, R.id.right) ? sizeTop : sizeBottom);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 50b1186c91f1..4584b6db9340 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -547,7 +547,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
com.android.internal.R.string.config_recentsComponentName));
mQuickStepIntent = new Intent(ACTION_QUICKSTEP)
.setPackage(mRecentsComponentName.getPackageName());
- mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources());
+ mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(mContext);
mSupportsRoundedCornersOnWindows = ScreenDecorationsUtils
.supportsRoundedCornersOnWindows(mContext.getResources());
mSysUiState = sysUiState;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 4e1e61dc030a..51d531ba5672 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -902,7 +902,8 @@ public class NotificationPanelViewController extends PanelViewController {
R.dimen.pulse_expansion_max_top_overshoot);
mScrimCornerRadius = mResources.getDimensionPixelSize(
R.dimen.notification_scrim_corner_radius);
- mScreenCornerRadius = (int) ScreenDecorationsUtils.getWindowCornerRadius(mResources);
+ mScreenCornerRadius = (int) ScreenDecorationsUtils.getWindowCornerRadius(
+ mView.getContext());
mLockscreenNotificationQSPadding = mResources.getDimensionPixelSize(
R.dimen.notification_side_paddings);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
index ed5cbe20aa11..afbd2f2929aa 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
@@ -43,6 +43,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.res.Configuration;
+import android.content.res.TypedArray;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
@@ -60,7 +61,6 @@ import android.view.WindowMetrics;
import androidx.test.filters.SmallTest;
-import com.android.systemui.R.dimen;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.events.PrivacyDotViewController;
@@ -100,6 +100,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
private UserTracker mUserTracker;
@Mock
private PrivacyDotViewController mDotViewController;
+ @Mock
+ private TypedArray mMockTypedArray;
@Before
public void setup() {
@@ -121,6 +123,7 @@ public class ScreenDecorationsTest extends SysuiTestCase {
.getDisplay(DEFAULT_DISPLAY);
when(mDisplayManager.getDisplay(anyInt())).thenReturn(display);
mContext.addMockSystemService(DisplayManager.class, mDisplayManager);
+ when(mMockTypedArray.length()).thenReturn(0);
mScreenDecorations = spy(new ScreenDecorations(mContext, mExecutor, mSecureSettings,
mBroadcastDispatcher, mTunerService, mUserTracker, mDotViewController,
@@ -148,18 +151,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testNoRounding_NoCutout() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
// no cutout
doReturn(null).when(mScreenDecorations).getCutout();
@@ -173,14 +167,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testRounding_NoCutout() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 20 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
// no cutout
doReturn(null).when(mScreenDecorations).getCutout();
@@ -203,19 +192,10 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testRoundingRadius_NoCutout() {
- final int testRadius = 1;
final Point testRadiusPoint = new Point(1, 1);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, testRadius);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, testRadius);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, testRadius);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
-
+ setupResources(1 /* radius */, 1 /* radiusTop */, 1 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
// no cutout
doReturn(null).when(mScreenDecorations).getCutout();
@@ -230,16 +210,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
public void testRoundingTopBottomRadius_OnTopBottomOverlay() {
final int testTopRadius = 1;
final int testBottomRadius = 5;
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, testTopRadius);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, testTopRadius);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, testBottomRadius);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(testTopRadius, testTopRadius, testBottomRadius, 0 /* roundedPadding */,
+ false /* multipleRadius */, false /* fillCutout */);
// no cutout
doReturn(null).when(mScreenDecorations).getCutout();
@@ -267,16 +239,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
public void testRoundingTopBottomRadius_OnLeftRightOverlay() {
final int testTopRadius = 1;
final int testBottomRadius = 5;
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, testTopRadius);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, testTopRadius);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, testBottomRadius);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(testTopRadius, testTopRadius, testBottomRadius, 0 /* roundedPadding */,
+ false /* multipleRadius */, false /* fillCutout */);
// left cutout
doReturn(new DisplayCutout(
@@ -310,15 +274,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
public void testRoundingMultipleRadius_NoCutout() {
final VectorDrawable d = (VectorDrawable) mContext.getDrawable(R.drawable.rounded);
final Point multipleRadiusSize = new Point(d.getIntrinsicWidth(), d.getIntrinsicHeight());
-
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 9999);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 9999);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, true);
+ setupResources(9999 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 9999 /* roundedPadding */, true /* multipleRadius */,
+ false /* fillCutout */);
// no cutout
doReturn(null).when(mScreenDecorations).getCutout();
@@ -345,27 +303,18 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testNoRounding_CutoutShortEdge() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ true /* fillCutout */);
// top cutout
doReturn(new DisplayCutout(
- Insets.of(0, 10, 0, 0),
- ZERO_RECT,
- new Rect(9, 0, 10, 1),
- ZERO_RECT,
- ZERO_RECT,
- Insets.NONE)).when(mScreenDecorations).getCutout();
+ Insets.of(0, 10, 0, 0),
+ ZERO_RECT,
+ new Rect(9, 0, 10, 1),
+ ZERO_RECT,
+ ZERO_RECT,
+ Insets.NONE)).when(mScreenDecorations).getCutout();
mScreenDecorations.start();
// Top window is created for top cutout.
@@ -381,18 +330,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testNoRounding_CutoutLongEdge() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ true /* fillCutout */);
// left cutout
doReturn(new DisplayCutout(
@@ -417,14 +357,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testRounding_CutoutShortEdge() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 20 /* roundedPadding */, false /* multipleRadius */,
+ true /* fillCutout */);
// top cutout
doReturn(new DisplayCutout(
@@ -450,14 +385,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testRounding_CutoutLongEdge() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 20 /* roundedPadding */, false /* multipleRadius */,
+ true /* fillCutout */);
// left cutout
doReturn(new DisplayCutout(
@@ -483,14 +413,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testRounding_CutoutShortAndLongEdge() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 20 /* roundedPadding */, false /* multipleRadius */,
+ true /* fillCutout */);
// top and left cutout
doReturn(new DisplayCutout(
@@ -517,18 +442,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testNoRounding_SwitchFrom_ShortEdgeCutout_To_LongCutout() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ true /* fillCutout */);
// Set to short edge cutout(top).
doReturn(new DisplayCutout(
@@ -566,18 +482,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testDelayedCutout() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
// top cutout
doReturn(new DisplayCutout(
@@ -591,8 +498,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
mScreenDecorations.start();
assertNull(mScreenDecorations.mOverlays);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
+ when(mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout))
+ .thenReturn(true);
mScreenDecorations.onConfigurationChanged(new Configuration());
// Only top windows should be added.
@@ -612,34 +520,24 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testUpdateRoundedCorners() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
mScreenDecorations.start();
assertEquals(mScreenDecorations.mRoundedDefault, new Point(20, 20));
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 5);
+ when(mContext.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.rounded_corner_radius)).thenReturn(5);
mScreenDecorations.onConfigurationChanged(null);
assertEquals(mScreenDecorations.mRoundedDefault, new Point(5, 5));
}
@Test
public void testOnlyRoundedCornerRadiusTop() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 10);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 10 /* radiusTop */, 0 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
mScreenDecorations.start();
assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
@@ -649,16 +547,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
@Test
public void testOnlyRoundedCornerRadiusBottom() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 20);
- mContext.getOrCreateTestableResources()
- .addOverride(R.bool.config_roundedCornerMultipleRadius, false);
+ setupResources(0 /* radius */, 0 /* radiusTop */, 20 /* radiusBottom */,
+ 0 /* roundedPadding */, false /* multipleRadius */,
+ false /* fillCutout */);
mScreenDecorations.start();
assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
@@ -721,4 +612,44 @@ public class ScreenDecorationsTest extends SysuiTestCase {
verify(mTunerService, times(1)).removeTunable(any());
assertThat(mScreenDecorations.mIsRegistered, is(false));
}
+
+ private void setupResources(int radius, int radiusTop, int radiusBottom, int roundedPadding,
+ boolean multipleRadius, boolean fillCutout) {
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.array.config_displayUniqueIdArray,
+ new String[]{});
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.array.config_roundedCornerRadiusArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.array.config_roundedCornerTopRadiusArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.array.config_roundedCornerBottomRadiusArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ R.array.config_roundedCornerDrawableArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ R.array.config_roundedCornerTopDrawableArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ R.array.config_roundedCornerBottomDrawableArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ R.array.config_roundedCornerMultipleRadiusArray,
+ mMockTypedArray);
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.dimen.rounded_corner_radius, radius);
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.dimen.rounded_corner_radius_top, radiusTop);
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.dimen.rounded_corner_radius_bottom, radiusBottom);
+ mContext.getOrCreateTestableResources().addOverride(
+ R.dimen.rounded_corner_content_padding, roundedPadding);
+ mContext.getOrCreateTestableResources().addOverride(
+ R.bool.config_roundedCornerMultipleRadius, multipleRadius);
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, fillCutout);
+ }
}
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index 17697127d508..5a9efd707f5d 100644
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -601,8 +601,6 @@ final class LocalDisplayAdapter extends DisplayAdapter {
&& SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false))) {
mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
}
- mInfo.roundedCorners = RoundedCorners.fromResources(
- res, mInfo.width, mInfo.height);
} else {
if (!res.getBoolean(
com.android.internal.R.bool.config_localDisplaysMirrorContent)) {
@@ -620,6 +618,9 @@ final class LocalDisplayAdapter extends DisplayAdapter {
mInfo.displayCutout = DisplayCutout.fromResourcesRectApproximation(res,
mInfo.uniqueId, mInfo.width, mInfo.height);
+ mInfo.roundedCorners = RoundedCorners.fromResources(
+ res, mInfo.uniqueId, mInfo.width, mInfo.height);
+
if (mStaticDisplayInfo.isInternal) {
mInfo.type = Display.TYPE_INTERNAL;
mInfo.touch = DisplayDeviceInfo.TOUCH_INTERNAL;
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index c0b2ca8822cd..c99e5cecc858 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -2409,7 +2409,7 @@ public class DisplayPolicy {
*/
float getWindowCornerRadius() {
return mDisplayContent.getDisplay().getType() == TYPE_INTERNAL
- ? ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources()) : 0f;
+ ? ScreenDecorationsUtils.getWindowCornerRadius(mContext) : 0f;
}
boolean isShowingDreamLw() {
diff --git a/services/tests/mockingservicestests/src/com/android/server/display/LocalDisplayAdapterTest.java b/services/tests/mockingservicestests/src/com/android/server/display/LocalDisplayAdapterTest.java
index 34856e2580ed..28cdd6317e5a 100644
--- a/services/tests/mockingservicestests/src/com/android/server/display/LocalDisplayAdapterTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/display/LocalDisplayAdapterTest.java
@@ -142,6 +142,12 @@ public class LocalDisplayAdapterTest {
.thenReturn(mockArray);
when(mMockedResources.obtainTypedArray(R.array.config_waterfallCutoutArray))
.thenReturn(mockArray);
+ when(mMockedResources.obtainTypedArray(R.array.config_roundedCornerRadiusArray))
+ .thenReturn(mockArray);
+ when(mMockedResources.obtainTypedArray(R.array.config_roundedCornerTopRadiusArray))
+ .thenReturn(mockArray);
+ when(mMockedResources.obtainTypedArray(R.array.config_roundedCornerBottomRadiusArray))
+ .thenReturn(mockArray);
}
@After