summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/aconfig/systemui.aconfig10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java51
3 files changed, 66 insertions, 1 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index 903c05526122..c5cf2d862465 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -186,6 +186,16 @@ flag {
}
flag {
+ name: "notifications_pinned_hun_in_shade"
+ namespace: "systemui"
+ description: "Fixes displaying pinned HUNs in the Shade, making sure that their y and z positions are correct."
+ bug: "385041854"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
name: "pss_app_selector_recents_split_screen"
namespace: "systemui"
description: "Allows recent apps selected for partial screenshare to be launched in split screen mode"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 5d7b8e6e8a84..ee8f9eabb9a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -21,6 +21,7 @@ import static android.app.Notification.Action.SEMANTIC_ACTION_MARK_CONVERSATION_
import static android.service.notification.NotificationListenerService.REASON_CANCEL;
import static com.android.systemui.flags.Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE;
+import static com.android.systemui.Flags.notificationsPinnedHunInShade;
import static com.android.systemui.statusbar.notification.collection.NotificationEntry.DismissState.PARENT_DISMISSED;
import static com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_HEADSUP;
import static com.android.systemui.statusbar.policy.RemoteInputView.FOCUS_ANIMATION_MIN_SCALE;
@@ -3184,7 +3185,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
@Override
public boolean mustStayOnScreen() {
- return mIsHeadsUp && mMustStayOnScreen;
+ // Must stay on screen in the open shade regardless how much the stack is scrolled if:
+ // 1. Is HUN and not marked as seen yet (isHeadsUp && mustStayOnScreen)
+ // 2. Is an FSI HUN (isPinned)
+ return mIsHeadsUp && mMustStayOnScreen || notificationsPinnedHunInShade() && isPinned();
}
/**
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index 5aee92939ed5..ce5058095562 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -941,6 +941,57 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
assertThat(row.getImageResolver().getContext()).isSameInstanceAs(userContext);
}
+ @Test
+ @EnableFlags(com.android.systemui.Flags.FLAG_NOTIFICATIONS_PINNED_HUN_IN_SHADE)
+ public void mustStayOnScreen_false() throws Exception {
+ final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
+ assertThat(row.mustStayOnScreen()).isFalse();
+ }
+
+ @Test
+ @EnableFlags(com.android.systemui.Flags.FLAG_NOTIFICATIONS_PINNED_HUN_IN_SHADE)
+ public void mustStayOnScreen_isHeadsUp_markedAsSeen() throws Exception {
+ final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
+ // When the row is a HUN
+ row.setHeadsUp(true);
+ //Then it must stay on screen
+ assertThat(row.mustStayOnScreen()).isTrue();
+ // And when the user has seen it
+ row.markHeadsUpSeen();
+ // Then it should NOT stay on screen anymore
+ assertThat(row.mustStayOnScreen()).isFalse();
+ }
+
+ @Test
+ @EnableFlags(com.android.systemui.Flags.FLAG_NOTIFICATIONS_PINNED_HUN_IN_SHADE)
+ public void mustStayOnScreen_isPinned_markedAsSeen() throws Exception {
+ final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
+ // When a HUN is pinned
+ row.setHeadsUp(true);
+ row.setPinnedStatus(PinnedStatus.PinnedBySystem);
+ //Then it must stay on screen
+ assertThat(row.mustStayOnScreen()).isTrue();
+ // And when the user has seen it
+ row.markHeadsUpSeen();
+ // Then it should still stay on screen
+ assertThat(row.mustStayOnScreen()).isTrue();
+ }
+
+ @Test
+ @DisableFlags(com.android.systemui.Flags.FLAG_NOTIFICATIONS_PINNED_HUN_IN_SHADE)
+ public void mustStayOnScreen_isPinned_markedAsSeen_false() throws Exception {
+ final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
+ // When a HUN is pinned
+ row.setHeadsUp(true);
+ row.setPinnedStatus(PinnedStatus.PinnedBySystem);
+ //Then it must stay on screen
+ assertThat(row.mustStayOnScreen()).isTrue();
+ // And when the user has seen it
+ row.markHeadsUpSeen();
+ // Then it should NOT stay on screen anymore
+ assertThat(row.mustStayOnScreen()).isFalse();
+ }
+
private void setDrawableIconsInImageView(CachingIconView icon, Drawable iconDrawable,
Drawable rightIconDrawable) {
ImageView iconView = mock(ImageView.class);