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

Commit 80e36dbb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make Settings battery entries support dock charging" into tm-qpr-dev

parents 0d04b9e8 b8857ae4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1134,6 +1134,8 @@
    <string name="battery_info_status_charging_slow">Charging slowly</string>
    <!-- [CHAR_LIMIT=20] Battery use screen.  Battery status shown in chart label when charging wirelessly.  -->
    <string name="battery_info_status_charging_wireless">Charging wirelessly</string>
    <!-- [CHAR_LIMIT=20] Battery use screen.  Battery status shown in chart label when the device is dock charging.  -->
    <string name="battery_info_status_charging_dock">Charging Dock</string>
    <!-- Battery Info screen. Value for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
    <string name="battery_info_status_discharging">Not charging</string>
    <!-- Battery Info screen. Value for a status item. A state which device is connected with any charger(e.g. USB, Adapter or Wireless) but not charging yet. Used for diagnostic info screens, precise translation isn't needed -->
+2 −0
Original line number Diff line number Diff line
@@ -239,6 +239,8 @@ public class Utils {
                            statusString = res.getString(R.string.battery_info_status_charging);
                            break;
                    }
                } else if (batteryStatus.isPluggedInDock()) {
                    statusString = res.getString(R.string.battery_info_status_charging_dock);
                } else {
                    statusString = res.getString(R.string.battery_info_status_charging_wireless);
                }
+11 −0
Original line number Diff line number Diff line
@@ -364,6 +364,17 @@ public class UtilsTest {
                resources.getString(R.string.battery_info_status_charging));
    }

    @Test
    public void getBatteryStatus_chargingDock_returnDockChargingString() {
        final Intent intent = new Intent();
        intent.putExtra(BatteryManager.EXTRA_STATUS, BatteryManager.BATTERY_STATUS_CHARGING);
        intent.putExtra(BatteryManager.EXTRA_PLUGGED, BatteryManager.BATTERY_PLUGGED_DOCK);
        final Resources resources = mContext.getResources();

        assertThat(Utils.getBatteryStatus(mContext, intent, /* compactStatus= */ false)).isEqualTo(
                resources.getString(R.string.battery_info_status_charging_dock));
    }

    @Test
    public void getBatteryStatus_chargingWireless_returnWirelessChargingString() {
        final Intent intent = new Intent();