summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Faye Yan <fayey@google.com> 2024-05-07 17:37:26 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-05-07 17:37:26 +0000
commitc8c4b2637a9e4319e36b1bcc7c888b7544d47a55 (patch)
treee093c58257caaa13e5db33da85445aaeeb36403c
parent36e85518e11fa1e6fe145fa6c355c65890127430 (diff)
parenta72e33cc908356d0a622c9f8f4cf09842d55af1c (diff)
Merge "Security fix for VPN app killable via lockscreen." into udc-dev am: a72e33cc90
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/27145545 Change-Id: I2c106c46a657a861a8c3c9a9b153413527c1ae25 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt13
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/footer/FooterActionsTestUtils.kt4
2 files changed, 15 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt
index b3596a254b7d..b9258ac1497a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt
@@ -30,6 +30,7 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.globalactions.GlobalActionsDialogLite
+import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.qs.dagger.QSFlagsModule.PM_LITE_ENABLED
import com.android.systemui.qs.footer.data.model.UserSwitcherStatusModel
@@ -54,6 +55,7 @@ class FooterActionsViewModel(
private val footerActionsInteractor: FooterActionsInteractor,
private val falsingManager: FalsingManager,
private val globalActionsDialogLite: GlobalActionsDialogLite,
+ private val activityStarter: ActivityStarter,
showPowerButton: Boolean,
) {
/** The context themed with the Quick Settings colors. */
@@ -222,7 +224,14 @@ class FooterActionsViewModel(
return
}
- footerActionsInteractor.showForegroundServicesDialog(expandable)
+ activityStarter.dismissKeyguardThenExecute(
+ {
+ footerActionsInteractor.showForegroundServicesDialog(expandable)
+ false /* if the dismiss should be deferred */
+ },
+ null /* cancelAction */,
+ true /* afterKeyguardGone */
+ )
}
private fun onUserSwitcherClicked(expandable: Expandable) {
@@ -283,6 +292,7 @@ class FooterActionsViewModel(
private val falsingManager: FalsingManager,
private val footerActionsInteractor: FooterActionsInteractor,
private val globalActionsDialogLiteProvider: Provider<GlobalActionsDialogLite>,
+ private val activityStarter: ActivityStarter,
@Named(PM_LITE_ENABLED) private val showPowerButton: Boolean,
) {
/** Create a [FooterActionsViewModel] bound to the lifecycle of [lifecycleOwner]. */
@@ -308,6 +318,7 @@ class FooterActionsViewModel(
footerActionsInteractor,
falsingManager,
globalActionsDialogLite,
+ activityStarter,
showPowerButton,
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/footer/FooterActionsTestUtils.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/footer/FooterActionsTestUtils.kt
index 1a893f8c523c..a94acf9c8106 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/footer/FooterActionsTestUtils.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/footer/FooterActionsTestUtils.kt
@@ -68,6 +68,7 @@ class FooterActionsTestUtils(
private val testableLooper: TestableLooper,
private val scheduler: TestCoroutineScheduler,
) {
+ private val mockActivityStarter: ActivityStarter = mock<ActivityStarter>()
/** Enable or disable the user switcher in the settings. */
fun setUserSwitcherEnabled(settings: GlobalSettings, enabled: Boolean, userId: Int) {
settings.putBoolForUser(Settings.Global.USER_SWITCHER_ENABLED, enabled, userId)
@@ -90,13 +91,14 @@ class FooterActionsTestUtils(
footerActionsInteractor,
falsingManager,
globalActionsDialogLite,
+ mockActivityStarter,
showPowerButton,
)
}
/** Create a [FooterActionsInteractor] to be used in tests. */
fun footerActionsInteractor(
- activityStarter: ActivityStarter = mock(),
+ activityStarter: ActivityStarter = mockActivityStarter,
metricsLogger: MetricsLogger = FakeMetricsLogger(),
uiEventLogger: UiEventLogger = UiEventLoggerFake(),
deviceProvisionedController: DeviceProvisionedController = mock(),