Merge "Not precalculating launcher package in Tapl" into ub-launcher3-master
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
index 7582d53..3ffd30c 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
@@ -32,7 +32,7 @@
}
static BySelector getAppIconSelector(String appName, LauncherInstrumentation launcher) {
- return By.clazz(TextView.class).text(appName).pkg(launcher.mLauncherPackageName);
+ return By.clazz(TextView.class).text(appName).pkg(launcher.getLauncherPackageName());
}
/**
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 7070555..bb399d5 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -89,7 +89,6 @@
private static WeakReference<VisibleContainer> sActiveContainer = new WeakReference<>(null);
private final UiDevice mDevice;
- final String mLauncherPackageName;
private final boolean mSwipeUpEnabled;
private Boolean mSwipeUpEnabledOverride = null;
private final Instrumentation mInstrumentation;
@@ -101,7 +100,6 @@
public LauncherInstrumentation(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
mDevice = UiDevice.getInstance(instrumentation);
- mLauncherPackageName = mDevice.getLauncherPackageName();
final boolean swipeUpEnabledDefault =
!SwipeUpSetting.isSwipeUpSettingAvailable() ||
SwipeUpSetting.isSwipeUpEnabledDefaultValue();
@@ -382,13 +380,16 @@
UiObject2 waitForLauncherObject(String resName) {
final BySelector selector = getLauncherObjectSelector(resName);
final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS);
- assertNotNull("Can't find a launcher object; selector: " + selector + ", current launcher: "
- + mDevice.getLauncherPackageName(), object);
+ assertNotNull("Can't find a launcher object; selector: " + selector, object);
return object;
}
BySelector getLauncherObjectSelector(String resName) {
- return By.res(mLauncherPackageName, resName);
+ return By.res(getLauncherPackageName(), resName);
+ }
+
+ String getLauncherPackageName() {
+ return mDevice.getLauncherPackageName();
}
@NonNull