diff options
author | Eric Olsen <eolsen@android.com> | 2010-03-26 15:38:41 -0700 |
---|---|---|
committer | Eric Olsen <eolsen@android.com> | 2010-03-31 09:33:47 -0700 |
commit | 6a362a97f71cda9eadfb72ce51e664c494cf7a04 (patch) | |
tree | ecf0974a0ad851a3fecfd7ad40b9bea4fa2fc96a /services/java/com/android/server/BatteryService.java | |
parent | 0a08b1948f1e93fc36af8913e6e87fbeb0e9a92d (diff) |
Add thermal shutdown. If battery temp >= 68C.
Change-Id: I625fa47939d8ecc532457b5c6e13f91d83bfbcc5
Diffstat (limited to 'services/java/com/android/server/BatteryService.java')
-rw-r--r-- | services/java/com/android/server/BatteryService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index 57944fbdfdcc..5cf61bdc659c 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -177,6 +177,7 @@ class BatteryService extends Binder { void systemReady() { // check our power situation now that it is safe to display the shutdown dialog. shutdownIfNoPower(); + shutdownIfOverTemp(); } private final void shutdownIfNoPower() { @@ -190,6 +191,17 @@ 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()) { + Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN); + intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mContext.startActivity(intent); + } + } + private native void native_update(); private synchronized final void update() { @@ -199,6 +211,7 @@ class BatteryService extends Binder { long dischargeDuration = 0; shutdownIfNoPower(); + shutdownIfOverTemp(); mBatteryLevelCritical = mBatteryLevel <= CRITICAL_BATTERY_LEVEL; if (mAcOnline) { |