Merge "Removing flake when 2 long-press events happened on single long press" into ub-launcher3-master
This commit is contained in:
commit
bb150db0cd
|
@ -33,7 +33,6 @@ import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.dragndrop.DragController;
|
import com.android.launcher3.dragndrop.DragController;
|
||||||
import com.android.launcher3.dragndrop.DragOptions;
|
import com.android.launcher3.dragndrop.DragOptions;
|
||||||
import com.android.launcher3.folder.Folder;
|
import com.android.launcher3.folder.Folder;
|
||||||
import com.android.launcher3.testing.TestLogging;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle long-clicks on workspace items and start drag as a result.
|
* Class to handle long-clicks on workspace items and start drag as a result.
|
||||||
|
@ -47,7 +46,6 @@ public class ItemLongClickListener {
|
||||||
ItemLongClickListener::onAllAppsItemLongClick;
|
ItemLongClickListener::onAllAppsItemLongClick;
|
||||||
|
|
||||||
private static boolean onWorkspaceItemLongClick(View v) {
|
private static boolean onWorkspaceItemLongClick(View v) {
|
||||||
TestLogging.recordEvent("onWorkspaceItemLongClick");
|
|
||||||
Launcher launcher = Launcher.getLauncher(v.getContext());
|
Launcher launcher = Launcher.getLauncher(v.getContext());
|
||||||
if (!canStartDrag(launcher)) return false;
|
if (!canStartDrag(launcher)) return false;
|
||||||
if (!launcher.isInState(NORMAL) && !launcher.isInState(OVERVIEW)) return false;
|
if (!launcher.isInState(NORMAL) && !launcher.isInState(OVERVIEW)) return false;
|
||||||
|
@ -77,7 +75,6 @@ public class ItemLongClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean onAllAppsItemLongClick(View v) {
|
private static boolean onAllAppsItemLongClick(View v) {
|
||||||
TestLogging.recordEvent("onAllAppsItemLongClick");
|
|
||||||
Launcher launcher = Launcher.getLauncher(v.getContext());
|
Launcher launcher = Launcher.getLauncher(v.getContext());
|
||||||
if (!canStartDrag(launcher)) return false;
|
if (!canStartDrag(launcher)) return false;
|
||||||
// When we have exited all apps or are in transition, disregard long clicks
|
// When we have exited all apps or are in transition, disregard long clicks
|
||||||
|
|
|
@ -38,7 +38,6 @@ import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.Workspace;
|
import com.android.launcher3.Workspace;
|
||||||
import com.android.launcher3.dragndrop.DragLayer;
|
import com.android.launcher3.dragndrop.DragLayer;
|
||||||
import com.android.launcher3.testing.TestLogging;
|
|
||||||
import com.android.launcher3.views.OptionsPopupView;
|
import com.android.launcher3.views.OptionsPopupView;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
|
@ -166,7 +165,6 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLongPress(MotionEvent event) {
|
public void onLongPress(MotionEvent event) {
|
||||||
TestLogging.recordEvent("Workspace.longPress");
|
|
||||||
if (mLongPressState == STATE_REQUESTED) {
|
if (mLongPressState == STATE_REQUESTED) {
|
||||||
if (canHandleLongPress()) {
|
if (canHandleLongPress()) {
|
||||||
mLongPressState = STATE_PENDING_PARENT_INFORM;
|
mLongPressState = STATE_PENDING_PARENT_INFORM;
|
||||||
|
|
|
@ -35,7 +35,6 @@ import com.android.launcher3.R;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.dragndrop.DragOptions;
|
import com.android.launcher3.dragndrop.DragOptions;
|
||||||
import com.android.launcher3.popup.PopupDataProvider;
|
import com.android.launcher3.popup.PopupDataProvider;
|
||||||
import com.android.launcher3.testing.TestLogging;
|
|
||||||
import com.android.launcher3.touch.ItemLongClickListener;
|
import com.android.launcher3.touch.ItemLongClickListener;
|
||||||
import com.android.launcher3.uioverrides.WallpaperColorInfo;
|
import com.android.launcher3.uioverrides.WallpaperColorInfo;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
|
@ -91,7 +90,6 @@ abstract class BaseWidgetSheet extends AbstractSlideInView
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
TestLogging.recordEvent("Widgets.onLongClick");
|
|
||||||
if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
|
if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
|
||||||
|
|
||||||
if (v instanceof WidgetCell) {
|
if (v instanceof WidgetCell) {
|
||||||
|
|
|
@ -22,15 +22,11 @@ import androidx.test.uiautomator.By;
|
||||||
import androidx.test.uiautomator.BySelector;
|
import androidx.test.uiautomator.BySelector;
|
||||||
import androidx.test.uiautomator.UiObject2;
|
import androidx.test.uiautomator.UiObject2;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App icon, whether in all apps or in workspace/
|
* App icon, whether in all apps or in workspace/
|
||||||
*/
|
*/
|
||||||
public final class AppIcon extends Launchable {
|
public final class AppIcon extends Launchable {
|
||||||
|
|
||||||
private static final Pattern LONG_CLICK_EVENT = Pattern.compile("onAllAppsItemLongClick");
|
|
||||||
|
|
||||||
AppIcon(LauncherInstrumentation launcher, UiObject2 icon) {
|
AppIcon(LauncherInstrumentation launcher, UiObject2 icon) {
|
||||||
super(launcher, icon);
|
super(launcher, icon);
|
||||||
}
|
}
|
||||||
|
@ -47,11 +43,6 @@ public final class AppIcon extends Launchable {
|
||||||
mObject, "deep_shortcuts_container"));
|
mObject, "deep_shortcuts_container"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addExpectedEventsForLongClick() {
|
|
||||||
mLauncher.expectEvent(LONG_CLICK_EVENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getLongPressIndicator() {
|
protected String getLongPressIndicator() {
|
||||||
return "deep_shortcuts_container";
|
return "deep_shortcuts_container";
|
||||||
|
|
|
@ -33,10 +33,6 @@ public class AppIconMenuItem extends Launchable {
|
||||||
return mObject.getText();
|
return mObject.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addExpectedEventsForLongClick() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getLongPressIndicator() {
|
protected String getLongPressIndicator() {
|
||||||
return "drop_target_bar";
|
return "drop_target_bar";
|
||||||
|
|
|
@ -73,7 +73,6 @@ abstract class Launchable {
|
||||||
final Point launchableCenter = getObject().getVisibleCenter();
|
final Point launchableCenter = getObject().getVisibleCenter();
|
||||||
final Point displaySize = mLauncher.getRealDisplaySize();
|
final Point displaySize = mLauncher.getRealDisplaySize();
|
||||||
final int width = displaySize.x / 2;
|
final int width = displaySize.x / 2;
|
||||||
addExpectedEventsForLongClick();
|
|
||||||
Workspace.dragIconToWorkspace(
|
Workspace.dragIconToWorkspace(
|
||||||
mLauncher,
|
mLauncher,
|
||||||
this,
|
this,
|
||||||
|
@ -86,7 +85,5 @@ abstract class Launchable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void addExpectedEventsForLongClick();
|
|
||||||
|
|
||||||
protected abstract String getLongPressIndicator();
|
protected abstract String getLongPressIndicator();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,11 @@ package com.android.launcher3.tapl;
|
||||||
|
|
||||||
import androidx.test.uiautomator.UiObject2;
|
import androidx.test.uiautomator.UiObject2;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget in workspace or a widget list.
|
* Widget in workspace or a widget list.
|
||||||
*/
|
*/
|
||||||
public final class Widget extends Launchable {
|
public final class Widget extends Launchable {
|
||||||
|
|
||||||
private static final Pattern LONG_CLICK_EVENT = Pattern.compile("Widgets.onLongClick");
|
|
||||||
|
|
||||||
Widget(LauncherInstrumentation launcher, UiObject2 icon) {
|
Widget(LauncherInstrumentation launcher, UiObject2 icon) {
|
||||||
super(launcher, icon);
|
super(launcher, icon);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +31,4 @@ public final class Widget extends Launchable {
|
||||||
protected String getLongPressIndicator() {
|
protected String getLongPressIndicator() {
|
||||||
return "drop_target_bar";
|
return "drop_target_bar";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addExpectedEventsForLongClick() {
|
|
||||||
mLauncher.expectEvent(LONG_CLICK_EVENT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue