summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorDamien Bargiacchi <drb@google.com>2016-11-29 19:10:58 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-11-29 19:10:58 +0000
commitfdce0878f1fac332adda2bbe8686f4e9cebeab39 (patch)
tree8249bc3ceff547da2ae2f6422b45d3e3c5c82011 /healthd
parent610e0ec98f41d065f33d895326124a7430bdaec3 (diff)
parent3f0250c3cc84b2480ef70d51343204eecbe84532 (diff)
downloadsystem_core-fdce0878f1fac332adda2bbe8686f4e9cebeab39.tar.gz
system_core-fdce0878f1fac332adda2bbe8686f4e9cebeab39.tar.bz2
system_core-fdce0878f1fac332adda2bbe8686f4e9cebeab39.zip
Always show the battery percentage unless it is unknown
am: 3f0250c3cc Change-Id: If5027f2fc94aaf1f2db1d6df79866185e2cfe86d
Diffstat (limited to 'healthd')
-rw-r--r--healthd/healthd_mode_charger.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index 243cbea86..ec3de34cd 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -341,14 +341,19 @@ static void draw_clock(const animation& anim)
static void draw_percent(const animation& anim)
{
- if (anim.cur_level <= 0 || anim.cur_status != BATTERY_STATUS_CHARGING) return;
+ int cur_level = anim.cur_level;
+ if (anim.cur_status == BATTERY_STATUS_FULL) {
+ cur_level = 100;
+ }
+
+ if (cur_level <= 0) return;
const animation::text_field& field = anim.text_percent;
if (field.font == nullptr || field.font->char_width == 0 || field.font->char_height == 0) {
return;
}
- std::string str = base::StringPrintf("%d%%", anim.cur_level);
+ std::string str = base::StringPrintf("%d%%", cur_level);
int x, y;
determine_xy(field, str.size(), &x, &y);