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

Commit 438fb283 authored by Arthur Hung's avatar Arthur Hung
Browse files

Revert "Fix drag and drop (2/3)"

This reverts commit b5e316c3.

Bug: 137819199
Test: manual
Change-Id: I31e60725035d5af06884521499aed9fc07e505c9
parent c499ad37
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -129,7 +129,6 @@ class DragState {
     * {@code true} when {@link #closeLocked()} is called.
     */
    private boolean mIsClosing;
    IBinder mTransferTouchFromToken;

    DragState(WindowManagerService service, DragDropController controller, IBinder token,
            SurfaceControl surface, int flags, IBinder localWin) {
@@ -167,10 +166,9 @@ class DragState {

        mTmpClipRect.set(0, 0, mDisplaySize.x, mDisplaySize.y);
        mTransaction.setWindowCrop(mInputSurface, mTmpClipRect);
        mTransaction.transferTouchFocus(mTransferTouchFromToken, h.token);
        mTransferTouchFromToken = null;

        // syncInputWindows here to ensure the input channel isn't removed before the transfer.
        // syncInputWindows here to ensure the input window info is sent before the
        // transferTouchFocus is called.
        mTransaction.syncInputWindows();
        mTransaction.apply();
    }
+7 −6
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.app.IActivityTaskManager;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Slog;
@@ -51,7 +50,6 @@ class TaskPositioningController {
    private @Nullable TaskPositioner mTaskPositioner;

    private final Rect mTmpClipRect = new Rect();
    private IBinder mTransferTouchFromToken;

    boolean isPositioningLocked() {
        return mTaskPositioner != null;
@@ -104,8 +102,6 @@ class TaskPositioningController {

        mTmpClipRect.set(0, 0, p.x, p.y);
        t.setWindowCrop(mInputSurface, mTmpClipRect);
        t.transferTouchFocus(mTransferTouchFromToken, h.token);
        mTransferTouchFromToken = null;
    }

    boolean startMovingTask(IWindow window, float startX, float startY) {
@@ -168,6 +164,7 @@ class TaskPositioningController {
        mPositioningDisplay = displayContent;

        mTaskPositioner = TaskPositioner.create(mService);
        mTaskPositioner.register(displayContent);

        // We need to grab the touch focus so that the touch events during the
        // resizing/scrolling are not sent to the app. 'win' is the main window
@@ -178,8 +175,12 @@ class TaskPositioningController {
                && displayContent.mCurrentFocus.mAppToken == win.mAppToken) {
            transferFocusFromWin = displayContent.mCurrentFocus;
        }
        mTransferTouchFromToken = transferFocusFromWin.mInputChannel.getToken();
        mTaskPositioner.register(displayContent);
        if (!mInputManager.transferTouchFocus(
                transferFocusFromWin.mInputChannel, mTaskPositioner.mServerChannel)) {
            Slog.e(TAG_WM, "startPositioningLocked: Unable to transfer touch focus");
            cleanUpTaskPositioner();
            return false;
        }

        mTaskPositioner.startDrag(win, resize, preserveOrientation, startX, startY);
        return true;
+1 −2
Original line number Diff line number Diff line
@@ -160,9 +160,8 @@ public abstract class WindowManagerInternal {
        default boolean registerInputChannel(
                DragState state, Display display, InputManagerService service,
                InputChannel source) {
            state.mTransferTouchFromToken = source.getToken();
            state.register(display);
            return true;
            return service.transferTouchFocus(source, state.getInputChannel());
        }

        /**