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

Commit e9d1f6f1 authored by jackqdyulei's avatar jackqdyulei Committed by android-build-merger
Browse files

Merge "Update the chargeLabel when battery level is full" into oc-dr1-dev

am: 1eb2f153

Change-Id: I9a1e1f78b34e989a1e56a0e43bf2f40df10a35eb
parents 758b2d4a 1eb2f153
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -227,8 +227,9 @@ public class BatteryInfo {
                final String chargeStatusLabel = resources.getString(
                        R.string.battery_info_status_charging_lower);
                info.remainingLabel = null;
                info.chargeLabel = resources.getString(
                        R.string.power_charging, info.batteryPercentString, chargeStatusLabel);
                info.chargeLabel = info.batteryLevel == 100 ? info.batteryPercentString :
                        resources.getString(R.string.power_charging, info.batteryPercentString,
                                chargeStatusLabel);
            }
        }
        return info;
+11 −0
Original line number Diff line number Diff line
@@ -164,4 +164,15 @@ public class BatteryInfoTest {
        assertThat(info.remainingLabel.toString())
                .isEqualTo(TEST_CHARGE_TIME_REMAINING_STRINGIFIED);
    }

    @Test
    public void testGetBatteryInfo_pluggedInWithFullBattery_onlyShowBatteryLevel() {
        mChargingBatteryBroadcast.putExtra(BatteryManager.EXTRA_LEVEL, 100);

        BatteryInfo info = BatteryInfo.getBatteryInfo(mContext, mChargingBatteryBroadcast,
                mBatteryStats, SystemClock.elapsedRealtime() * 1000, false /* shortString */,
                1000, false /* basedOnUsage */);

        assertThat(info.chargeLabel).isEqualTo("100%");
    }
}