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

Commit a839dd16 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "QuickBoot: enable poweroff charging under QuickBoot mode"

parents 9d678115 36b074b5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4444,6 +4444,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    };

    private void disableQbCharger() {
        if (SystemProperties.getInt("sys.quickboot.enable", 0) == 1) {
            SystemProperties.set("sys.qbcharger.enable", "false");
        }
    }

    @Override
    public void screenTurnedOff(int why) {
        EventLog.writeEvent(70000, 0);
@@ -4468,6 +4474,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            here.fillInStackTrace();
            Slog.i(TAG, "Screen turning on...", here);
        }
        // To disable native charger when under QuickBoot mode
        disableQbCharger();

        synchronized (mLock) {
            mScreenOnEarly = true;
+12 −0
Original line number Diff line number Diff line
@@ -1071,6 +1071,17 @@ public final class PowerManagerService extends IPowerManager.Stub
        return true;
    }

    private void enableQbCharger(boolean enable) {
        if (SystemProperties.getInt("sys.quickboot.enable", 0) == 1 &&
                SystemProperties.getInt("sys.quickboot.poweroff", 0) != 1) {
            // only handle "charged" event, native charger will handle
            // "uncharged" event itself
            if (enable && mIsPowered && !isScreenOn()) {
                SystemProperties.set("sys.qbcharger.enable", "true");
            }
        }
    }

    @Override // Binder call
    public void goToSleep(long eventTime, int reason) {
        if (eventTime > SystemClock.uptimeMillis()) {
@@ -1270,6 +1281,7 @@ public final class PowerManagerService extends IPowerManager.Stub
                        + ", mBatteryLevel=" + mBatteryLevel);
            }

            enableQbCharger(mIsPowered);
            if (wasPowered != mIsPowered || oldPlugType != mPlugType) {
                mDirty |= DIRTY_IS_POWERED;