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

Commit 40ef0fc0 authored by John Li's avatar John Li Committed by Automerger Merge Worker
Browse files

Merge "Provide isWirelessCharging() in BatteryController" into rvc-d1-dev am:...

Merge "Provide isWirelessCharging() in BatteryController" into rvc-d1-dev am: b09e202d am: 973dd92c

Change-Id: I88a268e3f708bae0c83223bbfadef0a431ee14b7
parents f972d9a7 973dd92c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@ public interface BatteryController extends DemoMode, Dumpable,
     */
    boolean isAodPowerSave();

    /**
     * Returns {@code true} if the device is currently in wireless charging mode.
     */
    default boolean isWirelessCharging() { return false; }

    /**
     * Returns {@code true} if reverse is supported.
     */
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public class BatteryControllerImpl extends BroadcastReceiver implements BatteryC
    private boolean mCharged;
    protected boolean mPowerSave;
    private boolean mAodPowerSave;
    protected boolean mWirelessCharging;
    private boolean mTestmode = false;
    private boolean mHasReceivedBattery = false;
    private Estimate mEstimate;
@@ -150,6 +151,8 @@ public class BatteryControllerImpl extends BroadcastReceiver implements BatteryC
                    BatteryManager.BATTERY_STATUS_UNKNOWN);
            mCharged = status == BatteryManager.BATTERY_STATUS_FULL;
            mCharging = mCharged || status == BatteryManager.BATTERY_STATUS_CHARGING;
            mWirelessCharging = mCharging && intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0)
                    == BatteryManager.BATTERY_PLUGGED_WIRELESS;

            fireBatteryLevelChanged();
        } else if (action.equals(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED)) {
@@ -204,6 +207,11 @@ public class BatteryControllerImpl extends BroadcastReceiver implements BatteryC
        return mAodPowerSave;
    }

    @Override
    public boolean isWirelessCharging() {
        return mWirelessCharging;
    }

    @Override
    public void getEstimatedTimeRemainingString(EstimateFetchCompletion completion) {
        // Need to fetch or refresh the estimate, but it may involve binder calls so offload the