Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 630d98b0 authored by Christopher Tate's avatar Christopher Tate
Browse files

Shell can now fake battery presence

For testing purposes it's useful to have a device pretend to be
a hard-power permanent-power type device for a while.

Bug 34221968
Test: dumpsys verification + cts

Change-Id: Iaace582ee2af051bd1bd3319b079172d6540f5f9
parent 3744d8ba
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -678,7 +678,7 @@ public final class BatteryService extends SystemService {
        pw.println("Battery service (battery) commands:");
        pw.println("  help");
        pw.println("    Print this help text.");
        pw.println("  set [-f] [ac|usb|wireless|status|level|invalid] <value>");
        pw.println("  set [-f] [ac|usb|wireless|status|level|present|invalid] <value>");
        pw.println("    Force a battery property value, freezing battery state.");
        pw.println("    -f: force a battery change broadcast be sent, prints new sequence.");
        pw.println("  unplug [-f]");
@@ -748,6 +748,9 @@ public final class BatteryService extends SystemService {
                    }
                    boolean update = true;
                    switch (key) {
                        case "present":
                            mBatteryProps.batteryPresent = Integer.parseInt(value) != 0;
                            break;
                        case "ac":
                            mBatteryProps.chargerAcOnline = Integer.parseInt(value) != 0;
                            break;