summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorBrian Muramatsu <btmura@google.com>2012-09-04 22:48:35 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-04 22:48:36 -0700
commit580e9f72e09efc4645aa98753ad8e9806d428950 (patch)
tree0b5938ccef128da65af4fb00d5b6a326b0618c5c /services/java
parentf87633f38c399edf5b2c358992ecbbbbbad5a648 (diff)
parentf3c74f34999337b8eb77e1a5ed0287561b512c21 (diff)
downloadframeworks_base-580e9f72e09efc4645aa98753ad8e9806d428950.zip
frameworks_base-580e9f72e09efc4645aa98753ad8e9806d428950.tar.gz
frameworks_base-580e9f72e09efc4645aa98753ad8e9806d428950.tar.bz2
Merge "Make battery shutdown temperature configurable" into jb-mr1-dev
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/BatteryService.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index f0989e7..fe8529b 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -116,6 +116,7 @@ public class BatteryService extends Binder {
private int mLowBatteryWarningLevel;
private int mLowBatteryCloseWarningLevel;
+ private int mShutdownBatteryTemperature;
private int mPlugType;
private int mLastPlugType = -1; // Extra state so we can detect first run
@@ -138,6 +139,8 @@ public class BatteryService extends Binder {
com.android.internal.R.integer.config_lowBatteryWarningLevel);
mLowBatteryCloseWarningLevel = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lowBatteryCloseWarningLevel);
+ mShutdownBatteryTemperature = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_shutdownBatteryTemperature);
mPowerSupplyObserver.startObserving("SUBSYSTEM=power_supply");
@@ -228,9 +231,11 @@ public class BatteryService extends Binder {
}
private final void shutdownIfOverTemp() {
- // shut down gracefully if temperature is too high (> 68.0C)
- // wait until the system has booted before attempting to display the shutdown dialog.
- if (mBatteryTemperature > 680 && ActivityManagerNative.isSystemReady()) {
+ // shut down gracefully if temperature is too high (> 68.0C by default)
+ // wait until the system has booted before attempting to display the
+ // shutdown dialog.
+ if (mBatteryTemperature > mShutdownBatteryTemperature
+ && ActivityManagerNative.isSystemReady()) {
Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -259,7 +264,7 @@ public class BatteryService extends Binder {
} else {
mPlugType = BATTERY_PLUGGED_NONE;
}
-
+
// Let the battery stats keep track of the current level.
try {
mBatteryStats.setBatteryState(mBatteryStatus, mBatteryHealth,
@@ -268,7 +273,7 @@ public class BatteryService extends Binder {
} catch (RemoteException e) {
// Should never happen.
}
-
+
shutdownIfNoPower();
shutdownIfOverTemp();