Hi
I am looking into Eclair and onward regarding the initialization of
shutting down the device due to low battery.
I would like to hear your opinion and if we can improve the current
shutdown handling in future.
In file "frameworks/base/services/java/com/android/server/
BatteryService.java" we have the function:
private final void shutdownIfNoPower() {
// 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);
}
}
I think that initiating a shutdown when battery level reaches 0 % is
not that good from battery fuel gauging view. There might still be
some energy left in the battery when the gauging turns from 1 % to 0
%.
Example: Depending on the battery gauging SW and/or HW 0.5% might be
presented as 1 % or 0 %. If in this case it presents 0 % the battery
is not fully used before shutting down.
What would be the best is to monitor the battery voltage (in fuel
gauge SW or HW) and when the level hits the desired level the device
should initiate a shutdown that results in an intent that is handled
by the shutdownIfNoPower() function.
What about using the battery health "Dead" to initiate a shutdown?
The modified shutdownIfNoPower() could then look like:
private final void shutdownIfNoPower() {
// shut down gracefully if our battery is dead
// wait until the system has booted before attempting to
display the shutdown dialog.
if (mBatteryHealth == BatteryManager.BATTERY_HEALTH_DEAD &&
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);
}
}
Br
Imre
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to
android-...@googlegroups.com.
To unsubscribe from this group, send email to
android-platfo...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/android-platform?hl=en.