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

Also, make the battery service do it, not some keyguard thing.
This commit is contained in:
Joe Onorato
2009-07-28 18:18:20 -07:00
parent f256c4001b
commit a7e4cf9b5c

View File

@ -44,6 +44,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import com.android.internal.app.ShutdownThread;
/**
@ -182,6 +183,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) {