diff options
author | Christoph Studer <chstuder@google.com> | 2014-04-30 17:33:27 +0200 |
---|---|---|
committer | Christoph Studer <chstuder@google.com> | 2014-04-30 18:00:55 +0200 |
commit | 03b87a2f40c26948b7b0c9409c33ad44857218cf (patch) | |
tree | bb97024d9004a3dee7aae483f6d51c6e637ef067 /services/core/java/com | |
parent | ff8dbe52eb3452df4d2cbd7af90483969bb061f4 (diff) | |
download | frameworks_base-03b87a2f40c26948b7b0c9409c33ad44857218cf.zip frameworks_base-03b87a2f40c26948b7b0c9409c33ad44857218cf.tar.gz frameworks_base-03b87a2f40c26948b7b0c9409c33ad44857218cf.tar.bz2 |
Log notification clicks
Emit notification_clicked log events when a notification
is clicked from SystemUI.
Also refactor the onNotificationClicked method to work with
a key instead of individual notification params.
Change-Id: Iffd15e95d46371b2ae7bfd00b2c348d9f4cf5d14
Diffstat (limited to 'services/core/java/com')
4 files changed, 19 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags index 5083d44..6fab37c 100644 --- a/services/core/java/com/android/server/EventLogTags.logtags +++ b/services/core/java/com/android/server/EventLogTags.logtags @@ -65,6 +65,8 @@ option java_package com.android.server 27501 notification_panel_hidden # when notifications are newly displayed on screen, or disappear from screen 27510 notification_visibility_changed (newlyVisibleKeys|3),(noLongerVisibleKeys|3) +# when a notification has been clicked +27520 notification_clicked (key|3) # --------------------------- # Watchdog.java diff --git a/services/core/java/com/android/server/notification/NotificationDelegate.java b/services/core/java/com/android/server/notification/NotificationDelegate.java index ce4c1ed..b41b478 100644 --- a/services/core/java/com/android/server/notification/NotificationDelegate.java +++ b/services/core/java/com/android/server/notification/NotificationDelegate.java @@ -21,8 +21,7 @@ import android.os.IBinder; public interface NotificationDelegate { void onSetDisabled(int status); void onClearAll(int callingUid, int callingPid, int userId); - void onNotificationClick(int callingUid, int callingPid, - String pkg, String tag, int id, int userId); + void onNotificationClick(int callingUid, int callingPid, String key); void onNotificationClear(int callingUid, int callingPid, String pkg, String tag, int id, int userId); void onNotificationError(int callingUid, int callingPid, diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 6e4eb56..76b4c89 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -602,10 +602,20 @@ public class NotificationManagerService extends SystemService { } @Override - public void onNotificationClick(int callingUid, int callingPid, - String pkg, String tag, int id, int userId) { - cancelNotification(callingUid, callingPid, pkg, tag, id, Notification.FLAG_AUTO_CANCEL, - Notification.FLAG_FOREGROUND_SERVICE, false, userId, REASON_DELEGATE_CLICK, null); + public void onNotificationClick(int callingUid, int callingPid, String key) { + synchronized (mNotificationList) { + EventLogTags.writeNotificationClicked(key); + NotificationRecord r = mNotificationsByKey.get(key); + if (r == null) { + Log.w(TAG, "No notification with key: " + key); + return; + } + StatusBarNotification sbn = r.sbn; + cancelNotification(callingUid, callingPid, sbn.getPackageName(), sbn.getTag(), + sbn.getId(), Notification.FLAG_AUTO_CANCEL, + Notification.FLAG_FOREGROUND_SERVICE, false, r.getUserId(), + REASON_DELEGATE_CLICK, null); + } } @Override diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 91f796b..022bdae 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -546,13 +546,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub } @Override - public void onNotificationClick(String pkg, String tag, int id, int userId) { + public void onNotificationClick(String key) { enforceStatusBarService(); final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); long identity = Binder.clearCallingIdentity(); try { - mNotificationDelegate.onNotificationClick(callingUid, callingPid, pkg, tag, id, userId); + mNotificationDelegate.onNotificationClick(callingUid, callingPid, key); } finally { Binder.restoreCallingIdentity(identity); } |