diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-22 22:24:10 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-22 22:24:10 -0400 |
commit | 7c47adefea3101876f747926e7631406b4fbf45e (patch) | |
tree | 2f5b78cb99ab30a4e2418ebc229acc19e9f5fd79 | |
parent | 520ca7e503498f394ad67faf8caecea25a1930ea (diff) | |
parent | 99f7eb453cee23e13f3ac8a4fa0632dd28f3a4b8 (diff) | |
download | frameworks_base-7c47adefea3101876f747926e7631406b4fbf45e.zip frameworks_base-7c47adefea3101876f747926e7631406b4fbf45e.tar.gz frameworks_base-7c47adefea3101876f747926e7631406b4fbf45e.tar.bz2 |
Merge change 26527 into eclair
* changes:
Dock screen on config can now select AC or USB.
-rw-r--r-- | core/res/res/values/config.xml | 12 | ||||
-rw-r--r-- | services/java/com/android/server/BatteryService.java | 45 |
2 files changed, 31 insertions, 26 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 7aeaec4..a32f519 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -79,12 +79,16 @@ <integer name="config_carDockRotation">-1</integer> <!-- Control whether being in the desk dock (and powered) always - keeps the screen on. By default it doesn't. Set to true to make it. --> - <bool name="config_deskDockKeepsScreenOn">false</bool> + keeps the screen on. By default it stays on when plugged in to + AC. 0 will not keep it on; or together 1 to stay on when plugged + in to AC and 2 to stay on when plugged in to USB. (So 3 for both.) --> + <integer name="config_deskDockKeepsScreenOn">1</integer> <!-- Control whether being in the car dock (and powered) always - keeps the screen on. By default it does. Set to false to not keep on. --> - <bool name="config_carDockKeepsScreenOn">true</bool> + keeps the screen on. By default it stays on when plugged in to + AC. 0 will not keep it on; or together 1 to stay on when plugged + in to AC and 2 to stay on when plugged in to USB. (So 3 for both.) --> + <integer name="config_carDockKeepsScreenOn">1</integer> <!-- Control whether being in the desk dock should enable accelerometer based screen orientation --> <bool name="config_deskDockEnablesAccelerometer">false</bool> diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index d78d886..53edf31 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -267,6 +267,20 @@ class BatteryService extends Binder { logOutlier = true; } + final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE; + final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE; + + /* The ACTION_BATTERY_LOW broadcast is sent in these situations: + * - is just un-plugged (previously was plugged) and battery level is under WARNING, or + * - is not plugged and battery level crosses the WARNING boundary (becomes < 15). + */ + final boolean sendBatteryLow = !plugged + && mBatteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN + && mBatteryLevel < BATTERY_LEVEL_WARNING + && (oldPlugged || mLastBatteryLevel >= BATTERY_LEVEL_WARNING); + + sendIntent(); + // Separate broadcast is sent for power connected / not connected // since the standard intent will not wake any applications and some // applications may want to have smart behavior based on this. @@ -281,28 +295,6 @@ class BatteryService extends Binder { mContext.sendBroadcast(statusIntent); } - final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE; - final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE; - - /* The ACTION_BATTERY_LOW broadcast is sent in these situations: - * - is just un-plugged (previously was plugged) and battery level is under WARNING, or - * - is not plugged and battery level crosses the WARNING boundary (becomes < 15). - */ - final boolean sendBatteryLow = !plugged - && mBatteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN - && mBatteryLevel < BATTERY_LEVEL_WARNING - && (oldPlugged || mLastBatteryLevel >= BATTERY_LEVEL_WARNING); - - mLastBatteryStatus = mBatteryStatus; - mLastBatteryHealth = mBatteryHealth; - mLastBatteryPresent = mBatteryPresent; - mLastBatteryLevel = mBatteryLevel; - mLastPlugType = mPlugType; - mLastBatteryVoltage = mBatteryVoltage; - mLastBatteryTemperature = mBatteryTemperature; - mLastBatteryLevelCritical = mBatteryLevelCritical; - - sendIntent(); if (sendBatteryLow) { mSentLowBatteryBroadcast = true; statusIntent.setAction(Intent.ACTION_BATTERY_LOW); @@ -317,6 +309,15 @@ class BatteryService extends Binder { if (logOutlier && dischargeDuration != 0) { logOutlier(dischargeDuration); } + + mLastBatteryStatus = mBatteryStatus; + mLastBatteryHealth = mBatteryHealth; + mLastBatteryPresent = mBatteryPresent; + mLastBatteryLevel = mBatteryLevel; + mLastPlugType = mPlugType; + mLastBatteryVoltage = mBatteryVoltage; + mLastBatteryTemperature = mBatteryTemperature; + mLastBatteryLevelCritical = mBatteryLevelCritical; } } |