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

Commit 4f197550 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing flakiness of ShortcutsToHomeTest" into ub-launcher3-master

parents 584b9fa4 446bf009
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.launcher3.tapl;

import android.graphics.Point;
import android.view.MotionEvent;
import android.widget.TextView;

import androidx.test.uiautomator.By;
@@ -40,9 +41,10 @@ public final class AppIcon extends Launchable {
     */
    public AppIconMenu openMenu() {
        final Point iconCenter = mObject.getVisibleCenter();
        mLauncher.longTap(iconCenter.x, iconCenter.y);
        mLauncher.sendPointer(MotionEvent.ACTION_DOWN, iconCenter);
        final UiObject2 deepShortcutsContainer = mLauncher.waitForLauncherObject(
                "deep_shortcuts_container");
        mLauncher.sendPointer(MotionEvent.ACTION_UP, iconCenter);
        return new AppIconMenu(mLauncher, deepShortcutsContainer);
    }
}
+10 −5
Original line number Diff line number Diff line
@@ -21,10 +21,13 @@ import static com.android.systemui.shared.system.SettingsCompat.SWIPE_UP_SETTING
import android.app.ActivityManager;
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.accessibility.AccessibilityEvent;

@@ -403,11 +406,6 @@ public final class LauncherInstrumentation {
        return mDevice;
    }

    void longTap(int x, int y) {
        mDevice.drag(x, y, x, y, 0);
    }


    void swipe(int startX, int startY, int endX, int endY) {
        executeAndWaitForEvent(
                () -> mDevice.swipe(startX, startY, endX, endY, 60),
@@ -419,4 +417,11 @@ public final class LauncherInstrumentation {
    void waitForIdle() {
        mDevice.waitForIdle();
    }

    void sendPointer(int action, Point point) {
        final MotionEvent event = MotionEvent.obtain(SystemClock.uptimeMillis(),
                SystemClock.uptimeMillis(), action, point.x, point.y, 0);
        mInstrumentation.sendPointerSync(event);
        event.recycle();
    }
}
 No newline at end of file