mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
Fix battery time estimates showing thousands of hours on phones that report current in mA (#820)
fix: read battery current reported in mA so time estimates aren't 1000x too long
This commit is contained in:
1 parent
422429d63f
commit
ce444fbacb
2 files changed
+17
-2
No files matched your search
@@ -41,6 +41,14 @@ class BatteryComponentTest {
|
||||
assertTelemetry(supplies, vpower)
|
||||
}
|
||||
|
||||
@Test fun vendorsReportingMilliampsGetTheSameEstimatesAsMicroamps() {
|
||||
val supplies = tmp.newFolder("power_supply")
|
||||
val vpower = tmp.newFolder("vpower")
|
||||
start(supplies, vpower, -2_000L)
|
||||
assertTelemetry(supplies, vpower)
|
||||
assertEquals("-2000000", File(supplies, "BAT1/current_now").readText().trim())
|
||||
}
|
||||
|
||||
private fun start(supplies: File, vpower: File, currentUa: Long) {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
context.sendStickyBroadcast(Intent(Intent.ACTION_BATTERY_CHANGED).apply {
|
||||
|
||||
Reference in new issue
Block a user