Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | |
Bookatz | c697797 | 2018-01-16 16:55:05 -0800 | [diff] [blame] | 19 | import android.os.StatsDimensionsValue; |
David Chen | 1481fe1 | 2017-10-16 13:16:34 -0700 | [diff] [blame] | 20 | import android.os.StatsLogEventWrapper; |
| 21 | |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 22 | /** |
| 23 | * Binder interface to communicate with the Java-based statistics service helper. |
| 24 | * {@hide} |
| 25 | */ |
Bookatz | c68a9d2 | 2017-09-27 14:09:55 -0700 | [diff] [blame] | 26 | interface IStatsCompanionService { |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 27 | /** |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 28 | * Tell statscompanion that stastd is up and running. |
| 29 | */ |
Bookatz | c68a9d2 | 2017-09-27 14:09:55 -0700 | [diff] [blame] | 30 | oneway void statsdReady(); |
Bookatz | b487b55 | 2017-09-18 11:26:01 -0700 | [diff] [blame] | 31 | |
| 32 | /** |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 33 | * Register an alarm for anomaly detection to fire at the given timestamp (ms since epoch). |
| 34 | * If anomaly alarm had already been registered, it will be replaced with the new timestamp. |
| 35 | * Uses AlarmManager.set API, so if the timestamp is in the past, alarm fires immediately, and |
| 36 | * alarm is inexact. |
| 37 | */ |
Bookatz | c68a9d2 | 2017-09-27 14:09:55 -0700 | [diff] [blame] | 38 | oneway void setAnomalyAlarm(long timestampMs); |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 39 | |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 40 | /** Cancel any anomaly detection alarm. */ |
Bookatz | c68a9d2 | 2017-09-27 14:09:55 -0700 | [diff] [blame] | 41 | oneway void cancelAnomalyAlarm(); |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * Register a repeating alarm for polling to fire at the given timestamp and every |
| 45 | * intervalMs thereafter (in ms since epoch). |
| 46 | * If polling alarm had already been registered, it will be replaced by new one. |
| 47 | * Uses AlarmManager.setRepeating API, so if the timestamp is in past, alarm fires immediately, |
| 48 | * and alarm is inexact. |
| 49 | */ |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 50 | oneway void setPullingAlarms(long timestampMs, long intervalMs); |
Bookatz | 1b0b114 | 2017-09-08 11:58:42 -0700 | [diff] [blame] | 51 | |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 52 | /** Cancel any repeating polling alarm. */ |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 53 | oneway void cancelPullingAlarms(); |
Bookatz | c68a9d2 | 2017-09-27 14:09:55 -0700 | [diff] [blame] | 54 | |
| 55 | /** Pull the specified data. Results will be sent to statsd when complete. */ |
David Chen | 1481fe1 | 2017-10-16 13:16:34 -0700 | [diff] [blame] | 56 | StatsLogEventWrapper[] pullData(int pullCode); |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 57 | |
| 58 | /** Send a broadcast to the specified pkg and class that it should getData now. */ |
Bookatz | c697797 | 2018-01-16 16:55:05 -0800 | [diff] [blame] | 59 | // TODO: Rename this and use a pending intent instead. |
David Chen | adaf8b3 | 2017-11-03 15:42:08 -0700 | [diff] [blame] | 60 | oneway void sendBroadcast(String pkg, String cls); |
David Chen | c136f45 | 2017-11-27 11:52:26 -0800 | [diff] [blame] | 61 | |
Bookatz | c697797 | 2018-01-16 16:55:05 -0800 | [diff] [blame] | 62 | /** |
| 63 | * Requests StatsCompanionService to send a broadcast using the given intentSender |
| 64 | * (which should cast to an IIntentSender), along with the other information specified. |
| 65 | */ |
| 66 | oneway void sendSubscriberBroadcast(in IBinder intentSender, long configUid, long configId, |
| 67 | long subscriptionId, long subscriptionRuleId, |
| 68 | in StatsDimensionsValue dimensionsValue); |
| 69 | |
David Chen | c136f45 | 2017-11-27 11:52:26 -0800 | [diff] [blame] | 70 | /** Tells StatsCompaionService to grab the uid map snapshot and send it to statsd. */ |
| 71 | oneway void triggerUidSnapshot(); |
Bookatz | 9472641 | 2017-08-31 09:26:15 -0700 | [diff] [blame] | 72 | } |