public class NotificationUsageStats extends Object
This class receives signals from NoMan and keeps running stats of notification usage. Some metrics are updated as events occur. Others, namely those involving durations, are updated as the notification is canceled.
This class is thread-safe.
Modifier and Type | Class and Description |
---|---|
static class |
NotificationUsageStats.Aggregate
Aggregates long samples to sum and averages.
|
static class |
NotificationUsageStats.SingleNotificationStats
Tracks usage of an individual notification that is currently active.
|
Modifier and Type | Field and Description |
---|---|
static int |
FOUR_HOURS |
static int |
TEN_SECONDS |
Constructor and Description |
---|
NotificationUsageStats(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
dump(PrintWriter pw,
String indent,
NotificationManagerService.DumpFilter filter) |
JSONObject |
dumpJson(NotificationManagerService.DumpFilter filter) |
void |
emit() |
float |
getAppEnqueueRate(String packageName)
Called when a notification has been posted.
|
void |
registerBlocked(NotificationRecord notification) |
void |
registerClickedByUser(NotificationRecord notification)
Called when the user clicked the notification in the UI.
|
void |
registerDismissedByUser(NotificationRecord notification)
Called when the user dismissed the notification via the UI.
|
void |
registerEnqueuedByApp(String packageName)
Called when a notification is tentatively enqueued by an app, before rate checking.
|
void |
registerOverCountQuota(String packageName) |
void |
registerOverRateQuota(String packageName) |
void |
registerPeopleAffinity(NotificationRecord notification,
boolean valid,
boolean starred,
boolean cached) |
void |
registerPostedByApp(NotificationRecord notification)
Called when a notification has been posted.
|
void |
registerRemovedByApp(NotificationRecord notification)
Called when the originating app removed the notification programmatically.
|
void |
registerSuspendedByAdmin(NotificationRecord notification) |
void |
registerUpdatedByApp(NotificationRecord notification,
NotificationRecord old)
Called when a notification has been updated.
|
public static final int TEN_SECONDS
public static final int FOUR_HOURS
public NotificationUsageStats(Context context)
public float getAppEnqueueRate(String packageName)
public void registerEnqueuedByApp(String packageName)
public void registerPostedByApp(NotificationRecord notification)
public void registerUpdatedByApp(NotificationRecord notification, NotificationRecord old)
public void registerRemovedByApp(NotificationRecord notification)
public void registerDismissedByUser(NotificationRecord notification)
public void registerClickedByUser(NotificationRecord notification)
public void registerPeopleAffinity(NotificationRecord notification, boolean valid, boolean starred, boolean cached)
public void registerBlocked(NotificationRecord notification)
public void registerSuspendedByAdmin(NotificationRecord notification)
public void registerOverRateQuota(String packageName)
public void registerOverCountQuota(String packageName)
public JSONObject dumpJson(NotificationManagerService.DumpFilter filter)
public void dump(PrintWriter pw, String indent, NotificationManagerService.DumpFilter filter)
public void emit()