Hide running time for "Android System" in the optimization page

Hide the running time information for "Android System" entry, since this
entry will combine multiple system components together. It will provide
incorrect running time information. The getRealUid() method maps many
UIDs to Process.SYSTEM_UID(1000), which results in combining all of
those UIDs into one "Android System" entry. This is the expected behavior.

Bug: 220717612
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER="com.android.settings.fuelgauge"
Change-Id: I9d44fe8490ad5c684419b8ebf8d7d5576a42788a
This commit is contained in:
ykhung
2022-05-10 17:13:28 +08:00
parent c880114dba
commit 7015cd0dd9
4 changed files with 49 additions and 10 deletions

View File

@@ -525,20 +525,24 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
final long foregroundTimeMs = bundle.getLong(EXTRA_FOREGROUND_TIME);
final long backgroundTimeMs = bundle.getLong(EXTRA_BACKGROUND_TIME);
final int consumedPower = bundle.getInt(EXTRA_POWER_USAGE_AMOUNT);
final int uid = bundle.getInt(EXTRA_UID, 0);
final String slotTime = bundle.getString(EXTRA_SLOT_TIME, null);
final long totalTimeMs = foregroundTimeMs + backgroundTimeMs;
final CharSequence usageTimeSummary;
final PowerUsageFeatureProvider powerFeatureProvider =
FeatureFactory.getFactory(getContext()).getPowerUsageFeatureProvider(getContext());
final boolean isChartGraphEnabled = FeatureFactory.getFactory(getContext())
.getPowerUsageFeatureProvider(getContext()).isChartGraphEnabled(getContext());
if (!isChartGraphEnabled && BatteryEntry.isSystemUid(uid)) {
return null;
}
if (totalTimeMs == 0) {
final int batteryWithoutUsageTime = consumedPower > 0
? R.string.battery_usage_without_time : R.string.battery_not_usage_24hr;
usageTimeSummary = getText(powerFeatureProvider.isChartGraphEnabled(getContext())
usageTimeSummary = getText(isChartGraphEnabled
? batteryWithoutUsageTime : R.string.battery_not_usage);
} else if (slotTime == null) {
// Shows summary text with past 24 hr or full charge if slot time is null.
usageTimeSummary = powerFeatureProvider.isChartGraphEnabled(getContext())
usageTimeSummary = isChartGraphEnabled
? getAppPast24HrActiveSummary(foregroundTimeMs, backgroundTimeMs, totalTimeMs)
: getAppFullChargeActiveSummary(
foregroundTimeMs, backgroundTimeMs, totalTimeMs);