• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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.automotive.watchdog.internal;
18 
19 import android.automotive.watchdog.internal.PackageInfo;
20 import android.automotive.watchdog.internal.PackageIoOveruseStats;
21 import android.automotive.watchdog.internal.TimeoutLength;
22 import android.automotive.watchdog.internal.UserPackageIoUsageStats;
23 import android.automotive.watchdog.internal.ResourceStats;
24 
25 /**
26  * ICarWatchdogServiceForSystem interface used by the watchdog server to communicate with the
27  * watchdog service.
28  *
29  * @hide
30  */
31 interface ICarWatchdogServiceForSystem {
32   /**
33    * Checks if the client is alive.
34    *
35    * Watchdog server calls this method, expecting the clients will respond within timeout.
36    * The final timeout is decided by the server, considering the requested timeout on client
37    * registration. If no response from the clients, watchdog server will dump process information
38    * and kill them.
39    *
40    * @param sessionId                   Unique id to identify each health check session.
41    * @param timeout                     Final timeout given by the server based on client request.
42    */
checkIfAlive(int sessionId, in TimeoutLength timeout)43   oneway void checkIfAlive(int sessionId, in TimeoutLength timeout);
44 
45   /**
46    * Notifies the client that it will be forcedly terminated in 1 second.
47    */
prepareProcessTermination()48   oneway void prepareProcessTermination();
49 
50   /**
51    * Returns the package information for the given UIDs. Only UIDs with package information will be
52    * returned.
53    *
54    * @param uids                        List of UIDs to resolve the package infos.
55    * @param vendorPackagePrefixes       List of vendor package prefixes.
56    */
getPackageInfosForUids( in int[] uids, in @utf8InCpp List<String> vendorPackagePrefixes)57   List<PackageInfo> getPackageInfosForUids(
58             in int[] uids, in @utf8InCpp List<String> vendorPackagePrefixes);
59 
60   // TODO(b/269191275): This method was replaced by onLatestResourceStats in Android U.
61   //  Deprecate method in Android W (N+2 releases).
62   /**
63    * Pushes the latest I/O overuse stats to the watchdog server.
64    *
65    * @param packageIoOveruseStats       Latest package I/O overuse stats, for all packages, from the
66    *                                    recent collection.
67    */
latestIoOveruseStats(in List<PackageIoOveruseStats> packageIoOveruseStats)68   oneway void latestIoOveruseStats(in List<PackageIoOveruseStats> packageIoOveruseStats);
69 
70   /**
71    * Resets resource overuse stats on the watchdog server side.
72    *
73    * @param packageNames       Package names for which to reset the stats.
74    */
resetResourceOveruseStats(in @tf8InCpp List<String> packageNames)75   oneway void resetResourceOveruseStats(in @utf8InCpp List<String> packageNames);
76 
77   // TODO(b/273354756): This method was replaced by an async request/response pattern Android U.
78   // Requests for the I/O stats are made through the requestTodayIoUsageStats method. And responses
79   // are received by the carwatchdog daemon via ICarWatchdog#onTodayIoUsageStats. Deprecate method
80   // in Android W.
81   /**
82    * Fetches current UTC calendar day's I/O usage stats for all packages collected during the
83    * previous boot.
84    */
getTodayIoUsageStats()85   List<UserPackageIoUsageStats> getTodayIoUsageStats();
86 
87   /**
88    * Pushes the latest resource usage and I/O overuse stats to the carwatchdog service.
89    *
90    * @param resourceStats  Latest resource stats, for the overall system and all packages, from
91    * the recent collection.
92    */
onLatestResourceStats(in List<ResourceStats> resourceStats)93   oneway void onLatestResourceStats(in List<ResourceStats> resourceStats);
94 
95   /**
96    * Request watchdog service to fetch the AIDL VHAL pid.
97    *
98    * Watchdog service responds with the AIDL VHAL pid via the onAidlVhalPidFetched callback in
99    * the ICarWatchdog.aidl. The response is provided via an asynchronous call because
100    * the watchdog service (that resides inside the CarService process) should make a binder call
101    * to the CarServiceHelperService (that resides inside the SystemServer process) to fetch the PID.
102    * This is a time consuming operation and cannot be performed on the same binder call.
103    */
requestAidlVhalPid()104   oneway void requestAidlVhalPid();
105 
106   /**
107    * Requests current UTC calendar day's I/O usage stats for all packages collected during the
108    * previous boot. Stats are sent by CarWatchdogService through the
109    * ICarWatchdog#onTodayIoUsageStats method once it receives the request.
110    */
requestTodayIoUsageStats()111   oneway void requestTodayIoUsageStats();
112 }
113