From f9e559275dcf8cf4c59d70614b5e117d45c76c27 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 19 Nov 2019 11:45:57 -0800 Subject: [PATCH] Making the default launcher rule outer for the Portrait-Landscape one Portrait-Landscape uses Launcher activity and needs it to be set up correctly. Change-Id: I13c9712647b3e45a259039d7968bb95cfe8158ef --- .../launcher3/ui/AbstractLauncherUiTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index bb19515dd0..4243ed041f 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -122,10 +122,6 @@ public abstract class AbstractLauncherUiTest { protected final LauncherActivityRule mActivityMonitor = new LauncherActivityRule(); - @Rule - public ShellCommandRule mDefaultLauncherRule = - TestHelpers.isInLauncherProcess() ? ShellCommandRule.setDefaultLauncher() : null; - @Rule public ShellCommandRule mDisableHeadsUpNotification = ShellCommandRule.disableHeadsUpNotification(); @@ -154,9 +150,13 @@ public abstract class AbstractLauncherUiTest { } protected TestRule getRulesInsideActivityMonitor() { - return RuleChain. - outerRule(new PortraitLandscapeRunner(this)). - around(new FailureWatcher(mDevice)); + final RuleChain inner = RuleChain.outerRule(new PortraitLandscapeRunner(this)) + .around(new FailureWatcher(mDevice)); + + return TestHelpers.isInLauncherProcess() + ? RuleChain.outerRule(ShellCommandRule.setDefaultLauncher()) + .around(inner) : + inner; } @Rule