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

Commit 64677dba authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev Committed by Android (Google) Code Review
Browse files

Merge "Fix cross-app drag and drop crash."

parents 7e424b7c 68dd2e86
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -265,21 +265,27 @@ class DragState {
    }

    void broadcastDragEndedLw() {
        final int myPid = Process.myPid();

        if (WindowManagerService.DEBUG_DRAG) {
            Slog.d(WindowManagerService.TAG, "broadcasting DRAG_ENDED");
        }
        for (WindowState ws : mNotifiedWindows) {
            DragEvent evt = DragEvent.obtain(DragEvent.ACTION_DRAG_ENDED,
                    0, 0, null, null, null, null, mDragResult);
        for (WindowState ws: mNotifiedWindows) {
            try {
                ws.mClient.dispatchDragEvent(evt);
            } catch (RemoteException e) {
                Slog.w(WindowManagerService.TAG, "Unable to drag-end window " + ws);
            }
            // if the current window is in the same process,
            // the dispatch has already recycled the event
            if (myPid != ws.mSession.mPid) {
                evt.recycle();
            }
        }
        mNotifiedWindows.clear();
        mDragInProgress = false;
        evt.recycle();
    }

    void endDragLw() {