summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2016-10-25 01:28:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-10-25 01:28:06 +0000
commitcd542213e81c181350231a44a994a2bd562ae085 (patch)
tree294d639db05a0226fc2dd0d82b84aade1fb8ca98 /healthd
parenta1be7d1bb51e843784f17e4ab0185989d724dae3 (diff)
parent3f0250c3cc84b2480ef70d51343204eecbe84532 (diff)
downloadsystem_core-cd542213e81c181350231a44a994a2bd562ae085.tar.gz
system_core-cd542213e81c181350231a44a994a2bd562ae085.tar.bz2
system_core-cd542213e81c181350231a44a994a2bd562ae085.zip
Merge "Always show the battery percentage unless it is unknown" into cw-f-dev
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 6551cc777..ccf948b31 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);