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

@@ -357,6 +357,24 @@ public final class BatteryDiffEntryTest {
assertThat(entry.isSystemEntry()).isFalse();
}
@Test
public void testIsSystemEntry_uidBatteryWithTetheringProcess_returnTrue() {
final BatteryDiffEntry entry =
createBatteryDiffEntry(
ConvertUtils.CONSUMER_TYPE_UID_BATTERY,
/*uid=*/ BatteryUtils.UID_TETHERING, /*isHidden=*/ false);
assertThat(entry.isSystemEntry()).isTrue();
}
@Test
public void testIsSystemEntry_uidBatteryWithRemovedAppsProcess_returnTrue() {
final BatteryDiffEntry entry =
createBatteryDiffEntry(
ConvertUtils.CONSUMER_TYPE_UID_BATTERY,
/*uid=*/ BatteryUtils.UID_REMOVED_APPS, /*isHidden=*/ false);
assertThat(entry.isSystemEntry()).isTrue();
}
@Test
public void testUpdateRestrictionFlagState_updateFlagAsExpected() throws Exception {
final String expectedAppLabel = "fake app label";