From 8d27c4c40c7ab05a253dfcbafd2d34d6a31925d0 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 1 Jun 2021 14:11:58 -0700 Subject: [PATCH] Delaying initializing "is launcher3" flag Launcher3 tests may set default launcher after instantiating TAPL Test: presubmit Bug: 188477498 Change-Id: I6e40bc3fcf9c4f040983f164d3a04d0189228f83 --- .../com/android/launcher3/tapl/LauncherInstrumentation.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 4cf52f071d..c99a81f0f6 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -105,7 +105,7 @@ public final class LauncherInstrumentation { static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN"); static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP"); private final String mLauncherPackage; - private final boolean mIsLauncher3; + private Boolean mIsLauncher3; private long mTestStartTime = -1; // Types for launcher containers that the user is interacting with. "Background" is a @@ -206,7 +206,6 @@ public final class LauncherInstrumentation { public LauncherInstrumentation(Instrumentation instrumentation) { mInstrumentation = instrumentation; mDevice = UiDevice.getInstance(instrumentation); - mIsLauncher3 = "com.android.launcher3".equals(getLauncherPackageName()); // Launcher should run in test harness so that custom accessibility protocol between // Launcher and TAPL is enabled. In-process tests enable this protocol with a direct call @@ -1422,6 +1421,9 @@ public final class LauncherInstrumentation { } boolean isLauncher3() { + if (mIsLauncher3 == null) { + mIsLauncher3 = "com.android.launcher3".equals(getLauncherPackageName()); + } return mIsLauncher3; }