Joe Onorato | 5dcbc6c | 2017-08-29 15:13:58 -0700 | [diff] [blame] | 1 | /** |
yro | 947fbce | 2017-11-15 22:50:23 -0800 | [diff] [blame] | 2 | * Copyright (c) 2017, The Android Open Source Project |
Joe Onorato | 5dcbc6c | 2017-08-29 15:13:58 -0700 | [diff] [blame] | 3 | * |
| 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 | |
| 17 | package android.os; |
| 18 | |
| 19 | /** |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 20 | * Binder interface to communicate with the statistics management service. |
Joe Onorato | 5dcbc6c | 2017-08-29 15:13:58 -0700 | [diff] [blame] | 21 | * {@hide} |
| 22 | */ |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 23 | interface IStatsManager { |
Joe Onorato | 5dcbc6c | 2017-08-29 15:13:58 -0700 | [diff] [blame] | 24 | /** |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 25 | * Tell the stats daemon that the android system server is up and running. |
Joe Onorato | 5dcbc6c | 2017-08-29 15:13:58 -0700 | [diff] [blame] | 26 | */ |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 27 | 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(); |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Tells statsd that an anomaly may have occurred, so statsd can check whether this is so and |
| 37 | * act accordingly. |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 38 | * Two-way binder call so that caller's method (and corresponding wakelocks) will linger. |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 39 | */ |
| 40 | void informAnomalyAlarmFired(); |
| 41 | |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 42 | /** |
| 43 | * Tells statsd that it is time to poll some stats. Statsd will be responsible for determing |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 44 | * what stats to poll and initiating the polling. |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 45 | * Two-way binder call so that caller's method (and corresponding wakelocks) will linger. |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 46 | */ |
| 47 | void informPollAlarmFired(); |
David Chen | de70169 | 2017-10-05 13:16:02 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
yro | 947fbce | 2017-11-15 22:50:23 -0800 | [diff] [blame] | 50 | * Tells statsd to store data to disk. |
| 51 | */ |
| 52 | void writeDataToDisk(); |
| 53 | |
| 54 | /** |
David Chen | de70169 | 2017-10-05 13:16:02 -0700 | [diff] [blame] | 55 | * Inform statsd what the version and package are for each uid. Note that each array should |
| 56 | * have the same number of elements, and version[i] and package[i] correspond to uid[i]. |
| 57 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 58 | oneway void informAllUidData(in int[] uid, in long[] version, in String[] app); |
David Chen | de70169 | 2017-10-05 13:16:02 -0700 | [diff] [blame] | 59 | |
| 60 | /** |
| 61 | * Inform statsd what the uid and version are for one app that was updated. |
| 62 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 63 | oneway void informOnePackage(in String app, in int uid, in long version); |
David Chen | de70169 | 2017-10-05 13:16:02 -0700 | [diff] [blame] | 64 | |
| 65 | /** |
| 66 | * Inform stats that an app was removed. |
| 67 | */ |
| 68 | oneway void informOnePackageRemoved(in String app, in int uid); |
yro | 31eb67b | 2017-10-24 13:33:21 -0700 | [diff] [blame] | 69 | |
| 70 | /** |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 71 | * Fetches data for the specified configuration key. Returns a byte array representing proto |
David Chen | 2e8f380 | 2017-11-22 10:56:48 -0800 | [diff] [blame] | 72 | * wire-encoded of ConfigMetricsReportList. |
yro | 31eb67b | 2017-10-24 13:33:21 -0700 | [diff] [blame] | 73 | */ |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 74 | byte[] getData(in String key); |
yro | 31eb67b | 2017-10-24 13:33:21 -0700 | [diff] [blame] | 75 | |
| 76 | /** |
David Chen | 2e8f380 | 2017-11-22 10:56:48 -0800 | [diff] [blame] | 77 | * Fetches metadata across statsd. Returns byte array representing wire-encoded proto. |
| 78 | */ |
| 79 | byte[] getMetadata(); |
| 80 | |
| 81 | /** |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 82 | * Sets a configuration with the specified config key and subscribes to updates for this |
| 83 | * configuration key. Broadcasts will be sent if this configuration needs to be collected. |
| 84 | * The configuration must be a wire-encoded StatsDConfig. The caller specifies the name of the |
| 85 | * package and class that should receive these broadcasts. |
| 86 | * |
| 87 | * Returns if this configuration was correctly registered. |
yro | 31eb67b | 2017-10-24 13:33:21 -0700 | [diff] [blame] | 88 | */ |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 89 | boolean addConfiguration(in String configKey, in byte[] config, in String pkg, in String cls); |
| 90 | |
| 91 | /** |
| 92 | * Removes the configuration with the matching config key. No-op if this config key does not |
| 93 | * exist. |
| 94 | * |
| 95 | * Returns if this configuration key was removed. |
| 96 | */ |
| 97 | boolean removeConfiguration(in String configKey); |
Joe Onorato | 5dcbc6c | 2017-08-29 15:13:58 -0700 | [diff] [blame] | 98 | } |