Merge commit 'f85d6cd8045ce933dfdc19bc888228cd9382e48c' into HEAD

This commit is contained in:
Bill Yi 2015-11-03 14:30:40 -08:00
commit 1ec36aaeb0
3 changed files with 33 additions and 11 deletions

View File

@ -39,6 +39,7 @@
#define POWER_SUPPLY_SYSFS_PATH "/sys/class/" POWER_SUPPLY_SUBSYSTEM
#define FAKE_BATTERY_CAPACITY 42
#define FAKE_BATTERY_TEMPERATURE 424
#define ALWAYS_PLUGGED_CAPACITY 100
namespace android {
@ -208,6 +209,15 @@ bool BatteryMonitor::update(void) {
mBatteryFixedTemperature :
getIntField(mHealthdConfig->batteryTemperaturePath);
// For devices which do not have battery and are always plugged
// into power souce.
if (mAlwaysPluggedDevice) {
props.chargerAcOnline = true;
props.batteryPresent = true;
props.batteryStatus = BATTERY_STATUS_CHARGING;
props.batteryHealth = BATTERY_HEALTH_GOOD;
}
const int SIZE = 128;
char buf[SIZE];
String8 btech;
@ -590,8 +600,15 @@ void BatteryMonitor::init(struct healthd_config *hc) {
closedir(dir);
}
if (!mChargerNames.size())
// This indicates that there is no charger driver registered.
// Typically the case for devices which do not have a battery and
// and are always plugged into AC mains.
if (!mChargerNames.size()) {
KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
mBatteryFixedCapacity = ALWAYS_PLUGGED_CAPACITY;
mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE;
mAlwaysPluggedDevice = true;
}
if (!mBatteryDevicePresent) {
KLOG_WARNING(LOG_TAG, "No battery devices found\n");
hc->periodic_chores_interval_fast = -1;

View File

@ -46,6 +46,7 @@ class BatteryMonitor {
struct healthd_config *mHealthdConfig;
Vector<String8> mChargerNames;
bool mBatteryDevicePresent;
bool mAlwaysPluggedDevice;
int mBatteryFixedCapacity;
int mBatteryFixedTemperature;
struct BatteryProperties props;

View File

@ -138,23 +138,27 @@ on init
# sets up initial cpusets for ActivityManager
mkdir /dev/cpuset
mount cpuset none /dev/cpuset
mkdir /dev/cpuset/foreground
mkdir /dev/cpuset/foreground/boost
mkdir /dev/cpuset/background
# system-background is for system tasks that should only run on
# little cores, not on bigs
# to be used only by init, so don't change the permissions
mkdir /dev/cpuset/system-background
# this ensures that the cpusets are present and usable, but the device's
# init.rc must actually set the correct cpus
mkdir /dev/cpuset/foreground
write /dev/cpuset/foreground/cpus 0
write /dev/cpuset/foreground/boost/cpus 0
write /dev/cpuset/background/cpus 0
write /dev/cpuset/system-background/cpus 0
write /dev/cpuset/foreground/mems 0
mkdir /dev/cpuset/foreground/boost
write /dev/cpuset/foreground/boost/cpus 0
write /dev/cpuset/foreground/boost/mems 0
mkdir /dev/cpuset/background
write /dev/cpuset/background/cpus 0
write /dev/cpuset/background/mems 0
# system-background is for system tasks that should only run on
# little cores, not on bigs
# to be used only by init, so don't change system-bg permissions
mkdir /dev/cpuset/system-background
write /dev/cpuset/system-background/cpus 0
write /dev/cpuset/system-background/mems 0
# change permissions for all cpusets we'll touch at runtime
chown system system /dev/cpuset
chown system system /dev/cpuset/foreground
chown system system /dev/cpuset/foreground/boost