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

Commit c0401b62 authored by Wesley Wang's avatar Wesley Wang Committed by Jack Wu
Browse files

BatteryManager support dock charging 2/2

Bug: 194012532
Test: manually, local test with kernel patch
Change-Id: I1ce467844bb7657c1412b8958fe4d4b0961576e8
parent 9e27c0b7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -30286,6 +30286,7 @@ package android.os {
    field public static final int BATTERY_HEALTH_UNKNOWN = 1; // 0x1
    field public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; // 0x6
    field public static final int BATTERY_PLUGGED_AC = 1; // 0x1
    field public static final int BATTERY_PLUGGED_DOCK = 8; // 0x8
    field public static final int BATTERY_PLUGGED_USB = 2; // 0x2
    field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4
    field public static final int BATTERY_PROPERTY_CAPACITY = 4; // 0x4
+4 −1
Original line number Diff line number Diff line
@@ -187,10 +187,13 @@ public class BatteryManager {
    public static final int BATTERY_PLUGGED_USB = OsProtoEnums.BATTERY_PLUGGED_USB; // = 2
    /** Power source is wireless. */
    public static final int BATTERY_PLUGGED_WIRELESS = OsProtoEnums.BATTERY_PLUGGED_WIRELESS; // = 4
    /** Power source is dock. */
    public static final int BATTERY_PLUGGED_DOCK = OsProtoEnums.BATTERY_PLUGGED_DOCK; // = 8

    /** @hide */
    public static final int BATTERY_PLUGGED_ANY =
            BATTERY_PLUGGED_AC | BATTERY_PLUGGED_USB | BATTERY_PLUGGED_WIRELESS;
            BATTERY_PLUGGED_AC | BATTERY_PLUGGED_USB | BATTERY_PLUGGED_WIRELESS
                    | BATTERY_PLUGGED_DOCK;

    /**
     * Sent when the device's battery has started charging (or has reached full charge
+12 −2
Original line number Diff line number Diff line
@@ -88,14 +88,15 @@ public class BatteryStatus {
    }

    /**
     * Determine whether the device is plugged in (USB, power, or wireless).
     * Determine whether the device is plugged in (USB, power, wireless or dock).
     *
     * @return true if the device is plugged in.
     */
    public boolean isPluggedIn() {
        return plugged == BatteryManager.BATTERY_PLUGGED_AC
                || plugged == BatteryManager.BATTERY_PLUGGED_USB
                || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS;
                || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS
                || plugged == BatteryManager.BATTERY_PLUGGED_DOCK;
    }

    /**
@@ -117,6 +118,15 @@ public class BatteryStatus {
        return plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS;
    }

    /**
     * Determine whether the device is plugged in dock.
     *
     * @return true if the device is plugged in dock
     */
    public boolean isPluggedInDock() {
        return plugged == BatteryManager.BATTERY_PLUGGED_DOCK;
    }

    /**
     * Whether or not the device is charged. Note that some devices never return 100% for
     * battery level, so this allows either battery level or status to determine if the
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@
    <!-- When the lock screen is showing and the phone plugged in, and the battery is not fully charged, say that it's wirelessly charging. [CHAR LIMIT=50]  -->
    <string name="keyguard_plugged_in_wireless"><xliff:g id="percentage" example="20%">%s</xliff:g> • Charging wirelessly</string>

    <!-- When the lock screen is showing and the phone plugged in, and the battery is not fully charged, say that it's dock charging. [CHAR LIMIT=50]  -->
    <string name="keyguard_plugged_in_dock"><xliff:g id="percentage" example="20%">%s</xliff:g> • Charging Dock</string>

    <!-- When the lock screen is showing and the phone plugged in, and the battery
         is not fully charged, say that it's charging.  -->
    <string name="keyguard_plugged_in"><xliff:g id="percentage">%s</xliff:g> • Charging</string>
+3 −0
Original line number Diff line number Diff line
@@ -796,6 +796,9 @@
    <!-- Indication on the keyguard that is shown when the device is charging slowly. Should match keyguard_plugged_in_charging_slowly [CHAR LIMIT=50]-->
    <string name="keyguard_indication_charging_time_slowly"><xliff:g id="percentage">%2$s</xliff:g> • Charging slowly • Full in <xliff:g id="charging_time_left" example="4 hr, 2 min">%1$s</xliff:g></string>

    <!-- Indication on the keyguard that is shown when the device is dock charging. [CHAR LIMIT=80]-->
    <string name="keyguard_indication_charging_time_dock"><xliff:g id="percentage" example="20%">%2$s</xliff:g> • Charging Dock • Full in <xliff:g id="charging_time_left" example="4 hr, 2 min">%1$s</xliff:g></string>

    <!-- Related to user switcher --><skip/>

    <!-- Accessibility label for the button that opens the user switcher. -->
Loading