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

Commit 4a545171 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Add new callback to customize input event handling

Bug: 63914027
Test: DragDropControllerTests
Change-Id: I7f606ffd7a803e7f884d236bbac9dc3be8da5de1
parent 76be79a7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -153,9 +153,9 @@ class DragDropController {
                    mDragState.mToken = dragToken;

                    final Display display = displayContent.getDisplay();
                    mDragState.register(display);
                    if (!mService.mInputManager.transferTouchFocus(callingWin.mInputChannel,
                            mDragState.getInputChannel())) {
                    if (!mCallback.get().registerInputChannel(
                            mDragState, display, mService.mInputManager,
                            callingWin.mInputChannel)) {
                        Slog.e(TAG_WM, "Unable to transfer touch focus");
                        return null;
                    }
+10 −1
Original line number Diff line number Diff line
@@ -23,12 +23,14 @@ import android.graphics.Rect;
import android.graphics.Region;
import android.hardware.display.DisplayManagerInternal;
import android.os.IBinder;
import android.view.Display;
import android.view.IInputFilter;
import android.view.IWindow;
import android.view.InputChannel;
import android.view.MagnificationSpec;
import android.view.WindowInfo;
import android.view.animation.Animation;

import com.android.server.input.InputManagerService;
import com.android.server.policy.WindowManagerPolicy;

import java.util.List;
@@ -153,6 +155,13 @@ public abstract class WindowManagerInternal {
     * An interface to customize drag and drop behaviors.
     */
    public interface IDragDropCallback {
        default boolean registerInputChannel(
                DragState state, Display display, InputManagerService service,
                InputChannel source) {
            state.register(display);
            return service.transferTouchFocus(source, state.getInputChannel());
        }

        /**
         * Called when drag operation is starting.
         */