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 24 /** 25 * ICarWatchdogServiceForSystem interface used by the watchdog server to communicate with the 26 * watchdog service. 27 * 28 * @hide 29 */ 30 interface ICarWatchdogServiceForSystem { 31 /** 32 * Checks if the client is alive. 33 * 34 * Watchdog server calls this method, expecting the clients will respond within timeout. 35 * The final timeout is decided by the server, considering the requested timeout on client 36 * registration. If no response from the clients, watchdog server will dump process information 37 * and kill them. 38 * 39 * @param sessionId Unique id to identify each health check session. 40 * @param timeout Final timeout given by the server based on client request. 41 */ checkIfAlive(in int sessionId, in TimeoutLength timeout)42 oneway void checkIfAlive(in int sessionId, in TimeoutLength timeout); 43 44 /** 45 * Notifies the client that it will be forcedly terminated in 1 second. 46 */ prepareProcessTermination()47 oneway void prepareProcessTermination(); 48 49 /** 50 * Returns the package information for the given UIDs. Only UIDs with package information will be 51 * returned. 52 * 53 * @param uids List of UIDs to resolve the package infos. 54 * @param vendorPackagePrefixes List of vendor package prefixes. 55 */ getPackageInfosForUids( in int[] uids, in @utf8InCpp List<String> vendorPackagePrefixes)56 List<PackageInfo> getPackageInfosForUids( 57 in int[] uids, in @utf8InCpp List<String> vendorPackagePrefixes); 58 59 /** 60 * Pushes the latest I/O overuse stats to the watchdog server. 61 * 62 * @param packageIoOveruseStats Latest package I/O overuse stats, for all packages, from the 63 * recent collection. 64 */ latestIoOveruseStats(in List<PackageIoOveruseStats> packageIoOveruseStats)65 oneway void latestIoOveruseStats(in List<PackageIoOveruseStats> packageIoOveruseStats); 66 67 /** 68 * Resets resource overuse stats on the watchdog server side. 69 * 70 * @param packageNames Package names for which to reset the stats. 71 */ resetResourceOveruseStats(in @tf8InCpp List<String> packageNames)72 oneway void resetResourceOveruseStats(in @utf8InCpp List<String> packageNames); 73 74 /** 75 * Fetches today's I/O usage stats for all packages collected during the 76 * previous boot. 77 */ getTodayIoUsageStats()78 List<UserPackageIoUsageStats> getTodayIoUsageStats(); 79 } 80