Merge "Remove tracing for fixed bugs" into ub-launcher3-qt-dev
am: f57c62c091
Change-Id: I7cb4cb3345e8beb28e38dc6827c102f14cb27694
This commit is contained in:
@@ -111,14 +111,6 @@ public class TestInformationProvider extends ContentProvider {
|
||||
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance);
|
||||
break;
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_ENABLE_DRAG_LOGGING:
|
||||
TestProtocol.sDebugTracing = true;
|
||||
break;
|
||||
|
||||
case TestProtocol.REQUEST_DISABLE_DRAG_LOGGING:
|
||||
TestProtocol.sDebugTracing = false;
|
||||
break;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -33,20 +33,12 @@ public class CheckLongPressHelper {
|
||||
|
||||
class CheckForLongPress implements Runnable {
|
||||
public void run() {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"CheckForLongPress1");
|
||||
}
|
||||
if ((mView.getParent() != null) && mView.hasWindowFocus()
|
||||
&& !mHasPerformedLongPress) {
|
||||
boolean handled;
|
||||
if (mListener != null) {
|
||||
handled = mListener.onLongClick(mView);
|
||||
} else {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"CheckForLongPress2");
|
||||
}
|
||||
handled = mView.performLongClick();
|
||||
}
|
||||
if (handled) {
|
||||
@@ -81,21 +73,11 @@ public class CheckLongPressHelper {
|
||||
}
|
||||
mView.postDelayed(mPendingCheckForLongPress,
|
||||
(long) (ViewConfiguration.getLongPressTimeout() * mLongPressTimeoutFactor));
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"postCheckForLongPress: " + ViewConfiguration.getLongPressTimeout() + " "
|
||||
+ mLongPressTimeoutFactor);
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelLongPress() {
|
||||
mHasPerformedLongPress = false;
|
||||
if (mPendingCheckForLongPress != null) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"cancelLongPress @ " + android.util.Log.getStackTraceString(
|
||||
new Throwable()));
|
||||
}
|
||||
mView.removeCallbacks(mPendingCheckForLongPress);
|
||||
mPendingCheckForLongPress = null;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
synchronized (mLock) {
|
||||
Preconditions.assertUIThread();
|
||||
mCallbacks = new WeakReference<>(callbacks);
|
||||
android.util.Log.d("b/131170582", "mCallbacks = " + mCallbacks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +330,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
// Stop any existing loaders first, so they don't set mModelLoaded to true later
|
||||
stopLoader();
|
||||
mModelLoaded = false;
|
||||
android.util.Log.d("b/131170582", "1 mModelLoaded = " + mModelLoaded);
|
||||
}
|
||||
|
||||
// Start the loader if launcher is already running, otherwise the loader will run,
|
||||
@@ -392,7 +390,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
synchronized (mLock) {
|
||||
LoaderTask oldTask = mLoaderTask;
|
||||
mLoaderTask = null;
|
||||
android.util.Log.d("b/131170582", "1 mLoaderTask = " + mLoaderTask);
|
||||
if (oldTask != null) {
|
||||
oldTask.stopLocked();
|
||||
}
|
||||
@@ -403,7 +400,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
synchronized (mLock) {
|
||||
stopLoader();
|
||||
mLoaderTask = new LoaderTask(mApp, mBgAllAppsList, sBgDataModel, results);
|
||||
android.util.Log.d("b/131170582", "2 mLoaderTask = " + mLoaderTask);
|
||||
runOnWorkerThread(mLoaderTask);
|
||||
}
|
||||
}
|
||||
@@ -448,7 +444,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
mTask = task;
|
||||
mIsLoaderTaskRunning = true;
|
||||
mModelLoaded = false;
|
||||
android.util.Log.d("b/131170582", "2 mModelLoaded = " + mModelLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +451,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
synchronized (mLock) {
|
||||
// Everything loaded bind the data.
|
||||
mModelLoaded = true;
|
||||
android.util.Log.d("b/131170582", "3 mModelLoaded = " + mModelLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,7 +460,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
// If we are still the last one to be scheduled, remove ourselves.
|
||||
if (mLoaderTask == mTask) {
|
||||
mLoaderTask = null;
|
||||
android.util.Log.d("b/131170582", "3 mLoaderTask = " + mLoaderTask);
|
||||
}
|
||||
mIsLoaderTaskRunning = false;
|
||||
}
|
||||
|
||||
@@ -186,14 +186,4 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
|
||||
void onWindowVisibilityChanged(int visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLayout() {
|
||||
super.requestLayout();
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"requestLayout @ " + android.util.Log.getStackTraceString(
|
||||
new Throwable()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,9 +63,4 @@ public final class TestProtocol {
|
||||
"all-apps-to-overview-swipe-height";
|
||||
public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT =
|
||||
"home-to-all-apps-swipe-height";
|
||||
|
||||
public static boolean sDebugTracing = false;
|
||||
public static final String NO_DRAG_TAG = "b/129434166";
|
||||
public static final String REQUEST_ENABLE_DRAG_LOGGING = "enable-drag-logging";
|
||||
public static final String REQUEST_DISABLE_DRAG_LOGGING = "disable-drag-logging";
|
||||
}
|
||||
|
||||
@@ -1440,10 +1440,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
|
||||
public DragView beginDragShared(View child, DragSource source, ItemInfo dragObject,
|
||||
DragPreviewProvider previewProvider, DragOptions dragOptions) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"beginDragShared");
|
||||
}
|
||||
float iconScale = 1f;
|
||||
if (child instanceof BubbleTextView) {
|
||||
Drawable icon = ((BubbleTextView) child).getIcon();
|
||||
|
||||
@@ -219,9 +219,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
}
|
||||
|
||||
private void callOnDragStart() {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, "callOnDragStart");
|
||||
}
|
||||
if (mOptions.preDragCondition != null) {
|
||||
mOptions.preDragCondition.onPreDragEnd(mDragObject, true /* dragStarted*/);
|
||||
}
|
||||
@@ -475,9 +472,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
}
|
||||
|
||||
private void handleMoveEvent(int x, int y) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG, "handleMoveEvent1");
|
||||
}
|
||||
mDragObject.dragView.move(x, y);
|
||||
|
||||
// Drop on someone?
|
||||
@@ -494,10 +488,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
|
||||
if (mIsInPreDrag && mOptions.preDragCondition != null
|
||||
&& mOptions.preDragCondition.shouldStartDrag(mDistanceSinceScroll)) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"handleMoveEvent2");
|
||||
}
|
||||
callOnDragStart();
|
||||
}
|
||||
}
|
||||
@@ -535,10 +525,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
* Call this from a drag source view.
|
||||
*/
|
||||
public boolean onControllerTouchEvent(MotionEvent ev) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"onControllerTouchEvent1");
|
||||
}
|
||||
if (mDragDriver == null || mOptions == null || mOptions.isAccessibleDrag) {
|
||||
return false;
|
||||
}
|
||||
@@ -559,10 +545,6 @@ public class DragController implements DragDriver.EventListener, TouchController
|
||||
break;
|
||||
}
|
||||
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"onControllerTouchEvent2");
|
||||
}
|
||||
return mDragDriver.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,18 +45,10 @@ public abstract class DragDriver {
|
||||
public void onDragViewAnimationEnd() { }
|
||||
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"onTouchEvent " + ev);
|
||||
}
|
||||
final int action = ev.getAction();
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"onTouchEvent MOVE");
|
||||
}
|
||||
mEventListener.onDriverDragMove(ev.getX(), ev.getY());
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
|
||||
@@ -126,10 +126,6 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
protected boolean findActiveController(MotionEvent ev) {
|
||||
if (mActivity.getStateManager().getState().disableInteraction) {
|
||||
// You Shall Not Pass!!!
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"mActiveController = null");
|
||||
}
|
||||
mActiveController = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -190,10 +190,6 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource,
|
||||
* @return the container if shown or null.
|
||||
*/
|
||||
public static PopupContainerWithArrow showForIcon(BubbleTextView icon) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"PopupContainerWithArrow.showForIcon");
|
||||
}
|
||||
Launcher launcher = Launcher.getLauncher(icon.getContext());
|
||||
if (getOpen(launcher) != null) {
|
||||
// There is already an items container open, so don't open this one.
|
||||
|
||||
@@ -233,11 +233,6 @@ public abstract class AbstractStateChangeTouchController
|
||||
|
||||
@Override
|
||||
public void onDragStart(boolean start) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"AbstractStateChangeTouchController.onDragStart() called with: start = [" +
|
||||
start + "]");
|
||||
}
|
||||
mStartState = mLauncher.getStateManager().getState();
|
||||
if (mStartState == ALL_APPS) {
|
||||
mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS;
|
||||
@@ -269,11 +264,6 @@ public abstract class AbstractStateChangeTouchController
|
||||
public boolean onDrag(float displacement) {
|
||||
float deltaProgress = mProgressMultiplier * (displacement - mDisplacementShift);
|
||||
float progress = deltaProgress + mStartProgress;
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"AbstractStateChangeTouchController.onDrag() called with: displacement = [" +
|
||||
displacement + "], progress = [" + progress + "]");
|
||||
}
|
||||
updateProgress(progress);
|
||||
boolean isDragTowardPositive = mSwipeDirection.isPositive(
|
||||
displacement - mDisplacementShift);
|
||||
@@ -393,12 +383,6 @@ public abstract class AbstractStateChangeTouchController
|
||||
? MIN_PROGRESS_TO_ALL_APPS : SUCCESS_TRANSITION_PROGRESS;
|
||||
targetState = (interpolatedProgress > successProgress) ? mToState : mFromState;
|
||||
}
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"AbstractStateChangeTouchController.onDragEnd() called with: velocity = [" +
|
||||
velocity + "], fling = [" + fling + "], target state: " +
|
||||
targetState.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
final float endProgress;
|
||||
final float startProgress;
|
||||
|
||||
@@ -66,14 +66,6 @@ public class ItemClickHandler {
|
||||
}
|
||||
|
||||
private static void onClick(View v, String sourceContainer) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"onClick() called with: v = [" + v.getClass().getSimpleName() +
|
||||
"], sourceContainer = [" +
|
||||
(sourceContainer != null ?
|
||||
sourceContainer.getClass().getSimpleName() : "null")
|
||||
+ "]");
|
||||
}
|
||||
// Make sure that rogue clicks don't get through while allapps is launching, or after the
|
||||
// view has detached (it's possible for this to happen if the view is removed mid touch).
|
||||
if (v.getWindowToken() == null) {
|
||||
|
||||
@@ -74,10 +74,6 @@ public class ItemLongClickListener {
|
||||
}
|
||||
|
||||
private static boolean onAllAppsItemLongClick(View v) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"onAllAppsItemLongClick");
|
||||
}
|
||||
Launcher launcher = Launcher.getLauncher(v.getContext());
|
||||
if (!canStartDrag(launcher)) return false;
|
||||
// When we have exited all apps or are in transition, disregard long clicks
|
||||
|
||||
@@ -148,23 +148,13 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
|
||||
}
|
||||
|
||||
protected boolean findActiveController(MotionEvent ev) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"mActiveController = null");
|
||||
}
|
||||
mActiveController = null;
|
||||
if ((mTouchDispatchState & (TOUCH_DISPATCHING_GESTURE | TOUCH_DISPATCHING_PROXY)) == 0) {
|
||||
// Only look for controllers if we are not dispatching from gesture area and proxy is
|
||||
// not active
|
||||
mActiveController = findControllerToHandleTouch(ev);
|
||||
|
||||
if (mActiveController != null) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"setting controller1: " + mActiveController.getClass().getSimpleName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (mActiveController != null) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -231,17 +221,8 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
|
||||
}
|
||||
|
||||
if (mActiveController != null) {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"BaseDragLayer before onControllerTouchEvent " +
|
||||
mActiveController.getClass().getSimpleName());
|
||||
}
|
||||
return mActiveController.onControllerTouchEvent(ev);
|
||||
} else {
|
||||
if (com.android.launcher3.TestProtocol.sDebugTracing) {
|
||||
android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
|
||||
"BaseDragLayer no controller");
|
||||
}
|
||||
// In case no child view handled the touch event, we may not get onIntercept anymore
|
||||
return findActiveController(ev);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import androidx.test.uiautomator.UiDevice;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.TestProtocol;
|
||||
import com.android.launcher3.popup.ArrowPopup;
|
||||
import com.android.launcher3.tapl.AllApps;
|
||||
import com.android.launcher3.tapl.AppIcon;
|
||||
@@ -323,24 +322,19 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testDragAppIcon() throws Throwable {
|
||||
try {
|
||||
TestProtocol.sDebugTracing = true;
|
||||
// 1. Open all apps and wait for load complete.
|
||||
// 2. Drag icon to homescreen.
|
||||
// 3. Verify that the icon works on homescreen.
|
||||
mLauncher.getWorkspace().
|
||||
switchToAllApps().
|
||||
getAppIcon(APP_NAME).
|
||||
dragToWorkspace().
|
||||
getWorkspaceAppIcon(APP_NAME).
|
||||
launch(getAppPackageName());
|
||||
executeOnLauncher(launcher -> assertTrue(
|
||||
"Launcher activity is the top activity; expecting another activity to be the "
|
||||
+ "top one",
|
||||
isInBackground(launcher)));
|
||||
} finally {
|
||||
TestProtocol.sDebugTracing = false;
|
||||
}
|
||||
// 1. Open all apps and wait for load complete.
|
||||
// 2. Drag icon to homescreen.
|
||||
// 3. Verify that the icon works on homescreen.
|
||||
mLauncher.getWorkspace().
|
||||
switchToAllApps().
|
||||
getAppIcon(APP_NAME).
|
||||
dragToWorkspace().
|
||||
getWorkspaceAppIcon(APP_NAME).
|
||||
launch(getAppPackageName());
|
||||
executeOnLauncher(launcher -> assertTrue(
|
||||
"Launcher activity is the top activity; expecting another activity to be the top "
|
||||
+ "one",
|
||||
isInBackground(launcher)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -143,7 +143,6 @@ public final class Workspace extends Home {
|
||||
static void dragIconToWorkspace(
|
||||
LauncherInstrumentation launcher, Launchable launchable, Point dest,
|
||||
String longPressIndicator) {
|
||||
launcher.getTestInfo(TestProtocol.REQUEST_ENABLE_DRAG_LOGGING);
|
||||
LauncherInstrumentation.log("dragIconToWorkspace: begin");
|
||||
final Point launchableCenter = launchable.getObject().getVisibleCenter();
|
||||
final long downTime = SystemClock.uptimeMillis();
|
||||
@@ -157,7 +156,6 @@ public final class Workspace extends Home {
|
||||
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);
|
||||
LauncherInstrumentation.log("dragIconToWorkspace: end");
|
||||
launcher.waitUntilGone("drop_target_bar");
|
||||
launcher.getTestInfo(TestProtocol.REQUEST_DISABLE_DRAG_LOGGING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user