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

Commit a7e4cf9b authored by Joe Onorato's avatar Joe Onorato
Browse files

Fix bug 1982892 - batteryservice turns off device even while plugged in

Also, make the battery service do it, not some keyguard thing.
parent f256c400
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

import com.android.internal.app.ShutdownThread;


/**
@@ -183,6 +184,11 @@ class BatteryService extends Binder {
        boolean logOutlier = false;
        long dischargeDuration = 0;

        // shut down gracefully if our battery is critically low and we are not powered
        if (mBatteryLevel == 0 && isPowered(0xffffffff)) {
            ShutdownThread.shutdown(mContext, false);
        }
        
        mBatteryLevelCritical = mBatteryLevel <= CRITICAL_BATTERY_LEVEL;
        if (mAcOnline) {
            mPlugType = BatteryManager.BATTERY_PLUGGED_AC;