[RESTRICT AUTOMERGE] Launch activities in fullscreen in AssistantStackTests
In this test, activities need to be launched in a fullscreen windowing
mode. Without explicitly specifying it, this test fails in default
freeform devices, such as ARC++.
This change fixes the issue by specifying launch windowing mode.
Bug: 168770671
Test: android.server.wm.AssistantStackTests on eve and crosshatch
Change-Id: I9a5b7307bdfada536983662adced6d33f7aa0f49
Merged-In: I9a5b7307bdfada536983662adced6d33f7aa0f49
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
index 4a1a9a0..82c3770 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
@@ -17,6 +17,7 @@
package android.server.wm.app;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.server.wm.app.Components.AssistantActivity.EXTRA_ASSISTANT_DISPLAY_ID;
@@ -46,14 +47,13 @@
final Intent launchIntent = new Intent();
launchIntent.setComponent(launchActivity)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ final ActivityOptions activityOptions = ActivityOptions.makeBasic();
+ activityOptions.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
if (getIntent().hasExtra(EXTRA_ASSISTANT_DISPLAY_ID)) {
- ActivityOptions displayOptions = ActivityOptions.makeBasic();
- displayOptions.setLaunchDisplayId(Integer.parseInt(getIntent()
+ activityOptions.setLaunchDisplayId(Integer.parseInt(getIntent()
.getStringExtra(EXTRA_ASSISTANT_DISPLAY_ID)));
- startActivity(launchIntent, displayOptions.toBundle());
- } else {
- startActivity(launchIntent);
}
+ startActivity(launchIntent, activityOptions.toBundle());
}
// Enter pip if requested
@@ -84,6 +84,7 @@
final ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchActivityType(ACTIVITY_TYPE_ASSISTANT);
+ options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
caller.startActivity(intent, options.toBundle());
}
}
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java
index 3806377..98bb6a2 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java
@@ -17,6 +17,7 @@
package android.server.wm.app;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
@@ -40,6 +41,7 @@
final ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchActivityType(ACTIVITY_TYPE_ASSISTANT);
+ options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
caller.startActivity(intent, options.toBundle());
}
}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
index 267bec9..d777db2 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
@@ -209,7 +209,7 @@
// Launch an assistant activity on top of an existing fullscreen activity, and ensure that
// the fullscreen activity is still visible and on top after the assistant activity finishes
- launchActivityOnDisplay(TEST_ACTIVITY, mAssistantDisplayId);
+ launchActivityOnDisplay(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
try (final AssistantSession assistantSession = new AssistantSession()) {
assistantSession.setVoiceInteractionService(ASSISTANT_VOICE_INTERACTION_SERVICE);
@@ -265,7 +265,7 @@
// Launch a fullscreen app and then launch the assistant and check to see that it is
// also visible
removeStacksWithActivityTypes(ACTIVITY_TYPE_ASSISTANT);
- launchActivityOnDisplay(TEST_ACTIVITY, mAssistantDisplayId);
+ launchActivityOnDisplay(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
launchActivityNoWait(LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK,
EXTRA_ASSISTANT_IS_TRANSLUCENT, "true");
waitForValidStateWithActivityType(
@@ -336,7 +336,7 @@
// Launch a new fullscreen activity
// Using Animation Test Activity because it is opaque on all devices.
- launchActivityOnDisplay(ANIMATION_TEST_ACTIVITY, mAssistantDisplayId);
+ launchActivityOnDisplay(ANIMATION_TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
// Wait for animation finished.
mWmState.waitForActivityState(ANIMATION_TEST_ACTIVITY, STATE_RESUMED);
mWmState.assertVisibility(ASSISTANT_ACTIVITY, isAssistantOnTop());
@@ -367,7 +367,7 @@
// Launch a fullscreen activity and a PIP activity, then launch the assistant, and
// ensure that the test activity is still visible
- launchActivity(TEST_ACTIVITY);
+ launchActivity(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
launchActivityNoWait(LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK,
EXTRA_ASSISTANT_IS_TRANSLUCENT, String.valueOf(true));