summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Reynolds <juliacr@google.com> 2023-03-30 12:43:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-03-30 12:43:45 +0000
commitecb1be12b906d6bec742d1d44d8d36b159edd0db (patch)
treed61c50192f2e433feea55892f5bb288da9a5e339
parentd23967c6ea7bdc9cabd29c35573989d165e1eacc (diff)
parent45fe7840bfe16b0d8f7d3b4fe75187c420a3fe91 (diff)
Merge "Pin HUNs while guts are visible" into udc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java24
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java10
4 files changed, 29 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index 46f1bb5ebd6f..e6e6b9950d40 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -65,6 +65,7 @@ import com.android.systemui.statusbar.notification.collection.render.NotifGutsVi
import com.android.systemui.statusbar.notification.collection.render.NotifGutsViewManager;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.CentralSurfaces;
+import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.wmshell.BubblesManager;
@@ -119,6 +120,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
private final UiEventLogger mUiEventLogger;
private final ShadeController mShadeController;
private NotifGutsViewListener mGutsListener;
+ private final HeadsUpManagerPhone mHeadsUpManagerPhone;
@Inject
public NotificationGutsManager(Context context,
@@ -141,7 +143,8 @@ public class NotificationGutsManager implements NotifGutsViewManager {
NotificationLockscreenUserManager notificationLockscreenUserManager,
StatusBarStateController statusBarStateController,
DeviceProvisionedController deviceProvisionedController,
- MetricsLogger metricsLogger) {
+ MetricsLogger metricsLogger,
+ HeadsUpManagerPhone headsUpManagerPhone) {
mContext = context;
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
mMainHandler = mainHandler;
@@ -163,6 +166,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
mStatusBarStateController = statusBarStateController;
mDeviceProvisionedController = deviceProvisionedController;
mMetricsLogger = metricsLogger;
+ mHeadsUpManagerPhone = headsUpManagerPhone;
}
public void setUpWithPresenter(NotificationPresenter presenter,
@@ -259,7 +263,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
if (mGutsListener != null) {
mGutsListener.onGutsClose(entry);
}
- String key = entry.getKey();
+ mHeadsUpManagerPhone.setGutsShown(row.getEntry(), false);
});
View gutsView = item.getGutsView();
@@ -420,7 +424,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
}
/**
- * Sets up the {@link ConversationInfo} inside the notification row's guts.
+ * Sets up the {@link NotificationConversationInfo} inside the notification row's guts.
* @param row view to set up the guts for
* @param notificationInfoView view to set up/bind within {@code row}
*/
@@ -641,6 +645,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
row.closeRemoteInput();
mListContainer.onHeightChanged(row, true /* needsAnimation */);
mGutsMenuItem = menuItem;
+ mHeadsUpManagerPhone.setGutsShown(row.getEntry(), true);
}
};
guts.post(mOpenRunnable);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 1b4971717886..792746c60134 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -370,11 +370,6 @@ public class NotificationStackScrollLayoutController {
if (translatingParentView != null && row == translatingParentView) {
mSwipeHelper.clearExposedMenuView();
mSwipeHelper.clearTranslatingParentView();
- if (row instanceof ExpandableNotificationRow) {
- mHeadsUpManager.setMenuShown(
- ((ExpandableNotificationRow) row).getEntry(), false);
-
- }
}
}
@@ -385,7 +380,6 @@ public class NotificationStackScrollLayoutController {
mMetricsLogger.write(notificationRow.getEntry().getSbn().getLogMaker()
.setCategory(MetricsEvent.ACTION_REVEAL_GEAR)
.setType(MetricsEvent.TYPE_ACTION));
- mHeadsUpManager.setMenuShown(notificationRow.getEntry(), true);
mSwipeHelper.onMenuShown(row);
mNotificationGutsManager.closeAndSaveGuts(true /* removeLeavebehind */,
false /* force */, false /* removeControls */, -1 /* x */, -1 /* y */,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 3743fff3aaf7..1a84dde0384c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -271,13 +271,15 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
}
/**
- * Sets whether an entry's menu row is exposed and therefore it should stick in the heads up
+ * Sets whether an entry's guts are exposed and therefore it should stick in the heads up
* area if it's pinned until it's hidden again.
*/
- public void setMenuShown(@NonNull NotificationEntry entry, boolean menuShown) {
+ public void setGutsShown(@NonNull NotificationEntry entry, boolean gutsShown) {
HeadsUpEntry headsUpEntry = getHeadsUpEntry(entry.getKey());
- if (headsUpEntry instanceof HeadsUpEntryPhone && entry.isRowPinned()) {
- ((HeadsUpEntryPhone) headsUpEntry).setMenuShownPinned(menuShown);
+ if (!(headsUpEntry instanceof HeadsUpEntryPhone)) return;
+ HeadsUpEntryPhone headsUpEntryPhone = (HeadsUpEntryPhone)headsUpEntry;
+ if (entry.isRowPinned() || !gutsShown) {
+ headsUpEntryPhone.setGutsShownPinned(gutsShown);
}
}
@@ -411,7 +413,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
protected class HeadsUpEntryPhone extends HeadsUpManager.HeadsUpEntry {
- private boolean mMenuShownPinned;
+ private boolean mGutsShownPinned;
/**
* If the time this entry has been on was extended
@@ -421,7 +423,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
@Override
public boolean isSticky() {
- return super.isSticky() || mMenuShownPinned;
+ return super.isSticky() || mGutsShownPinned;
}
public void setEntry(@NonNull final NotificationEntry entry) {
@@ -469,13 +471,13 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
}
}
- public void setMenuShownPinned(boolean menuShownPinned) {
- if (mMenuShownPinned == menuShownPinned) {
+ public void setGutsShownPinned(boolean gutsShownPinned) {
+ if (mGutsShownPinned == gutsShownPinned) {
return;
}
- mMenuShownPinned = menuShownPinned;
- if (menuShownPinned) {
+ mGutsShownPinned = gutsShownPinned;
+ if (gutsShownPinned) {
removeAutoRemovalCallbacks();
} else {
updateEntry(false /* updatePostTime */);
@@ -485,7 +487,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
@Override
public void reset() {
super.reset();
- mMenuShownPinned = false;
+ mGutsShownPinned = false;
extended = false;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index 3d8a74466a5c..4bb2c8740d44 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -81,6 +81,7 @@ import com.android.systemui.statusbar.notification.people.PeopleNotificationIden
import com.android.systemui.statusbar.notification.row.NotificationGutsManager.OnSettingsClickListener;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.CentralSurfaces;
+import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.wmshell.BubblesManager;
@@ -134,6 +135,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
@Mock private AssistantFeedbackController mAssistantFeedbackController;
@Mock private NotificationLockscreenUserManager mNotificationLockscreenUserManager;
@Mock private StatusBarStateController mStatusBarStateController;
+ @Mock private HeadsUpManagerPhone mHeadsUpManagerPhone;
@Before
public void setUp() {
@@ -153,7 +155,8 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
mNotificationLockscreenUserManager,
mStatusBarStateController,
mDeviceProvisionedController,
- mMetricsLogger);
+ mMetricsLogger,
+ mHeadsUpManagerPhone);
mGutsManager.setUpWithPresenter(mPresenter, mNotificationListContainer,
mOnSettingsClickListener);
mGutsManager.setNotificationActivityStarter(mNotificationActivityStarter);
@@ -192,12 +195,15 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
anyInt(),
anyBoolean(),
any(Runnable.class));
+ verify(mHeadsUpManagerPhone).setGutsShown(realRow.getEntry(), true);
assertEquals(View.VISIBLE, guts.getVisibility());
- mGutsManager.closeAndSaveGuts(false, false, false, 0, 0, false);
+ mGutsManager.closeAndSaveGuts(false, false, true, 0, 0, false);
verify(guts).closeControls(anyBoolean(), anyBoolean(), anyInt(), anyInt(), anyBoolean());
verify(row, times(1)).setGutsView(any());
+ mTestableLooper.processAllMessages();
+ verify(mHeadsUpManagerPhone).setGutsShown(realRow.getEntry(), false);
}
@Test