summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-10-11 13:41:08 -0700
committerSunny Goyal <sunnygoyal@google.com>2018-10-11 13:41:27 -0700
commit897931a56aa8e732f0f26a04decb6fc963cc78bf (patch)
treef25562e5ab0bfb1dee89ec0441ca9a9810713e8b /tests
parent4548a7d48d431aa960bf81494351662a4146ceac (diff)
downloadandroid_packages_apps_Trebuchet-897931a56aa8e732f0f26a04decb6fc963cc78bf.tar.gz
android_packages_apps_Trebuchet-897931a56aa8e732f0f26a04decb6fc963cc78bf.tar.bz2
android_packages_apps_Trebuchet-897931a56aa8e732f0f26a04decb6fc963cc78bf.zip
Fixing overview package name chech in TAPL
Bug: 117568664 Change-Id: Icac29b4c2c600b90aa21d6db0a7a81403eb3c785
Diffstat (limited to 'tests')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Background.java8
-rw-r--r--tests/tapl/com/android/launcher3/tapl/BaseOverview.java2
-rw-r--r--tests/tapl/com/android/launcher3/tapl/TestHelpers.java11
3 files changed, 14 insertions, 7 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 26295c8ca..27e095424 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -17,11 +17,10 @@
package com.android.launcher3.tapl;
import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
+import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
import static org.junit.Assert.assertTrue;
-import static androidx.test.InstrumentationRegistry.getTargetContext;
-
import androidx.annotation.NonNull;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
@@ -52,9 +51,8 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
public BaseOverview switchToOverview() {
verifyActiveContainer();
goToOverviewUnchecked();
- assertTrue("Overview not visible", mLauncher.getDevice().wait(Until.hasObject(By.pkg(
- getTargetContext().getPackageName())),
- WAIT_TIME_MS));
+ assertTrue("Overview not visible", mLauncher.getDevice().wait(
+ Until.hasObject(By.pkg(getOverviewPackageName())), WAIT_TIME_MS));
return new BaseOverview(mLauncher);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 87d0a7977..4fce21126 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -16,8 +16,6 @@
package com.android.launcher3.tapl;
-import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType;
-
import java.util.Collections;
import java.util.List;
diff --git a/tests/tapl/com/android/launcher3/tapl/TestHelpers.java b/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
index c393cdf3d..93554d245 100644
--- a/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
+++ b/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
@@ -20,10 +20,12 @@ import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.InstrumentationRegistry.getTargetContext;
import android.app.Instrumentation;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
import java.util.List;
@@ -70,4 +72,13 @@ public class TestHelpers {
}
return launchers.get(0).activityInfo;
}
+
+ public static String getOverviewPackageName() {
+ Resources res = Resources.getSystem();
+ int id = res.getIdentifier("config_recentsComponentName", "string", "android");
+ if (id != 0) {
+ return ComponentName.unflattenFromString(res.getString(id)).getPackageName();
+ }
+ return "com.android.systemui";
+ }
}