Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4014d117 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Fixing AOSP tests using TAPL" into ub-launcher3-master

parents d7f9990a 263fb0d7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
    @NonNull
    public AppIcon getAppIcon(String appName) {
        final UiObject2 allAppsContainer = verifyActiveContainer();
        final BySelector appIconSelector = AppIcon.getAppIconSelector(appName);
        final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher);
        if (!allAppsContainer.hasObject(appIconSelector)) {
            scrollBackToBeginning();
            int attempts = 0;
+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ public final class AppIcon extends Launchable {
        super(launcher, icon);
    }

    static BySelector getAppIconSelector(String appName) {
        return By.clazz(TextView.class).text(appName).pkg(LauncherInstrumentation.LAUNCHER_PKG);
    static BySelector getAppIconSelector(String appName, LauncherInstrumentation launcher) {
        return By.clazz(TextView.class).text(appName).pkg(launcher.mLauncherPackageName);
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -16,13 +16,13 @@

package com.android.launcher3.tapl;

import java.util.Collections;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;

import java.util.Collections;
import java.util.List;

/**
 * Common overview pane for both Launcher and fallback recents
 */
@@ -69,7 +69,7 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
    public OverviewTask getCurrentTask() {
        verifyActiveContainer();
        final List<UiObject2> taskViews = mLauncher.getDevice().findObjects(
                LauncherInstrumentation.getLauncherObjectSelector("snapshot"));
                mLauncher.getLauncherObjectSelector("snapshot"));
        LauncherInstrumentation.assertNotEquals("Unable to find a task", 0, taskViews.size());

        // taskViews contains up to 3 task views: the 'main' (having the widest visible
+4 −3
Original line number Diff line number Diff line
@@ -83,13 +83,13 @@ public final class LauncherInstrumentation {
    private static final String APPS_RES_ID = "apps_view";
    private static final String OVERVIEW_RES_ID = "overview_panel";
    private static final String WIDGETS_RES_ID = "widgets_list_view";
    static final String LAUNCHER_PKG = "com.google.android.apps.nexuslauncher";
    public static final int WAIT_TIME_MS = 60000;
    private static final String SYSTEMUI_PACKAGE = "com.android.systemui";

    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,6 +101,7 @@ public final class LauncherInstrumentation {
    public LauncherInstrumentation(Instrumentation instrumentation) {
        mInstrumentation = instrumentation;
        mDevice = UiDevice.getInstance(instrumentation);
        mLauncherPackageName = mDevice.getLauncherPackageName();
        final boolean swipeUpEnabledDefault =
                !SwipeUpSetting.isSwipeUpSettingAvailable() ||
                        SwipeUpSetting.isSwipeUpEnabledDefaultValue();
@@ -385,8 +386,8 @@ public final class LauncherInstrumentation {
        return object;
    }

    static BySelector getLauncherObjectSelector(String resName) {
        return By.res(LAUNCHER_PKG, resName);
    BySelector getLauncherObjectSelector(String resName) {
        return By.res(mLauncherPackageName, resName);
    }

    @NonNull
+3 −3
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public final class Workspace extends Home {
    @Nullable
    public AppIcon tryGetWorkspaceAppIcon(String appName) {
        final UiObject2 workspace = verifyActiveContainer();
        final UiObject2 icon = workspace.findObject(AppIcon.getAppIconSelector(appName));
        final UiObject2 icon = workspace.findObject(AppIcon.getAppIconSelector(appName, mLauncher));
        return icon != null ? new AppIcon(mLauncher, icon) : null;
    }

@@ -85,7 +85,7 @@ public final class Workspace extends Home {
        return new AppIcon(mLauncher,
                mLauncher.getObjectInContainer(
                        verifyActiveContainer(),
                        AppIcon.getAppIconSelector(appName)));
                        AppIcon.getAppIconSelector(appName, mLauncher)));
    }

    /**
@@ -108,7 +108,7 @@ public final class Workspace extends Home {
    @NonNull
    private AppIcon getHotseatAppIcon(String appName) {
        return new AppIcon(mLauncher, mLauncher.getObjectInContainer(
                mHotseat, AppIcon.getAppIconSelector(appName)));
                mHotseat, AppIcon.getAppIconSelector(appName, mLauncher)));
    }

    private void dragIconToNextScreen(AppIcon app, UiObject2 workspace) {