Merge "Add jank CUJ instrumentation for user dialog-to-dialog transitions" into tm-qpr-dev am: 34c8b6d6af
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19031868 Change-Id: Ic2b668ad2986f2a3b27be17eac8c6bd1eaf5542f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -150,15 +150,16 @@ constructor(
|
|||||||
fun showFromDialog(
|
fun showFromDialog(
|
||||||
dialog: Dialog,
|
dialog: Dialog,
|
||||||
animateFrom: Dialog,
|
animateFrom: Dialog,
|
||||||
|
cuj: DialogCuj? = null,
|
||||||
animateBackgroundBoundsChange: Boolean = false
|
animateBackgroundBoundsChange: Boolean = false
|
||||||
) {
|
) {
|
||||||
val view =
|
val view =
|
||||||
openedDialogs.firstOrNull { it.dialog == animateFrom }?.dialogContentWithBackground
|
openedDialogs.firstOrNull { it.dialog == animateFrom }?.dialogContentWithBackground
|
||||||
?: throw IllegalStateException(
|
?: throw IllegalStateException(
|
||||||
"The animateFrom dialog was not animated using " +
|
"The animateFrom dialog was not animated using " +
|
||||||
"DialogLaunchAnimator.showFrom(View|Dialog)"
|
"DialogLaunchAnimator.showFrom(View|Dialog)")
|
||||||
)
|
showFromView(
|
||||||
showFromView(dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange)
|
dialog, view, animateBackgroundBoundsChange = animateBackgroundBoundsChange, cuj = cuj)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -128,15 +128,16 @@ class UserSwitchDialogController @VisibleForTesting constructor(
|
|||||||
private val animateFrom: Dialog,
|
private val animateFrom: Dialog,
|
||||||
private val dialogLaunchAnimator: DialogLaunchAnimator
|
private val dialogLaunchAnimator: DialogLaunchAnimator
|
||||||
) : DialogInterface by animateFrom, DialogShower {
|
) : DialogInterface by animateFrom, DialogShower {
|
||||||
override fun showDialog(dialog: Dialog) {
|
override fun showDialog(dialog: Dialog, cuj: DialogCuj) {
|
||||||
dialogLaunchAnimator.showFromDialog(
|
dialogLaunchAnimator.showFromDialog(
|
||||||
dialog,
|
dialog,
|
||||||
animateFrom = animateFrom
|
animateFrom = animateFrom,
|
||||||
|
cuj
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DialogShower : DialogInterface {
|
interface DialogShower : DialogInterface {
|
||||||
fun showDialog(dialog: Dialog)
|
fun showDialog(dialog: Dialog, cuj: DialogCuj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ import com.android.systemui.GuestResetOrExitSessionReceiver;
|
|||||||
import com.android.systemui.GuestResumeSessionReceiver;
|
import com.android.systemui.GuestResumeSessionReceiver;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.SystemUISecondaryUserService;
|
import com.android.systemui.SystemUISecondaryUserService;
|
||||||
|
import com.android.systemui.animation.DialogCuj;
|
||||||
import com.android.systemui.animation.DialogLaunchAnimator;
|
import com.android.systemui.animation.DialogLaunchAnimator;
|
||||||
import com.android.systemui.broadcast.BroadcastDispatcher;
|
import com.android.systemui.broadcast.BroadcastDispatcher;
|
||||||
import com.android.systemui.broadcast.BroadcastSender;
|
import com.android.systemui.broadcast.BroadcastSender;
|
||||||
@@ -116,6 +117,9 @@ public class UserSwitcherController implements Dumpable {
|
|||||||
private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF";
|
private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF";
|
||||||
private static final long MULTI_USER_JOURNEY_TIMEOUT = 20000l;
|
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 Context mContext;
|
||||||
protected final UserTracker mUserTracker;
|
protected final UserTracker mUserTracker;
|
||||||
protected final UserManager mUserManager;
|
protected final UserManager mUserManager;
|
||||||
@@ -597,7 +601,9 @@ public class UserSwitcherController implements Dumpable {
|
|||||||
}
|
}
|
||||||
mExitGuestDialog = new ExitGuestDialog(mContext, id, isGuestEphemeral, targetId);
|
mExitGuestDialog = new ExitGuestDialog(mContext, id, isGuestEphemeral, targetId);
|
||||||
if (dialogShower != null) {
|
if (dialogShower != null) {
|
||||||
dialogShower.showDialog(mExitGuestDialog);
|
dialogShower.showDialog(mExitGuestDialog, new DialogCuj(
|
||||||
|
InteractionJankMonitor.CUJ_USER_DIALOG_OPEN,
|
||||||
|
INTERACTION_JANK_EXIT_GUEST_MODE_TAG));
|
||||||
} else {
|
} else {
|
||||||
mExitGuestDialog.show();
|
mExitGuestDialog.show();
|
||||||
}
|
}
|
||||||
@@ -609,7 +615,11 @@ public class UserSwitcherController implements Dumpable {
|
|||||||
}
|
}
|
||||||
mAddUserDialog = new AddUserDialog(mContext);
|
mAddUserDialog = new AddUserDialog(mContext);
|
||||||
if (dialogShower != null) {
|
if (dialogShower != null) {
|
||||||
dialogShower.showDialog(mAddUserDialog);
|
dialogShower.showDialog(mAddUserDialog,
|
||||||
|
new DialogCuj(
|
||||||
|
InteractionJankMonitor.CUJ_USER_DIALOG_OPEN,
|
||||||
|
INTERACTION_JANK_ADD_NEW_USER_TAG
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
mAddUserDialog.show();
|
mAddUserDialog.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,19 +170,27 @@ class DialogLaunchAnimatorTest : SysuiTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun testCujSpecificationLogsInteraction() {
|
fun testCujSpecificationLogsInteraction() {
|
||||||
val touchSurface = createTouchSurface()
|
val touchSurface = createTouchSurface()
|
||||||
return runOnMainThreadAndWaitForIdleSync {
|
runOnMainThreadAndWaitForIdleSync {
|
||||||
val dialog = TestDialog(context)
|
val dialog = TestDialog(context)
|
||||||
dialogLaunchAnimator.showFromView(
|
dialogLaunchAnimator.showFromView(
|
||||||
dialog, touchSurface,
|
dialog, touchSurface, cuj = DialogCuj(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN))
|
||||||
cuj = DialogCuj(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(interactionJankMonitor).begin(
|
verify(interactionJankMonitor).begin(any())
|
||||||
any()
|
verify(interactionJankMonitor).end(InteractionJankMonitor.CUJ_SHADE_DIALOG_OPEN)
|
||||||
)
|
}
|
||||||
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 {
|
private fun createAndShowDialog(): TestDialog {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import com.android.systemui.GuestResumeSessionReceiver
|
|||||||
import com.android.systemui.GuestSessionNotification
|
import com.android.systemui.GuestSessionNotification
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
|
import com.android.systemui.animation.DialogCuj
|
||||||
import com.android.systemui.animation.DialogLaunchAnimator
|
import com.android.systemui.animation.DialogLaunchAnimator
|
||||||
import com.android.systemui.broadcast.BroadcastDispatcher
|
import com.android.systemui.broadcast.BroadcastDispatcher
|
||||||
import com.android.systemui.broadcast.BroadcastSender
|
import com.android.systemui.broadcast.BroadcastSender
|
||||||
@@ -72,12 +73,12 @@ import org.junit.Test
|
|||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.ArgumentMatchers.anyInt
|
import org.mockito.ArgumentMatchers.anyInt
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.`when`
|
|
||||||
import org.mockito.Mockito.doNothing
|
import org.mockito.Mockito.doNothing
|
||||||
import org.mockito.Mockito.doReturn
|
import org.mockito.Mockito.doReturn
|
||||||
import org.mockito.Mockito.eq
|
import org.mockito.Mockito.eq
|
||||||
import org.mockito.Mockito.mock
|
import org.mockito.Mockito.mock
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
|
import org.mockito.Mockito.`when`
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
|
|
||||||
@RunWith(AndroidTestingRunner::class)
|
@RunWith(AndroidTestingRunner::class)
|
||||||
@@ -362,7 +363,10 @@ class UserSwitcherControllerTest : SysuiTestCase() {
|
|||||||
userSwitcherController.onUserListItemClicked(currentGuestUserRecord, dialogShower)
|
userSwitcherController.onUserListItemClicked(currentGuestUserRecord, dialogShower)
|
||||||
assertNotNull(userSwitcherController.mExitGuestDialog)
|
assertNotNull(userSwitcherController.mExitGuestDialog)
|
||||||
testableLooper.processAllMessages()
|
testableLooper.processAllMessages()
|
||||||
verify(dialogShower).showDialog(userSwitcherController.mExitGuestDialog)
|
verify(dialogShower)
|
||||||
|
.showDialog(
|
||||||
|
userSwitcherController.mExitGuestDialog,
|
||||||
|
DialogCuj(InteractionJankMonitor.CUJ_USER_DIALOG_OPEN, "exit_guest_mode"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user