Attempt to reduce flakiness of testDisableRotationCheckForPhone

The request setOrientationLeft() is async that puts the target
rotation to setting. So the actual display rotation change may
happen when executing goHome(). Then the swipe gesture may be
interrupted that causes the test to fail.

Add a condition to wait for leaving natural orientation change
before calling goHome(). Also reorder and simplify the way to
start test activity to reduce execution time.

Bug: 253290379
Test: TaplTestsQuickstep#testDisableRotationCheckForPhone
Change-Id: I881d6f666c98fd3fe601b874adb0d14122bff2b7
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 38007d5..156ff1a 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -33,13 +33,13 @@
 
 import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherState;
-import com.android.launcher3.tapl.AllApps;
 import com.android.launcher3.tapl.LaunchedAppState;
 import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
 import com.android.launcher3.tapl.Overview;
 import com.android.launcher3.tapl.OverviewActions;
 import com.android.launcher3.tapl.OverviewTask;
 import com.android.launcher3.ui.TaplTestsLauncher3;
+import com.android.launcher3.util.Wait;
 import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
 import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
 import com.android.quickstep.views.RecentsView;
@@ -437,14 +437,10 @@
         try {
             mLauncher.setExpectedRotationCheckEnabled(false);
             mLauncher.setEnableRotation(false);
-            final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
-            allApps.freeze();
-            try {
-                allApps.getAppIcon("TestActivity7").launch(getAppPackageName());
-            } finally {
-                allApps.unfreeze();
-            }
             mLauncher.getDevice().setOrientationLeft();
+            startTestActivity(7);
+            Wait.atMost("Device should not be in natural orientation",
+                    () -> !mDevice.isNaturalOrientation(), DEFAULT_UI_TIMEOUT, mLauncher);
             mLauncher.goHome();
         } finally {
             mLauncher.setExpectedRotationCheckEnabled(true);