Merge "Adding tracing for switching to overview instead of all apps" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot
2020-05-08 18:39:39 +00:00
committed by Android (Google) Code Review
5 changed files with 23 additions and 2 deletions
@@ -36,6 +36,7 @@ import android.content.Context;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.UserHandle;
import android.util.Log;
import android.util.Pair;
import android.view.MotionEvent;
import android.view.View;
@@ -55,6 +56,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.SysUINavigationMode.Mode;
@@ -383,6 +385,9 @@ public final class LauncherActivityInterface implements BaseActivityInterface<La
@Override
public boolean switchToRecentsIfVisible(Runnable onCompleteCallback) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "switchToRecentsIfVisible");
}
Launcher launcher = getVisibleLauncher();
if (launcher == null) {
return false;
@@ -25,12 +25,14 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.states.StateAnimationConfig.AnimationFlags;
import com.android.launcher3.testing.TestProtocol;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -334,6 +336,10 @@ public class LauncherStateManager {
}
private PendingAnimation createAnimationToNewWorkspaceInternal(final LauncherState state) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "createAnimationToNewWorkspaceInternal: "
+ state.ordinal);
}
PendingAnimation builder = new PendingAnimation(mConfig.duration);
for (StateHandler handler : getStateHandlers()) {
handler.setStateWithAnimation(state, mConfig, builder);
@@ -348,6 +354,9 @@ public class LauncherStateManager {
@Override
public void onAnimationSuccess(Animator animator) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "onAnimationSuccess: " + state.ordinal);
}
onStateTransitionEnd(state);
}
});
@@ -100,4 +100,5 @@ public final class TestProtocol {
public static final String PERMANENT_DIAG_TAG = "TaplTarget";
public static final String PAUSE_NOT_DETECTED = "b/139891609";
public static final String OVERIEW_NOT_ALLAPPS = "b/156095088";
}
@@ -31,6 +31,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.os.SystemClock;
import android.util.Log;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
@@ -43,6 +44,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.states.StateAnimationConfig.AnimationFlags;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -194,6 +196,10 @@ public abstract class AbstractStateChangeTouchController
mFromState = newFromState;
mToState = newToState;
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "reinitCurrentAnimation: "
+ newToState.ordinal);
}
mStartProgress = 0;
mPassedOverviewAtomicThreshold = false;
@@ -937,9 +937,9 @@ public final class LauncherInstrumentation {
executeAndWaitForEvent(
command,
event -> isSwitchToStateEvent(event, expectedState, actualEvents),
() -> "Failed to receive an event for the state change: expected "
() -> "Failed to receive an event for the state change: expected ["
+ TestProtocol.stateOrdinalToString(expectedState)
+ ", actual: " + eventListToString(actualEvents));
+ "], actual: " + eventListToString(actualEvents));
}
private boolean isSwitchToStateEvent(