mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Fix a couple of drag and drop issues from transient taskbar
- Don't stash until drag ends, but immediately stash at that point (regardless of success or failure, though failure will animate to the original icon before stashing) - Send transient taskbar's bounds to WM Shell via intent extra such that they ignore drag events in that region Test: manual in persistent and transient taskbar Bug: 269814838 Fixes: 268526633 Fixes: 259645384 Change-Id: I5ded3998046f259ed6e79cb4ed765ad7b0c72e45
This commit is contained in:
@@ -33,6 +33,7 @@ import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Pair;
|
||||
@@ -69,11 +70,13 @@ import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.quickstep.util.LogUtils;
|
||||
import com.android.quickstep.util.MultiValueUpdateListener;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.wm.shell.draganddrop.DragAndDropConstants;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
@@ -310,9 +313,6 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
if (mDisallowGlobalDrag) {
|
||||
AbstractFloatingView.closeAllOpenViewsExcept(mActivity, TYPE_TASKBAR_ALL_APPS);
|
||||
} else {
|
||||
// stash the transient taskbar
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
|
||||
AbstractFloatingView.closeAllOpenViews(mActivity);
|
||||
}
|
||||
|
||||
@@ -395,6 +395,15 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
com.android.launcher3.logging.InstanceId launcherInstanceId = instanceIds.second;
|
||||
|
||||
intent.putExtra(ClipDescription.EXTRA_LOGGING_INSTANCE_ID, internalInstanceId);
|
||||
if (DisplayController.isTransientTaskbar(mActivity)) {
|
||||
// Tell WM Shell to ignore drag events in the provided transient taskbar region.
|
||||
TaskbarDragLayer dragLayer = mControllers.taskbarActivityContext.getDragLayer();
|
||||
int[] locationOnScreen = dragLayer.getLocationOnScreen();
|
||||
RectF disallowExternalDropRegion = new RectF(dragLayer.getLastDrawnTransientRect());
|
||||
disallowExternalDropRegion.offset(locationOnScreen[0], locationOnScreen[1]);
|
||||
intent.putExtra(DragAndDropConstants.EXTRA_DISALLOW_HIT_REGION,
|
||||
disallowExternalDropRegion);
|
||||
}
|
||||
|
||||
ClipData clipData = new ClipData(clipDescription, new ClipData.Item(intent));
|
||||
if (btv.startDragAndDrop(clipData, shadowBuilder, null /* localState */,
|
||||
@@ -421,9 +430,6 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
if (dragEvent.getResult()) {
|
||||
maybeOnDragEnd();
|
||||
} else {
|
||||
// un-stash the transient taskbar in case drag and drop was canceled
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(false);
|
||||
|
||||
// This will take care of calling maybeOnDragEnd() after the animation
|
||||
animateGlobalDragViewToOriginalPosition(btv, dragEvent);
|
||||
}
|
||||
@@ -451,6 +457,9 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
mControllers.taskbarAutohideSuspendController.updateFlag(
|
||||
TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING, false);
|
||||
mActivity.onDragEnd();
|
||||
// Note, this must be done last to ensure no AutohideSuspendFlags are active, as that
|
||||
// will prevent us from stashing until the timeout.
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user