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.car.watchdog;
18 
19 import android.car.watchdog.ICarWatchdogServiceCallback;
20 import android.car.watchdog.IResourceOveruseListener;
21 import android.car.watchdog.PackageKillableState;
22 import android.car.watchdog.ResourceOveruseConfiguration;
23 import android.car.watchdog.ResourceOveruseStats;
24 import android.os.UserHandle;
25 
26 /** @hide */
27 interface ICarWatchdogService {
28     // registerClient needs to get callingPid, so cannot be oneway.
registerClient(in ICarWatchdogServiceCallback client, in int timeout)29     void registerClient(in ICarWatchdogServiceCallback client, in int timeout);
unregisterClient(in ICarWatchdogServiceCallback client)30     void unregisterClient(in ICarWatchdogServiceCallback client);
tellClientAlive(in ICarWatchdogServiceCallback client, in int sessionId)31     void tellClientAlive(in ICarWatchdogServiceCallback client, in int sessionId);
32 
getResourceOveruseStats( in int resourceOveruseFlag, in int maxStatsPeriod)33     ResourceOveruseStats getResourceOveruseStats(
34         in int resourceOveruseFlag, in int maxStatsPeriod);
getAllResourceOveruseStats( in int resourceOveruseFlag, in int minimumStatsFlag, in int maxStatsPeriod)35     List<ResourceOveruseStats> getAllResourceOveruseStats(
36         in int resourceOveruseFlag, in int minimumStatsFlag, in int maxStatsPeriod);
getResourceOveruseStatsForUserPackage( in String packageName, in UserHandle userHandle, in int resourceOveruseFlag, in int maxStatsPeriod)37     ResourceOveruseStats getResourceOveruseStatsForUserPackage(
38         in String packageName, in UserHandle userHandle, in int resourceOveruseFlag,
39             in int maxStatsPeriod);
40 
41     // addResourceOveruseListener needs to get callingUid, so cannot be oneway.
addResourceOveruseListener( in int resourceOveruseFlag, in IResourceOveruseListener listener)42     void addResourceOveruseListener(
43         in int resourceOveruseFlag, in IResourceOveruseListener listener);
removeResourceOveruseListener(in IResourceOveruseListener listener)44     oneway void removeResourceOveruseListener(in IResourceOveruseListener listener);
45 
46     // Following APIs need to get calling pid/uid for permission checking, so cannot be oneway.
addResourceOveruseListenerForSystem( in int resourceOveruseFlag, in IResourceOveruseListener listener)47     void addResourceOveruseListenerForSystem(
48         in int resourceOveruseFlag, in IResourceOveruseListener listener);
removeResourceOveruseListenerForSystem(in IResourceOveruseListener listener)49     void removeResourceOveruseListenerForSystem(in IResourceOveruseListener listener);
50 
setKillablePackageAsUser(in String packageName, in UserHandle userHandle, in boolean isKillable)51     void setKillablePackageAsUser(in String packageName, in UserHandle userHandle,
52         in boolean isKillable);
getPackageKillableStatesAsUser(in UserHandle user)53     List<PackageKillableState> getPackageKillableStatesAsUser(in UserHandle user);
54 
setResourceOveruseConfigurations( in List<ResourceOveruseConfiguration> configurations, in int resourceOveruseFlag)55     int setResourceOveruseConfigurations(
56         in List<ResourceOveruseConfiguration> configurations, in int resourceOveruseFlag);
getResourceOveruseConfigurations( in int resourceOveruseFlag)57     List<ResourceOveruseConfiguration> getResourceOveruseConfigurations(
58         in int resourceOveruseFlag);
59 }
60