Loading packages/SystemUI/res-keyguard/layout/qs_footer_actions.xml→packages/SystemUI/res-keyguard/layout/footer_actions.xml +4 −3 Original line number Diff line number Diff line Loading @@ -14,9 +14,10 @@ ** See the License for the specific language governing permissions and ** limitations under the License. --> <com.android.systemui.qs.QSFooterActionsView <!-- Action buttons for footer in QS/QQS, containing settings button, power off button etc --> <com.android.systemui.qs.FooterActionsView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/qs_footer_actions_container" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical"> Loading Loading @@ -101,4 +102,4 @@ </com.android.systemui.statusbar.AlphaOptimizedFrameLayout> </com.android.systemui.qs.QSFooterActionsView> No newline at end of file </com.android.systemui.qs.FooterActionsView> No newline at end of file packages/SystemUI/res/layout/qs_footer_impl.xml +2 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ </LinearLayout> <include layout="@layout/qs_footer_actions"/> <include layout="@layout/footer_actions" android:id="@+id/qs_footer_actions"/> </LinearLayout> Loading packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +12 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,18 @@ android:clipToPadding="false" android:focusable="true" android:paddingBottom="24dp" android:importantForAccessibility="yes" /> android:importantForAccessibility="yes"> <include layout="@layout/footer_actions" android:id="@+id/qqs_footer_actions" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginStart="@dimen/qs_footer_margin" android:layout_marginEnd="@dimen/qs_footer_margin" /> </com.android.systemui.qs.QuickQSPanel> </RelativeLayout> </com.android.systemui.qs.QuickStatusBarHeader> packages/SystemUI/src/com/android/systemui/qs/QSFooterActionsController.kt→packages/SystemUI/src/com/android/systemui/qs/FooterActionsController.kt +60 −10 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. */ package com.android.systemui.qs import android.content.Intent Loading @@ -16,6 +32,8 @@ import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.globalactions.GlobalActionsDialogLite import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.qs.FooterActionsController.ExpansionState.COLLAPSED import com.android.systemui.qs.FooterActionsController.ExpansionState.EXPANDED import com.android.systemui.qs.dagger.QSFlagsModule.PM_LITE_ENABLED import com.android.systemui.statusbar.phone.MultiUserSwitchController import com.android.systemui.statusbar.phone.SettingsButton Loading @@ -27,8 +45,13 @@ import com.android.systemui.util.ViewController import javax.inject.Inject import javax.inject.Named class QSFooterActionsController @Inject constructor( view: QSFooterActionsView, /** * Manages [FooterActionsView] behaviour, both when it's placed in QS or QQS (split shade). * Main difference between QS and QQS behaviour is condition when buttons should be visible, * determined by [buttonsVisibleState] */ class FooterActionsController @Inject constructor( view: FooterActionsView, private val qsPanelController: QSPanelController, private val activityStarter: ActivityStarter, private val userManager: UserManager, Loading @@ -40,15 +63,20 @@ class QSFooterActionsController @Inject constructor( private val tunerService: TunerService, private val globalActionsDialog: GlobalActionsDialogLite, private val uiEventLogger: UiEventLogger, @Named(PM_LITE_ENABLED) private val showPMLiteButton: Boolean ) : ViewController<QSFooterActionsView>(view) { @Named(PM_LITE_ENABLED) private val showPMLiteButton: Boolean, private val buttonsVisibleState: ExpansionState ) : ViewController<FooterActionsView>(view) { enum class ExpansionState { COLLAPSED, EXPANDED } private var listening: Boolean = false var expanded = false set(value) { if (field != value) { field = value mView.setExpanded(value, isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) updateView() } } private val settingsButton: SettingsButton = view.findViewById(R.id.settings_button) Loading @@ -64,7 +92,7 @@ class QSFooterActionsController @Inject constructor( private val onClickListener = View.OnClickListener { v -> // Don't do anything until views are unhidden. Don't do anything if the tap looks // suspicious. if (!expanded || falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { if (!buttonsVisible() || falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { return@OnClickListener } if (v === settingsButton) { Loading Loading @@ -98,10 +126,26 @@ class QSFooterActionsController @Inject constructor( } } private fun buttonsVisible(): Boolean { return when (buttonsVisibleState) { EXPANDED -> expanded COLLAPSED -> !expanded } } override fun onInit() { multiUserSwitchController.init() } fun hideFooter() { mView.visibility = View.GONE } fun showFooter() { mView.visibility = View.VISIBLE updateView() } private fun startSettingsActivity() { val animationController = settingsButtonContainer?.let { ActivityLaunchAnimator.Controller.fromView( Loading @@ -128,7 +172,12 @@ class QSFooterActionsController @Inject constructor( activityStarter.postQSRunnableDismissingKeyguard { qsPanelController.showEdit(view) } }) mView.updateEverything(isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) updateView() } private fun updateView() { mView.updateEverything(buttonsVisible(), isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) } override fun onViewDetached() { Loading @@ -148,7 +197,8 @@ class QSFooterActionsController @Inject constructor( } fun disable(state2: Int) { mView.disable(state2, isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) mView.disable(buttonsVisible(), state2, isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) } fun setExpansion(headerExpansionFraction: Float) { Loading packages/SystemUI/src/com/android/systemui/qs/FooterActionsControllerBuilder.kt 0 → 100644 +67 −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. */ package com.android.systemui.qs import android.os.UserManager import com.android.internal.logging.MetricsLogger import com.android.internal.logging.UiEventLogger import com.android.systemui.globalactions.GlobalActionsDialogLite import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.qs.FooterActionsController.ExpansionState import com.android.systemui.qs.dagger.QSFlagsModule import com.android.systemui.statusbar.phone.MultiUserSwitchController import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.UserInfoController import com.android.systemui.tuner.TunerService import javax.inject.Inject import javax.inject.Named class FooterActionsControllerBuilder @Inject constructor( private val qsPanelController: QSPanelController, private val activityStarter: ActivityStarter, private val userManager: UserManager, private val userInfoController: UserInfoController, private val multiUserSwitchController: MultiUserSwitchController, private val deviceProvisionedController: DeviceProvisionedController, private val falsingManager: FalsingManager, private val metricsLogger: MetricsLogger, private val tunerService: TunerService, private val globalActionsDialog: GlobalActionsDialogLite, private val uiEventLogger: UiEventLogger, @Named(QSFlagsModule.PM_LITE_ENABLED) private val showPMLiteButton: Boolean ) { private lateinit var view: FooterActionsView private lateinit var buttonsVisibleState: ExpansionState fun withView(view: FooterActionsView): FooterActionsControllerBuilder { this.view = view return this } fun withButtonsVisibleWhen(state: ExpansionState): FooterActionsControllerBuilder { buttonsVisibleState = state return this } fun build(): FooterActionsController { return FooterActionsController(view, qsPanelController, activityStarter, userManager, userInfoController, multiUserSwitchController, deviceProvisionedController, falsingManager, metricsLogger, tunerService, globalActionsDialog, uiEventLogger, showPMLiteButton, buttonsVisibleState) } } No newline at end of file Loading
packages/SystemUI/res-keyguard/layout/qs_footer_actions.xml→packages/SystemUI/res-keyguard/layout/footer_actions.xml +4 −3 Original line number Diff line number Diff line Loading @@ -14,9 +14,10 @@ ** See the License for the specific language governing permissions and ** limitations under the License. --> <com.android.systemui.qs.QSFooterActionsView <!-- Action buttons for footer in QS/QQS, containing settings button, power off button etc --> <com.android.systemui.qs.FooterActionsView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/qs_footer_actions_container" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical"> Loading Loading @@ -101,4 +102,4 @@ </com.android.systemui.statusbar.AlphaOptimizedFrameLayout> </com.android.systemui.qs.QSFooterActionsView> No newline at end of file </com.android.systemui.qs.FooterActionsView> No newline at end of file
packages/SystemUI/res/layout/qs_footer_impl.xml +2 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ </LinearLayout> <include layout="@layout/qs_footer_actions"/> <include layout="@layout/footer_actions" android:id="@+id/qs_footer_actions"/> </LinearLayout> Loading
packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +12 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,18 @@ android:clipToPadding="false" android:focusable="true" android:paddingBottom="24dp" android:importantForAccessibility="yes" /> android:importantForAccessibility="yes"> <include layout="@layout/footer_actions" android:id="@+id/qqs_footer_actions" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginStart="@dimen/qs_footer_margin" android:layout_marginEnd="@dimen/qs_footer_margin" /> </com.android.systemui.qs.QuickQSPanel> </RelativeLayout> </com.android.systemui.qs.QuickStatusBarHeader>
packages/SystemUI/src/com/android/systemui/qs/QSFooterActionsController.kt→packages/SystemUI/src/com/android/systemui/qs/FooterActionsController.kt +60 −10 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. */ package com.android.systemui.qs import android.content.Intent Loading @@ -16,6 +32,8 @@ import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.globalactions.GlobalActionsDialogLite import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.qs.FooterActionsController.ExpansionState.COLLAPSED import com.android.systemui.qs.FooterActionsController.ExpansionState.EXPANDED import com.android.systemui.qs.dagger.QSFlagsModule.PM_LITE_ENABLED import com.android.systemui.statusbar.phone.MultiUserSwitchController import com.android.systemui.statusbar.phone.SettingsButton Loading @@ -27,8 +45,13 @@ import com.android.systemui.util.ViewController import javax.inject.Inject import javax.inject.Named class QSFooterActionsController @Inject constructor( view: QSFooterActionsView, /** * Manages [FooterActionsView] behaviour, both when it's placed in QS or QQS (split shade). * Main difference between QS and QQS behaviour is condition when buttons should be visible, * determined by [buttonsVisibleState] */ class FooterActionsController @Inject constructor( view: FooterActionsView, private val qsPanelController: QSPanelController, private val activityStarter: ActivityStarter, private val userManager: UserManager, Loading @@ -40,15 +63,20 @@ class QSFooterActionsController @Inject constructor( private val tunerService: TunerService, private val globalActionsDialog: GlobalActionsDialogLite, private val uiEventLogger: UiEventLogger, @Named(PM_LITE_ENABLED) private val showPMLiteButton: Boolean ) : ViewController<QSFooterActionsView>(view) { @Named(PM_LITE_ENABLED) private val showPMLiteButton: Boolean, private val buttonsVisibleState: ExpansionState ) : ViewController<FooterActionsView>(view) { enum class ExpansionState { COLLAPSED, EXPANDED } private var listening: Boolean = false var expanded = false set(value) { if (field != value) { field = value mView.setExpanded(value, isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) updateView() } } private val settingsButton: SettingsButton = view.findViewById(R.id.settings_button) Loading @@ -64,7 +92,7 @@ class QSFooterActionsController @Inject constructor( private val onClickListener = View.OnClickListener { v -> // Don't do anything until views are unhidden. Don't do anything if the tap looks // suspicious. if (!expanded || falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { if (!buttonsVisible() || falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { return@OnClickListener } if (v === settingsButton) { Loading Loading @@ -98,10 +126,26 @@ class QSFooterActionsController @Inject constructor( } } private fun buttonsVisible(): Boolean { return when (buttonsVisibleState) { EXPANDED -> expanded COLLAPSED -> !expanded } } override fun onInit() { multiUserSwitchController.init() } fun hideFooter() { mView.visibility = View.GONE } fun showFooter() { mView.visibility = View.VISIBLE updateView() } private fun startSettingsActivity() { val animationController = settingsButtonContainer?.let { ActivityLaunchAnimator.Controller.fromView( Loading @@ -128,7 +172,12 @@ class QSFooterActionsController @Inject constructor( activityStarter.postQSRunnableDismissingKeyguard { qsPanelController.showEdit(view) } }) mView.updateEverything(isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) updateView() } private fun updateView() { mView.updateEverything(buttonsVisible(), isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) } override fun onViewDetached() { Loading @@ -148,7 +197,8 @@ class QSFooterActionsController @Inject constructor( } fun disable(state2: Int) { mView.disable(state2, isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) mView.disable(buttonsVisible(), state2, isTunerEnabled(), multiUserSwitchController.isMultiUserEnabled) } fun setExpansion(headerExpansionFraction: Float) { Loading
packages/SystemUI/src/com/android/systemui/qs/FooterActionsControllerBuilder.kt 0 → 100644 +67 −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. */ package com.android.systemui.qs import android.os.UserManager import com.android.internal.logging.MetricsLogger import com.android.internal.logging.UiEventLogger import com.android.systemui.globalactions.GlobalActionsDialogLite import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.qs.FooterActionsController.ExpansionState import com.android.systemui.qs.dagger.QSFlagsModule import com.android.systemui.statusbar.phone.MultiUserSwitchController import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.UserInfoController import com.android.systemui.tuner.TunerService import javax.inject.Inject import javax.inject.Named class FooterActionsControllerBuilder @Inject constructor( private val qsPanelController: QSPanelController, private val activityStarter: ActivityStarter, private val userManager: UserManager, private val userInfoController: UserInfoController, private val multiUserSwitchController: MultiUserSwitchController, private val deviceProvisionedController: DeviceProvisionedController, private val falsingManager: FalsingManager, private val metricsLogger: MetricsLogger, private val tunerService: TunerService, private val globalActionsDialog: GlobalActionsDialogLite, private val uiEventLogger: UiEventLogger, @Named(QSFlagsModule.PM_LITE_ENABLED) private val showPMLiteButton: Boolean ) { private lateinit var view: FooterActionsView private lateinit var buttonsVisibleState: ExpansionState fun withView(view: FooterActionsView): FooterActionsControllerBuilder { this.view = view return this } fun withButtonsVisibleWhen(state: ExpansionState): FooterActionsControllerBuilder { buttonsVisibleState = state return this } fun build(): FooterActionsController { return FooterActionsController(view, qsPanelController, activityStarter, userManager, userInfoController, multiUserSwitchController, deviceProvisionedController, falsingManager, metricsLogger, tunerService, globalActionsDialog, uiEventLogger, showPMLiteButton, buttonsVisibleState) } } No newline at end of file