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

Commit 1d156c96 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 b65ac797 0c33413f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4880,6 +4880,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    };

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

    // Called on the PowerManager's Notifier thread.
    @Override
    public void goingToSleep(int why) {
@@ -4907,6 +4913,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        EventLog.writeEvent(70000, 1);
        if (DEBUG_WAKEUP) Slog.i(TAG, "Waking up...");

        // To disable qbcharger process when screen turning on
        disableQbCharger();

        // Since goToSleep performs these functions synchronously, we must
        // do the same here.  We cannot post this work to a handler because
        // that might cause it to become reordered with respect to what
+12 −0
Original line number Diff line number Diff line
@@ -1094,6 +1094,17 @@ public final class PowerManagerService extends SystemService
        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, qbcharger process will handle
            // "uncharged" event itself
            if (enable && mIsPowered && !isInteractiveInternal()) {
                SystemProperties.set("sys.qbcharger.enable", "true");
            }
        }
    }

    private void goToSleepInternal(long eventTime, int reason, int flags, int uid) {
        synchronized (mLock) {
            if (goToSleepNoUpdateLocked(eventTime, reason, flags, uid)) {
@@ -1329,6 +1340,7 @@ public final class PowerManagerService extends SystemService
                        + ", mBatteryLevel=" + mBatteryLevel);
            }

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