diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 85f982684d..5518f09aea 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -142,6 +142,7 @@ message Action { SWIPE = 3; FLING = 4; PINCH = 5; + SWIPE_NOOP = 6; } enum Direction { @@ -150,6 +151,8 @@ message Action { DOWN = 2; LEFT = 3; RIGHT = 4; + UPRIGHT = 5; + UPLEFT = 6; } enum Command { HOME_INTENT = 0; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java index e8dc0c93c1..7c0791e801 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java @@ -21,6 +21,11 @@ import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; +import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE; +import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE_NOOP; +import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPLEFT; +import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPRIGHT; +import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.NAVBAR; import android.animation.ValueAnimator; import android.content.Context; @@ -32,6 +37,7 @@ import android.os.SystemClock; import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.anim.Interpolators; +import com.android.launcher3.logging.UserEventDispatcher; import com.android.quickstep.util.MotionPauseDetector; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.launcher3.R; @@ -66,6 +72,7 @@ public class AssistantTouchConsumer implements InputConsumer { private long mDragTime; private float mLastProgress; private int mState; + private int mDirection; private final float mDistThreshold; private final long mTimeThreshold; @@ -74,10 +81,12 @@ public class AssistantTouchConsumer implements InputConsumer { private final MotionPauseDetector mMotionPauseDetector; private final ISystemUiProxy mSysUiProxy; private final InputConsumer mConsumerDelegate; + private final Context mContext; public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy, InputConsumer delegate) { final Resources res = context.getResources(); + mContext = context; mSysUiProxy = systemUiProxy; mConsumerDelegate = delegate; mMotionPauseDetector = new MotionPauseDetector(context); @@ -151,6 +160,7 @@ public class AssistantTouchConsumer implements InputConsumer { // Determine if angle is larger than threshold for assistant detection float angle = (float) Math.toDegrees( Math.atan2(mDownPos.y - mLastPos.y, mDownPos.x - mLastPos.x)); + mDirection = angle > 90 ? UPLEFT : UPRIGHT; angle = angle > 90 ? 180 - angle : angle; if (angle > mAngleThreshold) { mState = STATE_ASSISTANT_ACTIVE; @@ -184,9 +194,12 @@ public class AssistantTouchConsumer implements InputConsumer { if (mState != STATE_DELEGATE_ACTIVE && !mLaunchedAssistant) { ValueAnimator animator = ValueAnimator.ofFloat(mLastProgress, 0) .setDuration(RETRACT_ANIMATION_DURATION_MS); + UserEventDispatcher.newInstance(mContext).logActionOnContainer( + SWIPE_NOOP, mDirection, NAVBAR); animator.addUpdateListener(valueAnimator -> { float progress = (float) valueAnimator.getAnimatedValue(); try { + mSysUiProxy.onAssistantProgress(progress); } catch (RemoteException e) { Log.w(TAG, "Failed to send SysUI start/send assistant progress: " @@ -211,8 +224,9 @@ public class AssistantTouchConsumer implements InputConsumer { mLastProgress = progress; try { mSysUiProxy.onAssistantProgress(progress); - if (mDistance >= mDistThreshold && mTimeFraction >= 1) { + UserEventDispatcher.newInstance(mContext).logActionOnContainer( + SWIPE, mDirection, NAVBAR); mSysUiProxy.startAssistant(new Bundle()); mLaunchedAssistant = true; } diff --git a/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java b/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java index 4392851c0e..6dff187ea5 100644 --- a/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java +++ b/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java @@ -34,7 +34,6 @@ import com.android.systemui.shared.system.MetricsLoggerCompat; * quickstep interactions. */ @SuppressWarnings("unused") -@Deprecated public class UserEventDispatcherExtension extends UserEventDispatcher { private static final String TAG = "UserEventDispatcher"; diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index e11516890c..6ccde626c1 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -62,7 +62,6 @@ import androidx.annotation.Nullable; * * $ adb shell setprop log.tag.UserEvent VERBOSE */ -@Deprecated public class UserEventDispatcher implements ResourceBasedOverride { private static final String TAG = "UserEvent";