Do not collapse the shade when clicking the last notification.

This CL prevents the shade from collapsing as soon as the user clicks a
notification which is auto-cancelled and was the last one shown. The
shade will still collapse, but at the end of the notification animation.

Bug: 181654098
Test: Manual
Change-Id: Ieb0e1005c8e096a53b97dd402fa4ef26cb38c7bf
This commit is contained in:
Jordan Demeulenaere
2021-03-22 14:46:49 +01:00
parent 07f3583061
commit 45fa3b3013

View File

@@ -24,6 +24,7 @@ import android.app.KeyguardManager;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.service.vr.IVrManager;
import android.service.vr.IVrStateCallbacks;
@@ -187,7 +188,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
boolean removedByUser,
int reason) {
StatusBarNotificationPresenter.this.onNotificationRemoved(
entry.getKey(), entry.getSbn());
entry.getKey(), entry.getSbn(), reason);
if (removedByUser) {
maybeEndAmbientPulse();
}
@@ -301,13 +302,14 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
mNotificationPanel.updateNotificationViews(reason);
}
public void onNotificationRemoved(String key, StatusBarNotification old) {
private void onNotificationRemoved(String key, StatusBarNotification old, int reason) {
if (SPEW) Log.d(TAG, "removeNotification key=" + key + " old=" + old);
if (old != null) {
if (CLOSE_PANEL_WHEN_EMPTIED && !hasActiveNotifications()
&& !mNotificationPanel.isTracking() && !mNotificationPanel.isQsExpanded()) {
if (mStatusBarStateController.getState() == StatusBarState.SHADE) {
if (mStatusBarStateController.getState() == StatusBarState.SHADE
&& reason != NotificationListenerService.REASON_CLICK) {
mCommandQueue.animateCollapsePanels();
} else if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED
&& !isCollapsing()) {