Loading packages/SystemUI/src/com/android/systemui/user/domain/interactor/UserInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -429,6 +429,7 @@ constructor( isGuestEphemeral = currentlySelectedUserInfo.isEphemeral, isKeyguardShowing = keyguardInteractor.isKeyguardShowing(), onExitGuestUser = this::exitGuestUser, dialogShower = dialogShower, ) ) return Loading @@ -443,6 +444,7 @@ constructor( isGuestEphemeral = currentlySelectedUserInfo.isEphemeral, isKeyguardShowing = keyguardInteractor.isKeyguardShowing(), onExitGuestUser = this::exitGuestUser, dialogShower = dialogShower, ) ) return Loading Loading @@ -477,6 +479,7 @@ constructor( userHandle = currentUser.userHandle, isKeyguardShowing = keyguardInteractor.isKeyguardShowing(), showEphemeralMessage = currentUser.isGuest && currentUser.isEphemeral, dialogShower = dialogShower, ) ) } Loading packages/SystemUI/src/com/android/systemui/user/domain/model/ShowDialogRequestModel.kt +8 −3 Original line number Diff line number Diff line Loading @@ -18,14 +18,18 @@ package com.android.systemui.user.domain.model import android.os.UserHandle import com.android.systemui.qs.user.UserSwitchDialogController /** Encapsulates a request to show a dialog. */ sealed class ShowDialogRequestModel { sealed class ShowDialogRequestModel( open val dialogShower: UserSwitchDialogController.DialogShower? = null, ) { data class ShowAddUserDialog( val userHandle: UserHandle, val isKeyguardShowing: Boolean, val showEphemeralMessage: Boolean, ) : ShowDialogRequestModel() override val dialogShower: UserSwitchDialogController.DialogShower?, ) : ShowDialogRequestModel(dialogShower) data class ShowUserCreationDialog( val isGuest: Boolean, Loading @@ -37,5 +41,6 @@ sealed class ShowDialogRequestModel { val isGuestEphemeral: Boolean, val isKeyguardShowing: Boolean, val onExitGuestUser: (guestId: Int, targetId: Int, forceRemoveGuest: Boolean) -> Unit, ) : ShowDialogRequestModel() override val dialogShower: UserSwitchDialogController.DialogShower?, ) : ShowDialogRequestModel(dialogShower) } packages/SystemUI/src/com/android/systemui/user/ui/dialog/UserSwitcherDialogCoordinator.kt +50 −22 Original line number Diff line number Diff line Loading @@ -19,8 +19,10 @@ package com.android.systemui.user.ui.dialog import android.app.Dialog import android.content.Context import com.android.internal.jank.InteractionJankMonitor import com.android.settingslib.users.UserCreatingDialog import com.android.systemui.CoreStartable import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogLaunchAnimator import com.android.systemui.broadcast.BroadcastSender import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -71,9 +73,10 @@ constructor( } } currentDialog = val (dialog, dialogCuj) = when (request) { is ShowDialogRequestModel.ShowAddUserDialog -> Pair( AddUserDialog( context = context.get(), userHandle = request.userHandle, Loading @@ -82,13 +85,22 @@ constructor( falsingManager = falsingManager.get(), broadcastSender = broadcastSender.get(), dialogLaunchAnimator = dialogLaunchAnimator.get(), ), DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_ADD_NEW_USER_TAG, ), ) is ShowDialogRequestModel.ShowUserCreationDialog -> Pair( UserCreatingDialog( context.get(), request.isGuest, ), null, ) is ShowDialogRequestModel.ShowExitGuestDialog -> Pair( ExitGuestDialog( context = context.get(), guestUserId = request.guestUserId, Loading @@ -98,10 +110,21 @@ constructor( falsingManager = falsingManager.get(), dialogLaunchAnimator = dialogLaunchAnimator.get(), onExitGuestUserListener = request.onExitGuestUser, ), DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_EXIT_GUEST_MODE_TAG, ), ) } currentDialog = dialog if (request.dialogShower != null && dialogCuj != null) { request.dialogShower?.showDialog(dialog, dialogCuj) } else { dialog.show() } currentDialog?.show() interactor.get().onDialogShown() } } Loading @@ -120,4 +143,9 @@ constructor( } } } companion object { private const val INTERACTION_JANK_ADD_NEW_USER_TAG = "add_new_user" private const val INTERACTION_JANK_EXIT_GUEST_MODE_TAG = "exit_guest_mode" } } packages/SystemUI/tests/src/com/android/systemui/user/domain/interactor/UserInteractorRefactoredTest.kt +4 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest import com.android.internal.R.drawable.ic_account_circle import com.android.systemui.R import com.android.systemui.common.shared.model.Text import com.android.systemui.qs.user.UserSwitchDialogController import com.android.systemui.user.data.model.UserSwitcherSettingsModel import com.android.systemui.user.data.source.UserRecord import com.android.systemui.user.domain.model.ShowDialogRequestModel Loading Loading @@ -316,14 +317,16 @@ class UserInteractorRefactoredTest : UserInteractorTest() { keyguardRepository.setKeyguardShowing(false) var dialogRequest: ShowDialogRequestModel? = null val job = underTest.dialogShowRequests.onEach { dialogRequest = it }.launchIn(this) val dialogShower: UserSwitchDialogController.DialogShower = mock() underTest.executeAction(UserActionModel.ADD_USER) underTest.executeAction(UserActionModel.ADD_USER, dialogShower) assertThat(dialogRequest) .isEqualTo( ShowDialogRequestModel.ShowAddUserDialog( userHandle = userInfos[0].userHandle, isKeyguardShowing = false, showEphemeralMessage = false, dialogShower = dialogShower, ) ) Loading Loading
packages/SystemUI/src/com/android/systemui/user/domain/interactor/UserInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -429,6 +429,7 @@ constructor( isGuestEphemeral = currentlySelectedUserInfo.isEphemeral, isKeyguardShowing = keyguardInteractor.isKeyguardShowing(), onExitGuestUser = this::exitGuestUser, dialogShower = dialogShower, ) ) return Loading @@ -443,6 +444,7 @@ constructor( isGuestEphemeral = currentlySelectedUserInfo.isEphemeral, isKeyguardShowing = keyguardInteractor.isKeyguardShowing(), onExitGuestUser = this::exitGuestUser, dialogShower = dialogShower, ) ) return Loading Loading @@ -477,6 +479,7 @@ constructor( userHandle = currentUser.userHandle, isKeyguardShowing = keyguardInteractor.isKeyguardShowing(), showEphemeralMessage = currentUser.isGuest && currentUser.isEphemeral, dialogShower = dialogShower, ) ) } Loading
packages/SystemUI/src/com/android/systemui/user/domain/model/ShowDialogRequestModel.kt +8 −3 Original line number Diff line number Diff line Loading @@ -18,14 +18,18 @@ package com.android.systemui.user.domain.model import android.os.UserHandle import com.android.systemui.qs.user.UserSwitchDialogController /** Encapsulates a request to show a dialog. */ sealed class ShowDialogRequestModel { sealed class ShowDialogRequestModel( open val dialogShower: UserSwitchDialogController.DialogShower? = null, ) { data class ShowAddUserDialog( val userHandle: UserHandle, val isKeyguardShowing: Boolean, val showEphemeralMessage: Boolean, ) : ShowDialogRequestModel() override val dialogShower: UserSwitchDialogController.DialogShower?, ) : ShowDialogRequestModel(dialogShower) data class ShowUserCreationDialog( val isGuest: Boolean, Loading @@ -37,5 +41,6 @@ sealed class ShowDialogRequestModel { val isGuestEphemeral: Boolean, val isKeyguardShowing: Boolean, val onExitGuestUser: (guestId: Int, targetId: Int, forceRemoveGuest: Boolean) -> Unit, ) : ShowDialogRequestModel() override val dialogShower: UserSwitchDialogController.DialogShower?, ) : ShowDialogRequestModel(dialogShower) }
packages/SystemUI/src/com/android/systemui/user/ui/dialog/UserSwitcherDialogCoordinator.kt +50 −22 Original line number Diff line number Diff line Loading @@ -19,8 +19,10 @@ package com.android.systemui.user.ui.dialog import android.app.Dialog import android.content.Context import com.android.internal.jank.InteractionJankMonitor import com.android.settingslib.users.UserCreatingDialog import com.android.systemui.CoreStartable import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogLaunchAnimator import com.android.systemui.broadcast.BroadcastSender import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -71,9 +73,10 @@ constructor( } } currentDialog = val (dialog, dialogCuj) = when (request) { is ShowDialogRequestModel.ShowAddUserDialog -> Pair( AddUserDialog( context = context.get(), userHandle = request.userHandle, Loading @@ -82,13 +85,22 @@ constructor( falsingManager = falsingManager.get(), broadcastSender = broadcastSender.get(), dialogLaunchAnimator = dialogLaunchAnimator.get(), ), DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_ADD_NEW_USER_TAG, ), ) is ShowDialogRequestModel.ShowUserCreationDialog -> Pair( UserCreatingDialog( context.get(), request.isGuest, ), null, ) is ShowDialogRequestModel.ShowExitGuestDialog -> Pair( ExitGuestDialog( context = context.get(), guestUserId = request.guestUserId, Loading @@ -98,10 +110,21 @@ constructor( falsingManager = falsingManager.get(), dialogLaunchAnimator = dialogLaunchAnimator.get(), onExitGuestUserListener = request.onExitGuestUser, ), DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_EXIT_GUEST_MODE_TAG, ), ) } currentDialog = dialog if (request.dialogShower != null && dialogCuj != null) { request.dialogShower?.showDialog(dialog, dialogCuj) } else { dialog.show() } currentDialog?.show() interactor.get().onDialogShown() } } Loading @@ -120,4 +143,9 @@ constructor( } } } companion object { private const val INTERACTION_JANK_ADD_NEW_USER_TAG = "add_new_user" private const val INTERACTION_JANK_EXIT_GUEST_MODE_TAG = "exit_guest_mode" } }
packages/SystemUI/tests/src/com/android/systemui/user/domain/interactor/UserInteractorRefactoredTest.kt +4 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest import com.android.internal.R.drawable.ic_account_circle import com.android.systemui.R import com.android.systemui.common.shared.model.Text import com.android.systemui.qs.user.UserSwitchDialogController import com.android.systemui.user.data.model.UserSwitcherSettingsModel import com.android.systemui.user.data.source.UserRecord import com.android.systemui.user.domain.model.ShowDialogRequestModel Loading Loading @@ -316,14 +317,16 @@ class UserInteractorRefactoredTest : UserInteractorTest() { keyguardRepository.setKeyguardShowing(false) var dialogRequest: ShowDialogRequestModel? = null val job = underTest.dialogShowRequests.onEach { dialogRequest = it }.launchIn(this) val dialogShower: UserSwitchDialogController.DialogShower = mock() underTest.executeAction(UserActionModel.ADD_USER) underTest.executeAction(UserActionModel.ADD_USER, dialogShower) assertThat(dialogRequest) .isEqualTo( ShowDialogRequestModel.ShowAddUserDialog( userHandle = userInfos[0].userHandle, isKeyguardShowing = false, showEphemeralMessage = false, dialogShower = dialogShower, ) ) Loading