diff --git a/api/current.txt b/api/current.txt index 74953c234c5de..f21d18faf9b26 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37170,11 +37170,11 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final int REASON_APP_CANCEL = 8; // 0x8 field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9 + field public static final int REASON_CANCEL = 2; // 0x2 + field public static final int REASON_CANCEL_ALL = 3; // 0x3 field public static final int REASON_CHANNEL_BANNED = 17; // 0x11 - field public static final int REASON_DELEGATE_CANCEL = 2; // 0x2 - field public static final int REASON_DELEGATE_CANCEL_ALL = 3; // 0x3 - field public static final int REASON_DELEGATE_CLICK = 1; // 0x1 - field public static final int REASON_DELEGATE_ERROR = 4; // 0x4 + field public static final int REASON_CLICK = 1; // 0x1 + field public static final int REASON_ERROR = 4; // 0x4 field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc field public static final int REASON_LISTENER_CANCEL = 10; // 0xa diff --git a/api/system-current.txt b/api/system-current.txt index 7fc18d06df465..26d43e3891286 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40241,11 +40241,11 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final int REASON_APP_CANCEL = 8; // 0x8 field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9 + field public static final int REASON_CANCEL = 2; // 0x2 + field public static final int REASON_CANCEL_ALL = 3; // 0x3 field public static final int REASON_CHANNEL_BANNED = 17; // 0x11 - field public static final int REASON_DELEGATE_CANCEL = 2; // 0x2 - field public static final int REASON_DELEGATE_CANCEL_ALL = 3; // 0x3 - field public static final int REASON_DELEGATE_CLICK = 1; // 0x1 - field public static final int REASON_DELEGATE_ERROR = 4; // 0x4 + field public static final int REASON_CLICK = 1; // 0x1 + field public static final int REASON_ERROR = 4; // 0x4 field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc field public static final int REASON_LISTENER_CANCEL = 10; // 0xa diff --git a/api/test-current.txt b/api/test-current.txt index 670217029ddb8..49bab6f67f812 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37346,11 +37346,11 @@ package android.service.notification { field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0 field public static final int REASON_APP_CANCEL = 8; // 0x8 field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9 + field public static final int REASON_CANCEL = 2; // 0x2 + field public static final int REASON_CANCEL_ALL = 3; // 0x3 field public static final int REASON_CHANNEL_BANNED = 17; // 0x11 - field public static final int REASON_DELEGATE_CANCEL = 2; // 0x2 - field public static final int REASON_DELEGATE_CANCEL_ALL = 3; // 0x3 - field public static final int REASON_DELEGATE_CLICK = 1; // 0x1 - field public static final int REASON_DELEGATE_ERROR = 4; // 0x4 + field public static final int REASON_CLICK = 1; // 0x1 + field public static final int REASON_ERROR = 4; // 0x4 field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc field public static final int REASON_LISTENER_CANCEL = 10; // 0xa diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 70e0461ce73f3..f55c7cfb4ba54 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -149,13 +149,13 @@ public abstract class NotificationListenerService extends Service { // Notification cancellation reasons /** Notification was canceled by the status bar reporting a notification click. */ - public static final int REASON_DELEGATE_CLICK = 1; + public static final int REASON_CLICK = 1; /** Notification was canceled by the status bar reporting a user dismissal. */ - public static final int REASON_DELEGATE_CANCEL = 2; + public static final int REASON_CANCEL = 2; /** Notification was canceled by the status bar reporting a user dismiss all. */ - public static final int REASON_DELEGATE_CANCEL_ALL = 3; + public static final int REASON_CANCEL_ALL = 3; /** Notification was canceled by the status bar reporting an inflation error. */ - public static final int REASON_DELEGATE_ERROR = 4; + public static final int REASON_ERROR = 4; /** Notification was canceled by the package manager modifying the package. */ public static final int REASON_PACKAGE_CHANGED = 5; /** Notification was canceled by the owning user context being stopped. */ diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 82809469d89cc..3dcc5d997e080 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -22,10 +22,10 @@ import static android.content.pm.PackageManager.FEATURE_TELEVISION; import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL_ALL; import static android.service.notification.NotificationListenerService.REASON_CHANNEL_BANNED; -import static android.service.notification.NotificationListenerService.REASON_DELEGATE_CANCEL; -import static android.service.notification.NotificationListenerService.REASON_DELEGATE_CANCEL_ALL; -import static android.service.notification.NotificationListenerService.REASON_DELEGATE_CLICK; -import static android.service.notification.NotificationListenerService.REASON_DELEGATE_ERROR; +import static android.service.notification.NotificationListenerService.REASON_CANCEL; +import static android.service.notification.NotificationListenerService.REASON_CANCEL_ALL; +import static android.service.notification.NotificationListenerService.REASON_CLICK; +import static android.service.notification.NotificationListenerService.REASON_ERROR; import static android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED; import static android.service.notification.NotificationListenerService.REASON_LISTENER_CANCEL; import static android.service.notification.NotificationListenerService.REASON_LISTENER_CANCEL_ALL; @@ -88,7 +88,6 @@ import android.database.ContentObserver; import android.media.AudioManager; import android.media.AudioManagerInternal; import android.media.IRingtonePlayer; -import android.metrics.LogMaker; import android.net.Uri; import android.os.Binder; import android.os.Bundle; @@ -159,8 +158,6 @@ import com.android.server.notification.ManagedServices.UserProfiles; import libcore.io.IoUtils; -import com.google.android.collect.Lists; - import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; @@ -181,7 +178,6 @@ import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -545,7 +541,7 @@ public class NotificationManagerService extends SystemService { @Override public void onClearAll(int callingUid, int callingPid, int userId) { synchronized (mNotificationLock) { - cancelAllLocked(callingUid, callingPid, userId, REASON_DELEGATE_CANCEL_ALL, null, + cancelAllLocked(callingUid, callingPid, userId, REASON_CANCEL_ALL, null, /*includeCurrentProfiles*/ true); } } @@ -569,7 +565,7 @@ public class NotificationManagerService extends SystemService { cancelNotification(callingUid, callingPid, sbn.getPackageName(), sbn.getTag(), sbn.getId(), Notification.FLAG_AUTO_CANCEL, Notification.FLAG_FOREGROUND_SERVICE, false, r.getUserId(), - REASON_DELEGATE_CLICK, null); + REASON_CLICK, null); } } @@ -598,7 +594,7 @@ public class NotificationManagerService extends SystemService { String pkg, String tag, int id, int userId) { cancelNotification(callingUid, callingPid, pkg, tag, id, 0, Notification.FLAG_ONGOING_EVENT | Notification.FLAG_FOREGROUND_SERVICE, - true, userId, REASON_DELEGATE_CANCEL, null); + true, userId, REASON_CANCEL, null); } @Override @@ -633,7 +629,7 @@ public class NotificationManagerService extends SystemService { Slog.d(TAG, "onNotification error pkg=" + pkg + " tag=" + tag + " id=" + id + "; will crashApplication(uid=" + uid + ", pid=" + initialPid + ")"); cancelNotification(callingUid, callingPid, pkg, tag, id, 0, 0, false, userId, - REASON_DELEGATE_ERROR, null); + REASON_ERROR, null); long ident = Binder.clearCallingIdentity(); try { ActivityManager.getService().crashApplication(uid, initialPid, pkg, -1, @@ -3377,7 +3373,7 @@ public class NotificationManagerService extends SystemService { Slog.e(TAG, "Not posting notification without small icon: " + notification); if (old != null && !old.isCanceled) { mListeners.notifyRemovedLocked(n, - NotificationListenerService.REASON_DELEGATE_ERROR); + NotificationListenerService.REASON_ERROR); mHandler.post(new Runnable() { @Override public void run() { @@ -4024,8 +4020,8 @@ public class NotificationManagerService extends SystemService { // Record usage stats // TODO: add unbundling stats? switch (reason) { - case REASON_DELEGATE_CANCEL: - case REASON_DELEGATE_CANCEL_ALL: + case REASON_CANCEL: + case REASON_CANCEL_ALL: case REASON_LISTENER_CANCEL: case REASON_LISTENER_CANCEL_ALL: mUsageStats.registerDismissedByUser(r); @@ -4085,7 +4081,7 @@ public class NotificationManagerService extends SystemService { // Ideally we'd do this in the caller of this method. However, that would // require the caller to also find the notification. - if (reason == REASON_DELEGATE_CLICK) { + if (reason == REASON_CLICK) { mUsageStats.registerClickedByUser(r); }