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
This commit is contained in:
Tony Wickham 2020-09-29 17:29:06 -07:00
parent 8d14dbe041
commit 1fddddb4f3
9 changed files with 150 additions and 6 deletions

View File

@ -28,4 +28,40 @@ message LauncherTraceProto {
message TouchInteractionServiceProto { message TouchInteractionServiceProto {
optional bool service_connected = 1; 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;
}
} }

View File

@ -77,6 +77,8 @@ import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.logging.StatsLogManager.StatsLogger;
import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.testing.TestProtocol; 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.TraceHelper;
import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.util.WindowBounds; 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.AnimatorControllerWithResistance;
import com.android.quickstep.util.InputConsumerProxy; import com.android.quickstep.util.InputConsumerProxy;
import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.MotionPauseDetector;
import com.android.quickstep.util.ProtoTracer;
import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.SurfaceTransactionApplier; import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.TransformParams; import com.android.quickstep.util.TransformParams;
@ -1556,6 +1559,27 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
} }
mTaskViewSimulator.apply(mTransformParams); 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 { public interface Factory {

View File

@ -297,6 +297,10 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
* @param animate Whether to animate recents to/from its new attached state. * @param animate Whether to animate recents to/from its new attached state.
*/ */
default void setRecentsAttachedToAppWindow(boolean attached, boolean animate) { } default void setRecentsAttachedToAppWindow(boolean attached, boolean animate) { }
default boolean isRecentsAttachedToAppWindow() {
return false;
}
} }
class DefaultAnimationFactory implements AnimationFactory { class DefaultAnimationFactory implements AnimationFactory {
@ -388,6 +392,11 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
fadeAnim.setDuration(animate ? RECENTS_ATTACH_DURATION : 0).start(); fadeAnim.setDuration(animate ? RECENTS_ATTACH_DURATION : 0).start();
} }
@Override
public boolean isRecentsAttachedToAppWindow() {
return mIsAttachedToWindow;
}
protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) { protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) {
// Scale down recents from being full screen to being in overview. // Scale down recents from being full screen to being in overview.
RecentsView recentsView = activity.getOverviewPanel(); RecentsView recentsView = activity.getOverviewPanel();

View File

@ -26,6 +26,8 @@ import android.content.Intent;
import android.os.Build; import android.os.Build;
import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.tracing.GestureStateProto;
import com.android.launcher3.tracing.SwipeHandlerProto;
import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActiveGestureLog;
import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@ -46,19 +48,22 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
* Defines the end targets of a gesture and the associated state. * Defines the end targets of a gesture and the associated state.
*/ */
public enum GestureEndTarget { public enum GestureEndTarget {
HOME(true, LAUNCHER_STATE_HOME, false), HOME(true, LAUNCHER_STATE_HOME, false, GestureStateProto.GestureEndTarget.HOME),
RECENTS(true, LAUNCHER_STATE_OVERVIEW, true), RECENTS(true, LAUNCHER_STATE_OVERVIEW, true, GestureStateProto.GestureEndTarget.RECENTS),
NEW_TASK(false, LAUNCHER_STATE_BACKGROUND, true), NEW_TASK(false, LAUNCHER_STATE_BACKGROUND, true,
GestureStateProto.GestureEndTarget.NEW_TASK),
LAST_TASK(false, LAUNCHER_STATE_BACKGROUND, true); LAST_TASK(false, LAUNCHER_STATE_BACKGROUND, true,
GestureStateProto.GestureEndTarget.LAST_TASK);
GestureEndTarget(boolean isLauncher, int containerType, GestureEndTarget(boolean isLauncher, int containerType, boolean recentsAttachedToAppWindow,
boolean recentsAttachedToAppWindow) { GestureStateProto.GestureEndTarget protoEndTarget) {
this.isLauncher = isLauncher; this.isLauncher = isLauncher;
this.containerType = containerType; this.containerType = containerType;
this.recentsAttachedToAppWindow = recentsAttachedToAppWindow; this.recentsAttachedToAppWindow = recentsAttachedToAppWindow;
this.protoEndTarget = protoEndTarget;
} }
/** Whether the target is in the launcher activity. Implicitly, if the end target is going /** Whether the target is in the launcher activity. Implicitly, if the end target is going
@ -68,6 +73,8 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
public final int containerType; public final int containerType;
/** Whether RecentsView should be attached to the window as we animate to this target */ /** Whether RecentsView should be attached to the window as we animate to this target */
public final boolean recentsAttachedToAppWindow; public final boolean recentsAttachedToAppWindow;
/** The GestureStateProto enum value, used for winscope tracing. See launcher_trace.proto */
public final GestureStateProto.GestureEndTarget protoEndTarget;
} }
private static final String TAG = "GestureState"; private static final String TAG = "GestureState";
@ -345,4 +352,17 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
pw.println(" lastStartedTaskId=" + mLastStartedTaskId); pw.println(" lastStartedTaskId=" + mLastStartedTaskId);
pw.println(" isRecentsAnimationRunning=" + isRecentsAnimationRunning()); pw.println(" isRecentsAnimationRunning=" + isRecentsAnimationRunning());
} }
/**
* Used for winscope tracing, see launcher_trace.proto
* @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto
* @param swipeHandlerProto The parent of this proto message.
*/
public void writeToProto(SwipeHandlerProto.Builder swipeHandlerProto) {
GestureStateProto.Builder gestureStateProto = GestureStateProto.newBuilder();
gestureStateProto.setEndTarget(mEndTarget == null
? GestureStateProto.GestureEndTarget.UNSET
: mEndTarget.protoEndTarget);
swipeHandlerProto.setGestureState(gestureStateProto);
}
} }

