diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index 9d6c6e643165..fad7079939a3 100644 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -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; @@ -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 @@ -480,7 +474,6 @@ public void onBatteryUnknownStateChanged(boolean isUnknown) { mBatteryIconView.setImageDrawable(getUnknownStateDrawable()); } else { mBatteryIconView.setImageDrawable(mDrawable); - updateBatteryStyle(); } updateShowPercent();