Loading packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt +4 −3 Original line number Diff line number Diff line Loading @@ -150,15 +150,16 @@ constructor( fun showFromDialog( dialog: Dialog, animateFrom: Dialog, cuj: DialogCuj? = null, animateBackgroundBoundsChange: Boolean = false ) { val view = openedDialogs.firstOrNull { it.dialog == animateFrom }?.dialogContentWithBackground ?: throw IllegalStateException( "The animateFrom dialog was not animated using " + "DialogLaunchAnimator.showFrom(View|Dialog)" ) showFromView(dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange) "DialogLaunchAnimator.showFrom(View|Dialog)") showFromView( dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange, cuj = cuj) } /** Loading packages/SystemUI/src/com/android/systemui/qs/user/UserSwitchDialogController.kt +4 −3 Original line number Diff line number Diff line Loading @@ -128,15 +128,16 @@ class UserSwitchDialogController @VisibleForTesting constructor( private val animateFrom: Dialog, private val dialogLaunchAnimator: DialogLaunchAnimator ) : DialogInterface by animateFrom, DialogShower { override fun showDialog(dialog: Dialog) { override fun showDialog(dialog: Dialog, cuj: DialogCuj) { dialogLaunchAnimator.showFromDialog( dialog, animateFrom = animateFrom animateFrom = animateFrom, cuj ) } } interface DialogShower : DialogInterface { fun showDialog(dialog: Dialog) fun showDialog(dialog: Dialog, cuj: DialogCuj) } } packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +12 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.systemui.GuestResetOrExitSessionReceiver; import com.android.systemui.GuestResumeSessionReceiver; import com.android.systemui.R; import com.android.systemui.SystemUISecondaryUserService; import com.android.systemui.animation.DialogCuj; import com.android.systemui.animation.DialogLaunchAnimator; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastSender; Loading Loading @@ -116,6 +117,9 @@ public class UserSwitcherController implements Dumpable { private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; private static final long MULTI_USER_JOURNEY_TIMEOUT = 20000l; private static final String INTERACTION_JANK_ADD_NEW_USER_TAG = "add_new_user"; private static final String INTERACTION_JANK_EXIT_GUEST_MODE_TAG = "exit_guest_mode"; protected final Context mContext; protected final UserTracker mUserTracker; protected final UserManager mUserManager; Loading Loading @@ -597,7 +601,9 @@ public class UserSwitcherController implements Dumpable { } mExitGuestDialog = new ExitGuestDialog(mContext, id, isGuestEphemeral, targetId); if (dialogShower != null) { dialogShower.showDialog(mExitGuestDialog); dialogShower.showDialog(mExitGuestDialog, new DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_EXIT_GUEST_MODE_TAG)); } else { mExitGuestDialog.show(); } Loading @@ -609,7 +615,11 @@ public class UserSwitcherController implements Dumpable { } mAddUserDialog = new AddUserDialog(mContext); if (dialogShower != null) { dialogShower.showDialog(mAddUserDialog); dialogShower.showDialog(mAddUserDialog, new DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_ADD_NEW_USER_TAG )); } else { mAddUserDialog.show(); } Loading packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt +17 −9 Original line number Diff line number Diff line Loading @@ -170,19 +170,27 @@ class DialogLaunchAnimatorTest : SysuiTestCase() { @Test fun testCujSpecificationLogsInteraction() { val touchSurface = createTouchSurface() return runOnMainThreadAndWaitForIdleSync { runOnMainThreadAndWaitForIdleSync { val dialog = TestDialog(context) dialogLaunchAnimator.showFromView( dialog, touchSurface, cuj = DialogCuj(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN) ) dialog, touchSurface, cuj = DialogCuj(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN)) } verify(interactionJankMonitor).begin( any() ) verify(interactionJankMonitor) .end(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN) verify(interactionJankMonitor).begin(any()) verify(interactionJankMonitor).end(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN) } @Test fun testShowFromDialogCujSpecificationLogsInteraction() { val firstDialog = createAndShowDialog() runOnMainThreadAndWaitForIdleSync { val dialog = TestDialog(context) dialogLaunchAnimator.showFromDialog( dialog, firstDialog, cuj = DialogCuj(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN)) dialog } verify(interactionJankMonitor).begin(any()) verify(interactionJankMonitor).end(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN) } private fun createAndShowDialog(): TestDialog { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.GuestResumeSessionReceiver import com.android.systemui.GuestSessionNotification import com.android.systemui.R import com.android.systemui.SysuiTestCase import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogLaunchAnimator import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.broadcast.BroadcastSender Loading Loading @@ -72,12 +73,12 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.Mockito.`when` import org.mockito.Mockito.doNothing import org.mockito.Mockito.doReturn import org.mockito.Mockito.eq import org.mockito.Mockito.mock import org.mockito.Mockito.verify import org.mockito.Mockito.`when` import org.mockito.MockitoAnnotations @RunWith(AndroidTestingRunner::class) Loading Loading @@ -362,7 +363,10 @@ class UserSwitcherControllerTest : SysuiTestCase() { userSwitcherController.onUserListItemClicked(currentGuestUserRecord, dialogShower) assertNotNull(userSwitcherController.mExitGuestDialog) testableLooper.processAllMessages() verify(dialogShower).showDialog(userSwitcherController.mExitGuestDialog) verify(dialogShower) .showDialog( userSwitcherController.mExitGuestDialog, DialogCuj(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, "exit_guest_mode")) } @Test Loading Loading
packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt +4 −3 Original line number Diff line number Diff line Loading @@ -150,15 +150,16 @@ constructor( fun showFromDialog( dialog: Dialog, animateFrom: Dialog, cuj: DialogCuj? = null, animateBackgroundBoundsChange: Boolean = false ) { val view = openedDialogs.firstOrNull { it.dialog == animateFrom }?.dialogContentWithBackground ?: throw IllegalStateException( "The animateFrom dialog was not animated using " + "DialogLaunchAnimator.showFrom(View|Dialog)" ) showFromView(dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange) "DialogLaunchAnimator.showFrom(View|Dialog)") showFromView( dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange, cuj = cuj) } /** Loading
packages/SystemUI/src/com/android/systemui/qs/user/UserSwitchDialogController.kt +4 −3 Original line number Diff line number Diff line Loading @@ -128,15 +128,16 @@ class UserSwitchDialogController @VisibleForTesting constructor( private val animateFrom: Dialog, private val dialogLaunchAnimator: DialogLaunchAnimator ) : DialogInterface by animateFrom, DialogShower { override fun showDialog(dialog: Dialog) { override fun showDialog(dialog: Dialog, cuj: DialogCuj) { dialogLaunchAnimator.showFromDialog( dialog, animateFrom = animateFrom animateFrom = animateFrom, cuj ) } } interface DialogShower : DialogInterface { fun showDialog(dialog: Dialog) fun showDialog(dialog: Dialog, cuj: DialogCuj) } }
packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +12 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.systemui.GuestResetOrExitSessionReceiver; import com.android.systemui.GuestResumeSessionReceiver; import com.android.systemui.R; import com.android.systemui.SystemUISecondaryUserService; import com.android.systemui.animation.DialogCuj; import com.android.systemui.animation.DialogLaunchAnimator; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastSender; Loading Loading @@ -116,6 +117,9 @@ public class UserSwitcherController implements Dumpable { private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; private static final long MULTI_USER_JOURNEY_TIMEOUT = 20000l; private static final String INTERACTION_JANK_ADD_NEW_USER_TAG = "add_new_user"; private static final String INTERACTION_JANK_EXIT_GUEST_MODE_TAG = "exit_guest_mode"; protected final Context mContext; protected final UserTracker mUserTracker; protected final UserManager mUserManager; Loading Loading @@ -597,7 +601,9 @@ public class UserSwitcherController implements Dumpable { } mExitGuestDialog = new ExitGuestDialog(mContext, id, isGuestEphemeral, targetId); if (dialogShower != null) { dialogShower.showDialog(mExitGuestDialog); dialogShower.showDialog(mExitGuestDialog, new DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_EXIT_GUEST_MODE_TAG)); } else { mExitGuestDialog.show(); } Loading @@ -609,7 +615,11 @@ public class UserSwitcherController implements Dumpable { } mAddUserDialog = new AddUserDialog(mContext); if (dialogShower != null) { dialogShower.showDialog(mAddUserDialog); dialogShower.showDialog(mAddUserDialog, new DialogCuj( InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, INTERACTION_JANK_ADD_NEW_USER_TAG )); } else { mAddUserDialog.show(); } Loading
packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt +17 −9 Original line number Diff line number Diff line Loading @@ -170,19 +170,27 @@ class DialogLaunchAnimatorTest : SysuiTestCase() { @Test fun testCujSpecificationLogsInteraction() { val touchSurface = createTouchSurface() return runOnMainThreadAndWaitForIdleSync { runOnMainThreadAndWaitForIdleSync { val dialog = TestDialog(context) dialogLaunchAnimator.showFromView( dialog, touchSurface, cuj = DialogCuj(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN) ) dialog, touchSurface, cuj = DialogCuj(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN)) } verify(interactionJankMonitor).begin( any() ) verify(interactionJankMonitor) .end(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN) verify(interactionJankMonitor).begin(any()) verify(interactionJankMonitor).end(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN) } @Test fun testShowFromDialogCujSpecificationLogsInteraction() { val firstDialog = createAndShowDialog() runOnMainThreadAndWaitForIdleSync { val dialog = TestDialog(context) dialogLaunchAnimator.showFromDialog( dialog, firstDialog, cuj = DialogCuj(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN)) dialog } verify(interactionJankMonitor).begin(any()) verify(interactionJankMonitor).end(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN) } private fun createAndShowDialog(): TestDialog { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.GuestResumeSessionReceiver import com.android.systemui.GuestSessionNotification import com.android.systemui.R import com.android.systemui.SysuiTestCase import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogLaunchAnimator import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.broadcast.BroadcastSender Loading Loading @@ -72,12 +73,12 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.Mockito.`when` import org.mockito.Mockito.doNothing import org.mockito.Mockito.doReturn import org.mockito.Mockito.eq import org.mockito.Mockito.mock import org.mockito.Mockito.verify import org.mockito.Mockito.`when` import org.mockito.MockitoAnnotations @RunWith(AndroidTestingRunner::class) Loading Loading @@ -362,7 +363,10 @@ class UserSwitcherControllerTest : SysuiTestCase() { userSwitcherController.onUserListItemClicked(currentGuestUserRecord, dialogShower) assertNotNull(userSwitcherController.mExitGuestDialog) testableLooper.processAllMessages() verify(dialogShower).showDialog(userSwitcherController.mExitGuestDialog) verify(dialogShower) .showDialog( userSwitcherController.mExitGuestDialog, DialogCuj(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, "exit_guest_mode")) } @Test Loading