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

Commit b6796b00 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Make InputChannel private inside WindowState

The input channel token is already exposed, and in places where we are
accessing the channel we are actually after the token.

Make the channel private in this CL, and use the token instead where
needed.

Bug: 323450804
Test: atest android.view.surfacecontrol.cts.SurfaceControlViewHostTests
Flag: EXEMPT refactor
Change-Id: I9284f0bf7346384d0fb4f46b2f31ba3f5c1d2f9c
parent f01869f8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1254,9 +1254,10 @@ public class InputManagerService extends IInputManager.Stub
    /**
     * Start drag and drop.
     *
     * @param fromChannel The input channel that is currently receiving a touch gesture that should
     *                    be turned into the drag pointer.
     * @param dragAndDropChannel The input channel associated with the system drag window.
     * @param fromChannelToken The token of the input channel that is currently receiving a touch
     *                        gesture that should be turned into the drag pointer.
     * @param dragAndDropChannelToken The token of the input channel associated with the system drag
     *                               window.
     * @return true if drag and drop was successfully started, false otherwise.
     */
    public boolean startDragAndDrop(@NonNull IBinder fromChannelToken,
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm;

import static android.content.ClipDescription.EXTRA_HIDE_DRAG_SOURCE_TASK_ID;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.View.DRAG_FLAG_GLOBAL;
import static android.view.View.DRAG_FLAG_GLOBAL_SAME_APPLICATION;
@@ -228,7 +227,7 @@ class DragDropController {
                        final Display display = displayContent.getDisplay();
                        touchFocusTransferredFuture = mCallback.get().registerInputChannel(
                                mDragState, display, mService.mInputManager,
                                callingWin.mInputChannel);
                                callingWin.mInputChannelToken);
                    } else {
                        // Skip surface logic for a drag triggered by an AccessibilityAction
                        mDragState.broadcastDragStartedLocked(touchX, touchY);
+2 −3
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.view.Display;
import android.view.IInputFilter;
import android.view.IRemoteAnimationFinishedCallback;
import android.view.IWindow;
import android.view.InputChannel;
import android.view.MagnificationSpec;
import android.view.RemoteAnimationTarget;
import android.view.Surface;
@@ -377,10 +376,10 @@ public abstract class WindowManagerInternal {
    public interface IDragDropCallback {
        default CompletableFuture<Boolean> registerInputChannel(
                DragState state, Display display, InputManagerService service,
                InputChannel source) {
                IBinder sourceInputChannelToken) {
            return state.register(display)
                .thenApply(unused ->
                    service.startDragAndDrop(source.getToken(), state.getInputToken()));
                    service.startDragAndDrop(sourceInputChannelToken, state.getInputToken()));
        }

        /**
+1 −1
Original line number Diff line number Diff line
@@ -9778,7 +9778,7 @@ public class WindowManagerService extends IWindowManager.Stub
                Slog.e(TAG, "Host window not found");
                return;
            }
            if (hostWindow.mInputChannel == null) {
            if (hostWindow.mInputChannelToken == null) {
                Slog.e(TAG, "Host window does not have an input channel");
                return;
            }
+1 −1
Original line number Diff line number Diff line
@@ -638,7 +638,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    /**
     * Only populated if flag REMOVE_INPUT_CHANNEL_FROM_WINDOWSTATE is disabled.
     */
    InputChannel mInputChannel;
    private InputChannel mInputChannel;

    /**
     * The token will be assigned to {@link InputWindowHandle#token} if this window can receive
Loading