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