/**@class android.app.StatsManager @extends java.lang.Object API for statsd clients to send configurations and retrieve data. @hide */ var StatsManager = { /** Long extra of uid that added the relevant stats config. */ EXTRA_STATS_CONFIG_UID : "android.app.extra.STATS_CONFIG_UID", /** Long extra of the relevant stats config's configKey. */ EXTRA_STATS_CONFIG_KEY : "android.app.extra.STATS_CONFIG_KEY", /** Long extra of the relevant statsd_config.proto's Subscription.id. */ EXTRA_STATS_SUBSCRIPTION_ID : "android.app.extra.STATS_SUBSCRIPTION_ID", /** Long extra of the relevant statsd_config.proto's Subscription.rule_id. */ EXTRA_STATS_SUBSCRIPTION_RULE_ID : "android.app.extra.STATS_SUBSCRIPTION_RULE_ID", /** List<String> of the relevant statsd_config.proto's BroadcastSubscriberDetails.cookie. Obtain using {@link android.content.Intent#getStringArrayListExtra(String)}. */ EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES : "android.app.extra.STATS_BROADCAST_SUBSCRIBER_COOKIES", /** Extra of a {@link android.os.StatsDimensionsValue} representing sliced dimension value information. */ EXTRA_STATS_DIMENSIONS_VALUE : "android.app.extra.STATS_DIMENSIONS_VALUE", /** Long array extra of the active configs for the uid that added those configs. */ EXTRA_STATS_ACTIVE_CONFIG_KEYS : "android.app.extra.STATS_ACTIVE_CONFIG_KEYS", /** Broadcast Action: Statsd has started. Configurations and PendingIntents can now be sent to it. */ ACTION_STATSD_STARTED : "android.app.action.STATSD_STARTED", /**Adds the given configuration and associates it with the given configKey. If a config with the given configKey already exists for the caller's uid, it is replaced with the new one. @param {Number} configKey An arbitrary integer that allows clients to track the configuration. @param {Object {byte[]}} config Wire-encoded StatsdConfig proto that specifies metrics (and all dependencies eg, conditions and matchers). @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service @throws IllegalArgumentException if config is not a wire-encoded StatsdConfig proto */ addConfig : function( ) {}, /** @deprecated Use {@link #addConfig(long, byte[])} */ addConfiguration : function( ) {}, /**Remove a configuration from logging. @param {Number} configKey Configuration key to remove. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ removeConfig : function( ) {}, /** @deprecated Use {@link #removeConfig(long)} */ removeConfiguration : function( ) {}, /**Set the PendingIntent to be used when broadcasting subscriber information to the given subscriberId within the given config. <p> Suppose that the calling uid has added a config with key configKey, and that in this config it is specified that when a particular anomaly is detected, a broadcast should be sent to a BroadcastSubscriber with id subscriberId. This function links the given pendingIntent with that subscriberId (for that config), so that this pendingIntent is used to send the broadcast when the anomaly is detected. <p> When statsd sends the broadcast, the PendingIntent will used to send an intent with information of {@link #EXTRA_STATS_CONFIG_UID}, {@link #EXTRA_STATS_CONFIG_KEY}, {@link #EXTRA_STATS_SUBSCRIPTION_ID}, {@link #EXTRA_STATS_SUBSCRIPTION_RULE_ID}, {@link #EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES}, and {@link #EXTRA_STATS_DIMENSIONS_VALUE}. <p> This function can only be called by the owner (uid) of the config. It must be called each time statsd starts. The config must have been added first (via {@link #addConfig}). @param {Object {PendingIntent}} pendingIntent the PendingIntent to use when broadcasting info to the subscriber associated with the given subscriberId. May be null, in which case it undoes any previous setting of this subscriberId. @param {Number} configKey The integer naming the config to which this subscriber is attached. @param {Number} subscriberId ID of the subscriber, as used in the config. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ setBroadcastSubscriber : function( ) {}, /** @deprecated Use {@link #setBroadcastSubscriber(PendingIntent, long, long)} */ setBroadcastSubscriber : function( ) {}, /**Registers the operation that is called to retrieve the metrics data. This must be called each time statsd starts. The config must have been added first (via {@link #addConfig}, although addConfig could have been called on a previous boot). This operation allows statsd to send metrics data whenever statsd determines that the metrics in memory are approaching the memory limits. The fetch operation should call {@link #getReports} to fetch the data, which also deletes the retrieved metrics from statsd's memory. @param {Object {PendingIntent}} pendingIntent the PendingIntent to use when broadcasting info to the subscriber associated with the given subscriberId. May be null, in which case it removes any associated pending intent with this configKey. @param {Number} configKey The integer naming the config to which this operation is attached. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ setFetchReportsOperation : function( ) {}, /**Registers the operation that is called whenever there is a change in which configs are active. This must be called each time statsd starts. This operation allows statsd to inform clients that they should pull data of the configs that are currently active. The activeConfigsChangedOperation should set periodic alarms to pull data of configs that are active and stop pulling data of configs that are no longer active. @param {Object {PendingIntent}} pendingIntent the PendingIntent to use when broadcasting info to the subscriber associated with the given subscriberId. May be null, in which case it removes any associated pending intent for this client. @return {Number} A list of configs that are currently active for this client. If the pendingIntent is null, this will be an empty list. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ setActiveConfigsChangedOperation : function( ) {}, /** @deprecated Use {@link #setFetchReportsOperation(PendingIntent, long)} */ setDataFetchOperation : function( ) {}, /**Request the data collected for the given configKey. This getter is destructive - it also clears the retrieved metrics from statsd's memory. @param {Number} configKey Configuration key to retrieve data from. @return {Number} Serialized ConfigMetricsReportList proto. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ getReports : function( ) {}, /** @deprecated Use {@link #getReports(long)} */ getData : function( ) {}, /**Clients can request metadata for statsd. Will contain stats across all configurations but not the actual metrics themselves (metrics must be collected via {@link #getReports}(long). This getter is not destructive and will not reset any metrics/counters. @return {Number} Serialized StatsdStatsReport proto. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ getStatsMetadata : function( ) {}, /** @deprecated Use {@link #getStatsMetadata()} */ getMetadata : function( ) {}, /**Returns the experiments IDs registered with statsd, or an empty array if there aren't any. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service */ getRegisteredExperimentIds : function( ) {}, /**Registers a callback for an atom when that atom is to be pulled. The stats service will invoke pullData in the callback when the stats service determines that this atom needs to be pulled. Currently, this only works for atoms with tags above 100,000 that do not have a uid. @param {Number} atomTag The tag of the atom for this puller callback. Must be at least 100000. @param {Object {IStatsPullerCallback}} callback The callback to be invoked when the stats service pulls the atom. @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service @hide */ setPullerCallback : function( ) {}, };