diff options
author | Brian Muramatsu <btmura@google.com> | 2012-08-20 16:57:13 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-20 16:57:14 -0700 |
commit | a5d5d608ccd885d8328879dde782a8cc93b7cf4f (patch) | |
tree | fa07d3db774f101e8f55210c47bf7d1b8232e63b /services/java/com/android/server/BatteryService.java | |
parent | 33da458dd832996d8b0ae945d6ab2896faff4afa (diff) | |
parent | 37a37f445cbcd64376af153dd79ea2a123d9405d (diff) | |
download | frameworks_base-a5d5d608ccd885d8328879dde782a8cc93b7cf4f.zip frameworks_base-a5d5d608ccd885d8328879dde782a8cc93b7cf4f.tar.gz frameworks_base-a5d5d608ccd885d8328879dde782a8cc93b7cf4f.tar.bz2 |
Merge "add wireless charger support" into jb-mr1-dev
Diffstat (limited to 'services/java/com/android/server/BatteryService.java')
-rw-r--r-- | services/java/com/android/server/BatteryService.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index 0a6f23c..6ae16a4 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -93,6 +93,7 @@ public class BatteryService extends Binder { private boolean mAcOnline; private boolean mUsbOnline; + private boolean mWirelessOnline; private int mBatteryStatus; private int mBatteryHealth; private boolean mBatteryPresent; @@ -150,7 +151,8 @@ public class BatteryService extends Binder { public final boolean isPowered() { // assume we are powered if battery state is unknown so the "stay on while plugged in" option will work. - return (mAcOnline || mUsbOnline || mBatteryStatus == BatteryManager.BATTERY_STATUS_UNKNOWN); + return (mAcOnline || mUsbOnline || mWirelessOnline + || mBatteryStatus == BatteryManager.BATTERY_STATUS_UNKNOWN); } public final boolean isPowered(int plugTypeSet) { @@ -169,6 +171,9 @@ public class BatteryService extends Binder { if (mUsbOnline) { plugTypeBit |= BatteryManager.BATTERY_PLUGGED_USB; } + if (mWirelessOnline) { + plugTypeBit |= BatteryManager.BATTERY_PLUGGED_WIRELESS; + } return (plugTypeSet & plugTypeBit) != 0; } @@ -243,6 +248,8 @@ public class BatteryService extends Binder { mPlugType = BatteryManager.BATTERY_PLUGGED_AC; } else if (mUsbOnline) { mPlugType = BatteryManager.BATTERY_PLUGGED_USB; + } else if (mWirelessOnline) { + mPlugType = BatteryManager.BATTERY_PLUGGED_WIRELESS; } else { mPlugType = BATTERY_PLUGGED_NONE; } @@ -398,6 +405,7 @@ public class BatteryService extends Binder { " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + + " Wireless powered:" + mWirelessOnline + " icon:" + icon + " invalid charger:" + mInvalidCharger); } @@ -503,6 +511,7 @@ public class BatteryService extends Binder { pw.println("Current Battery Service state:"); pw.println(" AC powered: " + mAcOnline); pw.println(" USB powered: " + mUsbOnline); + pw.println(" Wireless powered: " + mWirelessOnline); pw.println(" status: " + mBatteryStatus); pw.println(" health: " + mBatteryHealth); pw.println(" present: " + mBatteryPresent); @@ -523,6 +532,8 @@ public class BatteryService extends Binder { mAcOnline = Integer.parseInt(value) != 0; } else if ("usb".equals(key)) { mUsbOnline = Integer.parseInt(value) != 0; + } else if ("wireless".equals(key)) { + mWirelessOnline = Integer.parseInt(value) != 0; } else if ("status".equals(key)) { mBatteryStatus = Integer.parseInt(value); } else if ("level".equals(key)) { @@ -603,4 +614,3 @@ public class BatteryService extends Binder { } } } - |