Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2019, The Android Open Source Project |
| 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 | import android.app.PendingIntent; |
| 20 | |
| 21 | /** |
| 22 | * Binder interface to communicate with the Java-based statistics service helper. |
| 23 | * Contains parcelable objects available only in Java. |
| 24 | * {@hide} |
| 25 | */ |
| 26 | interface IStatsManagerService { |
| 27 | |
| 28 | /** |
| 29 | * Registers the given pending intent for this config key. This intent is invoked when the |
| 30 | * memory consumed by the metrics for this configuration approach the pre-defined limits. There |
| 31 | * can be at most one listener per config key. |
| 32 | * |
Jeffrey Huang | ad21374 | 2019-12-16 13:50:06 -0800 | [diff] [blame] | 33 | * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS. |
Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 34 | */ |
Jeffrey Huang | ad21374 | 2019-12-16 13:50:06 -0800 | [diff] [blame] | 35 | void setDataFetchOperation(long configId, in PendingIntent pendingIntent, |
Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 36 | in String packageName); |
| 37 | |
| 38 | /** |
Jeffrey Huang | ad21374 | 2019-12-16 13:50:06 -0800 | [diff] [blame] | 39 | * Removes the data fetch operation for the specified configuration. |
| 40 | * |
| 41 | * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS. |
| 42 | */ |
| 43 | void removeDataFetchOperation(long configId, in String packageName); |
| 44 | |
| 45 | /** |
Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 46 | * Registers the given pending intent for this packagename. This intent is invoked when the |
| 47 | * active status of any of the configs sent by this package changes and will contain a list of |
| 48 | * config ids that are currently active. It also returns the list of configs that are currently |
| 49 | * active. There can be at most one active configs changed listener per package. |
| 50 | * |
| 51 | * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS. |
| 52 | */ |
| 53 | long[] setActiveConfigsChangedOperation(in PendingIntent pendingIntent, in String packageName); |
| 54 | |
| 55 | /** |
Jeffrey Huang | 47537a1 | 2020-01-06 15:35:34 -0800 | [diff] [blame] | 56 | * Removes the active configs changed operation for the specified package name. |
| 57 | * |
| 58 | * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS. |
| 59 | */ |
| 60 | void removeActiveConfigsChangedOperation(in String packageName); |
| 61 | |
| 62 | /** |
Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 63 | * Set the PendingIntent to be used when broadcasting subscriber |
| 64 | * information to the given subscriberId within the given config. |
| 65 | * |
| 66 | * Suppose that the calling uid has added a config with key configKey, and that in this config |
| 67 | * it is specified that when a particular anomaly is detected, a broadcast should be sent to |
| 68 | * a BroadcastSubscriber with id subscriberId. This function links the given pendingIntent with |
| 69 | * that subscriberId (for that config), so that this pendingIntent is used to send the broadcast |
| 70 | * when the anomaly is detected. |
| 71 | * |
| 72 | * This function can only be called by the owner (uid) of the config. It must be called each |
| 73 | * time statsd starts. Later calls overwrite previous calls; only one PendingIntent is stored. |
| 74 | * |
Jeffrey Huang | 4f2e6bd | 2020-01-06 16:24:45 -0800 | [diff] [blame] | 75 | * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS. |
Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 76 | */ |
| 77 | void setBroadcastSubscriber(long configKey, long subscriberId, in PendingIntent pendingIntent, |
| 78 | in String packageName); |
Jeffrey Huang | 4f2e6bd | 2020-01-06 16:24:45 -0800 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Undoes setBroadcastSubscriber() for the (configKey, subscriberId) pair. |
| 82 | * Any broadcasts associated with subscriberId will henceforth not be sent. |
| 83 | * No-op if this (configKey, subscriberId) pair was not associated with an PendingIntent. |
| 84 | * |
| 85 | * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS. |
| 86 | */ |
| 87 | void unsetBroadcastSubscriber(long configKey, long subscriberId, in String packageName); |
Jeffrey Huang | 8c1ae5a | 2019-12-12 10:56:24 -0800 | [diff] [blame] | 88 | } |