diff options
author | Patrik Ryd <patrik.ryd@linaro.org> | 2011-03-02 15:54:36 +0100 |
---|---|---|
committer | Patrik Ryd <patrik.ryd@linaro.org> | 2011-03-02 15:54:36 +0100 |
commit | b8213aacde0c158668a28e2bf29150fad9e2ed26 (patch) | |
tree | f04d3a50c89c2a3b9fa5ac05cde9f5c7a7d27cbe | |
parent | c2149349a661dc57124899db761ccb1e4b615c91 (diff) | |
download | base-linaro_android_2.3.2.tar.gz |
Revert "BatteryService: Remove battery library dependency"linaro_android_2.3.2
This reverts commit c2149349a661dc57124899db761ccb1e4b615c91.
lp:727694
-rw-r--r-- | services/java/com/android/server/BatteryService.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index b3c571af9dd7..fc4e06f3b4e1 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -182,15 +182,31 @@ class BatteryService extends Binder { } private final void shutdownIfNoPower() { - /* NOT IMPLEMENTED */ + // shut down gracefully if our battery is critically low and we are not powered. + // wait until the system has booted before attempting to display the shutdown dialog. + if (mBatteryLevel == 0 && !isPowered() && 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 final void shutdownIfOverTemp() { - /* NOT IMPLEMENTED */ + // 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() { - /* NOT IMPLMENTED */ + native_update(); boolean logOutlier = false; long dischargeDuration = 0; |