blob: 36c5deb00e8db8017c7249a2907f5eeafd1d02e9 [file] [log] [blame]
Joe Onorato5dcbc6c2017-08-29 15:13:58 -07001/**
yro947fbce2017-11-15 22:50:23 -08002 * Copyright (c) 2017, The Android Open Source Project
Joe Onorato5dcbc6c2017-08-29 15:13:58 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
19/**
Bookatz1b0b1142017-09-08 11:58:42 -070020 * Binder interface to communicate with the statistics management service.
Joe Onorato5dcbc6c2017-08-29 15:13:58 -070021 * {@hide}
22 */
Bookatzb487b552017-09-18 11:26:01 -070023interface IStatsManager {
Joe Onorato5dcbc6c2017-08-29 15:13:58 -070024 /**
Bookatz1b0b1142017-09-08 11:58:42 -070025 * Tell the stats daemon that the android system server is up and running.
Joe Onorato5dcbc6c2017-08-29 15:13:58 -070026 */
Bookatzb487b552017-09-18 11:26:01 -070027 oneway void systemRunning();
28
29 /**
30 * Tell the stats daemon that the StatsCompanionService is up and running.
31 * Two-way binder call so that caller knows message received.
32 */
33 void statsCompanionReady();
Bookatz1b0b1142017-09-08 11:58:42 -070034
35 /**
36 * Tells statsd that an anomaly may have occurred, so statsd can check whether this is so and
37 * act accordingly.
Bookatzb487b552017-09-18 11:26:01 -070038 * Two-way binder call so that caller's method (and corresponding wakelocks) will linger.
Bookatz1b0b1142017-09-08 11:58:42 -070039 */
40 void informAnomalyAlarmFired();
41
Bookatzb487b552017-09-18 11:26:01 -070042 /**
43 * Tells statsd that it is time to poll some stats. Statsd will be responsible for determing
Bookatz1b0b1142017-09-08 11:58:42 -070044 * what stats to poll and initiating the polling.
Bookatzb487b552017-09-18 11:26:01 -070045 * Two-way binder call so that caller's method (and corresponding wakelocks) will linger.
Bookatz1b0b1142017-09-08 11:58:42 -070046 */
47 void informPollAlarmFired();
David Chende701692017-10-05 13:16:02 -070048
49 /**
Yangster-mac932ecec2018-02-01 10:23:52 -080050 * Tells statsd that it is time to handle periodic alarms. Statsd will be responsible for
51 * determing what alarm subscriber to trigger.
52 * Two-way binder call so that caller's method (and corresponding wakelocks) will linger.
53 */
54 void informAlarmForSubscriberTriggeringFired();
55
56 /**
Chenjie Yue36018b2018-04-16 15:18:30 -070057 * Tells statsd that the device is about to shutdown.
yro947fbce2017-11-15 22:50:23 -080058 */
Chenjie Yue36018b2018-04-16 15:18:30 -070059 void informDeviceShutdown(boolean isShutdown);
yro947fbce2017-11-15 22:50:23 -080060
61 /**
David Chende701692017-10-05 13:16:02 -070062 * Inform statsd what the version and package are for each uid. Note that each array should
63 * have the same number of elements, and version[i] and package[i] correspond to uid[i].
64 */
Dianne Hackborn3accca02013-09-20 09:32:11 -070065 oneway void informAllUidData(in int[] uid, in long[] version, in String[] app);
David Chende701692017-10-05 13:16:02 -070066
67 /**
68 * Inform statsd what the uid and version are for one app that was updated.
69 */
Dianne Hackborn3accca02013-09-20 09:32:11 -070070 oneway void informOnePackage(in String app, in int uid, in long version);
David Chende701692017-10-05 13:16:02 -070071
72 /**
73 * Inform stats that an app was removed.
74 */
75 oneway void informOnePackageRemoved(in String app, in int uid);
yro31eb67b2017-10-24 13:33:21 -070076
77 /**
David Chenadaf8b32017-11-03 15:42:08 -070078 * Fetches data for the specified configuration key. Returns a byte array representing proto
David Chen2e8f3802017-11-22 10:56:48 -080079 * wire-encoded of ConfigMetricsReportList.
Bookatz4f716292018-04-10 17:15:12 -070080 *
81 * Requires Manifest.permission.DUMP.
yro31eb67b2017-10-24 13:33:21 -070082 */
Jeff Sharkey6b649252018-04-16 09:50:22 -060083 byte[] getData(in long key, in String packageName);
yro31eb67b2017-10-24 13:33:21 -070084
85 /**
David Chen2e8f3802017-11-22 10:56:48 -080086 * Fetches metadata across statsd. Returns byte array representing wire-encoded proto.
Bookatz4f716292018-04-10 17:15:12 -070087 *
88 * Requires Manifest.permission.DUMP.
David Chen2e8f3802017-11-22 10:56:48 -080089 */
Jeff Sharkey6b649252018-04-16 09:50:22 -060090 byte[] getMetadata(in String packageName);
David Chen2e8f3802017-11-22 10:56:48 -080091
92 /**
David Chenadaf8b32017-11-03 15:42:08 -070093 * Sets a configuration with the specified config key and subscribes to updates for this
94 * configuration key. Broadcasts will be sent if this configuration needs to be collected.
Bookatz4f716292018-04-10 17:15:12 -070095 * The configuration must be a wire-encoded StatsdConfig. The receiver for this data is
David Chen661f7912018-01-22 17:46:24 -080096 * registered in a separate function.
David Chenadaf8b32017-11-03 15:42:08 -070097 *
Bookatz4f716292018-04-10 17:15:12 -070098 * Requires Manifest.permission.DUMP.
yro31eb67b2017-10-24 13:33:21 -070099 */
Jeff Sharkey6b649252018-04-16 09:50:22 -0600100 void addConfiguration(in long configKey, in byte[] config, in String packageName);
David Chen661f7912018-01-22 17:46:24 -0800101
102 /**
103 * Registers the given pending intent for this config key. This intent is invoked when the
104 * memory consumed by the metrics for this configuration approach the pre-defined limits. There
105 * can be at most one listener per config key.
106 *
Bookatz4f716292018-04-10 17:15:12 -0700107 * Requires Manifest.permission.DUMP.
David Chen661f7912018-01-22 17:46:24 -0800108 */
Jeff Sharkey6b649252018-04-16 09:50:22 -0600109 void setDataFetchOperation(long configKey, in IBinder intentSender, in String packageName);
David Chen661f7912018-01-22 17:46:24 -0800110
111 /**
112 * Removes the data fetch operation for the specified configuration.
Bookatz4f716292018-04-10 17:15:12 -0700113 *
114 * Requires Manifest.permission.DUMP.
David Chen661f7912018-01-22 17:46:24 -0800115 */
Jeff Sharkey6b649252018-04-16 09:50:22 -0600116 void removeDataFetchOperation(long configKey, in String packageName);
David Chenadaf8b32017-11-03 15:42:08 -0700117
118 /**
119 * Removes the configuration with the matching config key. No-op if this config key does not
120 * exist.
121 *
Bookatz4f716292018-04-10 17:15:12 -0700122 * Requires Manifest.permission.DUMP.
David Chenadaf8b32017-11-03 15:42:08 -0700123 */
Jeff Sharkey6b649252018-04-16 09:50:22 -0600124 void removeConfiguration(in long configKey, in String packageName);
Bookatzc6977972018-01-16 16:55:05 -0800125
126 /**
127 * Set the IIntentSender (i.e. PendingIntent) to be used when broadcasting subscriber
128 * information to the given subscriberId within the given config.
129 *
130 * Suppose that the calling uid has added a config with key configKey, and that in this config
131 * it is specified that when a particular anomaly is detected, a broadcast should be sent to
132 * a BroadcastSubscriber with id subscriberId. This function links the given intentSender with
133 * that subscriberId (for that config), so that this intentSender is used to send the broadcast
134 * when the anomaly is detected.
135 *
136 * This function can only be called by the owner (uid) of the config. It must be called each
137 * time statsd starts. Later calls overwrite previous calls; only one intentSender is stored.
138 *
139 * intentSender must be convertible into an IntentSender using IntentSender(IBinder)
140 * and cannot be null.
141 *
Bookatz4f716292018-04-10 17:15:12 -0700142 * Requires Manifest.permission.DUMP.
Bookatzc6977972018-01-16 16:55:05 -0800143 */
Jeff Sharkey6b649252018-04-16 09:50:22 -0600144 void setBroadcastSubscriber(long configKey, long subscriberId, in IBinder intentSender,
145 in String packageName);
Bookatzc6977972018-01-16 16:55:05 -0800146
147 /**
148 * Undoes setBroadcastSubscriber() for the (configKey, subscriberId) pair.
149 * Any broadcasts associated with subscriberId will henceforth not be sent.
150 * No-op if this (configKey, subsriberId) pair was not associated with an IntentSender.
151 *
Bookatz4f716292018-04-10 17:15:12 -0700152 * Requires Manifest.permission.DUMP.
Bookatzc6977972018-01-16 16:55:05 -0800153 */
Jeff Sharkey6b649252018-04-16 09:50:22 -0600154 void unsetBroadcastSubscriber(long configKey, long subscriberId, in String packageName);
Joe Onorato5dcbc6c2017-08-29 15:13:58 -0700155}