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.net.wifi.WifiActivityEnergyInfo; 23 import android.os.ParcelFileDescriptor; 24 import android.os.WorkSource; 25 import android.os.health.HealthStatsParceler; 26 import android.telephony.DataConnectionRealTimeInfo; 27 import android.telephony.ModemActivityInfo; 28 import android.telephony.SignalStrength; 29 30 interface IBatteryStats { 31 // These first methods are also called by native code, so must 32 // be kept in sync with frameworks/native/include/binder/IBatteryStats.h noteStartSensor(int uid, int sensor)33 void noteStartSensor(int uid, int sensor); noteStopSensor(int uid, int sensor)34 void noteStopSensor(int uid, int sensor); noteStartVideo(int uid)35 void noteStartVideo(int uid); noteStopVideo(int uid)36 void noteStopVideo(int uid); noteStartAudio(int uid)37 void noteStartAudio(int uid); noteStopAudio(int uid)38 void noteStopAudio(int uid); noteResetVideo()39 void noteResetVideo(); noteResetAudio()40 void noteResetAudio(); noteFlashlightOn(int uid)41 void noteFlashlightOn(int uid); noteFlashlightOff(int uid)42 void noteFlashlightOff(int uid); noteStartCamera(int uid)43 void noteStartCamera(int uid); noteStopCamera(int uid)44 void noteStopCamera(int uid); noteResetCamera()45 void noteResetCamera(); noteResetFlashlight()46 void noteResetFlashlight(); 47 48 // Remaining methods are only used in Java. getStatistics()49 byte[] getStatistics(); 50 getStatisticsStream()51 ParcelFileDescriptor getStatisticsStream(); 52 53 // Return true if we see the battery as currently charging. isCharging()54 boolean isCharging(); 55 56 // Return the computed amount of time remaining on battery, in milliseconds. 57 // Returns -1 if nothing could be computed. computeBatteryTimeRemaining()58 long computeBatteryTimeRemaining(); 59 60 // Return the computed amount of time remaining to fully charge, in milliseconds. 61 // Returns -1 if nothing could be computed. computeChargeTimeRemaining()62 long computeChargeTimeRemaining(); 63 noteEvent(int code, String name, int uid)64 void noteEvent(int code, String name, int uid); 65 noteSyncStart(String name, int uid)66 void noteSyncStart(String name, int uid); noteSyncFinish(String name, int uid)67 void noteSyncFinish(String name, int uid); noteJobStart(String name, int uid)68 void noteJobStart(String name, int uid); noteJobFinish(String name, int uid)69 void noteJobFinish(String name, int uid); 70 noteStartWakelock(int uid, int pid, String name, String historyName, int type, boolean unimportantForLogging)71 void noteStartWakelock(int uid, int pid, String name, String historyName, 72 int type, boolean unimportantForLogging); noteStopWakelock(int uid, int pid, String name, String historyName, int type)73 void noteStopWakelock(int uid, int pid, String name, String historyName, int type); 74 noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, int type, boolean unimportantForLogging)75 void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, 76 int type, boolean unimportantForLogging); noteChangeWakelockFromSource(in WorkSource ws, int pid, String name, String histyoryName, int type, in WorkSource newWs, int newPid, String newName, String newHistoryName, int newType, boolean newUnimportantForLogging)77 void noteChangeWakelockFromSource(in WorkSource ws, int pid, String name, String histyoryName, 78 int type, in WorkSource newWs, int newPid, String newName, 79 String newHistoryName, int newType, boolean newUnimportantForLogging); noteStopWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, int type)80 void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, 81 int type); noteLongPartialWakelockStart(String name, String historyName, int uid)82 void noteLongPartialWakelockStart(String name, String historyName, int uid); noteLongPartialWakelockFinish(String name, String historyName, int uid)83 void noteLongPartialWakelockFinish(String name, String historyName, int uid); 84 noteVibratorOn(int uid, long durationMillis)85 void noteVibratorOn(int uid, long durationMillis); noteVibratorOff(int uid)86 void noteVibratorOff(int uid); noteStartGps(int uid)87 void noteStartGps(int uid); noteStopGps(int uid)88 void noteStopGps(int uid); noteScreenState(int state)89 void noteScreenState(int state); noteScreenBrightness(int brightness)90 void noteScreenBrightness(int brightness); noteUserActivity(int uid, int event)91 void noteUserActivity(int uid, int event); noteWakeUp(String reason, int reasonUid)92 void noteWakeUp(String reason, int reasonUid); noteInteractive(boolean interactive)93 void noteInteractive(boolean interactive); noteConnectivityChanged(int type, String extra)94 void noteConnectivityChanged(int type, String extra); noteMobileRadioPowerState(int powerState, long timestampNs, int uid)95 void noteMobileRadioPowerState(int powerState, long timestampNs, int uid); notePhoneOn()96 void notePhoneOn(); notePhoneOff()97 void notePhoneOff(); notePhoneSignalStrength(in SignalStrength signalStrength)98 void notePhoneSignalStrength(in SignalStrength signalStrength); notePhoneDataConnectionState(int dataType, boolean hasData)99 void notePhoneDataConnectionState(int dataType, boolean hasData); notePhoneState(int phoneState)100 void notePhoneState(int phoneState); noteWifiOn()101 void noteWifiOn(); noteWifiOff()102 void noteWifiOff(); noteWifiRunning(in WorkSource ws)103 void noteWifiRunning(in WorkSource ws); noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs)104 void noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs); noteWifiStopped(in WorkSource ws)105 void noteWifiStopped(in WorkSource ws); noteWifiState(int wifiState, String accessPoint)106 void noteWifiState(int wifiState, String accessPoint); noteWifiSupplicantStateChanged(int supplState, boolean failedAuth)107 void noteWifiSupplicantStateChanged(int supplState, boolean failedAuth); noteWifiRssiChanged(int newRssi)108 void noteWifiRssiChanged(int newRssi); noteFullWifiLockAcquired(int uid)109 void noteFullWifiLockAcquired(int uid); noteFullWifiLockReleased(int uid)110 void noteFullWifiLockReleased(int uid); noteWifiScanStarted(int uid)111 void noteWifiScanStarted(int uid); noteWifiScanStopped(int uid)112 void noteWifiScanStopped(int uid); noteWifiMulticastEnabled(int uid)113 void noteWifiMulticastEnabled(int uid); noteWifiMulticastDisabled(int uid)114 void noteWifiMulticastDisabled(int uid); noteFullWifiLockAcquiredFromSource(in WorkSource ws)115 void noteFullWifiLockAcquiredFromSource(in WorkSource ws); noteFullWifiLockReleasedFromSource(in WorkSource ws)116 void noteFullWifiLockReleasedFromSource(in WorkSource ws); noteWifiScanStartedFromSource(in WorkSource ws)117 void noteWifiScanStartedFromSource(in WorkSource ws); noteWifiScanStoppedFromSource(in WorkSource ws)118 void noteWifiScanStoppedFromSource(in WorkSource ws); noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph)119 void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph); noteWifiBatchedScanStoppedFromSource(in WorkSource ws)120 void noteWifiBatchedScanStoppedFromSource(in WorkSource ws); noteWifiMulticastEnabledFromSource(in WorkSource ws)121 void noteWifiMulticastEnabledFromSource(in WorkSource ws); noteWifiMulticastDisabledFromSource(in WorkSource ws)122 void noteWifiMulticastDisabledFromSource(in WorkSource ws); noteWifiRadioPowerState(int powerState, long timestampNs, int uid)123 void noteWifiRadioPowerState(int powerState, long timestampNs, int uid); noteNetworkInterfaceType(String iface, int type)124 void noteNetworkInterfaceType(String iface, int type); noteNetworkStatsEnabled()125 void noteNetworkStatsEnabled(); noteDeviceIdleMode(int mode, String activeReason, int activeUid)126 void noteDeviceIdleMode(int mode, String activeReason, int activeUid); setBatteryState(int status, int health, int plugType, int level, int temp, int volt, int chargeUAh)127 void setBatteryState(int status, int health, int plugType, int level, int temp, int volt, 128 int chargeUAh); getAwakeTimeBattery()129 long getAwakeTimeBattery(); getAwakeTimePlugged()130 long getAwakeTimePlugged(); 131 noteBleScanStarted(in WorkSource ws)132 void noteBleScanStarted(in WorkSource ws); noteBleScanStopped(in WorkSource ws)133 void noteBleScanStopped(in WorkSource ws); noteResetBleScan()134 void noteResetBleScan(); 135 takeUidSnapshot(int uid)136 HealthStatsParceler takeUidSnapshot(int uid); takeUidSnapshots(in int[] uid)137 HealthStatsParceler[] takeUidSnapshots(in int[] uid); 138 noteBluetoothControllerActivity(in BluetoothActivityEnergyInfo info)139 oneway void noteBluetoothControllerActivity(in BluetoothActivityEnergyInfo info); noteModemControllerActivity(in ModemActivityInfo info)140 oneway void noteModemControllerActivity(in ModemActivityInfo info); noteWifiControllerActivity(in WifiActivityEnergyInfo info)141 oneway void noteWifiControllerActivity(in WifiActivityEnergyInfo info); 142 } 143