From 0bfdf8bcac3f74d4068a3e986a7d0c05e43cfae9 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Tue, 15 Dec 2020 13:09:11 -0600 Subject: [PATCH] Update notif corner radii Has adjacent notif ? 0=>4dp : 20=>28dp Bug: 172289783 Test: visual Test: in sysui-studio, build with sysuiTestDebug variant and SystemUITests config, then run: adb shell am instrument -w -e class com.android.systemui.statusbar.notification.stack.NotificationRoundnessManagerTest com.android.systemui.tests Change-Id: I6926f26c1922a1736673ce8a675ae71fb06da6c0 --- packages/SystemUI/res/values/dimens.xml | 4 +-- .../stack/NotificationRoundnessManager.java | 10 ++++--- .../NotificationRoundnessManagerTest.java | 26 ++++++++++--------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index e1f7e7e567260..52b93eeaea909 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -176,8 +176,8 @@ 40dp - - 20dp + + 28dp 13dp diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java index 31600710057b0..079cf77767c00 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java @@ -20,12 +20,9 @@ import android.util.MathUtils; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; -import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.phone.KeyguardBypassController; -import com.android.systemui.statusbar.policy.HeadsUpManager; -import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import java.util.HashSet; @@ -48,6 +45,11 @@ public class NotificationRoundnessManager { private ExpandableNotificationRow mTrackedHeadsUp; private float mAppearFraction; + // Radius for notification corners WITH adjacent notifications + // as percent of radius WITHOUT adjacent notifications. + // TODO(b/175710408) pull from dimens and hide from beta builds. + static final float SMALL_CORNER_RADIUS = 4f/28; + @Inject NotificationRoundnessManager( KeyguardBypassController keyguardBypassController, @@ -126,7 +128,7 @@ public class NotificationRoundnessManager { if (view.showingPulsing() && !mBypassController.getBypassEnabled()) { return 1.0f; } - return 0.0f; + return SMALL_CORNER_RADIUS; } public void setExpanded(float expandedHeight, float appearFraction) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java index cb3e5e262df11..63bfd6ab25cc1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.stack; +import static com.android.systemui.statusbar.notification.stack.NotificationRoundnessManager.SMALL_CORNER_RADIUS; + import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -139,7 +141,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(null, null) }); Assert.assertEquals(1.0f, mSecond.getCurrentBottomRoundness(), 0.0f); - Assert.assertEquals(0.0f, mSecond.getCurrentTopRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mSecond.getCurrentTopRoundness(), 0.0f); } @Test @@ -166,8 +168,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { row.setHeadsUp(false); mRoundnessManager.updateView(entry.getRow(), false); - Assert.assertEquals(0f, row.getCurrentBottomRoundness(), 0.0f); - Assert.assertEquals(0f, row.getCurrentTopRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, row.getCurrentBottomRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, row.getCurrentTopRoundness(), 0.0f); } @Test @@ -177,7 +179,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(null, mSecond) }); Assert.assertEquals(1.0f, mSecond.getCurrentBottomRoundness(), 0.0f); - Assert.assertEquals(0.0f, mSecond.getCurrentTopRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mSecond.getCurrentTopRoundness(), 0.0f); } @Test @@ -186,7 +188,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(mFirst, mFirst), createSection(mSecond, null) }); - Assert.assertEquals(0.0f, mSecond.getCurrentBottomRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mSecond.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(1.0f, mSecond.getCurrentTopRoundness(), 0.0f); } @@ -196,7 +198,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(mFirst, null), createSection(null, null) }); - Assert.assertEquals(0.0f, mFirst.getCurrentBottomRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(1.0f, mFirst.getCurrentTopRoundness(), 0.0f); } @@ -206,8 +208,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(mSecond, mSecond), createSection(null, null) }); - Assert.assertEquals(0.0f, mFirst.getCurrentBottomRoundness(), 0.0f); - Assert.assertEquals(0.0f, mFirst.getCurrentTopRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentTopRoundness(), 0.0f); } @Test @@ -253,8 +255,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(mSecond, mSecond), createSection(null, null) }); - Assert.assertEquals(0.0f, mFirst.getCurrentBottomRoundness(), 0.0f); - Assert.assertEquals(0.0f, mFirst.getCurrentTopRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentTopRoundness(), 0.0f); } @Test @@ -303,8 +305,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { }); mFirst.setHeadsUpAnimatingAway(true); mFirst.setHeadsUpAnimatingAway(false); - Assert.assertEquals(0.0f, mFirst.getCurrentBottomRoundness(), 0.0f); - Assert.assertEquals(0.0f, mFirst.getCurrentTopRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); + Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentTopRoundness(), 0.0f); } @Test