blob: 4f0e29ebed3937715b5fac90fb6a674f2daa7347 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
17package com.android.internal.app;
18
19import com.android.internal.os.BatteryStatsImpl;
20
Dianne Hackborn0068d3dc2014-08-06 19:20:25 -070021import android.os.ParcelFileDescriptor;
Dianne Hackborn7e9f4eb2010-09-10 18:43:00 -070022import android.os.WorkSource;
Dianne Hackborn2ffa11e2014-04-21 15:56:18 -070023import android.telephony.DataConnectionRealTimeInfo;
Wink Savillee9b06d72009-05-18 21:47:50 -070024import android.telephony.SignalStrength;
25
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026interface IBatteryStats {
Mike Lockwood488bb0e2013-09-25 09:27:18 -070027 // 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 Zhangf3d00e42014-07-22 09:12:36 -070031 void noteStartVideo(int uid);
32 void noteStopVideo(int uid);
33 void noteStartAudio(int uid);
34 void noteStopAudio(int uid);
Dianne Hackborn10eaa852014-07-22 22:54:55 -070035 void noteResetVideo();
36 void noteResetAudio();
Mike Lockwood488bb0e2013-09-25 09:27:18 -070037
38 // Remaining methods are only used in Java.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039 byte[] getStatistics();
Dianne Hackborn099bc622014-01-22 13:39:16 -080040
Dianne Hackborn0068d3dc2014-08-06 19:20:25 -070041 ParcelFileDescriptor getStatisticsStream();
42
Dianne Hackborn4870e9d2015-04-08 16:55:47 -070043 // Return true if we see the battery as currently charging.
44 boolean isCharging();
45
Dianne Hackbornab5c0ea2014-04-29 14:53:32 -070046 // Return the computed amount of time remaining on battery, in milliseconds.
47 // Returns -1 if nothing could be computed.
48 long computeBatteryTimeRemaining();
49
50 // Return the computed amount of time remaining to fully charge, in milliseconds.
51 // Returns -1 if nothing could be computed.
52 long computeChargeTimeRemaining();
53
Dianne Hackborn099bc622014-01-22 13:39:16 -080054 void noteEvent(int code, String name, int uid);
55
Dianne Hackbornfdb19562014-07-11 16:03:36 -070056 void noteSyncStart(String name, int uid);
57 void noteSyncFinish(String name, int uid);
58 void noteJobStart(String name, int uid);
59 void noteJobFinish(String name, int uid);
Dianne Hackborn61659e52014-07-09 16:13:01 -070060
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -080061 void noteStartWakelock(int uid, int pid, String name, String historyName,
62 int type, boolean unimportantForLogging);
Dianne Hackborncbefd8d2014-05-14 11:42:00 -070063 void noteStopWakelock(int uid, int pid, String name, String historyName, int type);
Mathias Agopian32123fde2010-07-22 22:19:43 -070064
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -080065 void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName,
66 int type, boolean unimportantForLogging);
Dianne Hackborncbefd8d2014-05-14 11:42:00 -070067 void noteChangeWakelockFromSource(in WorkSource ws, int pid, String name, String histyoryName,
68 int type, in WorkSource newWs, int newPid, String newName,
Dianne Hackborne5167ca2014-03-08 14:39:10 -080069 String newHistoryName, int newType, boolean newUnimportantForLogging);
Dianne Hackborncbefd8d2014-05-14 11:42:00 -070070 void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, String historyName,
71 int type);
Dianne Hackborn7e9f4eb2010-09-10 18:43:00 -070072
Dianne Hackborna06de0f2012-12-11 16:34:47 -080073 void noteVibratorOn(int uid, long durationMillis);
74 void noteVibratorOff(int uid);
Dianne Hackbornabc7c492014-06-30 16:57:46 -070075 void noteFlashlightOn();
76 void noteFlashlightOff();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 void noteStartGps(int uid);
78 void noteStopGps(int uid);
Jeff Browne95c3cd2014-05-02 16:59:26 -070079 void noteScreenState(int state);
Dianne Hackborn617f8772009-03-31 15:04:46 -070080 void noteScreenBrightness(int brightness);
Dianne Hackborn617f8772009-03-31 15:04:46 -070081 void noteUserActivity(int uid, int event);
Jeff Browne95c3cd2014-05-02 16:59:26 -070082 void noteInteractive(boolean interactive);
Dianne Hackborn1e01d162014-12-04 17:46:42 -080083 void noteConnectivityChanged(int type, String extra);
Dianne Hackborn2ffa11e2014-04-21 15:56:18 -070084 void noteMobileRadioPowerState(int powerState, long timestampNs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 void notePhoneOn();
86 void notePhoneOff();
Wink Savillee9b06d72009-05-18 21:47:50 -070087 void notePhoneSignalStrength(in SignalStrength signalStrength);
Dianne Hackborn627bba72009-03-24 22:32:56 -070088 void notePhoneDataConnectionState(int dataType, boolean hasData);
Amith Yamasanif37447b2009-10-08 18:28:01 -070089 void notePhoneState(int phoneState);
Dianne Hackborn58e0eef2010-09-16 01:22:10 -070090 void noteWifiOn();
91 void noteWifiOff();
92 void noteWifiRunning(in WorkSource ws);
93 void noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs);
94 void noteWifiStopped(in WorkSource ws);
Dianne Hackbornca1bf212014-02-14 14:18:36 -080095 void noteWifiState(int wifiState, String accessPoint);
Dianne Hackborn3251b902014-06-20 14:40:53 -070096 void noteWifiSupplicantStateChanged(int supplState, boolean failedAuth);
97 void noteWifiRssiChanged(int newRssi);
The Android Open Source Project10592532009-03-18 17:39:46 -070098 void noteBluetoothOn();
99 void noteBluetoothOff();
Dianne Hackbornca1bf212014-02-14 14:18:36 -0800100 void noteBluetoothState(int bluetoothState);
The Android Open Source Project10592532009-03-18 17:39:46 -0700101 void noteFullWifiLockAcquired(int uid);
102 void noteFullWifiLockReleased(int uid);
Nick Pelly6ccaa542012-06-15 15:22:47 -0700103 void noteWifiScanStarted(int uid);
104 void noteWifiScanStopped(int uid);
Robert Greenwalt5347bd42009-05-13 15:10:16 -0700105 void noteWifiMulticastEnabled(int uid);
106 void noteWifiMulticastDisabled(int uid);
Dianne Hackborn7e9f4eb2010-09-10 18:43:00 -0700107 void noteFullWifiLockAcquiredFromSource(in WorkSource ws);
108 void noteFullWifiLockReleasedFromSource(in WorkSource ws);
Nick Pelly6ccaa542012-06-15 15:22:47 -0700109 void noteWifiScanStartedFromSource(in WorkSource ws);
110 void noteWifiScanStoppedFromSource(in WorkSource ws);
Robert Greenwalta029ea12013-09-25 16:38:12 -0700111 void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph);
112 void noteWifiBatchedScanStoppedFromSource(in WorkSource ws);
Dianne Hackborn7e9f4eb2010-09-10 18:43:00 -0700113 void noteWifiMulticastEnabledFromSource(in WorkSource ws);
114 void noteWifiMulticastDisabledFromSource(in WorkSource ws);
Adam Lesinskie08af192015-03-25 16:42:59 -0700115 void noteWifiRadioPowerState(int powerState, long timestampNs);
Jeff Sharkey1059c3c2011-10-04 16:54:49 -0700116 void noteNetworkInterfaceType(String iface, int type);
Jeff Sharkey7a1c3fc2013-06-04 12:29:00 -0700117 void noteNetworkStatsEnabled();
Dianne Hackborn8ad2af72015-03-17 17:00:24 -0700118 void noteDeviceIdleMode(boolean enabled, boolean fromActive, boolean fromMotion);
Dianne Hackborn6b7b4842010-06-14 17:17:44 -0700119 void setBatteryState(int status, int health, int plugType, int level, int temp, int volt);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 long getAwakeTimeBattery();
121 long getAwakeTimePlugged();
122}