Loading packages/SystemUI/res/values-w390dp/config.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources> <bool name="config_showBatteryEstimateQSBH">true</bool> </resources> No newline at end of file packages/SystemUI/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -539,6 +539,11 @@ <item>@*android:string/status_bar_headset</item> </string-array> <!-- Whether to show estimate in QS header. Default to false in case there's not enough space --> <bool name="config_showBatteryEstimateQSBH">false</bool> <!-- A path similar to frameworks/base/core/res/res/values/config.xml config_mainBuiltInDisplayCutout that describes a path larger than the exact path of a display cutout. If present as well as config_enableDisplayCutoutProtection is set to true, then Loading packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +3 −1 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ public class BatteryMeterView extends LinearLayout implements * @param mode desired mode (none, on, off) */ public void setPercentShowMode(@BatteryPercentMode int mode) { if (mode == mShowPercentMode) return; mShowPercentMode = mode; updateShowPercent(); } Loading Loading @@ -330,7 +331,7 @@ public class BatteryMeterView extends LinearLayout implements if (mBatteryPercentView == null) { return; } if (estimate != null) { if (estimate != null && mShowPercentMode == MODE_ESTIMATE) { mBatteryPercentView.setText(estimate); setContentDescription(getContext().getString( R.string.accessibility_battery_level_with_estimate, Loading Loading @@ -485,6 +486,7 @@ public class BatteryMeterView extends LinearLayout implements pw.println(" mTextColor: #" + Integer.toHexString(mTextColor)); pw.println(" mBatteryStateUnknown: " + mBatteryStateUnknown); pw.println(" mLevel: " + mLevel); pw.println(" mMode: " + mShowPercentMode); } private final class SettingObserver extends ContentObserver { Loading packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +18 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,9 @@ public class QuickStatusBarHeader extends FrameLayout { private List<String> mRssiIgnoredSlots; private boolean mIsSingleCarrier; private boolean mHasCenterCutout; private boolean mConfigShowBatteryEstimate; public QuickStatusBarHeader(Context context, AttributeSet attrs) { super(context, attrs); } Loading Loading @@ -203,9 +206,19 @@ public class QuickStatusBarHeader extends FrameLayout { mPrivacyContainer.setLayoutParams(lp); } private void updateBatteryMode() { if (mConfigShowBatteryEstimate && !mHasCenterCutout) { mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE); } else { mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ON); } } void updateResources() { Resources resources = mContext.getResources(); mConfigShowBatteryEstimate = resources.getBoolean(R.bool.config_showBatteryEstimateQSBH); mRoundedCornerPadding = resources.getDimensionPixelSize( R.dimen.rounded_corner_content_padding); Loading Loading @@ -246,6 +259,7 @@ public class QuickStatusBarHeader extends FrameLayout { .getDimensionPixelSize(R.dimen.qqs_layout_margin_top); mHeaderQsPanel.setLayoutParams(qqsLP); updateBatteryMode(); updateHeadersPadding(); updateAnimators(); } Loading Loading @@ -384,14 +398,14 @@ public class QuickStatusBarHeader extends FrameLayout { mClockIconsSeparatorLayoutParams.width = 0; setSeparatorVisibility(false); mShowClockIconsSeparator = false; mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE); mHasCenterCutout = false; } else { datePrivacySeparatorLayoutParams.width = topCutout.width(); mDatePrivacySeparator.setVisibility(View.VISIBLE); mClockIconsSeparatorLayoutParams.width = topCutout.width(); mShowClockIconsSeparator = true; setSeparatorVisibility(mKeyguardExpansionFraction == 0f); mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ON); mHasCenterCutout = true; } } mDatePrivacySeparator.setLayoutParams(datePrivacySeparatorLayoutParams); Loading @@ -399,6 +413,8 @@ public class QuickStatusBarHeader extends FrameLayout { mCutOutPaddingLeft = padding.first; mCutOutPaddingRight = padding.second; mWaterfallTopInset = cutout == null ? 0 : cutout.getWaterfallInsets().top; updateBatteryMode(); updateHeadersPadding(); return super.onApplyWindowInsets(insets); } Loading Loading
packages/SystemUI/res/values-w390dp/config.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources> <bool name="config_showBatteryEstimateQSBH">true</bool> </resources> No newline at end of file
packages/SystemUI/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -539,6 +539,11 @@ <item>@*android:string/status_bar_headset</item> </string-array> <!-- Whether to show estimate in QS header. Default to false in case there's not enough space --> <bool name="config_showBatteryEstimateQSBH">false</bool> <!-- A path similar to frameworks/base/core/res/res/values/config.xml config_mainBuiltInDisplayCutout that describes a path larger than the exact path of a display cutout. If present as well as config_enableDisplayCutoutProtection is set to true, then Loading
packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +3 −1 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ public class BatteryMeterView extends LinearLayout implements * @param mode desired mode (none, on, off) */ public void setPercentShowMode(@BatteryPercentMode int mode) { if (mode == mShowPercentMode) return; mShowPercentMode = mode; updateShowPercent(); } Loading Loading @@ -330,7 +331,7 @@ public class BatteryMeterView extends LinearLayout implements if (mBatteryPercentView == null) { return; } if (estimate != null) { if (estimate != null && mShowPercentMode == MODE_ESTIMATE) { mBatteryPercentView.setText(estimate); setContentDescription(getContext().getString( R.string.accessibility_battery_level_with_estimate, Loading Loading @@ -485,6 +486,7 @@ public class BatteryMeterView extends LinearLayout implements pw.println(" mTextColor: #" + Integer.toHexString(mTextColor)); pw.println(" mBatteryStateUnknown: " + mBatteryStateUnknown); pw.println(" mLevel: " + mLevel); pw.println(" mMode: " + mShowPercentMode); } private final class SettingObserver extends ContentObserver { Loading
packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +18 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,9 @@ public class QuickStatusBarHeader extends FrameLayout { private List<String> mRssiIgnoredSlots; private boolean mIsSingleCarrier; private boolean mHasCenterCutout; private boolean mConfigShowBatteryEstimate; public QuickStatusBarHeader(Context context, AttributeSet attrs) { super(context, attrs); } Loading Loading @@ -203,9 +206,19 @@ public class QuickStatusBarHeader extends FrameLayout { mPrivacyContainer.setLayoutParams(lp); } private void updateBatteryMode() { if (mConfigShowBatteryEstimate && !mHasCenterCutout) { mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE); } else { mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ON); } } void updateResources() { Resources resources = mContext.getResources(); mConfigShowBatteryEstimate = resources.getBoolean(R.bool.config_showBatteryEstimateQSBH); mRoundedCornerPadding = resources.getDimensionPixelSize( R.dimen.rounded_corner_content_padding); Loading Loading @@ -246,6 +259,7 @@ public class QuickStatusBarHeader extends FrameLayout { .getDimensionPixelSize(R.dimen.qqs_layout_margin_top); mHeaderQsPanel.setLayoutParams(qqsLP); updateBatteryMode(); updateHeadersPadding(); updateAnimators(); } Loading Loading @@ -384,14 +398,14 @@ public class QuickStatusBarHeader extends FrameLayout { mClockIconsSeparatorLayoutParams.width = 0; setSeparatorVisibility(false); mShowClockIconsSeparator = false; mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE); mHasCenterCutout = false; } else { datePrivacySeparatorLayoutParams.width = topCutout.width(); mDatePrivacySeparator.setVisibility(View.VISIBLE); mClockIconsSeparatorLayoutParams.width = topCutout.width(); mShowClockIconsSeparator = true; setSeparatorVisibility(mKeyguardExpansionFraction == 0f); mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ON); mHasCenterCutout = true; } } mDatePrivacySeparator.setLayoutParams(datePrivacySeparatorLayoutParams); Loading @@ -399,6 +413,8 @@ public class QuickStatusBarHeader extends FrameLayout { mCutOutPaddingLeft = padding.first; mCutOutPaddingRight = padding.second; mWaterfallTopInset = cutout == null ? 0 : cutout.getWaterfallInsets().top; updateBatteryMode(); updateHeadersPadding(); return super.onApplyWindowInsets(insets); } Loading