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

Commit 2bf0b8bc authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

InputManagerService: Add proto logs for input stream modifications

Create a new proto log group and add logs for all requests coming into
InputManagerService to modify an input gesture stream.

Also, clean up unused pilferPointers method.

Bug: 418194047
Test: Presubmit
Flag: EXEMPT logging only
Change-Id: Ia0d0460f90025a17b76a83c599d40d96e6e8f486
parent 2aee4723
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -154,12 +154,6 @@ public abstract class InputManagerInternal {
    /** Create an {@link InputChannel} that is registered to InputDispatcher. */
    public abstract InputChannel createInputChannel(String inputChannelName);

    /**
     * Pilfer pointers from the input channel with the given token so that ongoing gestures are
     * canceled for all other channels.
     */
    public abstract void pilferPointers(IBinder token);

    /**
     * Called when the current input method and/or {@link InputMethodSubtype} is updated.
     *
+17 −6
Original line number Diff line number Diff line
@@ -137,6 +137,9 @@ import com.android.internal.inputmethod.InputMethodSubtypeHandle;
import com.android.internal.os.SomeArgs;
import com.android.internal.policy.IShortcutService;
import com.android.internal.policy.KeyInterceptionInfo;
import com.android.internal.protolog.ProtoLog;
import com.android.internal.protolog.ProtoLogGroup;
import com.android.internal.protolog.common.IProtoLogGroup;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.Preconditions;
import com.android.server.DisplayThread;
@@ -178,6 +181,9 @@ public class InputManagerService extends IInputManager.Stub
    // To enable these logs, run: 'adb shell setprop log.tag.InputManager DEBUG' (requires restart)
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    private static final IProtoLogGroup INPUT_STREAM_MODIFIER_LOG = new ProtoLogGroup(
            "INPUT_STREAM_MODIFIER_LOG", "InputManagerService", true /*enabled*/);

    private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml";
    private static final String PORT_ASSOCIATIONS_PATH = "etc/input-port-associations.xml";

@@ -795,6 +801,7 @@ public class InputManagerService extends IInputManager.Stub
    public boolean transferTouch(@NonNull IBinder destChannelToken, int displayId) {
        // TODO(b/162194035): Replace this with a SPY window
        Objects.requireNonNull(destChannelToken, "destChannelToken must not be null");
        ProtoLog.d(INPUT_STREAM_MODIFIER_LOG, "transferTouch");
        return mNative.transferTouch(destChannelToken, displayId);
    }

@@ -1368,6 +1375,7 @@ public class InputManagerService extends IInputManager.Stub
     */
    public boolean startDragAndDrop(@NonNull IBinder fromChannelToken,
            @NonNull IBinder dragAndDropChannelToken) {
        ProtoLog.d(INPUT_STREAM_MODIFIER_LOG, "startDragAndDrop");
        return mNative.transferTouchGesture(fromChannelToken, dragAndDropChannelToken,
                true /* isDragDrop */, false /* transferEntireGesture */);
    }
@@ -1396,6 +1404,8 @@ public class InputManagerService extends IInputManager.Stub
            @NonNull IBinder toChannelToken, boolean transferEntireGesture) {
        Objects.requireNonNull(fromChannelToken);
        Objects.requireNonNull(toChannelToken);
        ProtoLog.d(INPUT_STREAM_MODIFIER_LOG, "transferTouchGesture: transferEntireGesture=%s",
                transferEntireGesture);
        return mNative.transferTouchGesture(fromChannelToken, toChannelToken,
                false /* isDragDrop */, transferEntireGesture);
    }
@@ -2128,6 +2138,7 @@ public class InputManagerService extends IInputManager.Stub
            throw new SecurityException("Requires MONITOR_INPUT permission");
        }

        ProtoLog.d(INPUT_STREAM_MODIFIER_LOG, "cancelCurrentTouch");
        mNative.cancelCurrentTouch();
    }

@@ -2165,6 +2176,11 @@ public class InputManagerService extends IInputManager.Stub
        super.pilferPointers_enforcePermission();

        Objects.requireNonNull(inputChannelToken);
        pilferPointersInternal(inputChannelToken);
    }

    private void pilferPointersInternal(@NonNull IBinder inputChannelToken) {
        ProtoLog.d(INPUT_STREAM_MODIFIER_LOG, "pilferPointers");
        mNative.pilferPointers(inputChannelToken);
    }

@@ -3480,7 +3496,7 @@ public class InputManagerService extends IInputManager.Stub

        @Override
        public void pilferPointers() {
            mNative.pilferPointers(mInputChannelToken);
            pilferPointersInternal(mInputChannelToken);
        }

        @Override
@@ -3739,11 +3755,6 @@ public class InputManagerService extends IInputManager.Stub
            return InputManagerService.this.createInputChannel(inputChannelName);
        }

        @Override
        public void pilferPointers(IBinder token) {
            mNative.pilferPointers(token);
        }

        @Override
        public void onInputMethodSubtypeChangedForKeyboardLayoutMapping(@UserIdInt int userId,
                @Nullable InputMethodSubtypeHandle subtypeHandle,