Merge "Pin HUNs while guts are visible" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ecb1be12b9
@@ -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);
|
||||
|
||||
@@ -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 */,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user