[Battery usage U] Add an item "Others" in the app list to group small usage apps. This will make the total percetage 100%, which is easy to understand for users.

Bug: 258124173
Fix: 258124173
Test: manual
Change-Id: I5965eeb73a2071c4a9994655e4ed24ec3adf64e8
This commit is contained in:
Zaiyue Xue
2023-01-04 17:09:09 +08:00
parent 1c8455dfea
commit 7c987c9d98
5 changed files with 81 additions and 0 deletions

View File

@@ -435,4 +435,45 @@ public class BatteryDiffEntry {
return false;
}
}
/** Specific battery diff entry for others. */
static class OthersBatteryDiffEntry extends BatteryDiffEntry {
OthersBatteryDiffEntry(Context context) {
super(context,
/*foregroundUsageTimeInMs=*/ 0,
/*backgroundUsageTimeInMs=*/ 0,
/*screenOnTimeInMs=*/ 0,
/*consumePower=*/ 0,
/*foregroundUsageConsumePower=*/ 0,
/*foregroundServiceUsageConsumePower=*/ 0,
/*backgroundUsageConsumePower=*/ 0,
/*cachedUsageConsumePower=*/ 0,
new BatteryHistEntry(new ContentValues()));
}
@Override
public String getKey() {
return "S|Others";
}
@Override
public String getAppLabel() {
return mContext.getString(R.string.battery_usage_others);
}
@Override
public Drawable getAppIcon() {
return mContext.getDrawable(R.drawable.ic_settings_ethernet);
}
@Override
public boolean validForRestriction() {
return false;
}
@Override
public boolean isSystemEntry() {
return true;
}
}
}