Fixed the NullPointerException

- Fix b/10633295

Change-Id: Ia429e679c53c959351316ffda7619e10ad6a626c
This commit is contained in:
Lifu Tang
2013-09-05 13:52:55 -07:00
parent 80c2b9b0c4
commit 6cc61f17a1

View File

@@ -560,7 +560,7 @@ public class BatteryStatsHelper {
osApp = app; osApp = app;
} }
} }
if (power != 0) { if (power != 0 || includeZeroConsumption) {
if (u.getUid() == Process.WIFI_UID) { if (u.getUid() == Process.WIFI_UID) {
mWifiPower += power; mWifiPower += power;
} else if (u.getUid() == Process.BLUETOOTH_UID) { } else if (u.getUid() == Process.BLUETOOTH_UID) {
@@ -725,7 +725,8 @@ public class BatteryStatsHelper {
name = mActivity.getResources().getString( name = mActivity.getResources().getString(
R.string.running_process_item_removed_user_label); R.string.running_process_item_removed_user_label);
} }
double power = mUserPower.get(userId); Double userPower = mUserPower.get(userId);
double power = (userPower != null) ? userPower : 0.0;
BatterySipper bs = addEntry(name, DrainType.USER, 0, 0, power); BatterySipper bs = addEntry(name, DrainType.USER, 0, 0, power);
bs.icon = icon; bs.icon = icon;
aggregateSippers(bs, sippers, "User"); aggregateSippers(bs, sippers, "User");