Disable app usage item if this item is not clickable

some items are not clickable to launch the restriction page in the
battery usage list, we will apply the disabled visual in the
preferrence item to improve the UX (avoid users click the item without
any action)

Bug: 188751551
Bug: 188663505
Test: make SettingsgRoboTests
Change-Id: Ib8925b8e191117543bb1c74d6d01191e3043fc73
This commit is contained in:
ykhung
2021-05-25 14:34:50 +08:00
committed by YUKAI HUNG
parent f49190d769
commit 46bcdda9b9
5 changed files with 178 additions and 41 deletions

View File

@@ -241,7 +241,10 @@ public class BatteryEntry {
mBatteryConsumer = null;
mIsHidden = false;
mPowerComponentId = powerComponentId;
mConsumedPower = devicePowerMah;
mConsumedPower =
powerComponentId == BatteryConsumer.POWER_COMPONENT_SCREEN
? devicePowerMah
: devicePowerMah - appsPowerMah;
mUsageDurationMs = usageDurationMs;
mConsumerType = ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY;
@@ -264,8 +267,10 @@ public class BatteryEntry {
iconId = R.drawable.ic_power_system;
icon = context.getDrawable(iconId);
name = powerComponentName;
mConsumedPower = devicePowerMah;
mConsumedPower =
powerComponentId == BatteryConsumer.POWER_COMPONENT_SCREEN
? devicePowerMah
: devicePowerMah - appsPowerMah;
mConsumerType = ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY;
}