OSDN Git Service

Add NPE check for screen and cellular update.
authorjackqdyulei <jackqdyulei@google.com>
Fri, 24 Feb 2017 21:03:35 +0000 (13:03 -0800)
committerjackqdyulei <jackqdyulei@google.com>
Fri, 24 Feb 2017 21:47:14 +0000 (13:47 -0800)
commit906055e38338dd1b1cf82a622c358fb157ac7af3
tree6d8d29e2b58b6937d21abcd69bf0c304fafb7643
parent7e0df1e48c6a6555a791d32073062357ac0007d9
Add NPE check for screen and cellular update.

When battery is full of charge, usageList in BatteryStatsHelper
will be empty. As a result, we cannot find BatterySipper with
type screen and cell, which creates the null pointer error.

In this cl, I add NPE check for sipper. When sipper is null, all
data will be set to default value. I also add check for totalPower
so we won't have divided by zero error.

Bug: 35757789
Test: RunSettingsRoboTests
Change-Id: I80f3c0c542e0a50868e7c314a8d9b3c17999d8c6
src/com/android/settings/fuelgauge/PowerUsageSummary.java
tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java