• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 import java.util.List;
24 
25 /**
26  * Battery stats local system service interface. This is used to pass internal data out of
27  * BatteryStatsImpl, as well as make unchecked calls into BatteryStatsImpl.
28  *
29  * @hide Only for use within Android OS.
30  */
31 public abstract class BatteryStatsInternal {
32     /**
33      * Returns the wifi interfaces.
34      */
getWifiIfaces()35     public abstract String[] getWifiIfaces();
36 
37     /**
38      * Returns the mobile data interfaces.
39      */
getMobileIfaces()40     public abstract String[] getMobileIfaces();
41 
42     /** Returns CPU times for system server thread groups. */
getSystemServiceCpuThreadTimes()43     public abstract SystemServiceCpuThreadTimes getSystemServiceCpuThreadTimes();
44 
45     /**
46      * Returns BatteryUsageStats, which contains power attribution data on a per-subsystem
47      * and per-UID basis.
48      *
49      * <p>
50      * Note: This is a slow running method and should be called from non-blocking threads only.
51      * </p>
52      */
getBatteryUsageStats( List<BatteryUsageStatsQuery> queries)53     public abstract List<BatteryUsageStats> getBatteryUsageStats(
54             List<BatteryUsageStatsQuery> queries);
55 
56     /**
57      * Inform battery stats how many deferred jobs existed when the app got launched and how
58      * long ago was the last job execution for the app.
59      * @param uid the uid of the app.
60      * @param numDeferred number of deferred jobs.
61      * @param sinceLast how long in millis has it been since a job was run
62      */
noteJobsDeferred(int uid, int numDeferred, long sinceLast)63     public abstract void noteJobsDeferred(int uid, int numDeferred, long sinceLast);
64 
65     /**
66      * Informs battery stats of binder stats for the given work source UID.
67      */
noteBinderCallStats(int workSourceUid, long incrementalBinderCallCount, Collection<BinderCallsStats.CallStat> callStats)68     public abstract void noteBinderCallStats(int workSourceUid, long incrementalBinderCallCount,
69             Collection<BinderCallsStats.CallStat> callStats);
70 
71     /**
72      * Informs battery stats of native thread IDs of threads taking incoming binder calls.
73      */
noteBinderThreadNativeIds(int[] binderThreadNativeTids)74     public abstract void noteBinderThreadNativeIds(int[] binderThreadNativeTids);
75 }
76