blob: 0558367776787d921352c98d67e012daf648f923 [file] [log] [blame]
Jeffrey Huang8c1ae5a2019-12-12 10:56:24 -08001/**
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
17package android.os;
18
19import 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 */
26interface 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 Huangad213742019-12-16 13:50:06 -080033 * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
Jeffrey Huang8c1ae5a2019-12-12 10:56:24 -080034 */
Jeffrey Huangad213742019-12-16 13:50:06 -080035 void setDataFetchOperation(long configId, in PendingIntent pendingIntent,
Jeffrey Huang8c1ae5a2019-12-12 10:56:24 -080036 in String packageName);
37
38 /**
Jeffrey Huangad213742019-12-16 13:50:06 -080039 * 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 Huang8c1ae5a2019-12-12 10:56:24 -080046 * 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 Huang47537a12020-01-06 15:35:34 -080056 * 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 Huang8c1ae5a2019-12-12 10:56:24 -080063 * 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 Huang4f2e6bd2020-01-06 16:24:45 -080075 * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
Jeffrey Huang8c1ae5a2019-12-12 10:56:24 -080076 */
77 void setBroadcastSubscriber(long configKey, long subscriberId, in PendingIntent pendingIntent,
78 in String packageName);
Jeffrey Huang4f2e6bd2020-01-06 16:24:45 -080079
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 Huang8c1ae5a2019-12-12 10:56:24 -080088}