From 1c6695951f13275b9c962b490da570f7c0da69ae Mon Sep 17 00:00:00 2001 From: ykhung Date: Fri, 15 Apr 2022 18:52:22 +0800 Subject: [PATCH] Use the custom name in the battery attribution if it is unknown item Keep the queried name is null to use the custom provided battery attribution name (avoid to replace it with POWER_COMPONENT_ prefix name), such that we can show "TPU", "GPU" ... attribution. old screenshot: https://screenshot.googleplex.com/8KGNxW2eHFY85zw new screenshot: https://screenshot.googleplex.com/8KVj3jBjShfa8wK Bug: 227749579 Test: make RunSettingsRoboTests Change-Id: I22fba3c252a92f7d64670ad5d0f6f3548374968a --- src/com/android/settings/fuelgauge/BatteryEntry.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java index 5c9d07128d0..7bb5a4e9aa6 100644 --- a/src/com/android/settings/fuelgauge/BatteryEntry.java +++ b/src/com/android/settings/fuelgauge/BatteryEntry.java @@ -625,8 +625,9 @@ public class BatteryEntry { iconId = R.drawable.ic_settings_phone_idle; break; default: - name = DebugUtils.constantToString(BatteryConsumer.class, "POWER_COMPONENT_", - powerComponentId); + Log.w(TAG, "unknown attribute:" + DebugUtils.constantToString( + BatteryConsumer.class, "POWER_COMPONENT_", powerComponentId)); + name = null; iconId = R.drawable.ic_power_system; break; }