diff options
| author | Damien Bargiacchi <drb@google.com> | 2016-10-24 16:45:29 -0700 |
|---|---|---|
| committer | Damien Bargiacchi <drb@google.com> | 2016-10-24 16:45:29 -0700 |
| commit | 3f0250c3cc84b2480ef70d51343204eecbe84532 (patch) | |
| tree | 1ac361ecd70a34192a62b88dd57c4236888ae82f /healthd | |
| parent | e476e9ce346daf4dd1ed14757349268be5ebb62e (diff) | |
| download | system_core-3f0250c3cc84b2480ef70d51343204eecbe84532.tar.gz system_core-3f0250c3cc84b2480ef70d51343204eecbe84532.tar.bz2 system_core-3f0250c3cc84b2480ef70d51343204eecbe84532.zip | |
Always show the battery percentage unless it is unknown
Bug: 29547343
Change-Id: I55630be8033cd8074628a892960b5fafe0c83338
Diffstat (limited to 'healthd')
| -rw-r--r-- | healthd/healthd_mode_charger.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp index fb17f2da1..b2570448f 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); |
