resolve merge conflicts of 758b2d4ae6
to master
Test: I solemnly swear I tested this conflict resolution. Change-Id: Ic82e244ad1485bdd1f73cff628e0e343bfdb1c53
This commit is contained in:
@@ -576,32 +576,9 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
if (((int) (percentOfTotal + .5)) < 1) {
|
||||
continue;
|
||||
}
|
||||
if (sipper.drainType == BatterySipper.DrainType.OVERCOUNTED) {
|
||||
// Don't show over-counted unless it is at least 2/3 the size of
|
||||
// the largest real entry, and its percent of total is more significant
|
||||
if (sipper.totalPowerMah < ((mStatsHelper.getMaxRealPower() * 2) / 3)) {
|
||||
if (shouldHideSipper(sipper)) {
|
||||
continue;
|
||||
}
|
||||
if (percentOfTotal < 10) {
|
||||
continue;
|
||||
}
|
||||
if ("user".equals(Build.TYPE)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (sipper.drainType == BatterySipper.DrainType.UNACCOUNTED) {
|
||||
// Don't show over-counted unless it is at least 1/2 the size of
|
||||
// the largest real entry, and its percent of total is more significant
|
||||
if (sipper.totalPowerMah < (mStatsHelper.getMaxRealPower() / 2)) {
|
||||
continue;
|
||||
}
|
||||
if (percentOfTotal < 5) {
|
||||
continue;
|
||||
}
|
||||
if ("user".equals(Build.TYPE)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
final UserHandle userHandle = new UserHandle(UserHandle.getUserId(sipper.getUid()));
|
||||
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
|
||||
final Drawable badgedIcon = mUm.getBadgedIconForUser(entry.getIcon(),
|
||||
@@ -650,6 +627,13 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
BatteryEntry.startRequestQueue();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean shouldHideSipper(BatterySipper sipper) {
|
||||
// Don't show over-counted and unaccounted in any condition
|
||||
return sipper.drainType == BatterySipper.DrainType.OVERCOUNTED
|
||||
|| sipper.drainType == BatterySipper.DrainType.UNACCOUNTED;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void refreshAnomalyIcon() {
|
||||
for (int i = 0, size = mAnomalySparseArray.size(); i < size; i++) {
|
||||
|
@@ -32,6 +32,8 @@ import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.app.LoaderManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -514,6 +516,27 @@ public class PowerUsageSummaryTest {
|
||||
assertThat(preference.showAnomalyIcon()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldHideSipper_typeOvercounted_returnTrue() {
|
||||
mNormalBatterySipper.drainType = BatterySipper.DrainType.OVERCOUNTED;
|
||||
|
||||
assertThat(mFragment.shouldHideSipper(mNormalBatterySipper)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldHideSipper_typeUnaccounted_returnTrue() {
|
||||
mNormalBatterySipper.drainType = BatterySipper.DrainType.UNACCOUNTED;
|
||||
|
||||
assertThat(mFragment.shouldHideSipper(mNormalBatterySipper)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldHideSipper_typeNormal_returnFalse() {
|
||||
mNormalBatterySipper.drainType = BatterySipper.DrainType.APP;
|
||||
|
||||
assertThat(mFragment.shouldHideSipper(mNormalBatterySipper)).isFalse();
|
||||
}
|
||||
|
||||
public static class TestFragment extends PowerUsageSummary {
|
||||
|
||||
private Context mContext;
|
||||
|
Reference in New Issue
Block a user