From 001bd61257ee25b86853818479e988c1ecde3f2d Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Tue, 31 Aug 2021 11:21:47 -0400 Subject: [PATCH] Hide security footer container (QSBH) in portrait In order to have both sides of the notch protection be of the same size (and the notch protection be centered), we need to hide the other container in the date_privacy header. This is fine to hide in portrait as it should only have content in landscape. Test: manual, using display cutout and checking layout dump Fixes: 197768177 Change-Id: I4e5754c92c386cb9ce9e2ecc7e22a0f0c0c3fd04 --- .../layout/quick_status_bar_header_date_privacy.xml | 7 ++++++- .../com/android/systemui/qs/QuickStatusBarHeader.java | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml b/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml index cc44b5e5df38b..b1e8c386fe217 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml @@ -49,6 +49,11 @@ /> + - + diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 19d5fa0ec74fb..c88c198f767cc 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -140,6 +140,10 @@ public class QuickStatusBarHeader extends FrameLayout { mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon); updateResources(); + Configuration config = mContext.getResources().getConfiguration(); + setDatePrivacyContainersWidth(config.orientation == Configuration.ORIENTATION_LANDSCAPE); + setSecurityHeaderContainerVisibility( + config.orientation == Configuration.ORIENTATION_LANDSCAPE); // Don't need to worry about tuner settings for this icon mBatteryRemainingIcon.setIgnoreTunerUpdates(true); @@ -191,6 +195,8 @@ public class QuickStatusBarHeader extends FrameLayout { super.onConfigurationChanged(newConfig); updateResources(); setDatePrivacyContainersWidth(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE); + setSecurityHeaderContainerVisibility( + newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE); } @Override @@ -211,6 +217,10 @@ public class QuickStatusBarHeader extends FrameLayout { mPrivacyContainer.setLayoutParams(lp); } + private void setSecurityHeaderContainerVisibility(boolean landscape) { + mSecurityHeaderView.setVisibility(landscape ? VISIBLE : GONE); + } + private void updateBatteryMode() { if (mConfigShowBatteryEstimate && !mHasCenterCutout) { mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE);