Merge change 26527 into eclair

* changes:
  Dock screen on config can now select AC or USB.
This commit is contained in:
Android (Google) Code Review
2009-09-22 22:24:10 -04:00
2 changed files with 31 additions and 26 deletions

View File

@@ -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>

View File

@@ -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;
}
}