Merge "Remove legacy unused proto tracing code to prevent confusion" into udc-qpr-dev am: 7d58acf943

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23987649

Change-Id: I4488871ff653fbfa31015dfa624e156c8d6e64c2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Winson Chung
2023-07-12 23:57:16 +00:00
committed by Automerger Merge Worker
8 changed files with 8 additions and 275 deletions
@@ -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<T extends StatefulActivity<S>,
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<T extends StatefulActivity<S>,
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);
}
@@ -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);
}
}
@@ -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) {}
}
@@ -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.
*/
@@ -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<LauncherTraceProto.Builder> {
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);
}
}
@@ -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);
}
}
@@ -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.
@@ -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<MessageLite.Builder,
LauncherTraceFileProto.Builder, LauncherTraceEntryProto.Builder,
LauncherTraceProto.Builder> {
public static final MainThreadInitializedObject<ProtoTracer> 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<MessageLite.Builder, LauncherTraceFileProto.Builder,
LauncherTraceEntryProto.Builder, LauncherTraceProto.Builder> 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<ProtoTraceable<LauncherTraceProto.Builder>> 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<LauncherTraceEntryProto.Builder> 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<LauncherTraceProto.Builder> traceable) {
mProtoTracer.add(traceable);
}
public void remove(ProtoTraceable<LauncherTraceProto.Builder> traceable) {
mProtoTracer.remove(traceable);
}
public void scheduleFrameUpdate() {
mProtoTracer.scheduleFrameUpdate();
}
public void update() {
mProtoTracer.update();
}
}