diff options
| author | 2021-08-31 11:21:47 -0400 | |
|---|---|---|
| committer | 2021-10-25 15:25:56 -0400 | |
| commit | 4103e75f9223654b84e27fd2e98e01ea712d7b64 (patch) | |
| tree | 6d4148adbb8a93a1479075fd25974bd98cf057d3 | |
| parent | ce29e7fe5c88bc95c2c2d07b2c464762f4b03d4e (diff) | |
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
Merged-In: I4e5754c92c386cb9ce9e2ecc7e22a0f0c0c3fd04
| -rw-r--r-- | packages/SystemUI/res/layout/quick_status_bar_header_date_privacy.xml | 7 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java | 10 |
2 files changed, 16 insertions, 1 deletions
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 bff93a99258a..ede7dd60ccf7 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 @@ -47,6 +47,11 @@ systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" /> </FrameLayout> + <!-- We want this to be centered (to align with notches). In order to do that, the following + has to hold (in portrait): + * date_container and privacy_container must have the same width and weight + * header_text_container must be gone + --> <android.widget.Space android:id="@+id/space" android:layout_width="0dp" @@ -73,7 +78,7 @@ android:layout_weight="1" android:gravity="center_vertical|end" > - <include layout="@layout/ongoing_privacy_chip" /> + <include layout="@layout/ongoing_privacy_chip" /> </FrameLayout> </LinearLayout> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 77906abce625..d142d381c085 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -135,6 +135,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); @@ -186,6 +190,8 @@ public class QuickStatusBarHeader extends FrameLayout { super.onConfigurationChanged(newConfig); updateResources(); setDatePrivacyContainersWidth(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE); + setSecurityHeaderContainerVisibility( + newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE); } @Override @@ -206,6 +212,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); |