[Battery usage U] Remove 'Phone Idle' to avoid confusion
Bug: 252938706
Fix: 252938706
Test: manual
Change-Id: I0ad973718f77640839dbdf4ac5ca4241f01bdb79
diff --git a/res-product/values/strings.xml b/res-product/values/strings.xml
index 93c2a1f..17fd4d5 100644
--- a/res-product/values/strings.xml
+++ b/res-product/values/strings.xml
@@ -551,10 +551,6 @@
<string name="battery_tip_dialog_summary_message" product="device">Your apps are using a normal amount of battery. If apps use too much battery, your device will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
<!-- Summary for the smart battery toggle [CHAR LIMIT=NONE] -->
<string name="smart_battery_summary" product="default">Limit battery for apps that you don\u2019t use often</string>
- <!-- Label for power consumed when Idle -->
- <string name="power_idle" product="tablet">Tablet idle</string>
- <!-- Label for power consumed when Idle -->
- <string name="power_idle" product="default">Phone idle</string>
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
<string name="battery_saver_sticky_description_new" product="default">Battery Saver turns off when your phone charges above <xliff:g id="battery_percentage" example="80%">%1$s</xliff:g></string>
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
diff --git a/res/drawable/ic_settings_phone_idle.xml b/res/drawable/ic_settings_phone_idle.xml
deleted file mode 100644
index fd304e7..0000000
--- a/res/drawable/ic_settings_phone_idle.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- Copyright (C) 2022 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
- android:viewportWidth="48"
- android:viewportHeight="48"
- android:tint="@color/battery_usage_system_icon_color">
- <path
- android:fillColor="@android:color/white"
- android:pathData="M14,48h4v-4h-4v4zM22,48h4v-4h-4v4zM26,4h-4v20h4L26,4zM33.13,8.87l-2.89,2.89C33.69,13.87 36,17.66 36,22c0,6.63 -5.37,12 -12,12s-12,-5.37 -12,-12c0,-4.34 2.31,-8.13 5.76,-10.24l-2.89,-2.89C10.72,11.76 8,16.56 8,22c0,8.84 7.16,16 16,16s16,-7.16 16,-16c0,-5.44 -2.72,-10.24 -6.87,-13.13zM30,48h4v-4h-4v4z"/>
-</vector>
diff --git a/src/com/android/settings/fuelgauge/PowerUsageFeatureProvider.java b/src/com/android/settings/fuelgauge/PowerUsageFeatureProvider.java
index e51db08..308409e 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageFeatureProvider.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageFeatureProvider.java
@@ -146,9 +146,9 @@
Intent getResumeChargeIntent(boolean isDockDefender);
/**
- * Returns {@link Set} for hiding applications background usage time.
+ * Returns {@link Set} for hiding system component ids in the usage screen.
*/
- Set<CharSequence> getHideBackgroundUsageTimeSet(Context context);
+ Set<Integer> getHideSystemComponentSet(Context context);
/**
* Returns {@link Set} for hiding application package names in the usage screen.
@@ -156,6 +156,11 @@
Set<CharSequence> getHideApplicationSet(Context context);
/**
+ * Returns {@link Set} for hiding applications background usage time.
+ */
+ Set<CharSequence> getHideBackgroundUsageTimeSet(Context context);
+
+ /**
* Returns {@link Set} for ignoring task root class names for screen on time.
*/
Set<CharSequence> getIgnoreScreenOnTimeTaskRootSet(Context context);
diff --git a/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImpl.java b/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImpl.java
index ba8587c..5b33dc1 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImpl.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImpl.java
@@ -162,7 +162,7 @@
}
@Override
- public Set<CharSequence> getHideBackgroundUsageTimeSet(Context context) {
+ public Set<Integer> getHideSystemComponentSet(Context context) {
return new ArraySet<>();
}
@@ -172,6 +172,11 @@
}
@Override
+ public Set<CharSequence> getHideBackgroundUsageTimeSet(Context context) {
+ return new ArraySet<>();
+ }
+
+ @Override
public Set<CharSequence> getIgnoreScreenOnTimeTaskRootSet(Context context) {
return new ArraySet<>();
}
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryEntry.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryEntry.java
index e9e0347..ba1ebab 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryEntry.java
@@ -590,11 +590,6 @@
name = context.getResources().getString(R.string.power_wifi);
iconId = R.drawable.ic_settings_wireless_no_theme;
break;
- case BatteryConsumer.POWER_COMPONENT_IDLE:
- case BatteryConsumer.POWER_COMPONENT_MEMORY:
- name = context.getResources().getString(R.string.power_idle);
- iconId = R.drawable.ic_settings_phone_idle;
- break;
default:
Log.w(TAG, "unknown attribute:" + DebugUtils.constantToString(
BatteryConsumer.class, "POWER_COMPONENT_", powerComponentId));
diff --git a/src/com/android/settings/fuelgauge/batteryusage/DataProcessor.java b/src/com/android/settings/fuelgauge/batteryusage/DataProcessor.java
index c33e0a3..feea8f8 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/DataProcessor.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/DataProcessor.java
@@ -1224,6 +1224,10 @@
private static void processBatteryDiffData(
final Context context,
final Map<Integer, Map<Integer, BatteryDiffData>> resultMap) {
+ final Set<Integer> hideSystemComponentSet =
+ FeatureFactory.getFactory(context)
+ .getPowerUsageFeatureProvider(context)
+ .getHideSystemComponentSet(context);
final Set<CharSequence> hideBackgroundUsageTimeSet =
FeatureFactory.getFactory(context)
.getPowerUsageFeatureProvider(context)
@@ -1239,11 +1243,15 @@
return;
}
purgeFakeAndHiddenPackages(
- batteryDiffData.getAppDiffEntryList(), hideBackgroundUsageTimeSet,
- hideApplicationSet);
+ batteryDiffData.getAppDiffEntryList(),
+ hideSystemComponentSet,
+ hideApplicationSet,
+ hideBackgroundUsageTimeSet);
purgeFakeAndHiddenPackages(
- batteryDiffData.getSystemDiffEntryList(), hideBackgroundUsageTimeSet,
- hideApplicationSet);
+ batteryDiffData.getSystemDiffEntryList(),
+ hideSystemComponentSet,
+ hideApplicationSet,
+ hideBackgroundUsageTimeSet);
batteryDiffData.setTotalConsumePower();
batteryDiffData.sortEntries();
});
@@ -1252,16 +1260,16 @@
private static void purgeFakeAndHiddenPackages(
final List<BatteryDiffEntry> entries,
- final Set<CharSequence> hideBackgroundUsageTimeSet,
- final Set<CharSequence> hideApplicationSet) {
+ final Set<Integer> hideSystemComponentSet,
+ final Set<CharSequence> hideApplicationSet,
+ final Set<CharSequence> hideBackgroundUsageTimeSet) {
final Iterator<BatteryDiffEntry> iterator = entries.iterator();
while (iterator.hasNext()) {
final BatteryDiffEntry entry = iterator.next();
final String packageName = entry.getPackageName();
- if (packageName == null) {
- continue;
- }
+ final Integer componentId = entry.mBatteryHistEntry.mDrainType;
if (ConvertUtils.FAKE_PACKAGE_NAME.equals(packageName)
+ || hideSystemComponentSet.contains(componentId)
|| hideApplicationSet.contains(packageName)) {
iterator.remove();
}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryEntryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryEntryTest.java
index 463a66d..7e5aaea 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryEntryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryEntryTest.java
@@ -337,9 +337,6 @@
assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_WIFI,
R.string.power_wifi,
R.drawable.ic_settings_wireless_no_theme);
- assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_IDLE,
- R.string.power_idle,
- R.drawable.ic_settings_phone_idle);
}
private void assertNameAndIcon(String name, int stringId) {