Merge "[DO NOT MERGE]Support rounded corner for multi-display devices" into sc-v2-dev
This commit is contained in:
54
core/java/android/util/DisplayUtils.java
Normal file
54
core/java/android/util/DisplayUtils.java
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ import android.graphics.Rect;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.DisplayUtils;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.util.RotationUtils;
|
import android.util.RotationUtils;
|
||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
@@ -873,31 +874,6 @@ public final class DisplayCutout {
|
|||||||
false /* copyArguments */);
|
false /* copyArguments */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
* Gets the display cutout by the given display unique id.
|
||||||
*
|
*
|
||||||
@@ -905,7 +881,7 @@ public final class DisplayCutout {
|
|||||||
* {@link R.array#config_displayUniqueIdArray} is not set.
|
* {@link R.array#config_displayUniqueIdArray} is not set.
|
||||||
*/
|
*/
|
||||||
private static String getDisplayCutoutPath(Resources res, String displayUniqueId) {
|
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);
|
final String[] array = res.getStringArray(R.array.config_displayCutoutPathArray);
|
||||||
if (index >= 0 && index < array.length) {
|
if (index >= 0 && index < array.length) {
|
||||||
return array[index];
|
return array[index];
|
||||||
@@ -920,7 +896,7 @@ public final class DisplayCutout {
|
|||||||
* {@link R.array#config_displayUniqueIdArray} is not set.
|
* {@link R.array#config_displayUniqueIdArray} is not set.
|
||||||
*/
|
*/
|
||||||
private static String getDisplayCutoutApproximationRect(Resources res, String displayUniqueId) {
|
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(
|
final String[] array = res.getStringArray(
|
||||||
R.array.config_displayCutoutApproximationRectArray);
|
R.array.config_displayCutoutApproximationRectArray);
|
||||||
if (index >= 0 && index < array.length) {
|
if (index >= 0 && index < array.length) {
|
||||||
@@ -939,7 +915,7 @@ public final class DisplayCutout {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static boolean getMaskBuiltInDisplayCutout(Resources res, String displayUniqueId) {
|
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);
|
final TypedArray array = res.obtainTypedArray(R.array.config_maskBuiltInDisplayCutoutArray);
|
||||||
boolean maskCutout;
|
boolean maskCutout;
|
||||||
if (index >= 0 && index < array.length()) {
|
if (index >= 0 && index < array.length()) {
|
||||||
@@ -961,7 +937,7 @@ public final class DisplayCutout {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static boolean getFillBuiltInDisplayCutout(Resources res, String displayUniqueId) {
|
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);
|
final TypedArray array = res.obtainTypedArray(R.array.config_fillBuiltInDisplayCutoutArray);
|
||||||
boolean fillCutout;
|
boolean fillCutout;
|
||||||
if (index >= 0 && index < array.length()) {
|
if (index >= 0 && index < array.length()) {
|
||||||
@@ -984,7 +960,7 @@ public final class DisplayCutout {
|
|||||||
*/
|
*/
|
||||||
private static Insets getWaterfallInsets(Resources res, String displayUniqueId) {
|
private static Insets getWaterfallInsets(Resources res, String displayUniqueId) {
|
||||||
Insets insets;
|
Insets insets;
|
||||||
final int index = getDisplayCutoutConfigIndex(res, displayUniqueId);
|
final int index = DisplayUtils.getDisplayUniqueIdConfigIndex(res, displayUniqueId);
|
||||||
final TypedArray array = res.obtainTypedArray(R.array.config_waterfallCutoutArray);
|
final TypedArray array = res.obtainTypedArray(R.array.config_waterfallCutoutArray);
|
||||||
if (index >= 0 && index < array.length() && array.getResourceId(index, 0) > 0) {
|
if (index >= 0 && index < array.length() && array.getResourceId(index, 0) > 0) {
|
||||||
final int resourceId = array.getResourceId(index, 0);
|
final int resourceId = array.getResourceId(index, 0);
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ import static android.view.Surface.ROTATION_90;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import android.util.DisplayUtils;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.RoundedCorner.Position;
|
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
|
* @android:dimen/rounded_corner_radius_top and @android:dimen/rounded_corner_radius_bottom
|
||||||
*/
|
*/
|
||||||
public static RoundedCorners fromResources(
|
public static RoundedCorners fromResources(
|
||||||
Resources res, int displayWidth, int displayHeight) {
|
Resources res, String displayUniqueId, int displayWidth, int displayHeight) {
|
||||||
return fromRadii(loadRoundedCornerRadii(res), displayWidth, displayHeight);
|
return fromRadii(loadRoundedCornerRadii(res, displayUniqueId), displayWidth, displayHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,14 +142,16 @@ public class RoundedCorners implements Parcelable {
|
|||||||
* Loads the rounded corner radii from resources.
|
* Loads the rounded corner radii from resources.
|
||||||
*
|
*
|
||||||
* @param res
|
* @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
|
* @return a Pair of radius. The first is the top rounded corner radius and second is the
|
||||||
* bottom corner radius.
|
* bottom corner radius.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private static Pair<Integer, Integer> loadRoundedCornerRadii(Resources res) {
|
private static Pair<Integer, Integer> loadRoundedCornerRadii(
|
||||||
final int radiusDefault = res.getDimensionPixelSize(R.dimen.rounded_corner_radius);
|
Resources res, String displayUniqueId) {
|
||||||
final int radiusTop = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_top);
|
final int radiusDefault = getRoundedCornerRadius(res, displayUniqueId);
|
||||||
final int radiusBottom = res.getDimensionPixelSize(R.dimen.rounded_corner_radius_bottom);
|
final int radiusTop = getRoundedCornerTopRadius(res, displayUniqueId);
|
||||||
|
final int radiusBottom = getRoundedCornerBottomRadius(res, displayUniqueId);
|
||||||
if (radiusDefault == 0 && radiusTop == 0 && radiusBottom == 0) {
|
if (radiusDefault == 0 && radiusTop == 0 && radiusBottom == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -157,6 +161,164 @@ public class RoundedCorners implements Parcelable {
|
|||||||
return radii;
|
return radii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Insets the reference frame of the rounded corners.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package com.android.internal.policy;
|
package com.android.internal.policy;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.view.RoundedCorners;
|
||||||
|
|
||||||
import com.android.internal.R;
|
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.
|
* 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
|
* 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.
|
* 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)) {
|
if (!supportsRoundedCornersOnWindows(resources)) {
|
||||||
return 0f;
|
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.
|
// Radius that should be used in case top or bottom aren't defined.
|
||||||
float defaultRadius = resources.getDimension(R.dimen.rounded_corner_radius)
|
float defaultRadius = RoundedCorners.getRoundedCornerRadius(resources, displayUniqueId)
|
||||||
- resources.getDimension(R.dimen.rounded_corner_radius_adjustment);
|
- RoundedCorners.getRoundedCornerRadiusAdjustment(resources, displayUniqueId);
|
||||||
|
|
||||||
float topRadius = resources.getDimension(R.dimen.rounded_corner_radius_top)
|
float topRadius = RoundedCorners.getRoundedCornerTopRadius(resources, displayUniqueId)
|
||||||
- resources.getDimension(R.dimen.rounded_corner_radius_top_adjustment);
|
- RoundedCorners.getRoundedCornerRadiusTopAdjustment(resources, displayUniqueId);
|
||||||
if (topRadius == 0f) {
|
if (topRadius == 0f) {
|
||||||
topRadius = defaultRadius;
|
topRadius = defaultRadius;
|
||||||
}
|
}
|
||||||
float bottomRadius = resources.getDimension(R.dimen.rounded_corner_radius_bottom)
|
float bottomRadius = RoundedCorners.getRoundedCornerBottomRadius(resources, displayUniqueId)
|
||||||
- resources.getDimension(R.dimen.rounded_corner_radius_bottom_adjustment);
|
- RoundedCorners.getRoundedCornerRadiusBottomAdjustment(resources, displayUniqueId);
|
||||||
if (bottomRadius == 0f) {
|
if (bottomRadius == 0f) {
|
||||||
bottomRadius = defaultRadius;
|
bottomRadius = defaultRadius;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5095,6 +5095,14 @@
|
|||||||
- config_fillBuiltInDisplayCutoutArray
|
- config_fillBuiltInDisplayCutoutArray
|
||||||
- config_maskBuiltInDisplayCutoutArray
|
- config_maskBuiltInDisplayCutoutArray
|
||||||
- config_waterfallCutoutArray
|
- 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
|
Leave this array empty for single display device and the system will load the default main
|
||||||
built-in related configs.
|
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
|
This flag should be enabled only when the product does not have any UI to toggle airplane
|
||||||
mode like automotive devices.-->
|
mode like automotive devices.-->
|
||||||
<bool name="config_autoResetAirplaneMode">false</bool>
|
<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>
|
</resources>
|
||||||
|
|||||||
@@ -952,4 +952,12 @@
|
|||||||
<dimen name="secondary_waterfall_display_top_edge_size">0px</dimen>
|
<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_right_edge_size">0px</dimen>
|
||||||
<dimen name="secondary_waterfall_display_bottom_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>
|
</resources>
|
||||||
|
|||||||
@@ -4452,4 +4452,19 @@
|
|||||||
<java-symbol type="array" name="config_mainBuiltInDisplayWaterfallCutout" />
|
<java-symbol type="array" name="config_mainBuiltInDisplayWaterfallCutout" />
|
||||||
<java-symbol type="array" name="config_secondaryBuiltInDisplayWaterfallCutout" />
|
<java-symbol type="array" name="config_secondaryBuiltInDisplayWaterfallCutout" />
|
||||||
<java-symbol type="array" name="config_waterfallCutoutArray" />
|
<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>
|
</resources>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class DropOutlineDrawable extends Drawable {
|
|||||||
public DropOutlineDrawable(Context context) {
|
public DropOutlineDrawable(Context context) {
|
||||||
super();
|
super();
|
||||||
// TODO(b/169894807): Use corner specific radii and maybe lower radius for non-edge corners
|
// 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);
|
mColor = context.getColor(R.color.drop_outline_background);
|
||||||
mMaxAlpha = Color.alpha(mColor);
|
mMaxAlpha = Color.alpha(mColor);
|
||||||
// Initialize as hidden
|
// Initialize as hidden
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ class ActivityLaunchAnimator(
|
|||||||
val endRadius = if (isExpandingFullyAbove) {
|
val endRadius = if (isExpandingFullyAbove) {
|
||||||
// Most of the time, expanding fully above the root view means expanding in full
|
// Most of the time, expanding fully above the root view means expanding in full
|
||||||
// screen.
|
// screen.
|
||||||
ScreenDecorationsUtils.getWindowCornerRadius(context.resources)
|
ScreenDecorationsUtils.getWindowCornerRadius(context)
|
||||||
} else {
|
} else {
|
||||||
// This usually means we are in split screen mode, so 2 out of 4 corners will have
|
// This usually means we are in split screen mode, so 2 out of 4 corners will have
|
||||||
// a radius of 0.
|
// a radius of 0.
|
||||||
|
|||||||
@@ -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"/>
|
||||||
@@ -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"/>
|
||||||
24
packages/SystemUI/res/drawable/rounded_secondary.xml
Normal file
24
packages/SystemUI/res/drawable/rounded_secondary.xml
Normal file
@@ -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>
|
||||||
@@ -679,4 +679,36 @@
|
|||||||
|
|
||||||
<!-- Flag to activate notification to contents feature -->
|
<!-- Flag to activate notification to contents feature -->
|
||||||
<bool name="config_notificationToContents">false</bool>
|
<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>
|
</resources>
|
||||||
|
|||||||
@@ -285,8 +285,8 @@ public class QuickStepContract {
|
|||||||
* These values are expressed in pixels because they should not respect display or font
|
* 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.
|
* scaling, this means that we don't have to reload them on config changes.
|
||||||
*/
|
*/
|
||||||
public static float getWindowCornerRadius(Resources resources) {
|
public static float getWindowCornerRadius(Context context) {
|
||||||
return ScreenDecorationsUtils.getWindowCornerRadius(resources);
|
return ScreenDecorationsUtils.getWindowCornerRadius(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import android.content.IntentFilter;
|
|||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
@@ -59,6 +60,7 @@ import android.os.SystemProperties;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings.Secure;
|
import android.provider.Settings.Secure;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.DisplayUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.DisplayCutout;
|
import android.view.DisplayCutout;
|
||||||
@@ -66,6 +68,7 @@ import android.view.DisplayCutout.BoundsPosition;
|
|||||||
import android.view.DisplayInfo;
|
import android.view.DisplayInfo;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.RoundedCorners;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnLayoutChangeListener;
|
import android.view.View.OnLayoutChangeListener;
|
||||||
@@ -159,6 +162,10 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
private boolean mIsRoundedCornerMultipleRadius;
|
private boolean mIsRoundedCornerMultipleRadius;
|
||||||
private int mStatusBarHeightPortrait;
|
private int mStatusBarHeightPortrait;
|
||||||
private int mStatusBarHeightLandscape;
|
private int mStatusBarHeightLandscape;
|
||||||
|
private Drawable mRoundedCornerDrawable;
|
||||||
|
private Drawable mRoundedCornerDrawableTop;
|
||||||
|
private Drawable mRoundedCornerDrawableBottom;
|
||||||
|
private String mDisplayUniqueId;
|
||||||
|
|
||||||
private CameraAvailabilityListener.CameraTransitionCallback mCameraTransitionCallback =
|
private CameraAvailabilityListener.CameraTransitionCallback mCameraTransitionCallback =
|
||||||
new CameraAvailabilityListener.CameraTransitionCallback() {
|
new CameraAvailabilityListener.CameraTransitionCallback() {
|
||||||
@@ -244,10 +251,11 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
|
|
||||||
private void startOnScreenDecorationsThread() {
|
private void startOnScreenDecorationsThread() {
|
||||||
mRotation = mContext.getDisplay().getRotation();
|
mRotation = mContext.getDisplay().getRotation();
|
||||||
|
mDisplayUniqueId = mContext.getDisplay().getUniqueId();
|
||||||
|
mIsRoundedCornerMultipleRadius = isRoundedCornerMultipleRadius(mContext, mDisplayUniqueId);
|
||||||
mWindowManager = mContext.getSystemService(WindowManager.class);
|
mWindowManager = mContext.getSystemService(WindowManager.class);
|
||||||
mDisplayManager = mContext.getSystemService(DisplayManager.class);
|
mDisplayManager = mContext.getSystemService(DisplayManager.class);
|
||||||
mIsRoundedCornerMultipleRadius = mContext.getResources().getBoolean(
|
updateRoundedCornerDrawable();
|
||||||
R.bool.config_roundedCornerMultipleRadius);
|
|
||||||
updateRoundedCornerRadii();
|
updateRoundedCornerRadii();
|
||||||
setupDecorations();
|
setupDecorations();
|
||||||
setupCameraListener();
|
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();
|
updateOrientation();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -474,6 +490,7 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
updateRoundedCornerView(pos, R.id.left);
|
updateRoundedCornerView(pos, R.id.left);
|
||||||
updateRoundedCornerView(pos, R.id.right);
|
updateRoundedCornerView(pos, R.id.right);
|
||||||
updateRoundedCornerSize(mRoundedDefault, mRoundedDefaultTop, mRoundedDefaultBottom);
|
updateRoundedCornerSize(mRoundedDefault, mRoundedDefaultTop, mRoundedDefaultBottom);
|
||||||
|
updateRoundedCornerImageView();
|
||||||
|
|
||||||
// update cutout view rotation
|
// update cutout view rotation
|
||||||
if (mCutoutViews != null && mCutoutViews[pos] != null) {
|
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
|
// 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
|
// device configured using the single integer config value is okay with drawing the corners
|
||||||
// as a square
|
// as a square
|
||||||
final int newRoundedDefault = mContext.getResources().getDimensionPixelSize(
|
final int newRoundedDefault = RoundedCorners.getRoundedCornerRadius(
|
||||||
com.android.internal.R.dimen.rounded_corner_radius);
|
mContext.getResources(), mDisplayUniqueId);
|
||||||
final int newRoundedDefaultTop = mContext.getResources().getDimensionPixelSize(
|
final int newRoundedDefaultTop = RoundedCorners.getRoundedCornerTopRadius(
|
||||||
com.android.internal.R.dimen.rounded_corner_radius_top);
|
mContext.getResources(), mDisplayUniqueId);
|
||||||
final int newRoundedDefaultBottom = mContext.getResources().getDimensionPixelSize(
|
final int newRoundedDefaultBottom = RoundedCorners.getRoundedCornerBottomRadius(
|
||||||
com.android.internal.R.dimen.rounded_corner_radius_bottom);
|
mContext.getResources(), mDisplayUniqueId);
|
||||||
|
|
||||||
final boolean changed = mRoundedDefault.x != newRoundedDefault
|
final boolean changed = mRoundedDefault.x != newRoundedDefault
|
||||||
|| mRoundedDefaultTop.x != newRoundedDefaultTop
|
|| mRoundedDefaultTop.x != newRoundedDefaultTop
|
||||||
|| mRoundedDefaultBottom.x != newRoundedDefaultBottom;
|
|| mRoundedDefaultBottom.x != newRoundedDefaultBottom;
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
// If config_roundedCornerMultipleRadius set as true, ScreenDecorations respect the
|
// If config_roundedCornerMultipleRadius set as true, ScreenDecorations respect the
|
||||||
// (width, height) size of drawable/rounded.xml instead of rounded_corner_radius
|
// (width, height) size of drawable/rounded.xml instead of rounded_corner_radius
|
||||||
if (mIsRoundedCornerMultipleRadius) {
|
if (mIsRoundedCornerMultipleRadius) {
|
||||||
Drawable d = mContext.getDrawable(R.drawable.rounded);
|
mRoundedDefault.set(mRoundedCornerDrawable.getIntrinsicWidth(),
|
||||||
mRoundedDefault.set(d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
mRoundedCornerDrawable.getIntrinsicHeight());
|
||||||
d = mContext.getDrawable(R.drawable.rounded_corner_top);
|
mRoundedDefaultTop.set(mRoundedCornerDrawableTop.getIntrinsicWidth(),
|
||||||
mRoundedDefaultTop.set(d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
mRoundedCornerDrawableTop.getIntrinsicHeight());
|
||||||
d = mContext.getDrawable(R.drawable.rounded_corner_bottom);
|
mRoundedDefaultBottom.set(mRoundedCornerDrawableBottom.getIntrinsicWidth(),
|
||||||
mRoundedDefaultBottom.set(d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
mRoundedCornerDrawableBottom.getIntrinsicHeight());
|
||||||
} else {
|
} else {
|
||||||
mRoundedDefault.set(newRoundedDefault, newRoundedDefault);
|
mRoundedDefault.set(newRoundedDefault, newRoundedDefault);
|
||||||
mRoundedDefaultTop.set(newRoundedDefaultTop, newRoundedDefaultTop);
|
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) {
|
private void updateRoundedCornerView(@BoundsPosition int pos, int id) {
|
||||||
final View rounded = mOverlays[pos].findViewById(id);
|
final View rounded = mOverlays[pos].findViewById(id);
|
||||||
if (rounded == null) {
|
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(
|
private void updateRoundedCornerSize(
|
||||||
Point sizeDefault,
|
Point sizeDefault,
|
||||||
Point sizeTop,
|
Point sizeTop,
|
||||||
@@ -855,21 +999,10 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
|||||||
if (mOverlays[i] == null) {
|
if (mOverlays[i] == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (i == BOUNDS_POSITION_LEFT || i == BOUNDS_POSITION_RIGHT) {
|
setSize(mOverlays[i].findViewById(R.id.left),
|
||||||
if (mRotation == ROTATION_270) {
|
isTopRoundedCorner(i, R.id.left) ? sizeTop : sizeBottom);
|
||||||
setSize(mOverlays[i].findViewById(R.id.left), sizeBottom);
|
setSize(mOverlays[i].findViewById(R.id.right),
|
||||||
setSize(mOverlays[i].findViewById(R.id.right), sizeTop);
|
isTopRoundedCorner(i, R.id.right) ? sizeTop : sizeBottom);
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
|||||||
com.android.internal.R.string.config_recentsComponentName));
|
com.android.internal.R.string.config_recentsComponentName));
|
||||||
mQuickStepIntent = new Intent(ACTION_QUICKSTEP)
|
mQuickStepIntent = new Intent(ACTION_QUICKSTEP)
|
||||||
.setPackage(mRecentsComponentName.getPackageName());
|
.setPackage(mRecentsComponentName.getPackageName());
|
||||||
mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources());
|
mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(mContext);
|
||||||
mSupportsRoundedCornersOnWindows = ScreenDecorationsUtils
|
mSupportsRoundedCornersOnWindows = ScreenDecorationsUtils
|
||||||
.supportsRoundedCornersOnWindows(mContext.getResources());
|
.supportsRoundedCornersOnWindows(mContext.getResources());
|
||||||
mSysUiState = sysUiState;
|
mSysUiState = sysUiState;
|
||||||
|
|||||||
@@ -902,7 +902,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
R.dimen.pulse_expansion_max_top_overshoot);
|
R.dimen.pulse_expansion_max_top_overshoot);
|
||||||
mScrimCornerRadius = mResources.getDimensionPixelSize(
|
mScrimCornerRadius = mResources.getDimensionPixelSize(
|
||||||
R.dimen.notification_scrim_corner_radius);
|
R.dimen.notification_scrim_corner_radius);
|
||||||
mScreenCornerRadius = (int) ScreenDecorationsUtils.getWindowCornerRadius(mResources);
|
mScreenCornerRadius = (int) ScreenDecorationsUtils.getWindowCornerRadius(
|
||||||
|
mView.getContext());
|
||||||
mLockscreenNotificationQSPadding = mResources.getDimensionPixelSize(
|
mLockscreenNotificationQSPadding = mResources.getDimensionPixelSize(
|
||||||
R.dimen.notification_side_paddings);
|
R.dimen.notification_side_paddings);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import static org.mockito.Mockito.verify;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Insets;
|
import android.graphics.Insets;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -60,7 +61,6 @@ import android.view.WindowMetrics;
|
|||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import com.android.systemui.R.dimen;
|
|
||||||
import com.android.systemui.broadcast.BroadcastDispatcher;
|
import com.android.systemui.broadcast.BroadcastDispatcher;
|
||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
import com.android.systemui.statusbar.events.PrivacyDotViewController;
|
import com.android.systemui.statusbar.events.PrivacyDotViewController;
|
||||||
@@ -100,6 +100,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
private UserTracker mUserTracker;
|
private UserTracker mUserTracker;
|
||||||
@Mock
|
@Mock
|
||||||
private PrivacyDotViewController mDotViewController;
|
private PrivacyDotViewController mDotViewController;
|
||||||
|
@Mock
|
||||||
|
private TypedArray mMockTypedArray;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
@@ -121,6 +123,7 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
.getDisplay(DEFAULT_DISPLAY);
|
.getDisplay(DEFAULT_DISPLAY);
|
||||||
when(mDisplayManager.getDisplay(anyInt())).thenReturn(display);
|
when(mDisplayManager.getDisplay(anyInt())).thenReturn(display);
|
||||||
mContext.addMockSystemService(DisplayManager.class, mDisplayManager);
|
mContext.addMockSystemService(DisplayManager.class, mDisplayManager);
|
||||||
|
when(mMockTypedArray.length()).thenReturn(0);
|
||||||
|
|
||||||
mScreenDecorations = spy(new ScreenDecorations(mContext, mExecutor, mSecureSettings,
|
mScreenDecorations = spy(new ScreenDecorations(mContext, mExecutor, mSecureSettings,
|
||||||
mBroadcastDispatcher, mTunerService, mUserTracker, mDotViewController,
|
mBroadcastDispatcher, mTunerService, mUserTracker, mDotViewController,
|
||||||
@@ -148,18 +151,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoRounding_NoCutout() {
|
public void testNoRounding_NoCutout() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// no cutout
|
// no cutout
|
||||||
doReturn(null).when(mScreenDecorations).getCutout();
|
doReturn(null).when(mScreenDecorations).getCutout();
|
||||||
@@ -173,14 +167,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRounding_NoCutout() {
|
public void testRounding_NoCutout() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
20 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// no cutout
|
// no cutout
|
||||||
doReturn(null).when(mScreenDecorations).getCutout();
|
doReturn(null).when(mScreenDecorations).getCutout();
|
||||||
@@ -203,19 +192,10 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRoundingRadius_NoCutout() {
|
public void testRoundingRadius_NoCutout() {
|
||||||
final int testRadius = 1;
|
|
||||||
final Point testRadiusPoint = new Point(1, 1);
|
final Point testRadiusPoint = new Point(1, 1);
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(1 /* radius */, 1 /* radiusTop */, 1 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// no cutout
|
// no cutout
|
||||||
doReturn(null).when(mScreenDecorations).getCutout();
|
doReturn(null).when(mScreenDecorations).getCutout();
|
||||||
|
|
||||||
@@ -230,16 +210,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
public void testRoundingTopBottomRadius_OnTopBottomOverlay() {
|
public void testRoundingTopBottomRadius_OnTopBottomOverlay() {
|
||||||
final int testTopRadius = 1;
|
final int testTopRadius = 1;
|
||||||
final int testBottomRadius = 5;
|
final int testBottomRadius = 5;
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(testTopRadius, testTopRadius, testBottomRadius, 0 /* roundedPadding */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
false /* multipleRadius */, false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// no cutout
|
// no cutout
|
||||||
doReturn(null).when(mScreenDecorations).getCutout();
|
doReturn(null).when(mScreenDecorations).getCutout();
|
||||||
@@ -267,16 +239,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
public void testRoundingTopBottomRadius_OnLeftRightOverlay() {
|
public void testRoundingTopBottomRadius_OnLeftRightOverlay() {
|
||||||
final int testTopRadius = 1;
|
final int testTopRadius = 1;
|
||||||
final int testBottomRadius = 5;
|
final int testBottomRadius = 5;
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(testTopRadius, testTopRadius, testBottomRadius, 0 /* roundedPadding */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
false /* multipleRadius */, false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// left cutout
|
// left cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -310,15 +274,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
public void testRoundingMultipleRadius_NoCutout() {
|
public void testRoundingMultipleRadius_NoCutout() {
|
||||||
final VectorDrawable d = (VectorDrawable) mContext.getDrawable(R.drawable.rounded);
|
final VectorDrawable d = (VectorDrawable) mContext.getDrawable(R.drawable.rounded);
|
||||||
final Point multipleRadiusSize = new Point(d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
final Point multipleRadiusSize = new Point(d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
||||||
|
setupResources(9999 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
9999 /* roundedPadding */, true /* multipleRadius */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// no cutout
|
// no cutout
|
||||||
doReturn(null).when(mScreenDecorations).getCutout();
|
doReturn(null).when(mScreenDecorations).getCutout();
|
||||||
@@ -345,27 +303,18 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoRounding_CutoutShortEdge() {
|
public void testNoRounding_CutoutShortEdge() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
true /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// top cutout
|
// top cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
Insets.of(0, 10, 0, 0),
|
Insets.of(0, 10, 0, 0),
|
||||||
ZERO_RECT,
|
ZERO_RECT,
|
||||||
new Rect(9, 0, 10, 1),
|
new Rect(9, 0, 10, 1),
|
||||||
ZERO_RECT,
|
ZERO_RECT,
|
||||||
ZERO_RECT,
|
ZERO_RECT,
|
||||||
Insets.NONE)).when(mScreenDecorations).getCutout();
|
Insets.NONE)).when(mScreenDecorations).getCutout();
|
||||||
|
|
||||||
mScreenDecorations.start();
|
mScreenDecorations.start();
|
||||||
// Top window is created for top cutout.
|
// Top window is created for top cutout.
|
||||||
@@ -381,18 +330,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoRounding_CutoutLongEdge() {
|
public void testNoRounding_CutoutLongEdge() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
true /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// left cutout
|
// left cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -417,14 +357,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRounding_CutoutShortEdge() {
|
public void testRounding_CutoutShortEdge() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
20 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
true /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// top cutout
|
// top cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -450,14 +385,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRounding_CutoutLongEdge() {
|
public void testRounding_CutoutLongEdge() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
20 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
true /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// left cutout
|
// left cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -483,14 +413,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRounding_CutoutShortAndLongEdge() {
|
public void testRounding_CutoutShortAndLongEdge() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
20 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
true /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// top and left cutout
|
// top and left cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -517,18 +442,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoRounding_SwitchFrom_ShortEdgeCutout_To_LongCutout() {
|
public void testNoRounding_SwitchFrom_ShortEdgeCutout_To_LongCutout() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
true /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// Set to short edge cutout(top).
|
// Set to short edge cutout(top).
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -566,18 +482,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDelayedCutout() {
|
public void testDelayedCutout() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
// top cutout
|
// top cutout
|
||||||
doReturn(new DisplayCutout(
|
doReturn(new DisplayCutout(
|
||||||
@@ -591,8 +498,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
mScreenDecorations.start();
|
mScreenDecorations.start();
|
||||||
assertNull(mScreenDecorations.mOverlays);
|
assertNull(mScreenDecorations.mOverlays);
|
||||||
|
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
when(mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, true);
|
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout))
|
||||||
|
.thenReturn(true);
|
||||||
mScreenDecorations.onConfigurationChanged(new Configuration());
|
mScreenDecorations.onConfigurationChanged(new Configuration());
|
||||||
|
|
||||||
// Only top windows should be added.
|
// Only top windows should be added.
|
||||||
@@ -612,34 +520,24 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateRoundedCorners() {
|
public void testUpdateRoundedCorners() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(20 /* radius */, 0 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
com.android.internal.R.dimen.rounded_corner_radius, 20);
|
|
||||||
mContext.getOrCreateTestableResources()
|
|
||||||
.addOverride(R.bool.config_roundedCornerMultipleRadius, false);
|
|
||||||
|
|
||||||
mScreenDecorations.start();
|
mScreenDecorations.start();
|
||||||
assertEquals(mScreenDecorations.mRoundedDefault, new Point(20, 20));
|
assertEquals(mScreenDecorations.mRoundedDefault, new Point(20, 20));
|
||||||
|
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
when(mContext.getResources().getDimensionPixelSize(
|
||||||
com.android.internal.R.dimen.rounded_corner_radius, 5);
|
com.android.internal.R.dimen.rounded_corner_radius)).thenReturn(5);
|
||||||
mScreenDecorations.onConfigurationChanged(null);
|
mScreenDecorations.onConfigurationChanged(null);
|
||||||
assertEquals(mScreenDecorations.mRoundedDefault, new Point(5, 5));
|
assertEquals(mScreenDecorations.mRoundedDefault, new Point(5, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnlyRoundedCornerRadiusTop() {
|
public void testOnlyRoundedCornerRadiusTop() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 10 /* radiusTop */, 0 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
mScreenDecorations.start();
|
mScreenDecorations.start();
|
||||||
assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
|
assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
|
||||||
@@ -649,16 +547,9 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnlyRoundedCornerRadiusBottom() {
|
public void testOnlyRoundedCornerRadiusBottom() {
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
setupResources(0 /* radius */, 0 /* radiusTop */, 20 /* radiusBottom */,
|
||||||
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
|
0 /* roundedPadding */, false /* multipleRadius */,
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
false /* fillCutout */);
|
||||||
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);
|
|
||||||
|
|
||||||
mScreenDecorations.start();
|
mScreenDecorations.start();
|
||||||
assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
|
assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
|
||||||
@@ -721,4 +612,44 @@ public class ScreenDecorationsTest extends SysuiTestCase {
|
|||||||
verify(mTunerService, times(1)).removeTunable(any());
|
verify(mTunerService, times(1)).removeTunable(any());
|
||||||
assertThat(mScreenDecorations.mIsRegistered, is(false));
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -601,8 +601,6 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
|||||||
&& SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false))) {
|
&& SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false))) {
|
||||||
mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
|
mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
|
||||||
}
|
}
|
||||||
mInfo.roundedCorners = RoundedCorners.fromResources(
|
|
||||||
res, mInfo.width, mInfo.height);
|
|
||||||
} else {
|
} else {
|
||||||
if (!res.getBoolean(
|
if (!res.getBoolean(
|
||||||
com.android.internal.R.bool.config_localDisplaysMirrorContent)) {
|
com.android.internal.R.bool.config_localDisplaysMirrorContent)) {
|
||||||
@@ -620,6 +618,9 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
|||||||
mInfo.displayCutout = DisplayCutout.fromResourcesRectApproximation(res,
|
mInfo.displayCutout = DisplayCutout.fromResourcesRectApproximation(res,
|
||||||
mInfo.uniqueId, mInfo.width, mInfo.height);
|
mInfo.uniqueId, mInfo.width, mInfo.height);
|
||||||
|
|
||||||
|
mInfo.roundedCorners = RoundedCorners.fromResources(
|
||||||
|
res, mInfo.uniqueId, mInfo.width, mInfo.height);
|
||||||
|
|
||||||
if (mStaticDisplayInfo.isInternal) {
|
if (mStaticDisplayInfo.isInternal) {
|
||||||
mInfo.type = Display.TYPE_INTERNAL;
|
mInfo.type = Display.TYPE_INTERNAL;
|
||||||
mInfo.touch = DisplayDeviceInfo.TOUCH_INTERNAL;
|
mInfo.touch = DisplayDeviceInfo.TOUCH_INTERNAL;
|
||||||
|
|||||||
@@ -2409,7 +2409,7 @@ public class DisplayPolicy {
|
|||||||
*/
|
*/
|
||||||
float getWindowCornerRadius() {
|
float getWindowCornerRadius() {
|
||||||
return mDisplayContent.getDisplay().getType() == TYPE_INTERNAL
|
return mDisplayContent.getDisplay().getType() == TYPE_INTERNAL
|
||||||
? ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources()) : 0f;
|
? ScreenDecorationsUtils.getWindowCornerRadius(mContext) : 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isShowingDreamLw() {
|
boolean isShowingDreamLw() {
|
||||||
|
|||||||
@@ -142,6 +142,12 @@ public class LocalDisplayAdapterTest {
|
|||||||
.thenReturn(mockArray);
|
.thenReturn(mockArray);
|
||||||
when(mMockedResources.obtainTypedArray(R.array.config_waterfallCutoutArray))
|
when(mMockedResources.obtainTypedArray(R.array.config_waterfallCutoutArray))
|
||||||
.thenReturn(mockArray);
|
.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
|
@After
|
||||||
|
|||||||
Reference in New Issue
Block a user