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

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

Merge "Update strings when shortString is true" into oc-mr1-dev

parents a097d68c ae4b79ee
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -243,8 +243,7 @@ public class BatteryInfo {
                info.remainingTimeUs = chargeTime;
                CharSequence timeString = Utils.formatElapsedTime(context,
                        BatteryUtils.convertUsToMs(chargeTime), false /* withSeconds */);
                int resId = shortString ? R.string.power_charging_duration_short
                        : R.string.power_charging_duration;
                int resId = R.string.power_charging_duration;
                info.remainingLabel = TextUtils.expandTemplate(context.getText(
                        R.string.power_remaining_charging_duration_only), timeString);
                info.chargeLabel = TextUtils.expandTemplate(context.getText(resId),
+4 −1
Original line number Diff line number Diff line
@@ -123,11 +123,14 @@ public class BatteryInfoTest {
    }

    @Test
    public void testGetBatteryInfo_pluggedIn_dischargingFalse() {
    public void testGetBatteryInfo_pluggedInUsingShortString_usesCorrectData() {
        doReturn(TEST_CHARGE_TIME_REMAINING).when(mBatteryStats).computeChargeTimeRemaining(
                anyLong());
        BatteryInfo info = BatteryInfo.getBatteryInfoOld(mContext, mChargingBatteryBroadcast,
                mBatteryStats, SystemClock.elapsedRealtime() * 1000, true /* shortString */);

        assertThat(info.discharging).isEqualTo(false);
        assertThat(info.chargeLabel.toString()).isEqualTo("50% - 1m until fully charged");
    }

    @Test