DO NOT MERGE - Set minimum density when running testTapLink_changeOrientationThenTapBack

Test: atest CtsAutoFillServiceTestCases:SimpleSaveActivityTest#testTapLink_changeOrientationThenTapBack

Bug: 70969410
Fixes: 73730674

Change-Id: I4972d50e803a4cef697b02c1b1648d4dc6dc8ebe
Merged-In: I4972d50e803a4cef697b02c1b1648d4dc6dc8ebe
(cherry picked from commit 3eebe3db8b1c03299c7aec6503a73a9046b94d15)
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
index 33f0943..d02e396 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
@@ -15,6 +15,8 @@
  */
 package android.autofillservice.cts;
 
+import static android.autofillservice.cts.Helper.runShellCommand;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import android.app.Activity;
@@ -63,9 +65,11 @@
     public final void testTapLink_changeOrientationThenTapBack() throws Exception {
         sUiBot.setScreenOrientation(UiBot.PORTRAIT);
         try {
+            runShellCommand("wm density 420");
             saveUiRestoredAfterTappingLinkTest(
                     PostSaveLinkTappedAction.ROTATE_THEN_TAP_BACK_BUTTON);
         } finally {
+            runShellCommand("wm density reset");
             sUiBot.setScreenOrientation(UiBot.PORTRAIT);
         }
     }
@@ -83,6 +87,9 @@
     protected abstract void saveUiRestoredAfterTappingLinkTest(PostSaveLinkTappedAction type)
             throws Exception;
 
+    protected void cleanUpAfterScreenOrientationIsBackToPortrait() throws Exception {
+    }
+
     /**
      * Tests scenarios when user taps a link in the custom description, taps back to return to the
      * activity with the Save UI, and touch outside the Save UI to dismiss it.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java
index 9fb16a2..a1d74de 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java
@@ -516,6 +516,11 @@
     }
 
     @Override
+    protected void cleanUpAfterScreenOrientationIsBackToPortrait() throws Exception {
+        sReplier.getNextFillRequest();
+    }
+
+    @Override
     protected void tapLinkThenTapBackThenStartOverTest(PostSaveLinkTappedAction action,
             boolean manualRequest) throws Exception {
         startActivity();