summaryrefslogtreecommitdiffstats
path: root/tests/tapl/com
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-05-23 00:50:08 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-05-23 14:02:33 -0700
commitab3963ddcf3c458d8aa669b89d9cf548f4b48b7e (patch)
tree8f30cdbe19114d4be97f9a84e26a874b24072609 /tests/tapl/com
parent571e51161cb1e4ab7685aca5b370fba73c5727e6 (diff)
downloadandroid_packages_apps_Trebuchet-ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e.tar.gz
android_packages_apps_Trebuchet-ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e.tar.bz2
android_packages_apps_Trebuchet-ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e.zip
Moving TestInformationProvider to Launcher3 so that it can be used for
testing Launcher3 without quickstep Also keeping the provider as disabled until needed Change-Id: Ib5f459e02ae551724b390f3b74f43d601568d749
Diffstat (limited to 'tests/tapl/com')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/AllApps.java2
-rw-r--r--tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java4
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Background.java4
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Home.java2
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Launchable.java2
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java35
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Overview.java2
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Workspace.java4
8 files changed, 41 insertions, 14 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index b2043cb5a..18a8f2755 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -27,7 +27,7 @@ import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;
import com.android.launcher3.ResourceUtils;
-import com.android.launcher3.TestProtocol;
+import com.android.launcher3.testing.TestProtocol;
/**
* Operations on AllApps opened from Home. Also a parent for All Apps opened from Overview.
diff --git a/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java b/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java
index a472d3134..f48d4dd4c 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllAppsFromOverview.java
@@ -16,14 +16,14 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
import android.graphics.Point;
import androidx.annotation.NonNull;
import androidx.test.uiautomator.UiObject2;
-import com.android.launcher3.TestProtocol;
+import com.android.launcher3.testing.TestProtocol;
/**
* Operations on AllApps opened from Overview.
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 55e14cc80..8627f485b 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -16,7 +16,7 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
import android.graphics.Point;
import android.os.SystemClock;
@@ -24,7 +24,7 @@ import android.view.MotionEvent;
import androidx.annotation.NonNull;
-import com.android.launcher3.TestProtocol;
+import com.android.launcher3.testing.TestProtocol;
/**
* Indicates the base state with a UI other than Overview running as foreground. It can also
diff --git a/tests/tapl/com/android/launcher3/tapl/Home.java b/tests/tapl/com/android/launcher3/tapl/Home.java
index 20c116ce2..cfc43749d 100644
--- a/tests/tapl/com/android/launcher3/tapl/Home.java
+++ b/tests/tapl/com/android/launcher3/tapl/Home.java
@@ -16,7 +16,7 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
import androidx.annotation.NonNull;
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index 3295ddbef..ee90d37b6 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -24,7 +24,7 @@ import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
-import com.android.launcher3.TestProtocol;
+import com.android.launcher3.testing.TestProtocol;
/**
* Ancestor for AppIcon and AppMenuItem.
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 7978c7928..8d69b3783 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -16,16 +16,23 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
-import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.DONT_KILL_APP;
+import static android.content.pm.PackageManager.MATCH_ALL;
+import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
+
+import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
import android.app.ActivityManager;
import android.app.Instrumentation;
import android.app.UiAutomation;
+import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
+import android.content.pm.ProviderInfo;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
@@ -53,7 +60,7 @@ import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
-import com.android.launcher3.TestProtocol;
+import com.android.launcher3.testing.TestProtocol;
import com.android.systemui.shared.system.QuickStepContract;
import org.junit.Assert;
@@ -149,9 +156,10 @@ public final class LauncherInstrumentation {
getLauncherPackageName() :
targetPackage;
+ String testProviderAuthority = authorityPackage + ".TestInfo";
mTestProviderUri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
- .authority(authorityPackage + ".TestInfo")
+ .authority(testProviderAuthority)
.build();
try {
@@ -160,6 +168,25 @@ public final class LauncherInstrumentation {
} catch (IOException e) {
fail(e.toString());
}
+
+
+ PackageManager pm = getContext().getPackageManager();
+ ProviderInfo pi = pm.resolveContentProvider(
+ testProviderAuthority, MATCH_ALL | MATCH_DISABLED_COMPONENTS);
+ ComponentName cn = new ComponentName(pi.packageName, pi.name);
+
+ if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) {
+ if (TestHelpers.isInLauncherProcess()) {
+ getContext().getPackageManager().setComponentEnabledSetting(
+ cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
+ } else {
+ try {
+ mDevice.executeShellCommand("pm enable " + cn.flattenToString());
+ } catch (IOException e) {
+ fail(e.toString());
+ }
+ }
+ }
}
Context getContext() {
diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java
index ec99d26c1..1aa957a17 100644
--- a/tests/tapl/com/android/launcher3/tapl/Overview.java
+++ b/tests/tapl/com/android/launcher3/tapl/Overview.java
@@ -16,7 +16,7 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL;
import androidx.annotation.NonNull;
import androidx.test.uiautomator.UiObject2;
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 10b253d44..7dcc426b9 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -16,7 +16,7 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL;
import static junit.framework.TestCase.assertTrue;
@@ -30,7 +30,7 @@ import androidx.annotation.Nullable;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;
-import com.android.launcher3.TestProtocol;
+import com.android.launcher3.testing.TestProtocol;
/**
* Operations on the workspace screen.