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

Commit d96d2b8e authored by Yiling Chuang's avatar Yiling Chuang
Browse files

Move the fully charged check to a later stage

Move the check to computePowerChargingStringIndication() instead so the child classes have more flexibility to check differnt cases.

Bug: 366130462
Flag: EXEMPT bugfix
Test: atest SystemUITest

Change-Id: I76c99654041e983cd6080ca87ce8d97160ad1e15
parent 392246dc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -207,8 +207,8 @@ public class KeyguardIndicationController {
    protected boolean mPowerPluggedInWireless;
    protected boolean mPowerPluggedInDock;
    protected int mChargingSpeed;
    protected boolean mPowerCharged;

    private boolean mPowerCharged;
    /** Whether the battery defender is triggered. */
    private boolean mBatteryDefender;
    /** Whether the battery defender is triggered with the device plugged. */
@@ -1100,14 +1100,15 @@ public class KeyguardIndicationController {
            String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f);
            return mContext.getResources().getString(
                    R.string.keyguard_plugged_in_incompatible_charger, percentage);
        } else if (mPowerCharged) {
            return mContext.getResources().getString(R.string.keyguard_charged);
        }

        return computePowerChargingStringIndication();
    }

    protected String computePowerChargingStringIndication() {
        if (mPowerCharged) {
            return mContext.getResources().getString(R.string.keyguard_charged);
        }
        final boolean hasChargingTime = mChargingTimeRemaining > 0;
        int chargingId;
        if (mPowerPluggedInWired) {