Loading src/com/android/launcher3/Utilities.java +5 −1 Original line number Diff line number Diff line Loading @@ -136,9 +136,13 @@ public final class Utilities { CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); public static final boolean IS_RUNNING_IN_TEST_HARNESS = public static boolean IS_RUNNING_IN_TEST_HARNESS = ActivityManager.isRunningInTestHarness(); public static void enableRunningInTestHarnessForTests() { IS_RUNNING_IN_TEST_HARNESS = true; } public static boolean isPropertyEnabled(String propertyName) { return Log.isLoggable(propertyName, Log.VERBOSE); } Loading tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.tapl.LauncherInstrumentation; Loading Loading @@ -101,6 +102,7 @@ public abstract class AbstractLauncherUiTest { } catch (RemoteException e) { throw new RuntimeException(e); } if (TestHelpers.isInLauncherProcess()) Utilities.enableRunningInTestHarnessForTests(); mLauncher = new LauncherInstrumentation(instrumentation); } Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +9 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,15 @@ public final class LauncherInstrumentation { instrumentation.getTargetContext().getContentResolver(), SWIPE_UP_SETTING_NAME, swipeUpEnabledDefault ? 1 : 0) == 1; assertTrue("Device must run in a test harness", ActivityManager.isRunningInTestHarness()); // 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 // into Launcher. final boolean isInLauncherProcess = instrumentation.getTargetContext().getPackageName().equals( UiDevice.getInstance(instrumentation).getLauncherPackageName()); assertTrue("Device must run in a test harness", isInLauncherProcess || ActivityManager.isRunningInTestHarness()); } // Used only by TaplTests. Loading Loading
src/com/android/launcher3/Utilities.java +5 −1 Original line number Diff line number Diff line Loading @@ -136,9 +136,13 @@ public final class Utilities { CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); public static final boolean IS_RUNNING_IN_TEST_HARNESS = public static boolean IS_RUNNING_IN_TEST_HARNESS = ActivityManager.isRunningInTestHarness(); public static void enableRunningInTestHarnessForTests() { IS_RUNNING_IN_TEST_HARNESS = true; } public static boolean isPropertyEnabled(String propertyName) { return Log.isLoggable(propertyName, Log.VERBOSE); } Loading
tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherState; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.tapl.LauncherInstrumentation; Loading Loading @@ -101,6 +102,7 @@ public abstract class AbstractLauncherUiTest { } catch (RemoteException e) { throw new RuntimeException(e); } if (TestHelpers.isInLauncherProcess()) Utilities.enableRunningInTestHarnessForTests(); mLauncher = new LauncherInstrumentation(instrumentation); } Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +9 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,15 @@ public final class LauncherInstrumentation { instrumentation.getTargetContext().getContentResolver(), SWIPE_UP_SETTING_NAME, swipeUpEnabledDefault ? 1 : 0) == 1; assertTrue("Device must run in a test harness", ActivityManager.isRunningInTestHarness()); // 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 // into Launcher. final boolean isInLauncherProcess = instrumentation.getTargetContext().getPackageName().equals( UiDevice.getInstance(instrumentation).getLauncherPackageName()); assertTrue("Device must run in a test harness", isInLauncherProcess || ActivityManager.isRunningInTestHarness()); } // Used only by TaplTests. Loading