From 89d9423321bf7bda7dccb94622c7ce034d5b4286 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 1 Sep 2021 12:33:00 -0700 Subject: [PATCH] Logging for drop bar not appearing for dragged widget Test: presubmit Bug: 195031154 Change-Id: I19494fc3d6d9db252570697c057fdee7f7d44521 --- src/com/android/launcher3/DropTargetBar.java | 18 ++++++++++++++++++ .../launcher3/dragndrop/DragController.java | 8 ++++++++ .../dragndrop/LauncherDragController.java | 5 +++++ .../launcher3/testing/TestProtocol.java | 1 + .../launcher3/widget/BaseWidgetSheet.java | 7 +++++++ .../widget/PendingItemDragHelper.java | 5 +++++ 6 files changed, 44 insertions(+) diff --git a/src/com/android/launcher3/DropTargetBar.java b/src/com/android/launcher3/DropTargetBar.java index 88f6c498aa..eb42a652f9 100644 --- a/src/com/android/launcher3/DropTargetBar.java +++ b/src/com/android/launcher3/DropTargetBar.java @@ -25,6 +25,7 @@ import android.animation.TimeInterpolator; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; +import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.View; @@ -32,10 +33,13 @@ import android.view.ViewDebug; import android.view.ViewPropertyAnimator; import android.widget.FrameLayout; +import androidx.annotation.NonNull; + import com.android.launcher3.anim.Interpolators; import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragController.DragListener; import com.android.launcher3.dragndrop.DragOptions; +import com.android.launcher3.testing.TestProtocol; /* * The top bar containing various drop targets: Delete/App Info/Uninstall. @@ -212,6 +216,9 @@ public class DropTargetBar extends FrameLayout } public void animateToVisibility(boolean isVisible) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "8"); + } if (mVisible != isVisible) { mVisible = isVisible; @@ -238,6 +245,9 @@ public class DropTargetBar extends FrameLayout */ @Override public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "7"); + } animateToVisibility(true); } @@ -261,4 +271,12 @@ public class DropTargetBar extends FrameLayout public ButtonDropTarget[] getDropTargets() { return mDropTargets; } + + @Override + protected void onVisibilityChanged(@NonNull View changedView, int visibility) { + super.onVisibilityChanged(changedView, visibility); + if (TestProtocol.sDebugTracing && visibility == VISIBLE) { + Log.d(TestProtocol.NO_DROP_TARGET, "9"); + } + } } diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index 1e0edacfe8..fdb27998de 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -22,6 +22,7 @@ import android.content.ComponentName; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.util.Log; import android.view.DragEvent; import android.view.KeyEvent; import android.view.MotionEvent; @@ -34,6 +35,7 @@ import com.android.launcher3.DropTarget; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.ActivityContext; @@ -146,6 +148,9 @@ public abstract class DragController float initialDragViewScale, float dragViewScaleOnDrop, DragOptions options) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "4"); + } return startDrag(drawable, /* view= */ null, originalView, dragLayerX, dragLayerY, source, dragInfo, dragOffset, dragRegion, initialDragViewScale, dragViewScaleOnDrop, options); @@ -203,6 +208,9 @@ public abstract class DragController DragOptions options); protected void callOnDragStart() { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "6"); + } if (mOptions.preDragCondition != null) { mOptions.preDragCondition.onPreDragEnd(mDragObject, true /* dragStarted*/); } diff --git a/src/com/android/launcher3/dragndrop/LauncherDragController.java b/src/com/android/launcher3/dragndrop/LauncherDragController.java index 0e8b0a5ba6..dcbfa502e6 100644 --- a/src/com/android/launcher3/dragndrop/LauncherDragController.java +++ b/src/com/android/launcher3/dragndrop/LauncherDragController.java @@ -24,6 +24,7 @@ import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.View; @@ -36,6 +37,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.accessibility.DragViewStateAnnouncer; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.testing.TestProtocol; /** * Drag controller for Launcher activity @@ -65,6 +67,9 @@ public class LauncherDragController extends DragController { float initialDragViewScale, float dragViewScaleOnDrop, DragOptions options) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "5"); + } if (PROFILE_DRAWING_DURING_DRAG) { android.os.Debug.startMethodTracing("Launcher"); } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index c4848112ef..aaa39befcb 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -120,4 +120,5 @@ public final class TestProtocol { public static final String THIRD_PARTY_LAUNCHER_NOT_SET = "b/187080582"; public static final String TASK_VIEW_ID_CRASH = "b/195430732"; public static final String L3_SWIPE_TO_HOME = "b/192018189"; + public static final String NO_DROP_TARGET = "b/195031154"; } diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java index b6cec1295e..00a0050e17 100644 --- a/src/com/android/launcher3/widget/BaseWidgetSheet.java +++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java @@ -19,6 +19,7 @@ import android.content.Context; import android.graphics.Point; import android.graphics.Rect; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; @@ -108,6 +109,9 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView @Override public boolean onLongClick(View v) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "1"); + } TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Widgets.onLongClick"); v.cancelLongPress(); if (!ItemLongClickListener.canStartDrag(mActivityContext)) return false; @@ -178,6 +182,9 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView } private boolean beginDraggingWidget(WidgetCell v) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "2"); + } // Get the widget preview as the drag representation WidgetImageView image = v.getWidgetView(); diff --git a/src/com/android/launcher3/widget/PendingItemDragHelper.java b/src/com/android/launcher3/widget/PendingItemDragHelper.java index 2347d28f21..463f4ac1b1 100644 --- a/src/com/android/launcher3/widget/PendingItemDragHelper.java +++ b/src/com/android/launcher3/widget/PendingItemDragHelper.java @@ -22,6 +22,7 @@ import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.util.Log; import android.util.Size; import android.view.View; import android.view.View.MeasureSpec; @@ -41,6 +42,7 @@ import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.icons.FastBitmapDrawable; import com.android.launcher3.icons.LauncherIcons; import com.android.launcher3.icons.RoundDrawableWrapper; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener; import com.android.launcher3.widget.util.WidgetSizes; @@ -94,6 +96,9 @@ public class PendingItemDragHelper extends DragPreviewProvider { */ public void startDrag(Rect previewBounds, int previewBitmapWidth, int previewViewWidth, Point screenPos, DragSource source, DragOptions options) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_DROP_TARGET, "3"); + } final Launcher launcher = Launcher.getLauncher(mView.getContext()); LauncherAppState app = LauncherAppState.getInstance(launcher);