summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/logging/EventLogTags.logtags2
-rw-r--r--core/java/com/android/internal/logging/MetricsLogger.java10
-rw-r--r--services/core/java/com/android/server/notification/NotificationUsageStats.java7
-rw-r--r--services/core/java/com/android/server/notification/ValidateNotificationPeople.java4
4 files changed, 23 insertions, 0 deletions
diff --git a/core/java/com/android/internal/logging/EventLogTags.logtags b/core/java/com/android/internal/logging/EventLogTags.logtags
index 870d20d3d7bf..b9208ff8ca1f 100644
--- a/core/java/com/android/internal/logging/EventLogTags.logtags
+++ b/core/java/com/android/internal/logging/EventLogTags.logtags
@@ -5,3 +5,5 @@ option java_package com.android.internal.logging;
# interaction logs
524287 sysui_view_visibility (category|1|5),(visible|1|6)
524288 sysui_action (category|1|5)
+524290 sysui_count (name|3),(increment|1)
+524291 sysui_histogram (name|3),(bucket|1)
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index f38229adbd74..6be6389ae314 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -50,4 +50,14 @@ public class MetricsLogger implements MetricsConstants {
}
EventLogTags.writeSysuiAction(category);
}
+
+ /** Add an integer value to the monotonically increasing counter with the given name. */
+ public static void count(Context context, String name, int value) {
+ EventLogTags.writeSysuiCount(name, value);
+ }
+
+ /** Increment the bucket with the integer label on the histogram with the given name. */
+ public static void histogram(Context context, String name, int bucket) {
+ EventLogTags.writeSysuiHistogram(name, bucket);
+ }
}
diff --git a/services/core/java/com/android/server/notification/NotificationUsageStats.java b/services/core/java/com/android/server/notification/NotificationUsageStats.java
index e029c58ebe43..4696771e3fea 100644
--- a/services/core/java/com/android/server/notification/NotificationUsageStats.java
+++ b/services/core/java/com/android/server/notification/NotificationUsageStats.java
@@ -28,6 +28,7 @@ import android.os.SystemClock;
import android.service.notification.StatusBarNotification;
import android.util.Log;
+import com.android.internal.logging.MetricsLogger;
import com.android.server.notification.NotificationManagerService.DumpFilter;
import java.io.PrintWriter;
@@ -56,8 +57,10 @@ public class NotificationUsageStats {
// Guarded by synchronized(this).
private final Map<String, AggregatedStats> mStats = new HashMap<String, AggregatedStats>();
private final SQLiteLog mSQLiteLog;
+ private final Context mContext;
public NotificationUsageStats(Context context) {
+ mContext = context;
mSQLiteLog = ENABLE_SQLITE_LOG ? new SQLiteLog(context) : null;
}
@@ -103,6 +106,8 @@ public class NotificationUsageStats {
* Called when the user dismissed the notification via the UI.
*/
public synchronized void registerDismissedByUser(NotificationRecord notification) {
+ MetricsLogger.histogram(mContext, "note_dismiss_longevity",
+ (int) (System.currentTimeMillis() - notification.getRankingTimeMs()) / (60 * 1000));
notification.stats.onDismiss();
for (AggregatedStats stats : getAggregatedStatsLocked(notification)) {
stats.numDismissedByUser++;
@@ -117,6 +122,8 @@ public class NotificationUsageStats {
* Called when the user clicked the notification in the UI.
*/
public synchronized void registerClickedByUser(NotificationRecord notification) {
+ MetricsLogger.histogram(mContext, "note_click_longevity",
+ (int) (System.currentTimeMillis() - notification.getRankingTimeMs()) / (60 * 1000));
notification.stats.onClick();
for (AggregatedStats stats : getAggregatedStatsLocked(notification)) {
stats.numClickedByUser++;
diff --git a/services/core/java/com/android/server/notification/ValidateNotificationPeople.java b/services/core/java/com/android/server/notification/ValidateNotificationPeople.java
index 5eb318b5c205..10f16960ff41 100644
--- a/services/core/java/com/android/server/notification/ValidateNotificationPeople.java
+++ b/services/core/java/com/android/server/notification/ValidateNotificationPeople.java
@@ -34,6 +34,7 @@ import android.util.ArrayMap;
import android.util.Log;
import android.util.LruCache;
import android.util.Slog;
+import com.android.internal.logging.MetricsLogger;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -244,6 +245,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
if (pendingLookups.isEmpty()) {
if (INFO) Slog.i(TAG, "final affinity: " + affinity);
+ if (affinity != NONE) MetricsLogger.count(mBaseContext, "note_with_people", 1);
return null;
}
@@ -453,6 +455,8 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor {
Slog.d(TAG, "Validation finished in " + (System.currentTimeMillis() - timeStartMs) +
"ms");
}
+
+ if (mContactAffinity != NONE) MetricsLogger.count(mBaseContext, "note_with_people", 1);
}
@Override