Loading core/java/com/android/internal/logging/EventLogTags.logtags +2 −0 Original line number Diff line number Diff line Loading @@ -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) core/java/com/android/internal/logging/MetricsLogger.java +10 −0 Original line number Diff line number Diff line Loading @@ -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); } } services/core/java/com/android/server/notification/NotificationUsageStats.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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++; Loading @@ -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++; Loading services/core/java/com/android/server/notification/ValidateNotificationPeople.java +4 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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 Loading Loading
core/java/com/android/internal/logging/EventLogTags.logtags +2 −0 Original line number Diff line number Diff line Loading @@ -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)
core/java/com/android/internal/logging/MetricsLogger.java +10 −0 Original line number Diff line number Diff line Loading @@ -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); } }
services/core/java/com/android/server/notification/NotificationUsageStats.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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++; Loading @@ -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++; Loading
services/core/java/com/android/server/notification/ValidateNotificationPeople.java +4 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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 Loading