diff options
author | 2025-02-20 15:13:43 -0500 | |
---|---|---|
committer | 2025-03-02 16:03:32 -0800 | |
commit | 841c6a98d2aa0522af131b303fde58bd9014e4b1 (patch) | |
tree | 8abbb21035470159fc85bf2daf8df1968b9a3408 | |
parent | 21dba415e912695b2a1af3cf32323f0d5fc61295 (diff) |
Update ActiveGestureLogs to print gestures' display IDs
Flag: com.android.launcher3.enable_gesture_nav_on_connected_displays
Bug: 382130680
Test: connected an external display and checked logs
Change-Id: I6846a3dda77fc4afbbd83855aacca726eeb8eace
3 files changed, 79 insertions, 45 deletions
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 80b877f410..2fd7945a52 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -809,8 +809,9 @@ public class TouchInteractionService extends Service { } private void onInputEvent(InputEvent ev) { + int displayId = ev.getDisplayId(); if (!(ev instanceof MotionEvent)) { - ActiveGestureProtoLogProxy.logUnknownInputEvent(ev.toString()); + ActiveGestureProtoLogProxy.logUnknownInputEvent(displayId, ev.toString()); return; } MotionEvent event = (MotionEvent) ev; @@ -819,19 +820,19 @@ public class TouchInteractionService extends Service { TestProtocol.SEQUENCE_TIS, "TouchInteractionService.onInputEvent", event); if (!LockedUserState.get(this).isUserUnlocked()) { - ActiveGestureProtoLogProxy.logOnInputEventUserLocked(); + ActiveGestureProtoLogProxy.logOnInputEventUserLocked(displayId); return; } NavigationMode currentNavMode = mDeviceState.getMode(); if (mGestureStartNavMode != null && mGestureStartNavMode != currentNavMode) { ActiveGestureProtoLogProxy.logOnInputEventNavModeSwitched( - mGestureStartNavMode.name(), currentNavMode.name()); + displayId, mGestureStartNavMode.name(), currentNavMode.name()); event.setAction(ACTION_CANCEL); } else if (mDeviceState.isButtonNavMode() && !mDeviceState.supportsAssistantGestureInButtonNav() && !isTrackpadMotionEvent(event)) { - ActiveGestureProtoLogProxy.logOnInputEventThreeButtonNav(); + ActiveGestureProtoLogProxy.logOnInputEventThreeButtonNav(displayId); return; } @@ -847,13 +848,12 @@ public class TouchInteractionService extends Service { } if (mTaskAnimationManager.shouldIgnoreMotionEvents()) { if (action == ACTION_DOWN || isHoverActionWithoutConsumer) { - ActiveGestureProtoLogProxy.logOnInputIgnoringFollowingEvents(); + ActiveGestureProtoLogProxy.logOnInputIgnoringFollowingEvents(displayId); } return; } } - int displayId = ev.getDisplayId(); InputMonitorCompat inputMonitorCompat = getInputMonitorCompat(displayId); InputEventReceiver inputEventReceiver = getInputEventReceiver(displayId); @@ -960,25 +960,28 @@ public class TouchInteractionService extends Service { if (mUncheckedConsumer != InputConsumer.NO_OP) { switch (action) { case ACTION_DOWN: - ActiveGestureProtoLogProxy.logOnInputEventActionDown(reasonString); + ActiveGestureProtoLogProxy.logOnInputEventActionDown(displayId, reasonString); // fall through case ACTION_UP: ActiveGestureProtoLogProxy.logOnInputEventActionUp( (int) event.getRawX(), (int) event.getRawY(), action, - MotionEvent.classificationToString(event.getClassification())); + MotionEvent.classificationToString(event.getClassification()), + displayId); break; case ACTION_MOVE: ActiveGestureProtoLogProxy.logOnInputEventActionMove( MotionEvent.actionToString(action), MotionEvent.classificationToString(event.getClassification()), - event.getPointerCount()); + event.getPointerCount(), + displayId); break; default: { ActiveGestureProtoLogProxy.logOnInputEventGenericAction( MotionEvent.actionToString(action), - MotionEvent.classificationToString(event.getClassification())); + MotionEvent.classificationToString(event.getClassification()), + displayId); } } } diff --git a/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java b/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java index 37c64cfafe..18a533842d 100644 --- a/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java +++ b/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java @@ -159,31 +159,37 @@ public class ActiveGestureProtoLogProxy { ProtoLog.d(ACTIVE_GESTURE_LOG, "cleanUpRecentsAnimation"); } - public static void logOnInputEventUserLocked() { - ActiveGestureLog.INSTANCE.addLog( - "TIS.onInputEvent: Cannot process input event: user is locked"); + public static void logOnInputEventUserLocked(int displayId) { + ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( + "TIS.onInputEvent(displayId=%d): Cannot process input event: user is locked", + displayId)); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; ProtoLog.d(ACTIVE_GESTURE_LOG, - "TIS.onInputEvent: Cannot process input event: user is locked"); + "TIS.onInputEvent(displayId=%d): Cannot process input event: user is locked", + displayId); } - public static void logOnInputIgnoringFollowingEvents() { - ActiveGestureLog.INSTANCE.addLog("TIS.onMotionEvent: A new gesture has been started, " + public static void logOnInputIgnoringFollowingEvents(int displayId) { + ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( + "TIS.onMotionEvent(displayId=%d): A new gesture has been started, " + "but a previously-requested recents animation hasn't started. " - + "Ignoring all following motion events.", + + "Ignoring all following motion events.", displayId), RECENTS_ANIMATION_START_PENDING); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; - ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onMotionEvent: A new gesture has been started, " - + "but a previously-requested recents animation hasn't started. " - + "Ignoring all following motion events."); + ProtoLog.d(ACTIVE_GESTURE_LOG, + "TIS.onMotionEvent(displayId=%d): A new gesture has been started, " + + "but a previously-requested recents animation hasn't started. " + + "Ignoring all following motion events.", displayId); } - public static void logOnInputEventThreeButtonNav() { - ActiveGestureLog.INSTANCE.addLog("TIS.onInputEvent: Cannot process input event: " - + "using 3-button nav and event is not a trackpad event"); + public static void logOnInputEventThreeButtonNav(int displayId) { + ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( + "TIS.onInputEvent(displayId=%d): Cannot process input event: " + + "using 3-button nav and event is not a trackpad event", displayId)); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; - ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onInputEvent: Cannot process input event: " - + "using 3-button nav and event is not a trackpad event"); + ProtoLog.d(ACTIVE_GESTURE_LOG, + "TIS.onInputEvent(displayId=%d): Cannot process input event: " + + "using 3-button nav and event is not a trackpad event", displayId); } public static void logPreloadRecentsAnimation() { @@ -322,61 +328,84 @@ public class ActiveGestureProtoLogProxy { } public static void logOnInputEventActionUp( - int x, int y, int action, @NonNull String classification) { + int x, int y, int action, @NonNull String classification, int displayId) { String actionString = MotionEvent.actionToString(action); ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( - "onMotionEvent(%d, %d): %s, %s", x, y, actionString, classification), + "onMotionEvent(%d, %d): %s, %s, displayId=%d", + x, + y, + actionString, + classification, + displayId), /* gestureEvent= */ action == ACTION_DOWN ? MOTION_DOWN : MOTION_UP); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; ProtoLog.d(ACTIVE_GESTURE_LOG, - "onMotionEvent(%d, %d): %s, %s", x, y, actionString, classification); + "onMotionEvent(%d, %d): %s, %s, displayId=%d", + x, + y, + actionString, + classification, + displayId); } public static void logOnInputEventActionMove( - @NonNull String action, @NonNull String classification, int pointerCount) { + @NonNull String action, + @NonNull String classification, + int pointerCount, + int displayId) { ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( - "onMotionEvent: %s, %s, pointerCount: %d", + "onMotionEvent: %s, %s, pointerCount: %d, displayId=%d", action, classification, - pointerCount), + pointerCount, + displayId), MOTION_MOVE); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; ProtoLog.d(ACTIVE_GESTURE_LOG, - "onMotionEvent: %s, %s, pointerCount: %d", action, classification, pointerCount); + "onMotionEvent: %s, %s, pointerCount: %d, displayId=%d", + action, + classification, + pointerCount, + displayId); } public static void logOnInputEventGenericAction( - @NonNull String action, @NonNull String classification) { + @NonNull String action, @NonNull String classification, int displayId) { ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( - "onMotionEvent: %s, %s", action, classification)); + "onMotionEvent: %s, %s, displayId=%d", action, classification, displayId)); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; - ProtoLog.d(ACTIVE_GESTURE_LOG, "onMotionEvent: %s, %s", action, classification); + ProtoLog.d(ACTIVE_GESTURE_LOG, + "onMotionEvent: %s, %s, displayId=%d", action, classification, displayId); } public static void logOnInputEventNavModeSwitched( - @NonNull String startNavMode, @NonNull String currentNavMode) { + int displayId, @NonNull String startNavMode, @NonNull String currentNavMode) { ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( - "TIS.onInputEvent: Navigation mode switched mid-gesture (%s -> %s); " + "TIS.onInputEvent(displayId=%d): Navigation mode switched mid-gesture (%s -> %s); " + "cancelling gesture.", + displayId, startNavMode, currentNavMode), NAVIGATION_MODE_SWITCHED); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; ProtoLog.d(ACTIVE_GESTURE_LOG, - "TIS.onInputEvent: Navigation mode switched mid-gesture (%s -> %s); " + "TIS.onInputEvent(displayId=%d): Navigation mode switched mid-gesture (%s -> %s); " + "cancelling gesture.", + displayId, startNavMode, currentNavMode); } - public static void logUnknownInputEvent(@NonNull String event) { + public static void logUnknownInputEvent(int displayId, @NonNull String event) { ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( - "TIS.onInputEvent: Cannot process input event: received unknown event %s", event)); + "TIS.onInputEvent(displayId=%d): Cannot process input event: " + + "received unknown event %s", displayId, event)); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; ProtoLog.d(ACTIVE_GESTURE_LOG, - "TIS.onInputEvent: Cannot process input event: received unknown event %s", event); + "TIS.onInputEvent(displayId=%d): Cannot process input event: " + + "received unknown event %s", displayId, event); } public static void logFinishRunningRecentsAnimation(boolean toHome) { @@ -433,11 +462,13 @@ public class ActiveGestureProtoLogProxy { ProtoLog.d(ACTIVE_GESTURE_LOG, "Launching side task id=%d", taskId); } - public static void logOnInputEventActionDown(@NonNull ActiveGestureLog.CompoundString reason) { + public static void logOnInputEventActionDown( + int displayId, @NonNull ActiveGestureLog.CompoundString reason) { ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( - "TIS.onMotionEvent: ").append(reason)); + "TIS.onMotionEvent(displayId=%d): ", displayId).append(reason)); if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; - ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onMotionEvent: %s", reason.toString()); + ProtoLog.d(ACTIVE_GESTURE_LOG, + "TIS.onMotionEvent(displayId=%d): %s", displayId, reason.toString()); } public static void logStartNewTask(@NonNull ActiveGestureLog.CompoundString tasks) { diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/DisplayModelTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/DisplayModelTest.kt index ca07c5d0a5..fa7907fa4b 100644 --- a/quickstep/tests/multivalentTests/src/com/android/quickstep/DisplayModelTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/DisplayModelTest.kt @@ -21,11 +21,11 @@ import android.view.Display import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest +import java.io.PrintWriter import org.junit.Assert.assertNotNull import org.junit.Assert.assertNull import org.junit.Test import org.junit.runner.RunWith -import java.io.PrintWriter @SmallTest @RunWith(AndroidJUnit4::class) |