Add debug logging for task view touch controllers.

Proguard should remove these logging paths from user builds.

Bug: 350398650
Test: Manual. Verify logs are present.
Flag: com.android.launcher3.enable_expressive_dismiss_task_motion
Change-Id: Ie1d1532782c443672cde5c5dfe1ccaa49e100cd3
This commit is contained in:
Pat Manning
2025-03-17 15:35:02 +00:00
parent dd25302794
commit d6027ed5a6
4 changed files with 51 additions and 6 deletions
@@ -25,6 +25,7 @@ import com.android.launcher3.AbstractFloatingView
import com.android.launcher3.R
import com.android.launcher3.Utilities.EDGE_NAV_BAR
import com.android.launcher3.Utilities.boundToRange
import com.android.launcher3.Utilities.debugLog
import com.android.launcher3.Utilities.isRtl
import com.android.launcher3.Utilities.mapToRange
import com.android.launcher3.touch.SingleAxisSwipeDetector
@@ -69,6 +70,7 @@ CONTAINER : RecentsViewContainer {
// Don't intercept swipes on the nav bar, as user might be trying to go home during a
// task dismiss animation.
(ev.edgeFlags and EDGE_NAV_BAR) != 0 -> {
debugLog(TAG, "Not intercepting edge swipe on nav bar.")
false
}
@@ -76,14 +78,23 @@ CONTAINER : RecentsViewContainer {
AbstractFloatingView.getTopOpenViewWithType(
container,
AbstractFloatingView.TYPE_TOUCH_CONTROLLER_NO_INTERCEPT,
) != null -> false
// Disable swiping if the task overlay is modal.
taskViewRecentsTouchContext.isRecentsModal -> {
) != null -> {
debugLog(TAG, "Not intercepting, open floating view blocking touch.")
false
}
else -> taskViewRecentsTouchContext.isRecentsInteractive
// Disable swiping if the task overlay is modal.
taskViewRecentsTouchContext.isRecentsModal -> {
debugLog(TAG, "Not intercepting touch in modal overlay.")
false
}
else ->
taskViewRecentsTouchContext.isRecentsInteractive.also { isRecentsInteractive ->
if (!isRecentsInteractive) {
debugLog(TAG, "Not intercepting touch, recents not interactive.")
}
}
}
override fun onControllerInterceptTouchEvent(ev: MotionEvent): Boolean {
@@ -138,6 +149,7 @@ CONTAINER : RecentsViewContainer {
override fun onDragStart(start: Boolean, startDisplacement: Float) {
val taskBeingDragged = taskBeingDragged ?: return
debugLog(TAG, "Handling touch event.")
initialDisplacement =
taskBeingDragged.secondaryDismissTranslationProperty.get(taskBeingDragged)
@@ -288,6 +300,8 @@ CONTAINER : RecentsViewContainer {
}
companion object {
private const val TAG = "TaskViewDismissTouchController"
private const val DISMISS_THRESHOLD_FRACTION = 0.5f
private const val DISMISS_THRESHOLD_HAPTIC_RANGE = 10f
@@ -24,6 +24,7 @@ import com.android.launcher3.AbstractFloatingView
import com.android.launcher3.LauncherAnimUtils
import com.android.launcher3.Utilities.EDGE_NAV_BAR
import com.android.launcher3.Utilities.boundToRange
import com.android.launcher3.Utilities.debugLog
import com.android.launcher3.Utilities.isRtl
import com.android.launcher3.anim.AnimatorPlaybackController
import com.android.launcher3.touch.BaseSwipeDetector
@@ -72,6 +73,7 @@ CONTAINER : RecentsViewContainer {
// Don't intercept swipes on the nav bar, as user might be trying to go home during a
// task dismiss animation.
(ev.edgeFlags and EDGE_NAV_BAR) != 0 -> {
debugLog(TAG, "Not intercepting edge swipe on nav bar.")
false
}
@@ -80,15 +82,22 @@ CONTAINER : RecentsViewContainer {
container,
AbstractFloatingView.TYPE_TOUCH_CONTROLLER_NO_INTERCEPT,
) != null -> {
debugLog(TAG, "Not intercepting, open floating view blocking touch.")
false
}
// Disable swiping if the task overlay is modal.
taskViewRecentsTouchContext.isRecentsModal -> {
debugLog(TAG, "Not intercepting touch in modal overlay.")
false
}
else -> taskViewRecentsTouchContext.isRecentsInteractive
else ->
taskViewRecentsTouchContext.isRecentsInteractive.also { isRecentsInteractive ->
if (!isRecentsInteractive) {
debugLog(TAG, "Not intercepting touch, recents not interactive.")
}
}
}
override fun onControllerInterceptTouchEvent(ev: MotionEvent): Boolean {
@@ -128,6 +137,7 @@ CONTAINER : RecentsViewContainer {
recentsView.pagedOrientationHandler.getTaskDragDisplacementFactor(isRtl)
}
if (!canTaskLaunchTaskView(taskBeingDragged)) {
debugLog(TAG, "Not intercepting touch, task cannot be launched.")
return false
}
detector.setDetectableScrollConditions(downDirection, /* ignoreSlop= */ false)
@@ -136,6 +146,7 @@ CONTAINER : RecentsViewContainer {
override fun onDragStart(start: Boolean, startDisplacement: Float) {
val taskBeingDragged = taskBeingDragged ?: return
debugLog(TAG, "Handling touch event.")
val secondaryLayerDimension: Int =
recentsView.pagedOrientationHandler.getSecondaryDimension(container.getDragLayer())
@@ -202,6 +213,7 @@ CONTAINER : RecentsViewContainer {
}
companion object {
private const val TAG = "TaskViewLaunchTouchController"
private const val LAUNCH_THRESHOLD_FRACTION: Float = 0.5f
}
}
@@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.touchcontrollers;
import static com.android.launcher3.AbstractFloatingView.TYPE_TOUCH_CONTROLLER_NO_INTERCEPT;
import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS;
import static com.android.launcher3.Utilities.debugLog;
import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_BOTH;
import android.animation.Animator;
@@ -56,6 +57,7 @@ import com.android.quickstep.views.TaskView;
public class TaskViewTouchControllerDeprecated<
CONTAINER extends Context & RecentsViewContainer> extends AnimatorListenerAdapter
implements TouchController, SingleAxisSwipeDetector.Listener {
private static final String TAG = "TaskViewTouchControllerDeprecated";
private static final float ANIMATION_PROGRESS_FRACTION_MIDPOINT = 0.5f;
private static final long MIN_TASK_DISMISS_ANIMATION_DURATION = 300;
@@ -110,6 +112,7 @@ public class TaskViewTouchControllerDeprecated<
if (mCurrentAnimation != null) {
mCurrentAnimation.getAnimationPlayer().end();
}
debugLog(TAG, "Not intercepting edge swipe on nav bar.");
return false;
}
if (mCurrentAnimation != null) {
@@ -121,6 +124,7 @@ public class TaskViewTouchControllerDeprecated<
}
if (AbstractFloatingView.getTopOpenViewWithType(
mContainer, TYPE_TOUCH_CONTROLLER_NO_INTERCEPT) != null) {
debugLog(TAG, "Not intercepting, open floating view blocking touch.");
return false;
}
return mTaskViewRecentsTouchContext.isRecentsInteractive();
@@ -142,6 +146,7 @@ public class TaskViewTouchControllerDeprecated<
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = !canInterceptTouch(ev);
if (mNoIntercept) {
debugLog(TAG, "Not intercepting touch.");
return false;
}
@@ -186,6 +191,7 @@ public class TaskViewTouchControllerDeprecated<
}
if (mTaskBeingDragged == null) {
mNoIntercept = true;
debugLog(TAG, "Not intercepting touch, no task to drag.");
return false;
}
}
@@ -195,6 +201,7 @@ public class TaskViewTouchControllerDeprecated<
}
if (mNoIntercept) {
debugLog(TAG, "Not intercepting touch.");
return false;
}
@@ -266,6 +273,7 @@ public class TaskViewTouchControllerDeprecated<
@Override
public void onDragStart(boolean start, float startDisplacement) {
if (!mDraggingEnabled) return;
debugLog(TAG, "Handling touch.");
RecentsPagedOrientationHandler orientationHandler =
mRecentsView.getPagedOrientationHandler();
+11
View File
@@ -964,4 +964,15 @@ public final class Utilities {
return null;
}
}
/**
* Logs with DEBUG priority if the current device is a debug device.
*
* <p>Debug devices by default include -eng and -userdebug builds, but not -user builds.
*/
public static void debugLog(String tag, String message) {
if (BuildConfig.IS_DEBUG_DEVICE) {
Log.d(tag, message);
}
}
}