The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Dianne Hackborn | 0068d3dc | 2014-08-06 19:20:25 -0700 | [diff] [blame] | 21 | import android.os.ParcelFileDescriptor; |
Dianne Hackborn | 7e9f4eb | 2010-09-10 18:43:00 -0700 | [diff] [blame] | 22 | import android.os.WorkSource; |
Dianne Hackborn | 2ffa11e | 2014-04-21 15:56:18 -0700 | [diff] [blame] | 23 | import android.telephony.DataConnectionRealTimeInfo; |
Wink Saville | e9b06d7 | 2009-05-18 21:47:50 -0700 | [diff] [blame] | 24 | import android.telephony.SignalStrength; |
| 25 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | interface IBatteryStats { |
Mike Lockwood | 488bb0e | 2013-09-25 09:27:18 -0700 | [diff] [blame] | 27 | // These first methods are also called by native code, so must |
| 28 | // be kept in sync with frameworks/native/include/binder/IBatteryStats.h |
| 29 | void noteStartSensor(int uid, int sensor); |
| 30 | void noteStopSensor(int uid, int sensor); |
Chong Zhang | f3d00e4 | 2014-07-22 09:12:36 -0700 | [diff] [blame] | 31 | void noteStartVideo(int uid); |
| 32 | void noteStopVideo(int uid); |
| 33 | void noteStartAudio(int uid); |
| 34 | void noteStopAudio(int uid); |
Dianne Hackborn | 10eaa85 | 2014-07-22 22:54:55 -0700 | [diff] [blame] | 35 | void noteResetVideo(); |
| 36 | void noteResetAudio(); |
Mike Lockwood | 488bb0e | 2013-09-25 09:27:18 -0700 | [diff] [blame] | 37 | |
| 38 | // Remaining methods are only used in Java. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | byte[] getStatistics(); |
Dianne Hackborn | 099bc62 | 2014-01-22 13:39:16 -0800 | [diff] [blame] | 40 | |
Dianne Hackborn | 0068d3dc | 2014-08-06 19:20:25 -0700 | [diff] [blame] | 41 | ParcelFileDescriptor getStatisticsStream(); |
| 42 | |
Dianne Hackborn | ab5c0ea | 2014-04-29 14:53:32 -0700 | [diff] [blame] | 43 | // Return the computed amount of time remaining on battery, in milliseconds. |
| 44 | // Returns -1 if nothing could be computed. |
| 45 | long computeBatteryTimeRemaining(); |
| 46 | |
| 47 | // Return the computed amount of time remaining to fully charge, in milliseconds. |
| 48 | // Returns -1 if nothing could be computed. |
| 49 | long computeChargeTimeRemaining(); |
| 50 | |
Dianne Hackborn | 099bc62 | 2014-01-22 13:39:16 -0800 | [diff] [blame] | 51 | void addIsolatedUid(int isolatedUid, int appUid); |
| 52 | void removeIsolatedUid(int isolatedUid, int appUid); |
| 53 | |
| 54 | void noteEvent(int code, String name, int uid); |
| 55 | |
Dianne Hackborn | 61659e5 | 2014-07-09 16:13:01 -0700 | [diff] [blame] | 56 | void noteProcessStart(String name, int uid); |
| 57 | void noteProcessState(String name, int uid, int state); |
| 58 | void noteProcessFinish(String name, int uid); |
Dianne Hackborn | fdb1956 | 2014-07-11 16:03:36 -0700 | [diff] [blame] | 59 | void noteSyncStart(String name, int uid); |
| 60 | void noteSyncFinish(String name, int uid); |
| 61 | void noteJobStart(String name, int uid); |
| 62 | void noteJobFinish(String name, int uid); |
Dianne Hackborn | 61659e5 | 2014-07-09 16:13:01 -0700 | [diff] [blame] | 63 | |
Dianne Hackborn | a1f1a3c | 2014-02-24 18:12:28 -0800 | [diff] [blame] | 64 | void noteStartWakelock(int uid, int pid, String name, String historyName, |
| 65 | int type, boolean unimportantForLogging); |
Dianne Hackborn | cbefd8d | 2014-05-14 11:42:00 -0700 | [diff] [blame] | 66 | void noteStopWakelock(int uid, int pid, String name, String historyName, int type); |
Mathias Agopian | 32123fde | 2010-07-22 22:19:43 -0700 | [diff] [blame] | 67 | |
Dianne Hackborn | a1f1a3c | 2014-02-24 18:12:28 -0800 | [diff] [blame] | 68 | void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, |
| 69 | int type, boolean unimportantForLogging); |
Dianne Hackborn | cbefd8d | 2014-05-14 11:42:00 -0700 | [diff] [blame] | 70 | void noteChangeWakelockFromSource(in WorkSource ws, int pid, String name, String histyoryName, |
| 71 | int type, in WorkSource newWs, int newPid, String newName, |
Dianne Hackborn | e5167ca | 2014-03-08 14:39:10 -0800 | [diff] [blame] | 72 | String newHistoryName, int newType, boolean newUnimportantForLogging); |
Dianne Hackborn | cbefd8d | 2014-05-14 11:42:00 -0700 | [diff] [blame] | 73 | void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, String historyName, |
| 74 | int type); |
Dianne Hackborn | 7e9f4eb | 2010-09-10 18:43:00 -0700 | [diff] [blame] | 75 | |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 76 | void noteVibratorOn(int uid, long durationMillis); |
| 77 | void noteVibratorOff(int uid); |
Dianne Hackborn | abc7c49 | 2014-06-30 16:57:46 -0700 | [diff] [blame] | 78 | void noteFlashlightOn(); |
| 79 | void noteFlashlightOff(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 80 | void noteStartGps(int uid); |
| 81 | void noteStopGps(int uid); |
Jeff Brown | e95c3cd | 2014-05-02 16:59:26 -0700 | [diff] [blame] | 82 | void noteScreenState(int state); |
Dianne Hackborn | 617f877 | 2009-03-31 15:04:46 -0700 | [diff] [blame] | 83 | void noteScreenBrightness(int brightness); |
Dianne Hackborn | 617f877 | 2009-03-31 15:04:46 -0700 | [diff] [blame] | 84 | void noteUserActivity(int uid, int event); |
Jeff Brown | e95c3cd | 2014-05-02 16:59:26 -0700 | [diff] [blame] | 85 | void noteInteractive(boolean interactive); |
Dianne Hackborn | 2ffa11e | 2014-04-21 15:56:18 -0700 | [diff] [blame] | 86 | void noteMobileRadioPowerState(int powerState, long timestampNs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | void notePhoneOn(); |
| 88 | void notePhoneOff(); |
Wink Saville | e9b06d7 | 2009-05-18 21:47:50 -0700 | [diff] [blame] | 89 | void notePhoneSignalStrength(in SignalStrength signalStrength); |
Dianne Hackborn | 627bba7 | 2009-03-24 22:32:56 -0700 | [diff] [blame] | 90 | void notePhoneDataConnectionState(int dataType, boolean hasData); |
Amith Yamasani | f37447b | 2009-10-08 18:28:01 -0700 | [diff] [blame] | 91 | void notePhoneState(int phoneState); |
Dianne Hackborn | 58e0eef | 2010-09-16 01:22:10 -0700 | [diff] [blame] | 92 | void noteWifiOn(); |
| 93 | void noteWifiOff(); |
| 94 | void noteWifiRunning(in WorkSource ws); |
| 95 | void noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs); |
| 96 | void noteWifiStopped(in WorkSource ws); |
Dianne Hackborn | ca1bf21 | 2014-02-14 14:18:36 -0800 | [diff] [blame] | 97 | void noteWifiState(int wifiState, String accessPoint); |
Dianne Hackborn | 3251b90 | 2014-06-20 14:40:53 -0700 | [diff] [blame] | 98 | void noteWifiSupplicantStateChanged(int supplState, boolean failedAuth); |
| 99 | void noteWifiRssiChanged(int newRssi); |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 100 | void noteBluetoothOn(); |
| 101 | void noteBluetoothOff(); |
Dianne Hackborn | ca1bf21 | 2014-02-14 14:18:36 -0800 | [diff] [blame] | 102 | void noteBluetoothState(int bluetoothState); |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 103 | void noteFullWifiLockAcquired(int uid); |
| 104 | void noteFullWifiLockReleased(int uid); |
Nick Pelly | 6ccaa54 | 2012-06-15 15:22:47 -0700 | [diff] [blame] | 105 | void noteWifiScanStarted(int uid); |
| 106 | void noteWifiScanStopped(int uid); |
Robert Greenwalt | 5347bd4 | 2009-05-13 15:10:16 -0700 | [diff] [blame] | 107 | void noteWifiMulticastEnabled(int uid); |
| 108 | void noteWifiMulticastDisabled(int uid); |
Dianne Hackborn | 7e9f4eb | 2010-09-10 18:43:00 -0700 | [diff] [blame] | 109 | void noteFullWifiLockAcquiredFromSource(in WorkSource ws); |
| 110 | void noteFullWifiLockReleasedFromSource(in WorkSource ws); |
Nick Pelly | 6ccaa54 | 2012-06-15 15:22:47 -0700 | [diff] [blame] | 111 | void noteWifiScanStartedFromSource(in WorkSource ws); |
| 112 | void noteWifiScanStoppedFromSource(in WorkSource ws); |
Robert Greenwalt | a029ea1 | 2013-09-25 16:38:12 -0700 | [diff] [blame] | 113 | void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph); |
| 114 | void noteWifiBatchedScanStoppedFromSource(in WorkSource ws); |
Dianne Hackborn | 7e9f4eb | 2010-09-10 18:43:00 -0700 | [diff] [blame] | 115 | void noteWifiMulticastEnabledFromSource(in WorkSource ws); |
| 116 | void noteWifiMulticastDisabledFromSource(in WorkSource ws); |
Jeff Sharkey | 1059c3c | 2011-10-04 16:54:49 -0700 | [diff] [blame] | 117 | void noteNetworkInterfaceType(String iface, int type); |
Jeff Sharkey | 7a1c3fc | 2013-06-04 12:29:00 -0700 | [diff] [blame] | 118 | void noteNetworkStatsEnabled(); |
Dianne Hackborn | 6b7b484 | 2010-06-14 17:17:44 -0700 | [diff] [blame] | 119 | void setBatteryState(int status, int health, int plugType, int level, int temp, int volt); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | long getAwakeTimeBattery(); |
| 121 | long getAwakeTimePlugged(); |
| 122 | } |