summaryrefslogtreecommitdiff
path: root/core/java/android/util/StatsManager.java
diff options
context:
space:
mode:
authorBookatz <bookatz@google.com>2018-01-16 16:55:05 -0800
committerBookatz <bookatz@google.com>2018-01-24 13:08:19 -0800
commitc697797d43b6932fc7cca1c8d7d850c3fb4d1452 (patch)
tree43037d273145230adad3e720cd798d729180a236 /core/java/android/util/StatsManager.java
parent96c73a3c40316e5aa36ea59d40e901d2dd505021 (diff)
Statsd broadcast subscriber
Allows a uid that uploads a statsd config to additionally register a BroadcastSubscriber with statsd. If statsd detects an anomaly (according to the config's Alert), statsd can inform a BroadcastSubscriber provided in the config. The config uses a subscriberId (just an int) to identify the BroadcastSubscriber. It then uses StatsManager.setBroadcastSubscriber to associate that subscriberId with a given PendingIntent. Then, when the anomaly is detected, statsd sends a broadcast using that PendingIntent, alerting whoever was specified by the config/setBroadcastSubscriber. Bug: 70356901 Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.BroadcastSubscriberTests Change-Id: I4d9ea9a6c8a85e61fadfd99c1513c55abbadd5e9
Diffstat (limited to 'core/java/android/util/StatsManager.java')
-rw-r--r--core/java/android/util/StatsManager.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/util/StatsManager.java b/core/java/android/util/StatsManager.java
index e0d085cfaa66..687aa8375e01 100644
--- a/core/java/android/util/StatsManager.java
+++ b/core/java/android/util/StatsManager.java
@@ -17,19 +17,33 @@ package android.util;
import android.Manifest;
import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
import android.os.IBinder;
import android.os.IStatsManager;
import android.os.RemoteException;
import android.os.ServiceManager;
+
+/*
+ *
+ *
+ *
+ *
+ * THIS ENTIRE FILE IS ONLY TEMPORARY TO PREVENT BREAKAGES OF DEPENDENCIES ON OLD APIS.
+ * The new StatsManager is to be found in android.app.StatsManager.
+ * TODO: Delete this file!
+ *
+ *
+ *
+ *
+ */
+
+
/**
* API for StatsD clients to send configurations and retrieve data.
*
* @hide
*/
-@SystemApi
-public final class StatsManager {
+public class StatsManager {
IStatsManager mService;
private static final String TAG = "StatsManager";
@@ -55,7 +69,7 @@ public final class StatsManager {
* Clients can send a configuration and simultaneously registers the name of a broadcast
* receiver that listens for when it should request data.
*
- * @param configKey An arbitrary string that allows clients to track the configuration.
+ * @param configKey An arbitrary integer that allows clients to track the configuration.
* @param config Wire-encoded StatsDConfig proto that specifies metrics (and all
* dependencies eg, conditions and matchers).
* @param pkg The package name to receive the broadcast.