Merge "Move notification shade changes into GX Overlay." into sc-dev am: 69ed0779b4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13418388

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7e6397b58431e276c809a6b63b9258929c52c9bb
This commit is contained in:
Jeff DeCew
2021-01-28 14:02:51 +00:00
committed by Automerger Merge Worker
7 changed files with 45 additions and 32 deletions

View File

@@ -351,7 +351,7 @@
<bool name="config_showNotificationGear">true</bool> <bool name="config_showNotificationGear">true</bool>
<!-- Whether or not a background should be drawn behind a notification. --> <!-- Whether or not a background should be drawn behind a notification. -->
<bool name="config_drawNotificationBackground">false</bool> <bool name="config_drawNotificationBackground">true</bool>
<!-- Whether or the notifications can be shown and dismissed with a drag. --> <!-- Whether or the notifications can be shown and dismissed with a drag. -->
<bool name="config_enableNotificationShadeDrag">true</bool> <bool name="config_enableNotificationShadeDrag">true</bool>

View File

@@ -155,7 +155,7 @@
<dimen name="notification_max_heads_up_height_increased">188dp</dimen> <dimen name="notification_max_heads_up_height_increased">188dp</dimen>
<!-- Side padding on the lockscreen on the side of notifications --> <!-- Side padding on the lockscreen on the side of notifications -->
<dimen name="notification_side_paddings">16dp</dimen> <dimen name="notification_side_paddings">4dp</dimen>
<!-- padding between the heads up and the statusbar --> <!-- padding between the heads up and the statusbar -->
<dimen name="heads_up_status_bar_padding">8dp</dimen> <dimen name="heads_up_status_bar_padding">8dp</dimen>
@@ -177,7 +177,10 @@
<dimen name="notification_min_interaction_height">40dp</dimen> <dimen name="notification_min_interaction_height">40dp</dimen>
<!-- Radius for notifications corners without adjacent notifications --> <!-- Radius for notifications corners without adjacent notifications -->
<dimen name="notification_corner_radius">28dp</dimen> <dimen name="notification_corner_radius">8dp</dimen>
<!-- Radius for notifications corners with adjacent notifications -->
<dimen name="notification_corner_radius_small">0dp</dimen>
<!-- the padding of the shelf icon container --> <!-- the padding of the shelf icon container -->
<dimen name="shelf_icon_container_padding">13dp</dimen> <dimen name="shelf_icon_container_padding">13dp</dimen>
@@ -619,7 +622,7 @@
<dimen name="z_distance_between_notifications">0.5dp</dimen> <dimen name="z_distance_between_notifications">0.5dp</dimen>
<!-- The height of the divider between the individual notifications. --> <!-- The height of the divider between the individual notifications. -->
<dimen name="notification_divider_height">2dp</dimen> <dimen name="notification_divider_height">1dp</dimen>
<!-- The corner radius of the shadow behind the notification. --> <!-- The corner radius of the shadow behind the notification. -->
<dimen name="notification_shadow_radius">0dp</dimen> <dimen name="notification_shadow_radius">0dp</dimen>
@@ -632,7 +635,7 @@
<dimen name="notification_children_container_divider_height">0.5dp</dimen> <dimen name="notification_children_container_divider_height">0.5dp</dimen>
<!-- The horizontal margin of the content in the notification shade --> <!-- The horizontal margin of the content in the notification shade -->
<dimen name="notification_shade_content_margin_horizontal">16dp</dimen> <dimen name="notification_shade_content_margin_horizontal">4dp</dimen>
<!-- The top margin for the notification children container in its non-expanded form. --> <!-- The top margin for the notification children container in its non-expanded form. -->
<dimen name="notification_children_container_margin_top"> <dimen name="notification_children_container_margin_top">

View File

@@ -20,6 +20,8 @@
<bool name="flag_notification_pipeline2">false</bool> <bool name="flag_notification_pipeline2">false</bool>
<bool name="flag_notification_pipeline2_rendering">false</bool> <bool name="flag_notification_pipeline2_rendering">false</bool>
<bool name="flag_notif_updates">false</bool>
<bool name="flag_shade_is_opaque">false</bool> <bool name="flag_shade_is_opaque">false</bool>
<!-- b/171917882 --> <!-- b/171917882 -->

View File

@@ -302,8 +302,12 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
} else { } else {
mMenuContainer = new FrameLayout(mContext); mMenuContainer = new FrameLayout(mContext);
} }
final boolean newFlowHideShelf = Settings.Global.getInt(mContext.getContentResolver(), // The setting can win (which is needed for tests) but if not set, then use the flag
Settings.Global.SHOW_NEW_NOTIF_DISMISS, 1 /* on by default */) == 1; final int showDismissSetting = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.SHOW_NEW_NOTIF_DISMISS, -1);
final boolean newFlowHideShelf = showDismissSetting == -1
? mContext.getResources().getBoolean(R.bool.flag_notif_updates)
: showDismissSetting == 1;
if (newFlowHideShelf) { if (newFlowHideShelf) {
return; return;
} }

View File

