Simplify onNotificationClear signature
Change-Id: Ib944418dea78fb090c70206c34519f9248a02c04 Test: NotifCollectionTest and NotificationManagerServiceTest Bug: 172575678
This commit is contained in:
@@ -67,7 +67,7 @@ interface IStatusBarService
|
||||
void onNotificationError(String pkg, String tag, int id,
|
||||
int uid, int initialPid, String message, int userId);
|
||||
void onClearAllNotifications(int userId);
|
||||
void onNotificationClear(String pkg, String tag, int id, int userId, String key,
|
||||
void onNotificationClear(String pkg, int userId, String key,
|
||||
int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv);
|
||||
void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys,
|
||||
in NotificationVisibility[] noLongerVisibleKeys);
|
||||
|
||||
@@ -548,8 +548,6 @@ public class NotificationEntryManager implements
|
||||
try {
|
||||
mStatusBarService.onNotificationClear(
|
||||
notification.getPackageName(),
|
||||
notification.getTag(),
|
||||
notification.getId(),
|
||||
notification.getUser().getIdentifier(),
|
||||
notification.getKey(),
|
||||
dismissedByUserStats.dismissalSurface,
|
||||
|
||||
@@ -254,8 +254,6 @@ public class NotifCollection implements Dumpable {
|
||||
try {
|
||||
mStatusBarService.onNotificationClear(
|
||||
entry.getSbn().getPackageName(),
|
||||
entry.getSbn().getTag(),
|
||||
entry.getSbn().getId(),
|
||||
entry.getSbn().getUser().getIdentifier(),
|
||||
entry.getSbn().getKey(),
|
||||
stats.dismissalSurface,
|
||||
|
||||
@@ -377,8 +377,6 @@ public class NotifCollectionTest extends SysuiTestCase {
|
||||
// THEN we send the dismissal to system server
|
||||
verify(mStatusBarService).onNotificationClear(
|
||||
notif2.sbn.getPackageName(),
|
||||
notif2.sbn.getTag(),
|
||||
88,
|
||||
notif2.sbn.getUser().getIdentifier(),
|
||||
notif2.sbn.getKey(),
|
||||
stats.dismissalSurface,
|
||||
@@ -528,8 +526,6 @@ public class NotifCollectionTest extends SysuiTestCase {
|
||||
// THEN we never send the dismissal to system server
|
||||
verify(mStatusBarService, never()).onNotificationClear(
|
||||
notif.sbn.getPackageName(),
|
||||
notif.sbn.getTag(),
|
||||
47,
|
||||
notif.sbn.getUser().getIdentifier(),
|
||||
notif.sbn.getKey(),
|
||||
stats.dismissalSurface,
|
||||
@@ -566,8 +562,6 @@ public class NotifCollectionTest extends SysuiTestCase {
|
||||
// THEN the notification is never sent to system server to dismiss
|
||||
verify(mStatusBarService, never()).onNotificationClear(
|
||||
eq(notif.sbn.getPackageName()),
|
||||
eq(notif.sbn.getTag()),
|
||||
eq(47),
|
||||
eq(notif.sbn.getUser().getIdentifier()),
|
||||
eq(notif.sbn.getKey()),
|
||||
anyInt(),
|
||||
@@ -596,8 +590,6 @@ public class NotifCollectionTest extends SysuiTestCase {
|
||||
// THEN we send the dismissal to system server
|
||||
verify(mStatusBarService).onNotificationClear(
|
||||
eq(notif.sbn.getPackageName()),
|
||||
eq(notif.sbn.getTag()),
|
||||
eq(47),
|
||||
eq(notif.sbn.getUser().getIdentifier()),
|
||||
eq(notif.sbn.getKey()),
|
||||
anyInt(),
|
||||
@@ -1125,8 +1117,6 @@ public class NotifCollectionTest extends SysuiTestCase {
|
||||
// THEN we send the dismissals to system server
|
||||
verify(mStatusBarService).onNotificationClear(
|
||||
notif1.sbn.getPackageName(),
|
||||
notif1.sbn.getTag(),
|
||||
47,
|
||||
notif1.sbn.getUser().getIdentifier(),
|
||||
notif1.sbn.getKey(),
|
||||
stats1.dismissalSurface,
|
||||
@@ -1135,8 +1125,6 @@ public class NotifCollectionTest extends SysuiTestCase {
|
||||
|
||||
verify(mStatusBarService).onNotificationClear(
|
||||
notif2.sbn.getPackageName(),
|
||||
notif2.sbn.getTag(),
|
||||
88,
|
||||
notif2.sbn.getUser().getIdentifier(),
|
||||
notif2.sbn.getKey(),
|
||||
stats2.dismissalSurface,
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface NotificationDelegate {
|
||||
void onNotificationActionClick(int callingUid, int callingPid, String key, int actionIndex,
|
||||
Notification.Action action, NotificationVisibility nv, boolean generatedByAssistant);
|
||||
void onNotificationClear(int callingUid, int callingPid,
|
||||
String pkg, String tag, int id, int userId, String key,
|
||||
String pkg, int userId, String key,
|
||||
@NotificationStats.DismissalSurface int dismissalSurface,
|
||||
@NotificationStats.DismissalSentiment int dismissalSentiment,
|
||||
NotificationVisibility nv);
|
||||
|
||||
@@ -1044,15 +1044,19 @@ public class NotificationManagerService extends SystemService {
|
||||
|
||||
@Override
|
||||
public void onNotificationClear(int callingUid, int callingPid,
|
||||
String pkg, String tag, int id, int userId, String key,
|
||||
String pkg, int userId, String key,
|
||||
@NotificationStats.DismissalSurface int dismissalSurface,
|
||||
@NotificationStats.DismissalSentiment int dismissalSentiment,
|
||||
NotificationVisibility nv) {
|
||||
String tag = null;
|
||||
int id = 0;
|
||||
synchronized (mNotificationLock) {
|
||||
NotificationRecord r = mNotificationsByKey.get(key);
|
||||
if (r != null) {
|
||||
r.recordDismissalSurface(dismissalSurface);
|
||||
r.recordDismissalSentiment(dismissalSentiment);
|
||||
tag = r.getSbn().getTag();
|
||||
id = r.getSbn().getId();
|
||||
}
|
||||
}
|
||||
cancelNotification(callingUid, callingPid, pkg, tag, id, 0,
|
||||
|
||||
@@ -1336,7 +1336,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotificationClear(String pkg, String tag, int id, int userId, String key,
|
||||
public void onNotificationClear(String pkg, int userId, String key,
|
||||
@NotificationStats.DismissalSurface int dismissalSurface,
|
||||
@NotificationStats.DismissalSentiment int dismissalSentiment,
|
||||
NotificationVisibility nv) {
|
||||
@@ -1345,7 +1345,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
final int callingPid = Binder.getCallingPid();
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mNotificationDelegate.onNotificationClear(callingUid, callingPid, pkg, tag, id, userId,
|
||||
mNotificationDelegate.onNotificationClear(callingUid, callingPid, pkg, userId,
|
||||
key, dismissalSurface, dismissalSentiment, nv);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
|
||||
@@ -3671,8 +3671,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
mService.addNotification(r);
|
||||
|
||||
final NotificationVisibility nv = NotificationVisibility.obtain(r.getKey(), 0, 1, true);
|
||||
mService.mNotificationDelegate.onNotificationClear(mUid, 0, PKG, r.getSbn().getTag(),
|
||||
r.getSbn().getId(), r.getUserId(), r.getKey(), NotificationStats.DISMISSAL_AOD,
|
||||
mService.mNotificationDelegate.onNotificationClear(mUid, 0, PKG, r.getUserId(),
|
||||
r.getKey(), NotificationStats.DISMISSAL_AOD,
|
||||
NotificationStats.DISMISS_SENTIMENT_POSITIVE, nv);
|
||||
waitForIdle();
|
||||
|
||||
@@ -3694,8 +3694,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
mService.addNotification(r);
|
||||
|
||||
final NotificationVisibility nv = NotificationVisibility.obtain(r.getKey(), 0, 1, true);
|
||||
mService.mNotificationDelegate.onNotificationClear(mUid, 0, PKG, r.getSbn().getTag(),
|
||||
r.getSbn().getId(), r.getUserId(), r.getKey(), NotificationStats.DISMISSAL_AOD,
|
||||
mService.mNotificationDelegate.onNotificationClear(mUid, 0, PKG, r.getUserId(),
|
||||
r.getKey(), NotificationStats.DISMISSAL_AOD,
|
||||
NotificationStats.DISMISS_SENTIMENT_NEGATIVE, nv);
|
||||
waitForIdle();
|
||||
|
||||
@@ -6693,8 +6693,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
final NotificationVisibility nv = NotificationVisibility.obtain(nrSummary.getKey(), 1, 2,
|
||||
true);
|
||||
mService.mNotificationDelegate.onNotificationClear(mUid, 0, PKG,
|
||||
nrSummary.getSbn().getTag(),
|
||||
nrSummary.getSbn().getId(), nrSummary.getUserId(), nrSummary.getKey(),
|
||||
nrSummary.getUserId(), nrSummary.getKey(),
|
||||
NotificationStats.DISMISSAL_SHADE,
|
||||
NotificationStats.DISMISS_SENTIMENT_NEUTRAL, nv);
|
||||
waitForIdle();
|
||||
|
||||
Reference in New Issue
Block a user