View File

@ -21,6 +21,9 @@ import android.view.InputEvent;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import com.android.launcher3.tracing.InputConsumerProto;
import com.android.launcher3.tracing.TouchInteractionServiceProto;
@TargetApi(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O)
public interface InputConsumer { public interface InputConsumer {
@ -116,4 +119,21 @@ public interface InputConsumer {
} }
return name.toString(); return name.toString();
} }
/**
* Used for winscope tracing, see launcher_trace.proto
* @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto
* @param serviceProto The parent of this proto message.
*/
default void writeToProto(TouchInteractionServiceProto.Builder serviceProto) {
InputConsumerProto.Builder inputConsumerProto = InputConsumerProto.newBuilder();
inputConsumerProto.setName(getName());
writeToProtoInternal(inputConsumerProto);
serviceProto.setInputConsumer(inputConsumerProto);
}
/**
* @see #writeToProto - allows subclasses to write additional info to the proto.
*/
default void writeToProtoInternal(InputConsumerProto.Builder inputConsumerProto) {}
} }

View File

@ -35,6 +35,8 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import com.android.launcher3.tracing.OverviewComponentObserverProto;
import com.android.launcher3.tracing.TouchInteractionServiceProto;
import com.android.launcher3.util.SimpleBroadcastReceiver; import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.systemui.shared.system.PackageManagerWrapper; import com.android.systemui.shared.system.PackageManagerWrapper;
@ -262,4 +264,17 @@ public final class OverviewComponentObserver {
pw.println(" overviewIntent=" + mOverviewIntent); pw.println(" overviewIntent=" + mOverviewIntent);
pw.println(" homeIntent=" + mCurrentHomeIntent); pw.println(" homeIntent=" + mCurrentHomeIntent);
} }
/**
* Used for winscope tracing, see launcher_trace.proto
* @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto
* @param serviceProto The parent of this proto message.
*/
public void writeToProto(TouchInteractionServiceProto.Builder serviceProto) {
OverviewComponentObserverProto.Builder overviewComponentObserver =
OverviewComponentObserverProto.newBuilder();
overviewComponentObserver.setOverviewActivityStarted(mActivityInterface.isStarted());
overviewComponentObserver.setOverviewActivityResumed(mActivityInterface.isResumed());
serviceProto.setOverviewComponentObvserver(overviewComponentObserver);
}
} }

View File

@ -890,6 +890,12 @@ public class TouchInteractionService extends Service implements PluginListener<O
TouchInteractionServiceProto.Builder serviceProto = TouchInteractionServiceProto.Builder serviceProto =
TouchInteractionServiceProto.newBuilder(); TouchInteractionServiceProto.newBuilder();
serviceProto.setServiceConnected(true); serviceProto.setServiceConnected(true);
if (mOverviewComponentObserver != null) {
mOverviewComponentObserver.writeToProto(serviceProto);
}
mConsumer.writeToProto(serviceProto);
proto.setTouchInteractionService(serviceProto); proto.setTouchInteractionService(serviceProto);
} }
} }

View File

@ -4,6 +4,7 @@ import android.view.MotionEvent;
import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.tracing.InputConsumerProto;
import com.android.quickstep.InputConsumer; import com.android.quickstep.InputConsumer;
import com.android.systemui.shared.system.InputMonitorCompat; import com.android.systemui.shared.system.InputMonitorCompat;
@ -53,4 +54,9 @@ public abstract class DelegateInputConsumer implements InputConsumer {
mDelegate.onMotionEvent(event); mDelegate.onMotionEvent(event);
event.recycle(); event.recycle();
} }
@Override
public void writeToProtoInternal(InputConsumerProto.Builder inputConsumerProto) {
mDelegate.writeToProtoInternal(inputConsumerProto);
}
} }

View File

@ -51,6 +51,7 @@ import androidx.annotation.UiThread;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.tracing.InputConsumerProto;
import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.AbsSwipeUpHandler; import com.android.quickstep.AbsSwipeUpHandler;
@ -478,4 +479,11 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
public boolean allowInterceptByParent() { public boolean allowInterceptByParent() {
return !mPassedPilferInputSlop || mGestureState.hasState(STATE_OVERSCROLL_WINDOW_CREATED); return !mPassedPilferInputSlop || mGestureState.hasState(STATE_OVERSCROLL_WINDOW_CREATED);
} }
@Override
public void writeToProtoInternal(InputConsumerProto.Builder inputConsumerProto) {
if (mInteractionHandler != null) {
mInteractionHandler.writeToProto(inputConsumerProto);
}
}
} }