From 0605ca7bfe8f11641621b5f1113b063f61751489 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 7 Jul 2023 22:51:07 +0000 Subject: [PATCH] Remove legacy unused proto tracing code to prevent confusion Bug: 290408307 Test: Presubmit Change-Id: I1bd1270876b8934659194f0ed2b5bcdaef3975bc --- .../android/quickstep/AbsSwipeUpHandler.java | 24 ---- .../com/android/quickstep/GestureState.java | 34 +---- .../com/android/quickstep/InputConsumer.java | 20 --- .../quickstep/OverviewComponentObserver.java | 15 -- .../quickstep/TouchInteractionService.java | 41 +----- .../inputconsumers/DelegateInputConsumer.java | 6 - .../OtherActivityInputConsumer.java | 8 -- .../android/quickstep/util/ProtoTracer.java | 135 ------------------ 8 files changed, 8 insertions(+), 275 deletions(-) delete mode 100644 quickstep/src/com/android/quickstep/util/ProtoTracer.java diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 95672f3ccb..25909ac331 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -107,8 +107,6 @@ import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.TaskbarUIController; -import com.android.launcher3.tracing.InputConsumerProto; -import com.android.launcher3.tracing.SwipeHandlerProto; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import com.android.launcher3.util.DisplayController; @@ -126,7 +124,6 @@ import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.InputConsumerProxy; import com.android.quickstep.util.InputProxyHandlerFactory; import com.android.quickstep.util.MotionPauseDetector; -import com.android.quickstep.util.ProtoTracer; import com.android.quickstep.util.RecentsOrientedState; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.StaggeredWorkspaceAnim; @@ -2426,7 +2423,6 @@ public abstract class AbsSwipeUpHandler, taskViewSimulator.apply(remoteHandle.getTransformParams()); } } - ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); } // Scaling of RecentsView during quick switch based on amount of recents scroll @@ -2496,26 +2492,6 @@ public abstract class AbsSwipeUpHandler, mRecentsAnimationTargets.nonApps, shown, null /* animatorHandler */); } - /** - * 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 { AbsSwipeUpHandler newHandler(GestureState gestureState, long touchTimeMs); } diff --git a/quickstep/src/com/android/quickstep/GestureState.java b/quickstep/src/com/android/quickstep/GestureState.java index 3d0f6d503c..c7df18f6fb 100644 --- a/quickstep/src/com/android/quickstep/GestureState.java +++ b/quickstep/src/com/android/quickstep/GestureState.java @@ -37,8 +37,6 @@ import android.view.RemoteAnimationTarget; import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; -import com.android.launcher3.tracing.GestureStateProto; -import com.android.launcher3.tracing.SwipeHandlerProto; import com.android.quickstep.TopTaskTracker.CachedTaskInfo; import com.android.quickstep.util.ActiveGestureErrorDetector; import com.android.quickstep.util.ActiveGestureLog; @@ -62,24 +60,21 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL * Defines the end targets of a gesture and the associated state. */ public enum GestureEndTarget { - HOME(true, LAUNCHER_STATE_HOME, false, GestureStateProto.GestureEndTarget.HOME), + HOME(true, LAUNCHER_STATE_HOME, false), - RECENTS(true, LAUNCHER_STATE_OVERVIEW, true, GestureStateProto.GestureEndTarget.RECENTS), + RECENTS(true, LAUNCHER_STATE_OVERVIEW, true), - NEW_TASK(false, LAUNCHER_STATE_BACKGROUND, true, - GestureStateProto.GestureEndTarget.NEW_TASK), + NEW_TASK(false, LAUNCHER_STATE_BACKGROUND, true), - LAST_TASK(false, LAUNCHER_STATE_BACKGROUND, true, - GestureStateProto.GestureEndTarget.LAST_TASK), + LAST_TASK(false, LAUNCHER_STATE_BACKGROUND, true), - ALL_APPS(true, LAUNCHER_STATE_ALLAPPS, false, GestureStateProto.GestureEndTarget.ALL_APPS); + ALL_APPS(true, LAUNCHER_STATE_ALLAPPS, false); - GestureEndTarget(boolean isLauncher, int containerType, boolean recentsAttachedToAppWindow, - GestureStateProto.GestureEndTarget protoEndTarget) { + GestureEndTarget(boolean isLauncher, int containerType, + boolean recentsAttachedToAppWindow) { this.isLauncher = isLauncher; this.containerType = containerType; this.recentsAttachedToAppWindow = recentsAttachedToAppWindow; - this.protoEndTarget = protoEndTarget; } /** Whether the target is in the launcher activity. Implicitly, if the end target is going @@ -89,8 +84,6 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL public final int containerType; /** Whether RecentsView should be attached to the window as we animate to this target */ 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"; @@ -489,17 +482,4 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL pw.println(" lastStartedTaskId=" + mLastStartedTaskId); 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); - } } diff --git a/quickstep/src/com/android/quickstep/InputConsumer.java b/quickstep/src/com/android/quickstep/InputConsumer.java index 207110328d..23def14515 100644 --- a/quickstep/src/com/android/quickstep/InputConsumer.java +++ b/quickstep/src/com/android/quickstep/InputConsumer.java @@ -21,9 +21,6 @@ import android.view.InputEvent; import android.view.KeyEvent; import android.view.MotionEvent; -import com.android.launcher3.tracing.InputConsumerProto; -import com.android.launcher3.tracing.TouchInteractionServiceProto; - @TargetApi(Build.VERSION_CODES.O) public interface InputConsumer { @@ -129,21 +126,4 @@ public interface InputConsumer { } 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) {} } diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index a8f3c3af46..60713cf28f 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -38,8 +38,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.R; -import com.android.launcher3.tracing.OverviewComponentObserverProto; -import com.android.launcher3.tracing.TouchInteractionServiceProto; import com.android.launcher3.util.SimpleBroadcastReceiver; import com.android.systemui.shared.system.PackageManagerWrapper; @@ -275,19 +273,6 @@ public final class OverviewComponentObserver { 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); - } - /** * Starts the intent for the current home activity. */ diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index b5c0f7ddd9..a1ecaeb33a 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -92,8 +92,6 @@ import com.android.launcher3.taskbar.TaskbarManager; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.ResourceUtils; import com.android.launcher3.testing.shared.TestProtocol; -import com.android.launcher3.tracing.LauncherTraceProto; -import com.android.launcher3.tracing.TouchInteractionServiceProto; import com.android.launcher3.uioverrides.flags.FlagsFactory; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; import com.android.launcher3.util.DisplayController; @@ -117,7 +115,6 @@ import com.android.quickstep.inputconsumers.TaskbarUnstashInputConsumer; import com.android.quickstep.inputconsumers.TrackpadStatusBarInputConsumer; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActiveGestureLog.CompoundString; -import com.android.quickstep.util.ProtoTracer; import com.android.quickstep.util.ProxyScreenStatusProvider; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; @@ -126,7 +123,6 @@ import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.InputMonitorCompat; import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController; -import com.android.systemui.shared.tracing.ProtoTraceable; import com.android.systemui.unfold.progress.IUnfoldAnimation; import com.android.wm.shell.back.IBackAnimation; import com.android.wm.shell.bubbles.IBubbles; @@ -149,8 +145,7 @@ import java.util.function.Function; * Service connected by system-UI for handling touch interaction. */ @TargetApi(Build.VERSION_CODES.R) -public class TouchInteractionService extends Service - implements ProtoTraceable { +public class TouchInteractionService extends Service { private static final String SUBSTRING_PREFIX = "; "; private static final String NEWLINE_PREFIX = "\n\t\t\t-> "; @@ -491,8 +486,6 @@ public class TouchInteractionService extends Service LockedUserState.get(this).runOnUserUnlocked(this::onUserUnlocked); LockedUserState.get(this).runOnUserUnlocked(mTaskbarManager::onUserUnlocked); mDeviceState.addNavigationModeChangedCallback(this::onNavigationModeChanged); - - ProtoTracer.INSTANCE.get(this).add(this); sConnected = true; } @@ -617,19 +610,6 @@ public class TouchInteractionService extends Service // overview. mTaskAnimationManager.endLiveTile(); } - - if ((lastSysUIFlags & SYSUI_STATE_TRACING_ENABLED) != - (systemUiStateFlags & SYSUI_STATE_TRACING_ENABLED)) { - // Update the tracing state - if ((systemUiStateFlags & SYSUI_STATE_TRACING_ENABLED) != 0) { - Log.d(TAG, "Starting tracing."); - ProtoTracer.INSTANCE.get(this).start(); - } else { - Log.d(TAG, "Stopping tracing. Dumping to file=" - + ProtoTracer.INSTANCE.get(this).getTraceFile()); - ProtoTracer.INSTANCE.get(this).stop(); - } - } } } @@ -652,8 +632,6 @@ public class TouchInteractionService extends Service disposeEventHandlers("TouchInteractionService onDestroy()"); mDeviceState.destroy(); SystemUiProxy.INSTANCE.get(this).clearProxy(); - ProtoTracer.INSTANCE.get(this).stop(); - ProtoTracer.INSTANCE.get(this).remove(this); getSystemService(AccessibilityManager.class) .unregisterSystemAction(GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS); @@ -781,7 +759,6 @@ public class TouchInteractionService extends Service reset(); } traceToken.close(); - ProtoTracer.INSTANCE.get(this).scheduleFrameUpdate(); } private InputConsumer tryCreateAssistantInputConsumer( @@ -1302,8 +1279,6 @@ public class TouchInteractionService extends Service pw.println(" mConsumer=" + mConsumer.getName()); ActiveGestureLog.INSTANCE.dump("", pw); RecentsModel.INSTANCE.get(this).dump("", pw); - pw.println("ProtoTrace:"); - pw.println(" file=" + ProtoTracer.INSTANCE.get(this).getTraceFile()); if (createdOverviewActivity != null) { createdOverviewActivity.getDeviceProfile().dump(this, "", pw); } @@ -1323,18 +1298,4 @@ public class TouchInteractionService extends Service gestureState, touchTimeMs, mTaskAnimationManager.isRecentsAnimationRunning(), mInputConsumer); } - - @Override - public void writeToProto(LauncherTraceProto.Builder proto) { - TouchInteractionServiceProto.Builder serviceProto = - TouchInteractionServiceProto.newBuilder(); - serviceProto.setServiceConnected(true); - - if (mOverviewComponentObserver != null) { - mOverviewComponentObserver.writeToProto(serviceProto); - } - mConsumer.writeToProto(serviceProto); - - proto.setTouchInteractionService(serviceProto); - } } diff --git a/quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java index 03f8eef077..858999e40e 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java @@ -4,7 +4,6 @@ import android.view.MotionEvent; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.TestProtocol; -import com.android.launcher3.tracing.InputConsumerProto; import com.android.quickstep.InputConsumer; import com.android.systemui.shared.system.InputMonitorCompat; @@ -54,9 +53,4 @@ public abstract class DelegateInputConsumer implements InputConsumer { mDelegate.onMotionEvent(event); event.recycle(); } - - @Override - public void writeToProtoInternal(InputConsumerProto.Builder inputConsumerProto) { - mDelegate.writeToProtoInternal(inputConsumerProto); - } } diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index 10c6316ac1..281622882a 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -48,7 +48,6 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.TestProtocol; -import com.android.launcher3.tracing.InputConsumerProto; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.TraceHelper; import com.android.quickstep.AbsSwipeUpHandler; @@ -509,13 +508,6 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC return !mPassedPilferInputSlop; } - @Override - public void writeToProtoInternal(InputConsumerProto.Builder inputConsumerProto) { - if (mInteractionHandler != null) { - mInteractionHandler.writeToProto(inputConsumerProto); - } - } - /** * A listener which just finishes the animation immediately after starting. Replaces * AbsSwipeUpHandler if the gesture itself finishes before the animation even starts. diff --git a/quickstep/src/com/android/quickstep/util/ProtoTracer.java b/quickstep/src/com/android/quickstep/util/ProtoTracer.java deleted file mode 100644 index ef9586d693..0000000000 --- a/quickstep/src/com/android/quickstep/util/ProtoTracer.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.quickstep.util; - -import static com.android.launcher3.tracing.LauncherTraceFileProto.MagicNumber.MAGIC_NUMBER_H_VALUE; -import static com.android.launcher3.tracing.LauncherTraceFileProto.MagicNumber.MAGIC_NUMBER_L_VALUE; - -import android.content.Context; -import android.os.SystemClock; - -import android.os.Trace; -import com.android.launcher3.tracing.LauncherTraceProto; -import com.android.launcher3.tracing.LauncherTraceEntryProto; -import com.android.launcher3.tracing.LauncherTraceFileProto; -import com.android.launcher3.util.MainThreadInitializedObject; -import com.android.systemui.shared.tracing.FrameProtoTracer; -import com.android.systemui.shared.tracing.FrameProtoTracer.ProtoTraceParams; -import com.android.systemui.shared.tracing.ProtoTraceable; -import com.google.protobuf.MessageLite; - -import java.io.File; -import java.util.ArrayList; -import java.util.Queue; - - -/** - * Controller for coordinating winscope proto tracing. - */ -public class ProtoTracer implements ProtoTraceParams { - - public static final MainThreadInitializedObject INSTANCE = - new MainThreadInitializedObject<>(ProtoTracer::new); - - private static final String TAG = "ProtoTracer"; - private static final long MAGIC_NUMBER_VALUE = - ((long) MAGIC_NUMBER_H_VALUE << 32) | MAGIC_NUMBER_L_VALUE; - - private final Context mContext; - private final FrameProtoTracer mProtoTracer; - - public ProtoTracer(Context context) { - mContext = context; - mProtoTracer = new FrameProtoTracer<>(this); - } - - @Override - public File getTraceFile() { - return new File(mContext.getFilesDir(), "launcher_trace.pb"); - } - - @Override - public LauncherTraceFileProto.Builder getEncapsulatingTraceProto() { - return LauncherTraceFileProto.newBuilder(); - } - - @Override - public LauncherTraceEntryProto.Builder updateBufferProto( - LauncherTraceEntryProto.Builder reuseObj, - ArrayList> traceables) { - Trace.beginSection("ProtoTracer.updateBufferProto"); - LauncherTraceEntryProto.Builder proto = LauncherTraceEntryProto.newBuilder(); - proto.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos()); - LauncherTraceProto.Builder launcherProto = LauncherTraceProto.newBuilder(); - for (ProtoTraceable t : traceables) { - t.writeToProto(launcherProto); - } - proto.setLauncher(launcherProto); - Trace.endSection(); - return proto; - } - - @Override - public byte[] serializeEncapsulatingProto(LauncherTraceFileProto.Builder encapsulatingProto, - Queue buffer) { - Trace.beginSection("ProtoTracer.serializeEncapsulatingProto"); - encapsulatingProto.setMagicNumber(MAGIC_NUMBER_VALUE); - for (LauncherTraceEntryProto.Builder entry : buffer) { - encapsulatingProto.addEntry(entry); - } - byte[] bytes = encapsulatingProto.build().toByteArray(); - Trace.endSection(); - return bytes; - } - - @Override - public byte[] getProtoBytes(MessageLite.Builder proto) { - return proto.build().toByteArray(); - } - - @Override - public int getProtoSize(MessageLite.Builder proto) { - return proto.build().getSerializedSize(); - } - - public void start() { - mProtoTracer.start(); - } - - public void stop() { - mProtoTracer.stop(); - } - - public void add(ProtoTraceable traceable) { - mProtoTracer.add(traceable); - } - - public void remove(ProtoTraceable traceable) { - mProtoTracer.remove(traceable); - } - - public void scheduleFrameUpdate() { - mProtoTracer.scheduleFrameUpdate(); - } - - public void update() { - mProtoTracer.update(); - } -}