diff options
author | Amith Yamasani <yamasani@google.com> | 2015-04-17 10:02:15 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2015-04-24 16:12:01 -0700 |
commit | f47e51ec605fccf7fed9e50d1adc98fbd4e8b340 (patch) | |
tree | 68c2fe8acf0144544d498ca413283d70d7666c53 /core | |
parent | 4bc704655abee70c1998b9a62777cdf643920467 (diff) | |
download | frameworks_base-f47e51ec605fccf7fed9e50d1adc98fbd4e8b340.zip frameworks_base-f47e51ec605fccf7fed9e50d1adc98fbd4e8b340.tar.gz frameworks_base-f47e51ec605fccf7fed9e50d1adc98fbd4e8b340.tar.bz2 |
More usage tracking
Notification listeners can now report that a notification
has been seen by the user and that package is then marked
as active.
Bug: 20066058
Change-Id: I336040a52c44c21fd0d78b02ec9a19d448c64b40
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/INotificationManager.aidl | 2 | ||||
-rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index e275df0..ac8d5d8 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -67,6 +67,8 @@ interface INotificationManager void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id); void cancelNotificationsFromListener(in INotificationListener token, in String[] keys); + void setNotificationsShownFromListener(in INotificationListener token, in String[] keys); + ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim); void requestHintsFromListener(in INotificationListener token, int hints); int getHintsFromListener(in INotificationListener token); diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index cc7f880..35b8819 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -358,6 +358,20 @@ public abstract class NotificationListenerService extends Service { } /** + * Inform the notification manager that these notifications have been viewed by the + * user. + * @param keys Notifications to mark as seen. + */ + public final void setNotificationsShown(String[] keys) { + if (!isBound()) return; + try { + getNotificationInterface().setNotificationsShownFromListener(mWrapper, keys); + } catch (android.os.RemoteException ex) { + Log.v(TAG, "Unable to contact notification manager", ex); + } + } + + /** * Sets the notification trim that will be received via {@link #onNotificationPosted}. * * <p> |