@@ -16,8 +16,10 @@
package com.android.systemui.statusbar.notification.stack; package com.android.systemui.statusbar.notification.stack;
import android.content.res.Resources;
import android.util.MathUtils; import android.util.MathUtils;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -45,11 +47,6 @@ public class NotificationRoundnessManager {
private ExpandableNotificationRow mTrackedHeadsUp; private ExpandableNotificationRow mTrackedHeadsUp;
private float mAppearFraction; 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 @Inject
NotificationRoundnessManager( NotificationRoundnessManager(
KeyguardBypassController keyguardBypassController, KeyguardBypassController keyguardBypassController,
@@ -128,7 +125,9 @@ public class NotificationRoundnessManager {
if (view.showingPulsing() && !mBypassController.getBypassEnabled()) { if (view.showingPulsing() && !mBypassController.getBypassEnabled()) {
return 1.0f; return 1.0f;
} }
return SMALL_CORNER_RADIUS; final Resources resources = view.getResources();
return resources.getDimension(R.dimen.notification_corner_radius_small)
/ resources.getDimension(R.dimen.notification_corner_radius);
} }
public void setExpanded(float expandedHeight, float appearFraction) { public void setExpanded(float expandedHeight, float appearFraction) {

View File

@@ -41,8 +41,6 @@ import android.graphics.Color;
import android.graphics.Outline; import android.graphics.Outline;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserHandle; import android.os.UserHandle;
@@ -503,7 +501,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mSections = mSectionsManager.createSectionsForBuckets(); mSections = mSectionsManager.createSectionsForBuckets();
mAmbientState = new AmbientState(context, mSectionsManager); mAmbientState = new AmbientState(context, mSectionsManager);
mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackground).getDefaultColor(); mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackgroundFloating)
.getDefaultColor();
int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height); int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height); int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
mExpandHelper = new ExpandHelper(getContext(), mExpandHelperCallback, mExpandHelper = new ExpandHelper(getContext(), mExpandHelperCallback,
@@ -623,7 +622,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
} }
void updateBgColor() { void updateBgColor() {
mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackground).getDefaultColor(); mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackgroundFloating)
.getDefaultColor();
updateBackgroundDimming(); updateBackgroundDimming();
mShelf.onUiModeChanged(); mShelf.onUiModeChanged();
} }
@@ -2282,7 +2282,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (child.getVisibility() != View.GONE if (child.getVisibility() != View.GONE
&& !(child instanceof StackScrollerDecorView) && !(child instanceof StackScrollerDecorView)
&& child != mShelf && child != mShelf
&& mSwipeHelper.getSwipedView() != child) { && (mSwipeHelper.getSwipedView() != child
|| !child.getResources().getBoolean(R.bool.flag_notif_updates))) {
children.add(child); children.add(child);
} }
} }

View File

@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.notification.stack; 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.atLeast;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
@@ -25,12 +23,14 @@ import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.content.res.Resources;
import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper; import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableLooper.RunWithLooper;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -61,10 +61,14 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
private ExpandableNotificationRow mSecond; private ExpandableNotificationRow mSecond;
@Mock @Mock
private KeyguardBypassController mBypassController; private KeyguardBypassController mBypassController;
private float mSmallRadiusRatio;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
final Resources resources = mContext.getResources();
mSmallRadiusRatio = resources.getDimension(R.dimen.notification_corner_radius_small)
/ resources.getDimension(R.dimen.notification_corner_radius);
mRoundnessManager = new NotificationRoundnessManager( mRoundnessManager = new NotificationRoundnessManager(
mBypassController, mBypassController,
new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext)); new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext));
@@ -141,7 +145,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
createSection(null, null) createSection(null, null)
}); });
Assert.assertEquals(1.0f, mSecond.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(1.0f, mSecond.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(SMALL_CORNER_RADIUS, mSecond.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mSecond.getCurrentTopRoundness(), 0.0f);
} }
@Test @Test
@@ -168,8 +172,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
row.setHeadsUp(false); row.setHeadsUp(false);
mRoundnessManager.updateView(entry.getRow(), false); mRoundnessManager.updateView(entry.getRow(), false);
Assert.assertEquals(SMALL_CORNER_RADIUS, row.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, row.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(SMALL_CORNER_RADIUS, row.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, row.getCurrentTopRoundness(), 0.0f);
} }
@Test @Test
@@ -179,7 +183,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
createSection(null, mSecond) createSection(null, mSecond)
}); });
Assert.assertEquals(1.0f, mSecond.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(1.0f, mSecond.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(SMALL_CORNER_RADIUS, mSecond.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mSecond.getCurrentTopRoundness(), 0.0f);
} }
@Test @Test
@@ -188,7 +192,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
createSection(mFirst, mFirst), createSection(mFirst, mFirst),
createSection(mSecond, null) createSection(mSecond, null)
}); });
Assert.assertEquals(SMALL_CORNER_RADIUS, mSecond.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mSecond.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(1.0f, mSecond.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(1.0f, mSecond.getCurrentTopRoundness(), 0.0f);
} }
@@ -198,7 +202,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
createSection(mFirst, null), createSection(mFirst, null),
createSection(null, null) createSection(null, null)
}); });
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(1.0f, mFirst.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(1.0f, mFirst.getCurrentTopRoundness(), 0.0f);
} }
@@ -208,8 +212,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
createSection(mSecond, mSecond), createSection(mSecond, mSecond),
createSection(null, null) createSection(null, null)
}); });
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentTopRoundness(), 0.0f);
} }
@Test @Test
@@ -255,8 +259,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
createSection(mSecond, mSecond), createSection(mSecond, mSecond),
createSection(null, null) createSection(null, null)
}); });
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentTopRoundness(), 0.0f);
} }
@Test @Test
@@ -305,8 +309,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
}); });
mFirst.setHeadsUpAnimatingAway(true); mFirst.setHeadsUpAnimatingAway(true);
mFirst.setHeadsUpAnimatingAway(false); mFirst.setHeadsUpAnimatingAway(false);
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentBottomRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentBottomRoundness(), 0.0f);
Assert.assertEquals(SMALL_CORNER_RADIUS, mFirst.getCurrentTopRoundness(), 0.0f); Assert.assertEquals(mSmallRadiusRatio, mFirst.getCurrentTopRoundness(), 0.0f);
} }
@Test @Test