1 /*
2  * Copyright 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 
19 import com.android.internal.os.BinderCallsStats;
20 import com.android.internal.os.SystemServerCpuThreadReader.SystemServiceCpuThreadTimes;
21 
22 import java.util.Collection;
23 
24 /**
25  * Battery stats local system service interface. This is used to pass internal data out of
26  * BatteryStatsImpl, as well as make unchecked calls into BatteryStatsImpl.
27  *
28  * @hide Only for use within Android OS.
29  */
30 public abstract class BatteryStatsInternal {
31     /**
32      * Returns the wifi interfaces.
33      */
getWifiIfaces()34     public abstract String[] getWifiIfaces();
35 
36     /**
37      * Returns the mobile data interfaces.
38      */
getMobileIfaces()39     public abstract String[] getMobileIfaces();
40 
41     /** Returns CPU times for system server thread groups. */
getSystemServiceCpuThreadTimes()42     public abstract SystemServiceCpuThreadTimes getSystemServiceCpuThreadTimes();
43 
44     /**
45      * Inform battery stats how many deferred jobs existed when the app got launched and how
46      * long ago was the last job execution for the app.
47      * @param uid the uid of the app.
48      * @param numDeferred number of deferred jobs.
49      * @param sinceLast how long in millis has it been since a job was run
50      */
noteJobsDeferred(int uid, int numDeferred, long sinceLast)51     public abstract void noteJobsDeferred(int uid, int numDeferred, long sinceLast);
52 
53     /**
54      * Informs battery stats of binder stats for the given work source UID.
55      */
noteBinderCallStats(int workSourceUid, long incrementalBinderCallCount, Collection<BinderCallsStats.CallStat> callStats)56     public abstract void noteBinderCallStats(int workSourceUid, long incrementalBinderCallCount,
57             Collection<BinderCallsStats.CallStat> callStats);
58 
59     /**
60      * Informs battery stats of native thread IDs of threads taking incoming binder calls.
61      */
noteBinderThreadNativeIds(int[] binderThreadNativeTids)62     public abstract void noteBinderThreadNativeIds(int[] binderThreadNativeTids);
63 }
64