From 1fddddb4f30505e0fc9bb2e7c0d88b38ad900e54 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 29 Sep 2020 17:29:06 -0700 Subject: [PATCH] Update launcher_trace.proto for quick switch Sample output from one entry: entry { elapsed_realtime_nanos: 440461382888540 launcher { touch_interaction_service { service_connected: true overview_component_obvserver { overview_activity_started: true overview_activity_resumed: false } input_consumer { name: "TYPE_OTHER_ACTIVITY:TYPE_ONE_HANDED" swipe_handler { gesture_state { endTarget: NEW_TASK } is_recents_attached_to_app_window: true scroll_offset: 846 app_to_overview_progress: 0 } } } } } Bug: 167259591 Change-Id: I7f199d88f1d736efcea6b9165b8c4b77a5d27c58 --- protos/launcher_trace.proto | 36 +++++++++++++++++++ .../android/quickstep/AbsSwipeUpHandler.java | 24 +++++++++++++ .../quickstep/BaseActivityInterface.java | 9 +++++ .../com/android/quickstep/GestureState.java | 32 +++++++++++++---- .../com/android/quickstep/InputConsumer.java | 20 +++++++++++ .../quickstep/OverviewComponentObserver.java | 15 ++++++++ .../quickstep/TouchInteractionService.java | 6 ++++ .../inputconsumers/DelegateInputConsumer.java | 6 ++++ .../OtherActivityInputConsumer.java | 8 +++++ 9 files changed, 150 insertions(+), 6 deletions(-) diff --git a/protos/launcher_trace.proto b/protos/launcher_trace.proto index c6f3543c09..65fcfe512b 100644 --- a/protos/launcher_trace.proto +++ b/protos/launcher_trace.proto @@ -28,4 +28,40 @@ message LauncherTraceProto { message TouchInteractionServiceProto { optional bool service_connected = 1; + optional OverviewComponentObserverProto overview_component_obvserver = 2; + optional InputConsumerProto input_consumer = 3; +} + +message OverviewComponentObserverProto { + + optional bool overview_activity_started = 1; + optional bool overview_activity_resumed = 2; +} + +message InputConsumerProto { + + optional string name = 1; + optional SwipeHandlerProto swipe_handler = 2; +} + +message SwipeHandlerProto { + + optional GestureStateProto gesture_state = 1; + optional bool is_recents_attached_to_app_window = 2; + optional int32 scroll_offset = 3; + // Swipe up progress from 0 (app) to 1 (overview); can be > 1 if swiping past overview. + optional float app_to_overview_progress = 4; +} + +message GestureStateProto { + + optional GestureEndTarget endTarget = 1 [default = UNSET]; + + enum GestureEndTarget { + UNSET = 0; + HOME = 1; + RECENTS = 2; + NEW_TASK = 3; + LAST_TASK = 4; + } } diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 5e05a7dbe1..cee9854880 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -77,6 +77,8 @@ import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.testing.TestProtocol; +import com.android.launcher3.tracing.InputConsumerProto; +import com.android.launcher3.tracing.SwipeHandlerProto; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.WindowBounds; @@ -88,6 +90,7 @@ import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.InputConsumerProxy; import com.android.quickstep.util.MotionPauseDetector; +import com.android.quickstep.util.ProtoTracer; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.SurfaceTransactionApplier; import com.android.quickstep.util.TransformParams; @@ -1556,6 +1559,27 @@ public abstract class AbsSwipeUpHandler, Q extends } mTaskViewSimulator.apply(mTransformParams); } + ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); + } + + /** + * Used for winscope tracing, see launcher_trace.proto + * @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto + * @param inputConsumerProto The parent of this proto message. + */ + public void writeToProto(InputConsumerProto.Builder inputConsumerProto) { + SwipeHandlerProto.Builder swipeHandlerProto = SwipeHandlerProto.newBuilder(); + + mGestureState.writeToProto(swipeHandlerProto); + + swipeHandlerProto.setIsRecentsAttachedToAppWindow( + mAnimationFactory.isRecentsAttachedToAppWindow()); + swipeHandlerProto.setScrollOffset(mRecentsView == null + ? 0 + : mRecentsView.getScrollOffset()); + swipeHandlerProto.setAppToOverviewProgress(mCurrentShift.value); + + inputConsumerProto.setSwipeHandler(swipeHandlerProto); } public interface Factory { diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index d35e270dd5..9089ae5f96 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -297,6 +297,10 @@ public abstract class BaseActivityInterface