From 3555ebc8b5133ab05cca2424c79f8a9e2aacc02e Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Tue, 7 Dec 2021 15:53:14 -0500 Subject: [PATCH] Add privacy indicators to combined QS header Use alpha 0 in icons and battery when privacy indicators are visible in QQS constraint. Test: manual, using handheld and split shade layout Bug: 202847414 Change-Id: I8b523c9f87c78fd4eac99a421eebaec90e37cadf --- .../res/layout/combined_qs_header.xml | 12 ++++++++++ packages/SystemUI/res/xml/qqs_header.xml | 19 ++++++++++++++- packages/SystemUI/res/xml/qs_header.xml | 11 ++++++++- packages/SystemUI/res/xml/split_header.xml | 24 +++++++++++++++++++ .../phone/SplitShadeHeaderController.kt | 17 ++++++++++++- 5 files changed, 80 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/res/layout/combined_qs_header.xml b/packages/SystemUI/res/layout/combined_qs_header.xml index 1f10e5dfeed83..405863dc9d92c 100644 --- a/packages/SystemUI/res/layout/combined_qs_header.xml +++ b/packages/SystemUI/res/layout/combined_qs_header.xml @@ -101,4 +101,16 @@ app:layout_constraintBottom_toBottomOf="parent" /> + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/xml/qqs_header.xml b/packages/SystemUI/res/xml/qqs_header.xml index 3d7b549fc54b8..c5b4c5d776b9a 100644 --- a/packages/SystemUI/res/xml/qqs_header.xml +++ b/packages/SystemUI/res/xml/qqs_header.xml @@ -48,6 +48,14 @@ /> + + + + + + - + + + \ No newline at end of file diff --git a/packages/SystemUI/res/xml/qs_header.xml b/packages/SystemUI/res/xml/qs_header.xml index 6a0ab866966ce..8248fcdb50fb9 100644 --- a/packages/SystemUI/res/xml/qs_header.xml +++ b/packages/SystemUI/res/xml/qs_header.xml @@ -58,5 +58,14 @@ /> - + + + \ No newline at end of file diff --git a/packages/SystemUI/res/xml/split_header.xml b/packages/SystemUI/res/xml/split_header.xml index 44d42a05cd46e..03401b3d51d1f 100644 --- a/packages/SystemUI/res/xml/split_header.xml +++ b/packages/SystemUI/res/xml/split_header.xml @@ -53,5 +53,29 @@ /> + + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt index 8cf7288c9cd5e..3f479731d4c73 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt @@ -19,12 +19,14 @@ package com.android.systemui.statusbar.phone import android.view.View import androidx.constraintlayout.motion.widget.MotionLayout import com.android.settingslib.Utils +import com.android.systemui.Dumpable import com.android.systemui.R import com.android.systemui.animation.ShadeInterpolation import com.android.systemui.battery.BatteryMeterView import com.android.systemui.battery.BatteryMeterViewController import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags +import com.android.systemui.qs.ChipVisibilityListener import com.android.systemui.qs.HeaderPrivacyIconsController import com.android.systemui.qs.carrier.QSCarrierGroupController import com.android.systemui.statusbar.phone.dagger.StatusBarComponent.StatusBarScope @@ -97,6 +99,18 @@ class SplitShadeHeaderController @Inject constructor( } } + private val chipVisibilityListener: ChipVisibilityListener = object : ChipVisibilityListener { + override fun onChipVisibilityRefreshed(visible: Boolean) { + if (statusBar is MotionLayout) { + val state = statusBar.getConstraintSet(R.id.qqs_header_constraint).apply { + setAlpha(R.id.statusIcons, if (visible) 0f else 1f) + setAlpha(R.id.batteryRemainingIcon, if (visible) 0f else 1f) + } + statusBar.updateState(R.id.qqs_header_constraint, state) + } + } + } + init { if (statusBar is MotionLayout) { val context = statusBar.context @@ -107,6 +121,7 @@ class SplitShadeHeaderController @Inject constructor( .load(context, resources.getXml(R.xml.qs_header)) statusBar.getConstraintSet(R.id.split_header_constraint) .load(context, resources.getXml(R.xml.split_header)) + privacyIconsController.chipVisibilityListener = chipVisibilityListener } } @@ -149,7 +164,7 @@ class SplitShadeHeaderController @Inject constructor( } private fun onSplitShadeModeChanged() { - if (splitShadeMode) { + if (splitShadeMode || combinedHeaders) { privacyIconsController.onParentVisible() } else { privacyIconsController.onParentInvisible()