Debian Codegraph @

core/java/com/android/internal/app/IBatteryStats.aidl

raw
1 /*
2 * Copyright (C) 2008 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 com.android.internal.app;
18
19 import com.android.internal.os.BatteryStatsImpl;
20
21 import android.bluetooth.BluetoothActivityEnergyInfo;
22 import android.os.BatteryUsageStats;
23 import android.os.BatteryUsageStatsQuery;
24 import android.os.BluetoothBatteryStats;
25 import android.os.ParcelFileDescriptor;
26 import android.os.WakeLockStats;
27 import android.os.WorkSource;
28 import android.os.connectivity.CellularBatteryStats;
29 import android.os.connectivity.WifiActivityEnergyInfo;
30 import android.os.connectivity.WifiBatteryStats;
31 import android.os.connectivity.GpsBatteryStats;
32 import android.os.health.HealthStatsParceler;
33 import android.telephony.DataConnectionRealTimeInfo;
34 import android.telephony.ModemActivityInfo;
35 import android.telephony.SignalStrength;
36
37 interface IBatteryStats {
38 // These first methods are also called by native code, so must
39 // be kept in sync with frameworks/native/libs/binder/include_batterystats/batterystats/IBatteryStats.h
40 void noteStartSensor(int uid, int sensor);
41 void noteStopSensor(int uid, int sensor);
42 void noteStartVideo(int uid);
43 void noteStopVideo(int uid);
44 void noteStartAudio(int uid);
45 void noteStopAudio(int uid);
46 void noteResetVideo();
47 void noteResetAudio();
48 void noteFlashlightOn(int uid);
49 void noteFlashlightOff(int uid);
50 void noteStartCamera(int uid);
51 void noteStopCamera(int uid);
52 void noteResetCamera();
53 void noteResetFlashlight();
54
55 // Remaining methods are only used in Java.
56
57 List<BatteryUsageStats> getBatteryUsageStats(in List<BatteryUsageStatsQuery> queries);
58
59 @UnsupportedAppUsage
60 byte[] getStatistics();
61
62 ParcelFileDescriptor getStatisticsStream(boolean updateAll);
63
64 // Return true if we see the battery as currently charging.
65 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
66 boolean isCharging();
67
68 // Return the computed amount of time remaining on battery, in milliseconds.
69 // Returns -1 if nothing could be computed.
70 long computeBatteryTimeRemaining();
71
72 // Return the computed amount of time remaining to fully charge, in milliseconds.
73 // Returns -1 if nothing could be computed.
74 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
75 long computeChargeTimeRemaining();
76
77 void noteEvent(int code, String name, int uid);
78
79 void noteSyncStart(String name, int uid);
80 void noteSyncFinish(String name, int uid);
81 void noteJobStart(String name, int uid);
82 void noteJobFinish(String name, int uid, int stopReason);
83
84 void noteStartWakelock(int uid, int pid, String name, String historyName,
85 int type, boolean unimportantForLogging);
86 void noteStopWakelock(int uid, int pid, String name, String historyName, int type);
87
88 void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName,
89 int type, boolean unimportantForLogging);
90 void noteChangeWakelockFromSource(in WorkSource ws, int pid, String name, String histyoryName,
91 int type, in WorkSource newWs, int newPid, String newName,
92 String newHistoryName, int newType, boolean newUnimportantForLogging);
93 void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, String historyName,
94 int type);
95 void noteLongPartialWakelockStart(String name, String historyName, int uid);
96 void noteLongPartialWakelockStartFromSource(String name, String historyName,
97 in WorkSource workSource);
98 void noteLongPartialWakelockFinish(String name, String historyName, int uid);
99 void noteLongPartialWakelockFinishFromSource(String name, String historyName,
100 in WorkSource workSource);
101
102 void noteVibratorOn(int uid, long durationMillis);
103 void noteVibratorOff(int uid);
104 void noteGpsChanged(in WorkSource oldSource, in WorkSource newSource);
105 void noteGpsSignalQuality(int signalLevel);
106 void noteScreenState(int state);
107 void noteScreenBrightness(int brightness);
108 void noteUserActivity(int uid, int event);
109 void noteWakeUp(String reason, int reasonUid);
110 void noteInteractive(boolean interactive);
111 void noteConnectivityChanged(int type, String extra);
112 void noteMobileRadioPowerState(int powerState, long timestampNs, int uid);
113 void notePhoneOn();
114 void notePhoneOff();
115 void notePhoneSignalStrength(in SignalStrength signalStrength);
116 void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType, int nrFrequency);
117 void notePhoneState(int phoneState);
118 void noteWifiOn();
119 void noteWifiOff();
120 void noteWifiRunning(in WorkSource ws);
121 void noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs);
122 void noteWifiStopped(in WorkSource ws);
123 void noteWifiState(int wifiState, String accessPoint);
124 void noteWifiSupplicantStateChanged(int supplState, boolean failedAuth);
125 void noteWifiRssiChanged(int newRssi);
126 void noteFullWifiLockAcquired(int uid);
127 void noteFullWifiLockReleased(int uid);
128 void noteWifiScanStarted(int uid);
129 void noteWifiScanStopped(int uid);
130 void noteWifiMulticastEnabled(int uid);
131 void noteWifiMulticastDisabled(int uid);
132 void noteFullWifiLockAcquiredFromSource(in WorkSource ws);
133 void noteFullWifiLockReleasedFromSource(in WorkSource ws);
134 void noteWifiScanStartedFromSource(in WorkSource ws);
135 void noteWifiScanStoppedFromSource(in WorkSource ws);
136 void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph);
137 void noteWifiBatchedScanStoppedFromSource(in WorkSource ws);
138 void noteWifiRadioPowerState(int powerState, long timestampNs, int uid);
139 void noteNetworkInterfaceForTransports(String iface, in int[] transportTypes);
140 void noteNetworkStatsEnabled();
141 void noteDeviceIdleMode(int mode, String activeReason, int activeUid);
142 void setBatteryState(int status, int health, int plugType, int level, int temp, int volt,
143 int chargeUAh, int chargeFullUAh, long chargeTimeToFullSeconds);
144 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
145 long getAwakeTimeBattery();
146 long getAwakeTimePlugged();
147
148 void noteBluetoothOn(int uid, int reason, String packageName);
149 void noteBluetoothOff(int uid, int reason, String packageName);
150 void noteBleScanStarted(in WorkSource ws, boolean isUnoptimized);
151 void noteBleScanStopped(in WorkSource ws, boolean isUnoptimized);
152 void noteBleScanReset();
153 void noteBleScanResults(in WorkSource ws, int numNewResults);
154
155 /** {@hide} */
156 CellularBatteryStats getCellularBatteryStats();
157
158 /** {@hide} */
159 WifiBatteryStats getWifiBatteryStats();
160
161 /** {@hide} */
162 GpsBatteryStats getGpsBatteryStats();
163
164 /** {@hide} */
165 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BATTERY_STATS)")
166 WakeLockStats getWakeLockStats();
167
168 /** {@hide} */
169 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BATTERY_STATS)")
170 BluetoothBatteryStats getBluetoothBatteryStats();
171
172 HealthStatsParceler takeUidSnapshot(int uid);
173 HealthStatsParceler[] takeUidSnapshots(in int[] uid);
174
175 oneway void noteBluetoothControllerActivity(in BluetoothActivityEnergyInfo info);
176 oneway void noteModemControllerActivity(in ModemActivityInfo info);
177 oneway void noteWifiControllerActivity(in WifiActivityEnergyInfo info);
178
179 /** {@hide} */
180 boolean setChargingStateUpdateDelayMillis(int delay);
181
182 /** Exposed as a test API. */
183 void setChargerAcOnline(boolean online, boolean forceUpdate);
184 /** Exposed as a test API. */
185 void setBatteryLevel(int level, boolean forceUpdate);
186 /** Exposed as a test API. */
187 void unplugBattery(boolean forceUpdate);
188 /** Exposed as a test API. */
189 void resetBattery(boolean forceUpdate);
190 /** Exposed as a test API. */
191 void suspendBatteryInput();
192 }