Skip to content
Snippets Groups Projects
Commit 598d7a18 authored by Faye Yan's avatar Faye Yan
Browse files

Security fix for VPN app killable via lockscreen.

Do not show the active apps dialog when the screen is locked.
Instead prompt the user to unlock directly if clicked and only open the dialog on
successsful unlock.

Flag: NONE
Bug: 304772709
Test: manually, locked and unlocked
Test: atest com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModelTest

Merged-In: I384699d478e5abcee3a165afc45211b9ed96334a
Change-Id: I384699d478e5abcee3a165afc45211b9ed96334a
(cherry picked from commit d7628d56)
parent 796b755a
No related branches found
No related tags found
No related merge requests found
......@@ -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,
)
}
......
......@@ -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(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment