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

Commit d201414c authored by Mykola Podolian's avatar Mykola Podolian Committed by Android (Google) Code Review
Browse files

Merge "Disables bubble drop targets for notification drag" into main

parents b3bf1f38 5bb6a95c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -29,4 +29,11 @@ public class DragAndDropConstants {
     * An Intent extra that Launcher can use to specify the {@link android.content.pm.ShortcutInfo}
     */
    public static final String EXTRA_SHORTCUT_INFO = "EXTRA_SHORTCUT_INFO";

    //TODO(b/440373358) : remove once we properly handle dragging from notification
    /**
     * An Intent extra that Notification can use to specify that the drag was originated from the
     * notification.
     */
    public static final String IS_FROM_NOTIFICATION = "IS_FROM_NOTIFICATION";
}
+7 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static com.android.wm.shell.draganddrop.SplitDragPolicy.Target.TYPE_SPLIT
import static com.android.wm.shell.draganddrop.SplitDragPolicy.Target.TYPE_SPLIT_LEFT;
import static com.android.wm.shell.draganddrop.SplitDragPolicy.Target.TYPE_SPLIT_RIGHT;
import static com.android.wm.shell.draganddrop.SplitDragPolicy.Target.TYPE_SPLIT_TOP;
import static com.android.wm.shell.shared.draganddrop.DragAndDropConstants.IS_FROM_NOTIFICATION;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;

@@ -124,6 +125,7 @@ public class DragLayout extends LinearLayout

    private boolean mIsShowing;
    private boolean mHasDropped;
    private boolean mAllowBubbleTarget;
    private DragSession mSession;
    // The last position that was handled by the drag layout
    private final Point mLastPosition = new Point();
@@ -340,7 +342,8 @@ public class DragLayout extends LinearLayout
        mSession = session;
        mHasDropped = false;
        mCurrentTarget = null;

        mAllowBubbleTarget = mSession.appData == null
                || !mSession.appData.getBooleanExtra(IS_FROM_NOTIFICATION, false);
        boolean alreadyInSplit = mSplitScreenController != null
                && mSplitScreenController.isSplitScreenVisible();
        if (!alreadyInSplit) {
@@ -549,7 +552,7 @@ public class DragLayout extends LinearLayout
            return;
        }
        // if event is over the bubble don't let split handle it
        if (interceptBubbleBarEvent(x, y)) {
        if (mAllowBubbleTarget && interceptBubbleBarEvent(x, y)) {
            mLastPosition.set(x, y);
            return;
        }
@@ -663,7 +666,8 @@ public class DragLayout extends LinearLayout
        // Process the drop exclusive by DropTarget OR by the BubbleBar
        if (mCurrentTarget != null) {
            mPolicy.onDropped(mCurrentTarget, hideTaskToken);
        } else if (appData != null
        } else if (mAllowBubbleTarget
                && appData != null
                && mIsOverBubblesDropZone
                && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            handleDropOnBubbleBar(appData, Objects.requireNonNull(mDragToBubbleController));
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.systemui.statusbar.notification.row;

import static android.widget.Toast.LENGTH_SHORT;

import static com.android.wm.shell.shared.draganddrop.DragAndDropConstants.IS_FROM_NOTIFICATION;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
@@ -52,8 +54,8 @@ import com.android.systemui.res.R;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeDisplayAware;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger;
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager;
import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger;
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi;

import javax.inject.Inject;
@@ -138,6 +140,7 @@ public class ExpandableNotificationRowDragController {
        ClipData.Item item = new ClipData.Item(dragIntent);
        InstanceId instanceId = new InstanceIdSequence(Integer.MAX_VALUE).newInstanceId();
        item.getIntent().putExtra(ClipDescription.EXTRA_LOGGING_INSTANCE_ID, instanceId);
        item.getIntent().putExtra(IS_FROM_NOTIFICATION, true);
        ClipData dragData = new ClipData(clipDescription, item);
        View.DragShadowBuilder myShadow = new View.DragShadowBuilder(snapshot);
        view.setOnDragListener(getDraggedViewDragListener());