Support special tethering and removed apps UID in the usage list

There is a special UID for network data tethering usage, we will handle
it in a special case to avoid the current rule considering it as an
invalid UID case without showing in the usage list. We will disable the
click behavior to protect the optimization mode page first.

Bug: 227395125
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER="com.android.settings.fuelgauge"
Change-Id: I8d96473d382ebc3253748cce8345d6f2261a233d
This commit is contained in:
ykhung
2022-05-04 23:57:15 +08:00
parent 3d1b6fd065
commit be10538a09
8 changed files with 71 additions and 6 deletions

View File

@@ -278,6 +278,22 @@ public class BatteryEntryTest {
assertNameAndIcon("dex2oat", R.string.process_dex2oat_label);
}
@Test
public void getNameAndIconFromUid_tetheringUid_rerturnExpectedName() {
final NameAndIcon nameAndIcon = BatteryEntry.getNameAndIconFromUid(
mContext, /* name */ null, /* uid */ BatteryUtils.UID_TETHERING);
assertThat(nameAndIcon.mName).isEqualTo(getString(R.string.process_network_tethering));
}
@Test
public void getNameAndIconFromUid_removedAppsUid_rerturnExpectedName() {
final NameAndIcon nameAndIcon = BatteryEntry.getNameAndIconFromUid(
mContext, /* name */ null, /* uid */ BatteryUtils.UID_REMOVED_APPS);
assertThat(nameAndIcon.mName).isEqualTo(getString(R.string.process_removed_apps));
}
@Test
public void getNameAndIconFromPowerComponent_rerturnExpectedNameAndIcon() {
assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_AMBIENT_DISPLAY,