summaryrefslogtreecommitdiffstats
path: root/services/core
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-10-21 17:24:20 +0200
committerChristoph Studer <chstuder@google.com>2014-10-22 20:18:14 +0200
commit4da84cd56582fb4025eb5a9a1d4bb5b5b4a50cef (patch)
treed0141b9f148b4e543a2f820276f256bd14452fcd /services/core
parent4816ed65c6425d31ea23f2c4f2e36c23c6f16b1c (diff)
downloadframeworks_base-4da84cd56582fb4025eb5a9a1d4bb5b5b4a50cef.zip
frameworks_base-4da84cd56582fb4025eb5a9a1d4bb5b5b4a50cef.tar.gz
frameworks_base-4da84cd56582fb4025eb5a9a1d4bb5b5b4a50cef.tar.bz2
SysUI/NoMan: Log clicks on notification buttons
Introduce notification_action_click logtag that is logged whenever the user clicks any notification button. For standard templates, we also log the index of the pressed action button. Bug: 18064190 Change-Id: Icb07795ff711729d16bde0b7e03d13c2f466779c
Diffstat (limited to 'services/core')
-rw-r--r--services/core/java/com/android/server/EventLogTags.logtags2
-rw-r--r--services/core/java/com/android/server/notification/NotificationDelegate.java1
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java14
-rw-r--r--services/core/java/com/android/server/statusbar/StatusBarManagerService.java14
4 files changed, 31 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index 64d8f6f..f7925f0 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -69,6 +69,8 @@ option java_package com.android.server
27511 notification_expansion (key|3),(user_action|1),(expanded|1)
# when a notification has been clicked
27520 notification_clicked (key|3)
+# when a notification action button has been clicked
+27521 notification_action_clicked (key|3),(action_index|1)
# ---------------------------
# 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 97f0a1e..24fc455 100644
--- a/services/core/java/com/android/server/notification/NotificationDelegate.java
+++ b/services/core/java/com/android/server/notification/NotificationDelegate.java
@@ -20,6 +20,7 @@ public interface NotificationDelegate {
void onSetDisabled(int status);
void onClearAll(int callingUid, int callingPid, int userId);
void onNotificationClick(int callingUid, int callingPid, String key);
+ void onNotificationActionClick(int callingUid, int callingPid, String key, int actionIndex);
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 22f060f..e0708cb 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -541,6 +541,20 @@ public class NotificationManagerService extends SystemService {
}
@Override
+ public void onNotificationActionClick(int callingUid, int callingPid, String key,
+ int actionIndex) {
+ synchronized (mNotificationList) {
+ EventLogTags.writeNotificationActionClicked(key, actionIndex);
+ NotificationRecord r = mNotificationsByKey.get(key);
+ if (r == null) {
+ Log.w(TAG, "No notification with key: " + key);
+ return;
+ }
+ // TODO: Log action click via UsageStats.
+ }
+ }
+
+ @Override
public void onNotificationClear(int callingUid, int callingPid,
String pkg, String tag, int id, int userId) {
cancelNotification(callingUid, callingPid, pkg, tag, id, 0,
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index f85e2d9..86c78dd 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -523,6 +523,20 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
}
@Override
+ public void onNotificationActionClick(String key, int actionIndex) {
+ enforceStatusBarService();
+ final int callingUid = Binder.getCallingUid();
+ final int callingPid = Binder.getCallingPid();
+ long identity = Binder.clearCallingIdentity();
+ try {
+ mNotificationDelegate.onNotificationActionClick(callingUid, callingPid, key,
+ actionIndex);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ @Override
public void onNotificationError(String pkg, String tag, int id,
int uid, int initialPid, String message, int userId) {
enforceStatusBarService();