Skip to content

Commit

Permalink
DNM 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pulkit077 committed Jun 10, 2021
1 parent 4e4303d commit 2ebb504
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ public class BatteryMeterView extends LinearLayout implements
// Lazily-loaded since this is expected to be a rare-if-ever state
private Drawable mUnknownStateDrawable;

private boolean mBatteryHidden;
private int mBatteryStyle = BATTERY_STYLE_PORTRAIT;

private int mDarkModeSingleToneColor;
private int mDarkModeBackgroundColor;
private int mDarkModeFillColor;
Expand Down Expand Up @@ -420,20 +417,17 @@ private void setPercentTextAtCurrentLevel() {

private void updateShowPercent() {
final boolean showing = mBatteryPercentView != null;
final int showBatteryPercent = LineageSettings.System.getIntForUser(
getContext().getContentResolver(), STATUS_BAR_SHOW_BATTERY_PERCENT, 0, mUser);
final boolean drawPercentInside = mShowPercentMode == MODE_DEFAULT &&
showBatteryPercent == 1;
final boolean drawPercentOnly = mShowPercentMode == MODE_ESTIMATE ||
showBatteryPercent == 2;
// TODO(b/140051051)
final boolean systemSetting = 0 != whitelistIpcs(() -> Settings.System
.getIntForUser(getContext().getContentResolver(),
SHOW_BATTERY_PERCENT, 0, mUser));
boolean shouldShow =
(drawPercentOnly && (!drawPercentInside || mCharging))
|| mBatteryStyle == BATTERY_STYLE_TEXT;
(mShowPercentAvailable && systemSetting && mShowPercentMode != MODE_OFF)
|| mShowPercentMode == MODE_ON
|| mShowPercentMode == MODE_ESTIMATE;
shouldShow = shouldShow && !mBatteryStateUnknown;

if (shouldShow) {
mCircleDrawable.setShowPercent(false);
mThemedDrawable.setShowPercent(false);
if (!showing) {
mBatteryPercentView = loadPercentView();
if (mPercentageStyleId != 0) { // Only set if specified as attribute
Expand Down Expand Up @@ -480,7 +474,6 @@ public void onBatteryUnknownStateChanged(boolean isUnknown) {
mBatteryIconView.setImageDrawable(getUnknownStateDrawable());
} else {
mBatteryIconView.setImageDrawable(mDrawable);
updateBatteryStyle();
}

updateShowPercent();
Expand Down

0 comments on commit 2ebb504

Please sign in to comment.