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