diff options
| author | 2022-03-16 02:07:15 +0800 | |
|---|---|---|
| committer | 2022-03-22 11:31:54 +0800 | |
| commit | b432ba94bb41719d90bde01ab8cf1331dc60e80c (patch) | |
| tree | 6c0c5a6876b164ead520c8945d3f785925513f0a | |
| parent | cb4664745cfb84d68ec80826a21c5210be251d80 (diff) | |
Support tuning sysui_rounded_size
Previous sysui_rounded_size only works on device w/o rounded_corner_top
or rounded_corner_bottom. Support tuning sysui_rounded_size for all
cases.
Bug: 220659061
Test: atest RoundedCornerResDelegateTest
Test: Manually check rounded corner size on normal phone, hardware-layer
phone with 'adb shell settings put secure sysui_rounded_size XX'
Change-Id: I1e16e93271ac81af99e51d62cf4035219a5e7070
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt | 11 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt | 8 |
2 files changed, 8 insertions, 11 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt b/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt index 256c6751c443..1d38e58dd48c 100644 --- a/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt +++ b/packages/SystemUI/src/com/android/systemui/decor/RoundedCornerResDelegate.kt @@ -125,17 +125,18 @@ class RoundedCornerResDelegate( bottomRoundedSize = Size(bottomRadius, bottomRadius) } - if (roundedSizeFactor != null && roundedSizeFactor > 0) { - val length: Int = (roundedSizeFactor * density).toInt() - roundedSize = Size(length, length) - } - if (topRoundedSize.width == 0) { topRoundedSize = roundedSize } if (bottomRoundedSize.width == 0) { bottomRoundedSize = roundedSize } + + if (roundedSizeFactor != null && roundedSizeFactor > 0) { + val length: Int = (roundedSizeFactor * density).toInt() + topRoundedSize = Size(length, length) + bottomRoundedSize = Size(length, length) + } } fun updateTuningSizeFactor(factor: Int?, newReloadToken: Int) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt index fb6ff76a4e38..e89ed309a1b6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerResDelegateTest.kt @@ -102,8 +102,9 @@ class RoundedCornerResDelegateTest : SysuiTestCase() { fun testUpdateTuningSizeFactor() { mContext.orCreateTestableResources.addOverrides( mockTypeArray = mockTypedArray, + radius = 1, radiusTop = 0, - radiusBottom = 0, + radiusBottom = 2, multipleRadius = false) roundedCornerResDelegate = RoundedCornerResDelegate(mContext.resources, null) @@ -115,11 +116,6 @@ class RoundedCornerResDelegateTest : SysuiTestCase() { assertEquals(Size(length, length), roundedCornerResDelegate.topRoundedSize) assertEquals(Size(length, length), roundedCornerResDelegate.bottomRoundedSize) - mContext.orCreateTestableResources.addOverrides( - mockTypeArray = mockTypedArray, - radiusTop = 1, - radiusBottom = 2, - multipleRadius = false) roundedCornerResDelegate.updateTuningSizeFactor(null, 2) assertEquals(Size(1, 1), roundedCornerResDelegate.topRoundedSize) |