aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuexi Ma <yuexima@google.com>2021-06-23 12:19:07 -0700
committerYuexi Ma <yuexima@google.com>2021-06-23 21:25:56 +0000
commit08c59177ebcf25c9e36d4039d0dd00b91335660e (patch)
tree5c5ab217daaecb795549c5b701febdf094137a47
parent95c44e48fadb5fa7a3c502cc618e84132caac3bf (diff)
downloadplatform_test_app_compat_csuite-08c59177ebcf25c9e36d4039d0dd00b91335660e.tar.gz
platform_test_app_compat_csuite-08c59177ebcf25c9e36d4039d0dd00b91335660e.tar.bz2
platform_test_app_compat_csuite-08c59177ebcf25c9e36d4039d0dd00b91335660e.zip
Add an option to enable splash screen on launch testsandroid-s-beta-4android-s-beta-3android-s-beta-4
When apps are launched from an instrumentation test, splash screen won't show as it inherits some of the window properties from the instrumentation app. We can re-enable the splash screen by creating a new bundle and set the splash screen property. Test: atest csuite-harness-tests Bug: 191278526 Change-Id: I6d2728c0f1d3839ad0b42aa70c5b3575ddd4ea8b
-rw-r--r--harness/src/main/java/com/android/compatibility/testtype/AppLaunchTest.java10
-rw-r--r--instrumentation/launch/src/main/java/com/android/compatibilitytest/AppCompatibility.java9
2 files changed, 18 insertions, 1 deletions
diff --git a/harness/src/main/java/com/android/compatibility/testtype/AppLaunchTest.java b/harness/src/main/java/com/android/compatibility/testtype/AppLaunchTest.java
index c5309e4..49fa2f8 100644
--- a/harness/src/main/java/com/android/compatibility/testtype/AppLaunchTest.java
+++ b/harness/src/main/java/com/android/compatibility/testtype/AppLaunchTest.java
@@ -68,6 +68,7 @@ public class AppLaunchTest
@VisibleForTesting static final String COLLECT_GMS_VERSION = "collect-gms-version";
@VisibleForTesting static final String GMS_PACKAGE_NAME = "com.google.android.gms";
@VisibleForTesting static final String RECORD_SCREEN = "record-screen";
+ @VisibleForTesting static final String ENABLE_SPLASH_SCREEN = "enable-splash-screen";
@Option(name = RECORD_SCREEN, description = "Whether to record screen during test.")
private boolean mRecordScreen;
@@ -91,6 +92,13 @@ public class AppLaunchTest
+ " test log files.")
private boolean mCollectGmsVersion;
+ @Option(
+ name = ENABLE_SPLASH_SCREEN,
+ description =
+ "Whether to enable splash screen when launching an package from the"
+ + " instrumentation test.")
+ private boolean mEnableSplashScreen;
+
@Option(name = "package-name", description = "Package name of testing app.")
private String mPackageName;
@@ -162,6 +170,8 @@ public class AppLaunchTest
APP_LAUNCH_TIMEOUT_LABEL, Integer.toString(mAppLaunchTimeoutMs));
instrumentationTest.addInstrumentationArg(
ARG_DISMISS_DIALOG, Boolean.toString(mDismissDialog));
+ instrumentationTest.addInstrumentationArg(
+ ENABLE_SPLASH_SCREEN, Boolean.toString(mEnableSplashScreen));
int testTimeoutMs = BASE_INSTRUMENTATION_TEST_TIMEOUT_MS + mAppLaunchTimeoutMs * 2;
instrumentationTest.setShellTimeout(testTimeoutMs);
diff --git a/instrumentation/launch/src/main/java/com/android/compatibilitytest/AppCompatibility.java b/instrumentation/launch/src/main/java/com/android/compatibilitytest/AppCompatibility.java
index 870076c..95a3bc9 100644
--- a/instrumentation/launch/src/main/java/com/android/compatibilitytest/AppCompatibility.java
+++ b/instrumentation/launch/src/main/java/com/android/compatibilitytest/AppCompatibility.java
@@ -64,6 +64,7 @@ public final class AppCompatibility {
private static final String PACKAGE_TO_LAUNCH = "package_to_launch";
private static final String APP_LAUNCH_TIMEOUT_MSECS = "app_launch_timeout_ms";
private static final String ARG_DISMISS_DIALOG = "ARG_DISMISS_DIALOG";
+ private static final String ENABLE_SPLASH_SCREEN = "enable-splash-screen";
private static final Set<String> DROPBOX_TAGS = new HashSet<>();
private static final int MAX_CRASH_SNIPPET_LINES = 20;
private static final int MAX_NUM_CRASH_SNIPPET = 3;
@@ -273,7 +274,13 @@ public final class AppCompatibility {
packageName, intent.toString()));
// Launch Activity
- mContext.startActivity(intent);
+ if (mArgs.getString(ENABLE_SPLASH_SCREEN, "false").equals("true")) {
+ Bundle bundle = new Bundle();
+ bundle.putInt("android.activity.splashScreenStyle", 1);
+ mContext.startActivity(intent, bundle);
+ } else {
+ mContext.startActivity(intent);
+ }
try {
// artificial delay: in case app crashes after doing some work during launch