am 5579ec33: DO NOT MERGE Enhance the NotificationListenerService api.
* commit '5579ec33eb317a19ad80929169b2b329b147d98b': DO NOT MERGE Enhance the NotificationListenerService api.
This commit is contained in:
@@ -22886,8 +22886,11 @@ package android.service.notification {
|
|||||||
ctor public NotificationListenerService();
|
ctor public NotificationListenerService();
|
||||||
method public final void cancelAllNotifications();
|
method public final void cancelAllNotifications();
|
||||||
method public final void cancelNotification(java.lang.String, java.lang.String, int);
|
method public final void cancelNotification(java.lang.String, java.lang.String, int);
|
||||||
|
method public final void cancelNotifications(java.lang.String[]);
|
||||||
method public android.service.notification.StatusBarNotification[] getActiveNotifications();
|
method public android.service.notification.StatusBarNotification[] getActiveNotifications();
|
||||||
|
method public android.service.notification.StatusBarNotification[] getActiveNotifications(java.lang.String[]);
|
||||||
method public android.os.IBinder onBind(android.content.Intent);
|
method public android.os.IBinder onBind(android.content.Intent);
|
||||||
|
method public void onListenerConnected(java.lang.String[]);
|
||||||
method public abstract void onNotificationPosted(android.service.notification.StatusBarNotification);
|
method public abstract void onNotificationPosted(android.service.notification.StatusBarNotification);
|
||||||
method public abstract void onNotificationRemoved(android.service.notification.StatusBarNotification);
|
method public abstract void onNotificationRemoved(android.service.notification.StatusBarNotification);
|
||||||
field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
|
field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
|
||||||
@@ -22899,6 +22902,7 @@ package android.service.notification {
|
|||||||
method public android.service.notification.StatusBarNotification clone();
|
method public android.service.notification.StatusBarNotification clone();
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public int getId();
|
method public int getId();
|
||||||
|
method public java.lang.String getKey();
|
||||||
method public android.app.Notification getNotification();
|
method public android.app.Notification getNotification();
|
||||||
method public java.lang.String getPackageName();
|
method public java.lang.String getPackageName();
|
||||||
method public long getPostTime();
|
method public long getPostTime();
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ interface INotificationManager
|
|||||||
void unregisterListener(in INotificationListener listener, int userid);
|
void unregisterListener(in INotificationListener listener, int userid);
|
||||||
|
|
||||||
void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
|
void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
|
||||||
void cancelAllNotificationsFromListener(in INotificationListener token);
|
void cancelNotificationsFromListener(in INotificationListener token, in String[] keys);
|
||||||
|
|
||||||
StatusBarNotification[] getActiveNotificationsFromListener(in INotificationListener token);
|
StatusBarNotification[] getActiveNotificationsFromListener(in INotificationListener token, in String[] keys);
|
||||||
|
String[] getActiveNotificationKeysFromListener(in INotificationListener token);
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@ import android.service.notification.StatusBarNotification;
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
oneway interface INotificationListener
|
oneway interface INotificationListener
|
||||||
{
|
{
|
||||||
|
void onListenerConnected(in String[] notificationKeys);
|
||||||
void onNotificationPosted(in StatusBarNotification notification);
|
void onNotificationPosted(in StatusBarNotification notification);
|
||||||
void onNotificationRemoved(in StatusBarNotification notification);
|
void onNotificationRemoved(in StatusBarNotification notification);
|
||||||
}
|
}
|
||||||
@@ -83,6 +83,17 @@ public abstract class NotificationListenerService extends Service {
|
|||||||
*/
|
*/
|
||||||
public abstract void onNotificationRemoved(StatusBarNotification sbn);
|
public abstract void onNotificationRemoved(StatusBarNotification sbn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement this method to learn about when the listener is enabled and connected to
|
||||||
|
* the notification manager. You are safe to call {@link #getActiveNotifications(String[])
|
||||||
|
* at this time.
|
||||||
|
*
|
||||||
|
* @param notificationKeys The notification keys for all currently posted notifications.
|
||||||
|
*/
|
||||||
|
public void onListenerConnected(String[] notificationKeys) {
|
||||||
|
// optional
|
||||||
|
}
|
||||||
|
|
||||||
private final INotificationManager getNotificationInterface() {
|
private final INotificationManager getNotificationInterface() {
|
||||||
if (mNoMan == null) {
|
if (mNoMan == null) {
|
||||||
mNoMan = INotificationManager.Stub.asInterface(
|
mNoMan = INotificationManager.Stub.asInterface(
|
||||||
@@ -132,9 +143,23 @@ public abstract class NotificationListenerService extends Service {
|
|||||||
* {@see #cancelNotification(String, String, int)}
|
* {@see #cancelNotification(String, String, int)}
|
||||||
*/
|
*/
|
||||||
public final void cancelAllNotifications() {
|
public final void cancelAllNotifications() {
|
||||||
|
cancelNotifications(null /*all*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inform the notification manager about dismissal of specific notifications.
|
||||||
|
* <p>
|
||||||
|
* Use this if your listener has a user interface that allows the user to dismiss
|
||||||
|
* multiple notifications at once.
|
||||||
|
*
|
||||||
|
* @param keys Notifications to dismiss, or {@code null} to dismiss all.
|
||||||
|
*
|
||||||
|
* {@see #cancelNotification(String, String, int)}
|
||||||
|
*/
|
||||||
|
public final void cancelNotifications(String[] keys) {
|
||||||
if (!isBound()) return;
|
if (!isBound()) return;
|
||||||
try {
|
try {
|
||||||
getNotificationInterface().cancelAllNotificationsFromListener(mWrapper);
|
getNotificationInterface().cancelNotificationsFromListener(mWrapper, keys);
|
||||||
} catch (android.os.RemoteException ex) {
|
} catch (android.os.RemoteException ex) {
|
||||||
Log.v(TAG, "Unable to contact notification manager", ex);
|
Log.v(TAG, "Unable to contact notification manager", ex);
|
||||||
}
|
}
|
||||||
@@ -142,14 +167,25 @@ public abstract class NotificationListenerService extends Service {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request the list of outstanding notifications (that is, those that are visible to the
|
* Request the list of outstanding notifications (that is, those that are visible to the
|
||||||
* current user). Useful when starting up and you don't know what's already been posted.
|
* current user). Useful when you don't know what's already been posted.
|
||||||
*
|
*
|
||||||
* @return An array of active notifications.
|
* @return An array of active notifications.
|
||||||
*/
|
*/
|
||||||
public StatusBarNotification[] getActiveNotifications() {
|
public StatusBarNotification[] getActiveNotifications() {
|
||||||
|
return getActiveNotifications(null /*all*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request the list of outstanding notifications (that is, those that are visible to the
|
||||||
|
* current user). Useful when you don't know what's already been posted.
|
||||||
|
*
|
||||||
|
* @param keys A specific list of notification keys, or {@code null} for all.
|
||||||
|
* @return An array of active notifications.
|
||||||
|
*/
|
||||||
|
public StatusBarNotification[] getActiveNotifications(String[] keys) {
|
||||||
if (!isBound()) return null;
|
if (!isBound()) return null;
|
||||||
try {
|
try {
|
||||||
return getNotificationInterface().getActiveNotificationsFromListener(mWrapper);
|
return getNotificationInterface().getActiveNotificationsFromListener(mWrapper, keys);
|
||||||
} catch (android.os.RemoteException ex) {
|
} catch (android.os.RemoteException ex) {
|
||||||
Log.v(TAG, "Unable to contact notification manager", ex);
|
Log.v(TAG, "Unable to contact notification manager", ex);
|
||||||
}
|
}
|
||||||
@@ -189,5 +225,13 @@ public abstract class NotificationListenerService extends Service {
|
|||||||
Log.w(TAG, "Error running onNotificationRemoved", t);
|
Log.w(TAG, "Error running onNotificationRemoved", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void onListenerConnected(String[] notificationKeys) {
|
||||||
|
try {
|
||||||
|
NotificationListenerService.this.onListenerConnected(notificationKeys);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
Log.w(TAG, "Error running onListenerConnected", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class StatusBarNotification implements Parcelable {
|
|||||||
private final String pkg;
|
private final String pkg;
|
||||||
private final int id;
|
private final int id;
|
||||||
private final String tag;
|
private final String tag;
|
||||||
|
private final String key;
|
||||||
|
|
||||||
private final int uid;
|
private final int uid;
|
||||||
private final String basePkg;
|
private final String basePkg;
|
||||||
@@ -70,6 +71,7 @@ public class StatusBarNotification implements Parcelable {
|
|||||||
this.notification.setUser(user);
|
this.notification.setUser(user);
|
||||||
|
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
|
this.key = key();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatusBarNotification(Parcel in) {
|
public StatusBarNotification(Parcel in) {
|
||||||
@@ -88,6 +90,11 @@ public class StatusBarNotification implements Parcelable {
|
|||||||
this.user = UserHandle.readFromParcel(in);
|
this.user = UserHandle.readFromParcel(in);
|
||||||
this.notification.setUser(this.user);
|
this.notification.setUser(this.user);
|
||||||
this.postTime = in.readLong();
|
this.postTime = in.readLong();
|
||||||
|
this.key = key();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String key() {
|
||||||
|
return pkg + '|' + basePkg + '|' + id + '|' + tag + '|' + uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel out, int flags) {
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
@@ -148,9 +155,9 @@ public class StatusBarNotification implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format(
|
return String.format(
|
||||||
"StatusBarNotification(pkg=%s user=%s id=%d tag=%s score=%d: %s)",
|
"StatusBarNotification(pkg=%s user=%s id=%d tag=%s score=%d key=%s: %s)",
|
||||||
this.pkg, this.user, this.id, this.tag,
|
this.pkg, this.user, this.id, this.tag,
|
||||||
this.score, this.notification);
|
this.score, this.key, this.notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience method to check the notification's flags for
|
/** Convenience method to check the notification's flags for
|
||||||
@@ -230,4 +237,11 @@ public class StatusBarNotification implements Parcelable {
|
|||||||
public int getScore() {
|
public int getScore() {
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A unique instance key for this notification record.
|
||||||
|
*/
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import android.service.notification.NotificationListenerService;
|
|||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.ArrayMap;
|
||||||
import android.util.AtomicFile;
|
import android.util.AtomicFile;
|
||||||
import android.util.EventLog;
|
import android.util.EventLog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -166,6 +167,8 @@ public class NotificationManagerService extends SystemService {
|
|||||||
// used as a mutex for access to all active notifications & listeners
|
// used as a mutex for access to all active notifications & listeners
|
||||||
final ArrayList<NotificationRecord> mNotificationList =
|
final ArrayList<NotificationRecord> mNotificationList =
|
||||||
new ArrayList<NotificationRecord>();
|
new ArrayList<NotificationRecord>();
|
||||||
|
final ArrayMap<String, NotificationRecord> mNotificationsByKey =
|
||||||
|
new ArrayMap<String, NotificationRecord>();
|
||||||
|
|
||||||
final ArrayList<ToastRecord> mToastQueue = new ArrayList<ToastRecord>();
|
final ArrayList<ToastRecord> mToastQueue = new ArrayList<ToastRecord>();
|
||||||
|
|
||||||
@@ -630,6 +633,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
|
boolean added = false;
|
||||||
synchronized (mNotificationList) {
|
synchronized (mNotificationList) {
|
||||||
mServicesBinding.remove(servicesBindingTag);
|
mServicesBinding.remove(servicesBindingTag);
|
||||||
try {
|
try {
|
||||||
@@ -638,11 +642,20 @@ public class NotificationManagerService extends SystemService {
|
|||||||
= new NotificationListenerInfo(
|
= new NotificationListenerInfo(
|
||||||
mListener, name, userid, this);
|
mListener, name, userid, this);
|
||||||
service.linkToDeath(info, 0);
|
service.linkToDeath(info, 0);
|
||||||
mListeners.add(info);
|
added = mListeners.add(info);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// already dead
|
// already dead
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (added) {
|
||||||
|
final String[] keys =
|
||||||
|
getActiveNotificationKeysFromListener(mListener);
|
||||||
|
try {
|
||||||
|
mListener.onListenerConnected(keys);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// we tried
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -768,6 +781,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
pw.println(prefix + " icon=0x" + Integer.toHexString(notification.icon)
|
pw.println(prefix + " icon=0x" + Integer.toHexString(notification.icon)
|
||||||
+ " / " + idDebugString(baseContext, sbn.getPackageName(), notification.icon));
|
+ " / " + idDebugString(baseContext, sbn.getPackageName(), notification.icon));
|
||||||
pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.getScore());
|
pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.getScore());
|
||||||
|
pw.println(prefix + " key=" + sbn.getKey());
|
||||||
pw.println(prefix + " contentIntent=" + notification.contentIntent);
|
pw.println(prefix + " contentIntent=" + notification.contentIntent);
|
||||||
pw.println(prefix + " deleteIntent=" + notification.deleteIntent);
|
pw.println(prefix + " deleteIntent=" + notification.deleteIntent);
|
||||||
pw.println(prefix + " tickerText=" + notification.tickerText);
|
pw.println(prefix + " tickerText=" + notification.tickerText);
|
||||||
@@ -824,10 +838,11 @@ public class NotificationManagerService extends SystemService {
|
|||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
return String.format(
|
return String.format(
|
||||||
"NotificationRecord(0x%08x: pkg=%s user=%s id=%d tag=%s score=%d: %s)",
|
"NotificationRecord(0x%08x: pkg=%s user=%s id=%d tag=%s score=%d key=%s: %s)",
|
||||||
System.identityHashCode(this),
|
System.identityHashCode(this),
|
||||||
this.sbn.getPackageName(), this.sbn.getUser(), this.sbn.getId(),
|
this.sbn.getPackageName(), this.sbn.getUser(), this.sbn.getId(),
|
||||||
this.sbn.getTag(), this.sbn.getScore(), this.sbn.getNotification());
|
this.sbn.getTag(), this.sbn.getScore(), this.sbn.getKey(),
|
||||||
|
this.sbn.getNotification());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1504,18 +1519,37 @@ public class NotificationManagerService extends SystemService {
|
|||||||
* @param token The binder for the listener, to check that the caller is allowed
|
* @param token The binder for the listener, to check that the caller is allowed
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cancelAllNotificationsFromListener(INotificationListener token) {
|
public void cancelNotificationsFromListener(INotificationListener token, String[] keys) {
|
||||||
long identity = Binder.clearCallingIdentity();
|
long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
synchronized (mNotificationList) {
|
synchronized (mNotificationList) {
|
||||||
NotificationListenerInfo info = checkListenerTokenLocked(token);
|
final NotificationListenerInfo info = checkListenerTokenLocked(token);
|
||||||
cancelAllLocked(info.userid);
|
if (keys != null) {
|
||||||
|
final int N = keys.length;
|
||||||
|
for (int i = 0; i < N; i++) {
|
||||||
|
NotificationRecord r = mNotificationsByKey.get(keys[i]);
|
||||||
|
if (r != null) {
|
||||||
|
cancelNotificationFromListenerLocked(info,
|
||||||
|
r.sbn.getPackageName(), r.sbn.getTag(), r.sbn.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cancelAllLocked(info.userid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(identity);
|
Binder.restoreCallingIdentity(identity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cancelNotificationFromListenerLocked(NotificationListenerInfo info,
|
||||||
|
String pkg, String tag, int id) {
|
||||||
|
cancelNotification(pkg, tag, id, 0,
|
||||||
|
Notification.FLAG_ONGOING_EVENT | Notification.FLAG_FOREGROUND_SERVICE,
|
||||||
|
true,
|
||||||
|
info.userid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow an INotificationListener to simulate clearing (dismissing) a single notification.
|
* Allow an INotificationListener to simulate clearing (dismissing) a single notification.
|
||||||
*
|
*
|
||||||
@@ -1528,14 +1562,11 @@ public class NotificationManagerService extends SystemService {
|
|||||||
String tag, int id) {
|
String tag, int id) {
|
||||||
long identity = Binder.clearCallingIdentity();
|
long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
NotificationListenerInfo info;
|
|
||||||
synchronized (mNotificationList) {
|
synchronized (mNotificationList) {
|
||||||
info = checkListenerTokenLocked(token);
|
final NotificationListenerInfo info = checkListenerTokenLocked(token);
|
||||||
|
cancelNotificationFromListenerLocked(info,
|
||||||
|
pkg, tag, id);
|
||||||
}
|
}
|
||||||
cancelNotification(pkg, tag, id, 0,
|
|
||||||
Notification.FLAG_ONGOING_EVENT | Notification.FLAG_FOREGROUND_SERVICE,
|
|
||||||
true,
|
|
||||||
info.userid);
|
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(identity);
|
Binder.restoreCallingIdentity(identity);
|
||||||
}
|
}
|
||||||
@@ -1550,20 +1581,35 @@ public class NotificationManagerService extends SystemService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public StatusBarNotification[] getActiveNotificationsFromListener(
|
public StatusBarNotification[] getActiveNotificationsFromListener(
|
||||||
INotificationListener token) {
|
INotificationListener token, String[] keys) {
|
||||||
StatusBarNotification[] result = new StatusBarNotification[0];
|
|
||||||
ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>();
|
|
||||||
synchronized (mNotificationList) {
|
synchronized (mNotificationList) {
|
||||||
NotificationListenerInfo info = checkListenerTokenLocked(token);
|
final NotificationListenerInfo info = checkListenerTokenLocked(token);
|
||||||
final int N = mNotificationList.size();
|
final ArrayList<StatusBarNotification> list
|
||||||
for (int i=0; i<N; i++) {
|
= new ArrayList<StatusBarNotification>();
|
||||||
StatusBarNotification sbn = mNotificationList.get(i).sbn;
|
if (keys == null) {
|
||||||
if (info.enabledAndUserMatches(sbn)) {
|
final int N = mNotificationList.size();
|
||||||
list.add(sbn);
|
for (int i=0; i<N; i++) {
|
||||||
|
StatusBarNotification sbn = mNotificationList.get(i).sbn;
|
||||||
|
if (info.enabledAndUserMatches(sbn)) {
|
||||||
|
list.add(sbn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final int N = keys.length;
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
NotificationRecord r = mNotificationsByKey.get(keys[i]);
|
||||||
|
if (r != null && info.enabledAndUserMatches(r.sbn)) {
|
||||||
|
list.add(r.sbn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return list.toArray(new StatusBarNotification[list.size()]);
|
||||||
}
|
}
|
||||||
return list.toArray(result);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getActiveNotificationKeysFromListener(INotificationListener token) {
|
||||||
|
return NotificationManagerService.this.getActiveNotificationKeysFromListener(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1580,6 +1626,21 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private String[] getActiveNotificationKeysFromListener(INotificationListener token) {
|
||||||
|
synchronized (mNotificationList) {
|
||||||
|
final NotificationListenerInfo info = checkListenerTokenLocked(token);
|
||||||
|
final ArrayList<String> keys = new ArrayList<String>();
|
||||||
|
final int N = mNotificationList.size();
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
final StatusBarNotification sbn = mNotificationList.get(i).sbn;
|
||||||
|
if (info.enabledAndUserMatches(sbn)) {
|
||||||
|
keys.add(sbn.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return keys.toArray(new String[keys.size()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void dumpImpl(PrintWriter pw) {
|
void dumpImpl(PrintWriter pw) {
|
||||||
pw.println("Current Notification Manager state:");
|
pw.println("Current Notification Manager state:");
|
||||||
|
|
||||||
@@ -1797,6 +1858,10 @@ public class NotificationManagerService extends SystemService {
|
|||||||
old.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE;
|
old.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (old != null) {
|
||||||
|
mNotificationsByKey.remove(old.sbn.getKey());
|
||||||
|
}
|
||||||
|
mNotificationsByKey.put(n.getKey(), r);
|
||||||
|
|
||||||
// Ensure if this is a foreground service that the proper additional
|
// Ensure if this is a foreground service that the proper additional
|
||||||
// flags are set.
|
// flags are set.
|
||||||
@@ -2271,6 +2336,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mNotificationList.remove(index);
|
mNotificationList.remove(index);
|
||||||
|
mNotificationsByKey.remove(r.sbn.getKey());
|
||||||
|
|
||||||
cancelNotificationLocked(r, sendDelete);
|
cancelNotificationLocked(r, sendDelete);
|
||||||
updateLightsLocked();
|
updateLightsLocked();
|
||||||
@@ -2329,6 +2395,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
mNotificationList.remove(i);
|
mNotificationList.remove(i);
|
||||||
|
mNotificationsByKey.remove(r.sbn.getKey());
|
||||||
cancelNotificationLocked(r, false);
|
cancelNotificationLocked(r, false);
|
||||||
}
|
}
|
||||||
if (canceledSomething) {
|
if (canceledSomething) {
|
||||||
@@ -2388,6 +2455,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
if ((r.getFlags() & (Notification.FLAG_ONGOING_EVENT
|
if ((r.getFlags() & (Notification.FLAG_ONGOING_EVENT
|
||||||
| Notification.FLAG_NO_CLEAR)) == 0) {
|
| Notification.FLAG_NO_CLEAR)) == 0) {
|
||||||
mNotificationList.remove(i);
|
mNotificationList.remove(i);
|
||||||
|
mNotificationsByKey.remove(r.sbn.getKey());
|
||||||
cancelNotificationLocked(r, true);
|
cancelNotificationLocked(r, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user