Include type service as type system
Bug: 37293081 Test: RunSettingsRoboTests Change-Id: Id9259a1a516fdf368d41f1b7205a1515d0989aab
This commit is contained in:
@@ -60,7 +60,6 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
|||||||
final int[] mUsageTypes = {
|
final int[] mUsageTypes = {
|
||||||
UsageType.WIFI,
|
UsageType.WIFI,
|
||||||
UsageType.CELL,
|
UsageType.CELL,
|
||||||
UsageType.SERVICE,
|
|
||||||
UsageType.SYSTEM,
|
UsageType.SYSTEM,
|
||||||
UsageType.BLUETOOTH,
|
UsageType.BLUETOOTH,
|
||||||
UsageType.USER,
|
UsageType.USER,
|
||||||
@@ -207,10 +206,9 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
|||||||
return UsageType.UNACCOUNTED;
|
return UsageType.UNACCOUNTED;
|
||||||
} else if (drainType == DrainType.OVERCOUNTED) {
|
} else if (drainType == DrainType.OVERCOUNTED) {
|
||||||
return UsageType.OVERCOUNTED;
|
return UsageType.OVERCOUNTED;
|
||||||
} else if (mPowerUsageFeatureProvider.isTypeSystem(sipper)) {
|
} else if (mPowerUsageFeatureProvider.isTypeSystem(sipper)
|
||||||
|
|| mPowerUsageFeatureProvider.isTypeService(sipper)) {
|
||||||
return UsageType.SYSTEM;
|
return UsageType.SYSTEM;
|
||||||
} else if (mPowerUsageFeatureProvider.isTypeService(sipper)) {
|
|
||||||
return UsageType.SERVICE;
|
|
||||||
} else {
|
} else {
|
||||||
return UsageType.APP;
|
return UsageType.APP;
|
||||||
}
|
}
|
||||||
@@ -320,7 +318,6 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
|||||||
@IntDef({UsageType.APP,
|
@IntDef({UsageType.APP,
|
||||||
UsageType.WIFI,
|
UsageType.WIFI,
|
||||||
UsageType.CELL,
|
UsageType.CELL,
|
||||||
UsageType.SERVICE,
|
|
||||||
UsageType.SYSTEM,
|
UsageType.SYSTEM,
|
||||||
UsageType.BLUETOOTH,
|
UsageType.BLUETOOTH,
|
||||||
UsageType.USER,
|
UsageType.USER,
|
||||||
@@ -331,13 +328,12 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
|||||||
int APP = 0;
|
int APP = 0;
|
||||||
int WIFI = 1;
|
int WIFI = 1;
|
||||||
int CELL = 2;
|
int CELL = 2;
|
||||||
int SERVICE = 3;
|
int SYSTEM = 3;
|
||||||
int SYSTEM = 4;
|
int BLUETOOTH = 4;
|
||||||
int BLUETOOTH = 5;
|
int USER = 5;
|
||||||
int USER = 6;
|
int IDLE = 6;
|
||||||
int IDLE = 7;
|
int UNACCOUNTED = 7;
|
||||||
int UNACCOUNTED = 8;
|
int OVERCOUNTED = 8;
|
||||||
int OVERCOUNTED = 9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
@@ -371,8 +367,6 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
|||||||
return R.string.power_wifi;
|
return R.string.power_wifi;
|
||||||
case UsageType.CELL:
|
case UsageType.CELL:
|
||||||
return R.string.power_cell;
|
return R.string.power_cell;
|
||||||
case UsageType.SERVICE:
|
|
||||||
return R.string.power_service;
|
|
||||||
case UsageType.SYSTEM:
|
case UsageType.SYSTEM:
|
||||||
return R.string.power_system;
|
return R.string.power_system;
|
||||||
case UsageType.BLUETOOTH:
|
case UsageType.BLUETOOTH:
|
||||||
|
@@ -136,13 +136,13 @@ public class PowerUsageAdvancedTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExtractUsageType_TypeService_ReturnService() {
|
public void testExtractUsageType_TypeService_ReturnSystem() {
|
||||||
mNormalBatterySipper.drainType = DrainType.APP;
|
mNormalBatterySipper.drainType = DrainType.APP;
|
||||||
when(mNormalBatterySipper.getUid()).thenReturn(FAKE_UID_1);
|
when(mNormalBatterySipper.getUid()).thenReturn(FAKE_UID_1);
|
||||||
when(mPowerUsageFeatureProvider.isTypeService(any())).thenReturn(true);
|
when(mPowerUsageFeatureProvider.isTypeService(any())).thenReturn(true);
|
||||||
|
|
||||||
assertThat(mPowerUsageAdvanced.extractUsageType(mNormalBatterySipper))
|
assertThat(mPowerUsageAdvanced.extractUsageType(mNormalBatterySipper))
|
||||||
.isEqualTo(UsageType.SERVICE);
|
.isEqualTo(UsageType.SYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -206,8 +206,8 @@ public class PowerUsageAdvancedTest {
|
|||||||
final int[] usageTypeSet = mPowerUsageAdvanced.mUsageTypes;
|
final int[] usageTypeSet = mPowerUsageAdvanced.mUsageTypes;
|
||||||
|
|
||||||
assertThat(usageTypeSet).asList().containsExactly(UsageType.APP, UsageType.WIFI,
|
assertThat(usageTypeSet).asList().containsExactly(UsageType.APP, UsageType.WIFI,
|
||||||
UsageType.CELL, UsageType.BLUETOOTH, UsageType.IDLE, UsageType.SERVICE,
|
UsageType.CELL, UsageType.BLUETOOTH, UsageType.IDLE, UsageType.USER,
|
||||||
UsageType.USER, UsageType.SYSTEM, UsageType.UNACCOUNTED, UsageType.OVERCOUNTED);
|
UsageType.SYSTEM, UsageType.UNACCOUNTED, UsageType.OVERCOUNTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user