Update the categorize rule for system and app item bucket

Add a config to control different design concept in the chart 1) put all apps with system UID and system components (e.g. bluetooth, display, wifi ... etc) into the system bucket or 2) separate them into two different bucket (app & system bucket) in the chart UI for better experimental testing

Bug: 202118250
Test: make RunSettingsRoboTests
Change-Id: Id6f7c07d96ad8a365e7405160a5248c57a5a008d
This commit is contained in:
ykhung
2022-03-15 14:00:29 +08:00
committed by YK Hung
parent 93a4ef67c4
commit 273d3445ee
3 changed files with 13 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ import android.util.Log;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
import com.android.settingslib.utils.StringUtil;
import java.util.Comparator;
@@ -52,6 +53,7 @@ public class BatteryDiffEntry {
public double mConsumePower;
// A BatteryHistEntry corresponding to this diff usage data.
public final BatteryHistEntry mBatteryHistEntry;
private double mTotalConsumePower;
private double mPercentOfTotal;
@@ -151,8 +153,13 @@ public class BatteryDiffEntry {
case ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY:
return true;
case ConvertUtils.CONSUMER_TYPE_UID_BATTERY:
return isSystemUid((int) mBatteryHistEntry.mUid)
|| mBatteryHistEntry.mIsHidden;
if (mBatteryHistEntry.mIsHidden) {
return true;
}
final boolean combineSystemComponents =
mContext.getResources().getBoolean(
R.bool.config_battery_combine_system_components);
return combineSystemComponents && isSystemUid((int) mBatteryHistEntry.mUid);
}
return false;
}