@@ -116,6 +116,7 @@ public class BatteryService extends Binder {
116116
117117 private int mLowBatteryWarningLevel ;
118118 private int mLowBatteryCloseWarningLevel ;
119+ private int mShutdownBatteryTemperature ;
119120
120121 private int mPlugType ;
121122 private int mLastPlugType = -1 ; // Extra state so we can detect first run
@@ -138,6 +139,8 @@ public BatteryService(Context context, LightsService lights) {
138139 com .android .internal .R .integer .config_lowBatteryWarningLevel );
139140 mLowBatteryCloseWarningLevel = mContext .getResources ().getInteger (
140141 com .android .internal .R .integer .config_lowBatteryCloseWarningLevel );
142+ mShutdownBatteryTemperature = mContext .getResources ().getInteger (
143+ com .android .internal .R .integer .config_shutdownBatteryTemperature );
141144
142145 mPowerSupplyObserver .startObserving ("SUBSYSTEM=power_supply" );
143146
@@ -228,9 +231,11 @@ private final void shutdownIfNoPower() {
228231 }
229232
230233 private final void shutdownIfOverTemp () {
231- // shut down gracefully if temperature is too high (> 68.0C)
232- // wait until the system has booted before attempting to display the shutdown dialog.
233- if (mBatteryTemperature > 680 && ActivityManagerNative .isSystemReady ()) {
234+ // shut down gracefully if temperature is too high (> 68.0C by default)
235+ // wait until the system has booted before attempting to display the
236+ // shutdown dialog.
237+ if (mBatteryTemperature > mShutdownBatteryTemperature
238+ && ActivityManagerNative .isSystemReady ()) {
234239 Intent intent = new Intent (Intent .ACTION_REQUEST_SHUTDOWN );
235240 intent .putExtra (Intent .EXTRA_KEY_CONFIRM , false );
236241 intent .setFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
@@ -259,7 +264,7 @@ private void processValues() {
259264 } else {
260265 mPlugType = BATTERY_PLUGGED_NONE ;
261266 }
262-
267+
263268 // Let the battery stats keep track of the current level.
264269 try {
265270 mBatteryStats .setBatteryState (mBatteryStatus , mBatteryHealth ,
@@ -268,7 +273,7 @@ private void processValues() {
268273 } catch (RemoteException e ) {
269274 // Should never happen.
270275 }
271-
276+
272277 shutdownIfNoPower ();
273278 shutdownIfOverTemp ();
274279
0 commit comments