Home
last modified time | relevance | path

Searched refs:BatteryManager (Results 1 – 25 of 50) sorted by relevance

12

/frameworks/support/work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/
DBatteryChargingTracker.java21 import android.os.BatteryManager;
61 intentFilter.addAction(BatteryManager.ACTION_CHARGING); in getIntentFilter()
62 intentFilter.addAction(BatteryManager.ACTION_DISCHARGING); in getIntentFilter()
79 case BatteryManager.ACTION_CHARGING: in onBroadcastReceive()
83 case BatteryManager.ACTION_DISCHARGING: in onBroadcastReceive()
100 int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1); in isBatteryChangedIntentCharging()
101 charging = (status == BatteryManager.BATTERY_STATUS_CHARGING in isBatteryChangedIntentCharging()
102 || status == BatteryManager.BATTERY_STATUS_FULL); in isBatteryChangedIntentCharging()
104 int chargePlug = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0); in isBatteryChangedIntentCharging()
DBatteryNotLowTracker.java21 import android.os.BatteryManager;
67 int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, BATTERY_PLUGGED_NONE); in getInitialState()
68 int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1); in getInitialState()
69 int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); in getInitialState()
70 int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); in getInitialState()
74 || status == BatteryManager.BATTERY_STATUS_UNKNOWN in getInitialState()
/frameworks/base/cmds/svc/src/com/android/commands/svc/
DPowerCommand.java20 import android.os.BatteryManager;
55 val = BatteryManager.BATTERY_PLUGGED_AC | in run()
56 BatteryManager.BATTERY_PLUGGED_USB | in run()
57 BatteryManager.BATTERY_PLUGGED_WIRELESS; in run()
62 val = BatteryManager.BATTERY_PLUGGED_USB; in run()
64 val = BatteryManager.BATTERY_PLUGGED_AC; in run()
66 val = BatteryManager.BATTERY_PLUGGED_WIRELESS; in run()
/frameworks/base/services/core/java/com/android/server/
DBatteryService.java34 import android.os.BatteryManager;
329 if (mHealthInfo.batteryStatus == BatteryManager.BATTERY_STATUS_UNKNOWN) { in isPoweredLocked()
332 if ((plugTypeSet & BatteryManager.BATTERY_PLUGGED_AC) != 0 && mHealthInfo.chargerAcOnline) { in isPoweredLocked()
335 … if ((plugTypeSet & BatteryManager.BATTERY_PLUGGED_USB) != 0 && mHealthInfo.chargerUsbOnline) { in isPoweredLocked()
338 …if ((plugTypeSet & BatteryManager.BATTERY_PLUGGED_WIRELESS) != 0 && mHealthInfo.chargerWirelessOnl… in isPoweredLocked()
355 && mHealthInfo.batteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN in shouldSendBatteryLowLocked()
363 if (mHealthInfo.batteryLevel == 0 && !isPoweredLocked(BatteryManager.BATTERY_PLUGGED_ANY)) { in shutdownIfNoPowerLocked()
440 mHealthInfo.batteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN in processValuesLocked()
443 mPlugType = BatteryManager.BATTERY_PLUGGED_AC; in processValuesLocked()
445 mPlugType = BatteryManager.BATTERY_PLUGGED_USB; in processValuesLocked()
[all …]
/frameworks/support/work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/
DBatteryChargingTrackerTest.java36 import android.os.BatteryManager;
73 int status = charging ? BatteryManager.BATTERY_STATUS_CHARGING in createBatteryChangedIntent()
74 : BatteryManager.BATTERY_STATUS_DISCHARGING; in createBatteryChangedIntent()
75 intent.putExtra(BatteryManager.EXTRA_STATUS, status); in createBatteryChangedIntent()
78 intent.putExtra(BatteryManager.EXTRA_PLUGGED, plugged); in createBatteryChangedIntent()
91 charging ? BatteryManager.ACTION_CHARGING : BatteryManager.ACTION_DISCHARGING); in createChargingIntent_afterApi23()
130 assertThat(intentFilter.hasAction(BatteryManager.ACTION_CHARGING), is(true)); in testGetIntentFilter_afterApi23()
131 assertThat(intentFilter.hasAction(BatteryManager.ACTION_DISCHARGING), is(true)); in testGetIntentFilter_afterApi23()
DBatteryNotLowTrackerTest.java34 import android.os.BatteryManager;
47 private static final int PLUGGED_IN = BatteryManager.BATTERY_PLUGGED_AC;
49 private static final int KNOWN_STATUS = BatteryManager.BATTERY_STATUS_CHARGING;
50 private static final int UNKNOWN_STATUS = BatteryManager.BATTERY_STATUS_UNKNOWN;
78 intent.putExtra(BatteryManager.EXTRA_PLUGGED, plugged); in createBatteryChangedIntent()
79 intent.putExtra(BatteryManager.EXTRA_STATUS, status); in createBatteryChangedIntent()
80 intent.putExtra(BatteryManager.EXTRA_LEVEL, level); in createBatteryChangedIntent()
81 intent.putExtra(BatteryManager.EXTRA_SCALE, scale); in createBatteryChangedIntent()
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/
DBatteryControllerImpl.java23 import android.os.BatteryManager;
124 * intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0) in onReceive()
125 / intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100)); in onReceive()
126 mPluggedIn = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0; in onReceive()
128 final int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, in onReceive()
129 BatteryManager.BATTERY_STATUS_UNKNOWN); in onReceive()
130 mCharged = status == BatteryManager.BATTERY_STATUS_FULL; in onReceive()
131 mCharging = mCharged || status == BatteryManager.BATTERY_STATUS_CHARGING; in onReceive()
155 dummy.putExtra("plugged", incr > 0 ? BatteryManager.BATTERY_PLUGGED_AC in onReceive()
/frameworks/base/services/core/java/com/android/server/job/controllers/
DBatteryController.java25 import android.os.BatteryManager;
133 filter.addAction(BatteryManager.ACTION_CHARGING); in startTracking()
134 filter.addAction(BatteryManager.ACTION_DISCHARGING); in startTracking()
141 mCharging = batteryManagerInternal.isPowered(BatteryManager.BATTERY_PLUGGED_ANY); in startTracking()
206 } else if (BatteryManager.ACTION_CHARGING.equals(action)) { in onReceiveInternal()
213 } else if (BatteryManager.ACTION_DISCHARGING.equals(action)) { in onReceiveInternal()
220 mLastBatterySeq = intent.getIntExtra(BatteryManager.EXTRA_SEQUENCE, in onReceiveInternal()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/power/
DPowerUITest.java32 import android.os.BatteryManager;
170 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_showHybridOnly_overrideThresholdHigh_returnsNoShow()
187 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_showHybridOnly_overrideThresholdHigh_returnsShow()
203 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_showHybridOnly_returnsShow()
219 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_showHybrid_showStandard_returnsShow()
235 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_showStandardOnly_returnsShow()
250 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_deviceHighBattery_returnsNoShow()
265 POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_devicePlugged_returnsNoShow()
281 !POWER_SAVER_OFF, BatteryManager.BATTERY_STATUS_UNKNOWN); in testShouldShowLowBatteryWarning_deviceBatteryStatusUnknown_returnsNoShow()
296 !POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD); in testShouldShowLowBatteryWarning_batterySaverEnabled_returnsNoShow()
[all …]
/frameworks/base/packages/SettingsLib/src/com/android/settingslib/
DUtils.java20 import android.os.BatteryManager;
182 int level = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); in getBatteryLevel()
183 int scale = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_SCALE, 100); in getBatteryLevel()
188 int status = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_STATUS, in getBatteryStatus()
189 BatteryManager.BATTERY_STATUS_UNKNOWN); in getBatteryStatus()
191 if (status == BatteryManager.BATTERY_STATUS_CHARGING) { in getBatteryStatus()
193 } else if (status == BatteryManager.BATTERY_STATUS_DISCHARGING) { in getBatteryStatus()
195 } else if (status == BatteryManager.BATTERY_STATUS_NOT_CHARGING) { in getBatteryStatus()
197 } else if (status == BatteryManager.BATTERY_STATUS_FULL) { in getBatteryStatus()
/frameworks/opt/telephony/src/java/com/android/internal/telephony/
DDeviceStateMonitor.java30 import android.os.BatteryManager;
147 case BatteryManager.ACTION_CHARGING:
151 case BatteryManager.ACTION_DISCHARGING:
197 filter.addAction(BatteryManager.ACTION_CHARGING); in DeviceStateMonitor()
198 filter.addAction(BatteryManager.ACTION_DISCHARGING); in DeviceStateMonitor()
518 final BatteryManager bm = (BatteryManager) mPhone.getContext().getSystemService( in isDeviceCharging()
/frameworks/base/packages/SystemUI/src/com/android/systemui/power/
DPowerUI.java28 import android.os.BatteryManager;
95 @VisibleForTesting int mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN;
209 mBatteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 100); in onReceive()
211 mBatteryStatus = intent.getIntExtra(BatteryManager.EXTRA_STATUS, in onReceive()
212 BatteryManager.BATTERY_STATUS_UNKNOWN); in onReceive()
214 mPlugType = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 1); in onReceive()
216 mInvalidCharger = intent.getIntExtra(BatteryManager.EXTRA_INVALID_CHARGER, 0); in onReceive()
324 && batteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN; in shouldShowLowBatteryWarning()
341 if (plugged || isPowerSaver || batteryStatus == BatteryManager.BATTERY_STATUS_UNKNOWN) { in isEnhancedTrigger()
/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/
DDeviceStateMonitorTest.java32 import android.os.BatteryManager;
106 Intent intent = new Intent(BatteryManager.ACTION_CHARGING); in testCharging()
114 intent = new Intent(BatteryManager.ACTION_DISCHARGING); in testCharging()
/frameworks/base/core/java/android/os/
DBatteryManager.java33 public class BatteryManager { class
254 public BatteryManager() { in BatteryManager() method in BatteryManager
263 public BatteryManager(Context context, in BatteryManager() method in BatteryManager
/frameworks/base/services/tests/servicestests/src/com/android/server/net/
DConnOnActivityStartTest.java32 import android.os.BatteryManager;
97 private static BatteryManager mBatteryManager;
115 mBatteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE); in setUpOnce()
326 executeCommand("cmd battery set status " + BatteryManager.BATTERY_STATUS_NOT_CHARGING); in turnBatteryOn()
339 executeCommand("cmd battery set ac " + BatteryManager.BATTERY_PLUGGED_AC); in turnBatteryOff()
340 executeCommand("cmd battery set status " + BatteryManager.BATTERY_STATUS_CHARGING); in turnBatteryOff()
/frameworks/base/services/core/java/com/android/server/storage/
DDiskStatsLoggingService.java28 import android.os.BatteryManager;
109 BatteryManager batteryManager = in isCharging()
110 (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE); in isCharging()
/frameworks/base/core/proto/android/os/
Denums.proto24 // They are primarily used by android/os/BatteryManager.java.
36 // Plug states, primarily used by android/os/BatteryManager.java.
38 // Note that NONE is not in BatteryManager.java's constants.
49 // They are primarily used by android/os/BatteryManager.java.
/frameworks/base/services/core/java/com/android/server/pm/
DBackgroundDexOptService.java30 import android.os.BatteryManager;
147 int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); in getBatteryLevel()
148 int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); in getBatteryLevel()
149 boolean present = intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true); in getBatteryLevel()
/frameworks/base/packages/SystemUI/src/com/android/keyguard/
DKeyguardUpdateMonitor.java22 import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
23 import static android.os.BatteryManager.BATTERY_STATUS_FULL;
24 import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
25 import static android.os.BatteryManager.EXTRA_HEALTH;
26 import static android.os.BatteryManager.EXTRA_LEVEL;
27 import static android.os.BatteryManager.EXTRA_MAX_CHARGING_CURRENT;
28 import static android.os.BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE;
29 import static android.os.BatteryManager.EXTRA_PLUGGED;
30 import static android.os.BatteryManager.EXTRA_STATUS;
54 import android.os.BatteryManager;
[all …]
/frameworks/base/services/core/java/com/android/server/power/
DWirelessChargerDetector.java23 import android.os.BatteryManager;
220 if (isPowered && plugType == BatteryManager.BATTERY_PLUGGED_WIRELESS) { in update()
231 if (plugType != 0 && plugType != BatteryManager.BATTERY_PLUGGED_WIRELESS) { in update()
/frameworks/base/tests/BatteryWaster/src/com/android/batterywaster/
DBatteryWaster.java24 import android.os.BatteryManager;
173 int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
/frameworks/base/services/tests/servicestests/src/com/android/server/storage/
DDiskStatsLoggingServiceTest.java38 import android.os.BatteryManager;
180 BatteryManager batteryManager = mock(BatteryManager.class); in testDontCrashOnRun()
/frameworks/base/core/java/android/provider/
DSettings.java67 import android.os.BatteryManager;
2824 || (val == BatteryManager.BATTERY_PLUGGED_AC)
2825 || (val == BatteryManager.BATTERY_PLUGGED_USB)
2826 || (val == BatteryManager.BATTERY_PLUGGED_WIRELESS)
2827 || (val == (BatteryManager.BATTERY_PLUGGED_AC
2828 | BatteryManager.BATTERY_PLUGGED_USB))
2829 || (val == (BatteryManager.BATTERY_PLUGGED_AC
2830 | BatteryManager.BATTERY_PLUGGED_WIRELESS))
2831 || (val == (BatteryManager.BATTERY_PLUGGED_USB
2832 | BatteryManager.BATTERY_PLUGGED_WIRELESS))
[all …]
/frameworks/base/services/core/java/com/android/server/power/batterysaver/
DBatterySaverController.java25 import android.os.BatteryManager;
134 mIsPluggedIn = (intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0);
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/
DKeyguardIndicationController.java29 import android.os.BatteryManager;
498 boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING in onRefreshBatteryInfo()
499 || status.status == BatteryManager.BATTERY_STATUS_FULL; in onRefreshBatteryInfo()

12