From 7f687ebfe412946a10a73db97f8676a42dbaa511 Mon Sep 17 00:00:00 2001 From: Brad Hinegardner Date: Wed, 22 Mar 2023 18:11:18 -0400 Subject: [PATCH] Change Fullscreen UserSwitcher into a dialog This is done to retain the last-active-app-resumption when switching users. Also mitigates some issues with the previous activity behavior in "lockTaskMode". Bug: b/270495254 Fixes: b/274122173 Test: UserInteractorTest.kt Test: manual - switch user from chip bar to other non-supervised user Test: manual - switch user to locked-down supervised user. verify that user switcher still appears on locked-down child user and that the user can switch back to the main user. Test: manual - switch user to guest user, and back Test: manual - open fullscreen user switcher, turn off screen. verify that user switcher is dismissed. Test: manual - verify user switcher fullscreen is the expected UI in portrait and landscape. Change-Id: Icc65e464c4f08817fc3668b2e898dadfc7cea4aa --- packages/SystemUI/AndroidManifest.xml | 12 -- packages/SystemUI/docs/user-switching.md | 6 +- packages/SystemUI/res/values/styles.xml | 4 +- .../interactor/FooterActionsInteractor.kt | 6 +- .../ui/viewmodel/FooterActionsViewModel.kt | 2 +- .../com/android/systemui/user/UserModule.java | 10 -- .../systemui/user/UserSwitcherActivity.kt | 57 ------- .../user/UserSwitcherFullscreenDialog.kt | 70 ++++++++ .../user/domain/interactor/UserInteractor.kt | 21 +-- .../domain/model/ShowDialogRequestModel.kt | 4 + .../user/ui/binder/UserSwitcherViewBinder.kt | 160 +++++++++--------- .../dialog/UserSwitcherDialogCoordinator.kt | 14 ++ .../viewmodel/StatusBarUserChipViewModel.kt | 2 +- .../ui/viewmodel/UserSwitcherViewModel.kt | 56 +----- .../domain/interactor/UserInteractorTest.kt | 42 ++--- .../ui/viewmodel/UserSwitcherViewModelTest.kt | 47 +---- 16 files changed, 208 insertions(+), 305 deletions(-) delete mode 100644 packages/SystemUI/src/com/android/systemui/user/UserSwitcherActivity.kt create mode 100644 packages/SystemUI/src/com/android/systemui/user/UserSwitcherFullscreenDialog.kt diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index aadc14061a61d..5491b4cbe666d 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -893,18 +893,6 @@ android:visibleToInstantApps="true"> - - - diff --git a/packages/SystemUI/docs/user-switching.md b/packages/SystemUI/docs/user-switching.md index b9509eb41c3c4..01cba426f7826 100644 --- a/packages/SystemUI/docs/user-switching.md +++ b/packages/SystemUI/docs/user-switching.md @@ -6,7 +6,7 @@ Multiple users and the ability to switch between them is controlled by Settings ### Quick Settings -In the QS footer, an icon becomes available for users to tap on. The view and its onClick actions are handled by [MultiUserSwitchController][2]. Multiple visual implementations are currently in use; one for phones/foldables ([UserSwitchDialogController][6]) and one for tablets ([UserSwitcherActivity][5]). +In the QS footer, an icon becomes available for users to tap on. The view and its onClick actions are handled by [MultiUserSwitchController][2]. Multiple visual implementations are currently in use; one for phones/foldables ([UserSwitchDialogController][6]) and one for tablets ([UserSwitcherFullscreenDialog][5]). ### Bouncer @@ -29,7 +29,7 @@ All visual implementations should derive their logic and use the adapter specifi ## Visual Components -### [UserSwitcherActivity][5] +### [UserSwitcherFullscreenDialog][5] A fullscreen user switching activity, supporting add guest/user actions if configured. @@ -41,5 +41,5 @@ Renders user switching as a dialog over the current surface, and supports add gu [2]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserController.java [3]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java [4]: /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java -[5]: /frameworks/base/packages/SystemUI/src/com/android/systemui/user/UserSwitcherActivity.kt +[5]: /frameworks/base/packages/SystemUI/src/com/android/systemui/user/UserSwitcherFullscreenDialog.kt [6]: /frameworks/base/packages/SystemUI/src/com/android/systemui/qs/user/UserSwitchDialogController.kt diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 1da1a294f9ba8..27b15c926bbb5 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -836,12 +836,10 @@ @*android:color/primary_text_material_dark -