Merge cherrypicks of ['googleplex-android-review.googlesource.com/30844048', 'googleplex-android-review.googlesource.com/30866743'] into 25Q1-release.

Change-Id: I503218c9ff1f4996b5db627d70b2f4a90ca389a9
This commit is contained in:
Android Build Coastguard Worker
2024-12-16 19:50:28 -08:00
5 changed files with 127 additions and 89 deletions
@@ -3900,25 +3900,40 @@ public abstract class RecentsView<
: distanceFromDismissedTask;
// Set timings based on if user is initiating splitscreen on the focused task,
// or splitting/dismissing some other task.
float animationStartProgress = isSlidingTasks
? Utilities.boundToRange(
splitTimings.getGridSlideStartOffset()
+ (splitTimings.getGridSlideStaggerOffset()
* staggerColumn),
0f,
dismissTranslationInterpolationEnd)
: Utilities.boundToRange(
INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET
+ ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET
* staggerColumn, 0f, dismissTranslationInterpolationEnd);
float animationEndProgress = isSlidingTasks
? Utilities.boundToRange(
splitTimings.getGridSlideStartOffset()
+ (splitTimings.getGridSlideStaggerOffset() * staggerColumn)
+ splitTimings.getGridSlideDurationOffset(),
0f,
dismissTranslationInterpolationEnd)
: dismissTranslationInterpolationEnd;
final float animationStartProgress;
if (isSlidingTasks) {
float slidingStartOffset = splitTimings.getGridSlideStartOffset()
+ (splitTimings.getGridSlideStaggerOffset() * staggerColumn);
if (areAllDesktopTasksDismissed) {
animationStartProgress = Utilities.boundToRange(
slidingStartOffset
+ splitTimings.getDesktopFadeSplitAnimationEndOffset(),
0f,
dismissTranslationInterpolationEnd);
} else {
animationStartProgress = Utilities.boundToRange(
slidingStartOffset,
0f,
dismissTranslationInterpolationEnd);
}
} else {
animationStartProgress = Utilities.boundToRange(
INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET
+ ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET
* staggerColumn, 0f, dismissTranslationInterpolationEnd);
}
final float animationEndProgress;
if (isSlidingTasks && taskView != nextFocusedTaskView) {
animationEndProgress = Utilities.boundToRange(
splitTimings.getGridSlideStartOffset()
+ (splitTimings.getGridSlideStaggerOffset() * staggerColumn)
+ splitTimings.getGridSlideDurationOffset(),
0f,
dismissTranslationInterpolationEnd);
} else {
animationEndProgress = dismissTranslationInterpolationEnd;
}
Interpolator dismissInterpolator = isSlidingTasks ? EMPHASIZED : LINEAR;
@@ -3930,7 +3945,6 @@ public abstract class RecentsView<
clampToProgress(LINEAR, animationStartProgress,
dismissTranslationInterpolationEnd));
primaryTranslation += dismissedTaskWidth;
animationEndProgress = dismissTranslationInterpolationEnd;
float secondaryTranslation = -mTaskGridVerticalDiff;
if (!nextFocusedTaskFromTop) {
secondaryTranslation -= mTopBottomRowHeightDiff;
@@ -3958,11 +3972,6 @@ public abstract class RecentsView<
startTranslation = isTaskViewVisible(taskView) ? 0
: finalTranslation + (mIsRtl ? -mLastComputedTaskSize.right
: mLastComputedTaskSize.right);
animationStartProgress = Utilities.boundToRange(
animationStartProgress
+ splitTimings.getDesktopFadeSplitAnimationEndOffset(),
0f,
dismissTranslationInterpolationEnd);
}
Animator dismissAnimator = ObjectAnimator.ofFloat(taskView,
taskView.getPrimaryDismissTranslationProperty(),
@@ -18,6 +18,7 @@ package com.android.launcher3.util;
import static com.android.launcher3.Flags.enableStateManagerProtoLog;
import static com.android.quickstep.util.QuickstepProtoLogGroup.LAUNCHER_STATE_MANAGER;
import static com.android.quickstep.util.QuickstepProtoLogGroup.isProtoLogInitialized;
import androidx.annotation.NonNull;
@@ -30,7 +31,7 @@ public class StateManagerProtoLogProxy {
public static void logGoToState(
@NonNull Object fromState, @NonNull Object toState, @NonNull String trace) {
if (!enableStateManagerProtoLog()) return;
if (!enableStateManagerProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(LAUNCHER_STATE_MANAGER,
"StateManager.goToState: fromState: %s, toState: %s, partial trace:\n%s",
fromState,
@@ -40,7 +41,7 @@ public class StateManagerProtoLogProxy {
public static void logCreateAtomicAnimation(
@NonNull Object fromState, @NonNull Object toState, @NonNull String trace) {
if (!enableStateManagerProtoLog()) return;
if (!enableStateManagerProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(LAUNCHER_STATE_MANAGER, "StateManager.createAtomicAnimation: "
+ "fromState: %s, toState: %s, partial trace:\n%s",
fromState,
@@ -49,17 +50,17 @@ public class StateManagerProtoLogProxy {
}
public static void logOnStateTransitionStart(@NonNull Object state) {
if (!enableStateManagerProtoLog()) return;
if (!enableStateManagerProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(LAUNCHER_STATE_MANAGER, "StateManager.onStateTransitionStart: state: %s", state);
}
public static void logOnStateTransitionEnd(@NonNull Object state) {
if (!enableStateManagerProtoLog()) return;
if (!enableStateManagerProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(LAUNCHER_STATE_MANAGER, "StateManager.onStateTransitionEnd: state: %s", state);
}
public static void logCancelAnimation(boolean animationOngoing, @NonNull String trace) {
if (!enableStateManagerProtoLog()) return;
if (!enableStateManagerProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(LAUNCHER_STATE_MANAGER,
"StateManager.cancelAnimation: animation ongoing: %b, partial trace:\n%s",
animationOngoing,
@@ -37,6 +37,7 @@ import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION;
import static com.android.quickstep.util.QuickstepProtoLogGroup.ACTIVE_GESTURE_LOG;
import static com.android.quickstep.util.QuickstepProtoLogGroup.isProtoLogInitialized;
import android.graphics.Point;
import android.graphics.RectF;
@@ -62,7 +63,7 @@ public class ActiveGestureProtoLogProxy {
public static void logLauncherDestroyed() {
ActiveGestureLog.INSTANCE.addLog("Launcher destroyed", LAUNCHER_DESTROYED);
if (!enableActiveGestureProtoLog()) return;
if (isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "Launcher destroyed");
}
@@ -70,7 +71,7 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(
/* event= */ "AbsSwipeUpHandler.onRecentsAnimationCanceled",
/* gestureEvent= */ CANCEL_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "AbsSwipeUpHandler.onRecentsAnimationCanceled");
}
@@ -78,7 +79,7 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(
/* event= */ "RecentsAnimationCallbacks.onAnimationFinished",
ON_FINISH_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "AbsSwipeUpHandler.onAnimationFinished");
}
@@ -86,27 +87,27 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(
"AbsSwipeUpHandler.cancelCurrentAnimation",
ActiveGestureErrorDetector.GestureEvent.CANCEL_CURRENT_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "AbsSwipeUpHandler.cancelCurrentAnimation");
}
public static void logAbsSwipeUpHandlerOnTasksAppeared() {
ActiveGestureLog.INSTANCE.addLog("AbsSwipeUpHandler.onTasksAppeared: "
+ "force finish recents animation complete; clearing state callback.");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "AbsSwipeUpHandler.onTasksAppeared: "
+ "force finish recents animation complete; clearing state callback.");
}
public static void logHandOffAnimation() {
ActiveGestureLog.INSTANCE.addLog("AbsSwipeUpHandler.handOffAnimation");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "AbsSwipeUpHandler.handOffAnimation");
}
public static void logFinishRecentsAnimationOnTasksAppeared() {
ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimationOnTasksAppeared");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "finishRecentsAnimationOnTasksAppeared");
}
@@ -114,14 +115,14 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(
/* event= */ "RecentsAnimationCallbacks.onAnimationCanceled",
/* gestureEvent= */ ON_CANCEL_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "RecentsAnimationCallbacks.onAnimationCanceled");
}
public static void logRecentsAnimationCallbacksOnTasksAppeared() {
ActiveGestureLog.INSTANCE.addLog("RecentsAnimationCallbacks.onTasksAppeared",
ActiveGestureErrorDetector.GestureEvent.TASK_APPEARED);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "RecentsAnimationCallbacks.onTasksAppeared");
}
@@ -129,39 +130,39 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(
/* event= */ "TaskAnimationManager.startRecentsAnimation",
/* gestureEvent= */ START_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "TaskAnimationManager.startRecentsAnimation");
}
public static void logLaunchingSideTaskFailed() {
ActiveGestureLog.INSTANCE.addLog("Unable to launch side task (no recents)");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "Unable to launch side task (no recents)");
}
public static void logContinueRecentsAnimation() {
ActiveGestureLog.INSTANCE.addLog(/* event= */ "continueRecentsAnimation");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "continueRecentsAnimation");
}
public static void logCleanUpRecentsAnimationSkipped() {
ActiveGestureLog.INSTANCE.addLog(
/* event= */ "cleanUpRecentsAnimation skipped due to wrong callbacks");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "cleanUpRecentsAnimation skipped due to wrong callbacks");
}
public static void logCleanUpRecentsAnimation() {
ActiveGestureLog.INSTANCE.addLog(/* event= */ "cleanUpRecentsAnimation");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "cleanUpRecentsAnimation");
}
public static void logOnInputEventUserLocked() {
ActiveGestureLog.INSTANCE.addLog(
"TIS.onInputEvent: Cannot process input event: user is locked");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"TIS.onInputEvent: Cannot process input event: user is locked");
}
@@ -171,7 +172,7 @@ public class ActiveGestureProtoLogProxy {
+ "but a previously-requested recents animation hasn't started. "
+ "Ignoring all following motion events.",
RECENTS_ANIMATION_START_PENDING);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onMotionEvent: A new gesture has been started, "
+ "but a previously-requested recents animation hasn't started. "
+ "Ignoring all following motion events.");
@@ -180,53 +181,53 @@ public class ActiveGestureProtoLogProxy {
public static void logOnInputEventThreeButtonNav() {
ActiveGestureLog.INSTANCE.addLog("TIS.onInputEvent: Cannot process input event: "
+ "using 3-button nav and event is not a trackpad event");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onInputEvent: Cannot process input event: "
+ "using 3-button nav and event is not a trackpad event");
}
public static void logPreloadRecentsAnimation() {
ActiveGestureLog.INSTANCE.addLog("preloadRecentsAnimation");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "preloadRecentsAnimation");
}
public static void logRecentTasksMissing() {
ActiveGestureLog.INSTANCE.addLog("Null mRecentTasks", RECENT_TASKS_MISSING);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "Null mRecentTasks");
}
public static void logExecuteHomeCommand() {
ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(HOME)");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "OverviewCommandHelper.executeCommand(HOME)");
}
public static void logFinishRecentsAnimationCallback() {
ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation-callback");
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "finishRecentsAnimation-callback");
}
public static void logOnScrollerAnimationAborted() {
ActiveGestureLog.INSTANCE.addLog("scroller animation aborted",
ActiveGestureErrorDetector.GestureEvent.SCROLLER_ANIMATION_ABORTED);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "scroller animation aborted");
}
public static void logInputConsumerBecameActive(@NonNull String consumerName) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"%s became active", consumerName));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "%s became active", consumerName);
}
public static void logTaskLaunchFailed(int launchedTaskId) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"Launch failed, task (id=%d) finished mid transition", launchedTaskId));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"Launch failed, task (id=%d) finished mid transition", launchedTaskId);
}
@@ -234,7 +235,7 @@ public class ActiveGestureProtoLogProxy {
public static void logOnPageEndTransition(int nextPageIndex) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"onPageEndTransition: current page index updated: %d", nextPageIndex));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"onPageEndTransition: current page index updated: %d", nextPageIndex);
}
@@ -244,7 +245,7 @@ public class ActiveGestureProtoLogProxy {
"Quick switch from home fallback case: The TaskView at index %d is missing.",
taskIndex),
QUICK_SWITCH_FROM_HOME_FALLBACK);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"Quick switch from home fallback case: The TaskView at index %d is missing.",
taskIndex);
@@ -255,7 +256,7 @@ public class ActiveGestureProtoLogProxy {
"Quick switch from home failed: TaskViews at indices %d and 0 are missing.",
taskIndex),
QUICK_SWITCH_FROM_HOME_FAILED);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"Quick switch from home failed: TaskViews at indices %d and 0 are missing.",
taskIndex);
@@ -265,42 +266,42 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"finishRecentsAnimation: %b", toRecents),
/* gestureEvent= */ FINISH_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "finishRecentsAnimation: %b", toRecents);
}
public static void logSetEndTarget(@NonNull String target) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"setEndTarget %s", target), /* gestureEvent= */ SET_END_TARGET);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "setEndTarget %s", target);
}
public static void logStartHomeIntent(@NonNull String reason) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"OverviewComponentObserver.startHomeIntent: %s", reason));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "OverviewComponentObserver.startHomeIntent: %s", reason);
}
public static void logRunningTaskPackage(@NonNull String packageName) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"Current running task package name=%s", packageName));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "Current running task package name=%s", packageName);
}
public static void logSysuiStateFlags(@NonNull String stateFlags) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"Current SystemUi state flags=%s", stateFlags));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "Current SystemUi state flags=%s", stateFlags);
}
public static void logSetInputConsumer(@NonNull String consumerName, @NonNull String reason) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"setInputConsumer: %s. reason(s):%s", consumerName, reason));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"setInputConsumer: %s. reason(s):%s", consumerName, reason);
}
@@ -312,7 +313,7 @@ public class ActiveGestureProtoLogProxy {
+ "one (%s) was excluded from recents",
otherTaskPackage,
runningTaskPackage));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"Changing active task to %s because the previous task running on top of this "
+ "one (%s) was excluded from recents",
@@ -328,7 +329,7 @@ public class ActiveGestureProtoLogProxy {
/* gestureEvent= */ action == ACTION_DOWN
? MOTION_DOWN
: MOTION_UP);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"onMotionEvent(%d, %d): %s, %s", x, y, actionString, classification);
}
@@ -341,7 +342,7 @@ public class ActiveGestureProtoLogProxy {
classification,
pointerCount),
MOTION_MOVE);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"onMotionEvent: %s, %s, pointerCount: %d", action, classification, pointerCount);
}
@@ -350,7 +351,7 @@ public class ActiveGestureProtoLogProxy {
@NonNull String action, @NonNull String classification) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"onMotionEvent: %s, %s", action, classification));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "onMotionEvent: %s, %s", action, classification);
}
@@ -362,7 +363,7 @@ public class ActiveGestureProtoLogProxy {
startNavMode,
currentNavMode),
NAVIGATION_MODE_SWITCHED);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"TIS.onInputEvent: Navigation mode switched mid-gesture (%s -> %s); "
+ "cancelling gesture.",
@@ -373,7 +374,7 @@ public class ActiveGestureProtoLogProxy {
public static void logUnknownInputEvent(@NonNull String event) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"TIS.onInputEvent: Cannot process input event: received unknown event %s", event));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"TIS.onInputEvent: Cannot process input event: received unknown event %s", event);
}
@@ -381,14 +382,14 @@ public class ActiveGestureProtoLogProxy {
public static void logFinishRunningRecentsAnimation(boolean toHome) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"finishRunningRecentsAnimation: %b", toHome));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "finishRunningRecentsAnimation: %b", toHome);
}
public static void logOnRecentsAnimationStartCancelled() {
ActiveGestureLog.INSTANCE.addLog("RecentsAnimationCallbacks.onAnimationStart (canceled): 0",
/* gestureEvent= */ ON_START_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "RecentsAnimationCallbacks.onAnimationStart (canceled): 0");
}
@@ -396,7 +397,7 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"RecentsAnimationCallbacks.onAnimationStart (canceled): %d", appCount),
/* gestureEvent= */ ON_START_RECENTS_ANIMATION);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"RecentsAnimationCallbacks.onAnimationStart (canceled): %d", appCount);
}
@@ -406,7 +407,7 @@ public class ActiveGestureProtoLogProxy {
"TaskAnimationManager.startRecentsAnimation(%s): "
+ "Setting mRecentsAnimationStartPending = false",
callback));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"TaskAnimationManager.startRecentsAnimation(%s): "
+ "Setting mRecentsAnimationStartPending = false",
@@ -418,7 +419,7 @@ public class ActiveGestureProtoLogProxy {
"TaskAnimationManager.startRecentsAnimation: "
+ "Setting mRecentsAnimationStartPending = %b",
value));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"TaskAnimationManager.startRecentsAnimation: "
+ "Setting mRecentsAnimationStartPending = %b",
@@ -428,28 +429,28 @@ public class ActiveGestureProtoLogProxy {
public static void logLaunchingSideTask(int taskId) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"Launching side task id=%d", taskId));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "Launching side task id=%d", taskId);
}
public static void logOnInputEventActionDown(@NonNull ActiveGestureLog.CompoundString reason) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"TIS.onMotionEvent: ").append(reason));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onMotionEvent: %s", reason.toString());
}
public static void logStartNewTask(@NonNull ActiveGestureLog.CompoundString tasks) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"Launching task: ").append(tasks));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "TIS.onMotionEvent: %s", tasks.toString());
}
public static void logMotionPauseDetectorEvent(@NonNull ActiveGestureLog.CompoundString event) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"MotionPauseDetector: ").append(event));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "MotionPauseDetector: %s", event.toString());
}
@@ -457,7 +458,7 @@ public class ActiveGestureProtoLogProxy {
@NonNull ActiveGestureLog.CompoundString reason) {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"handleTaskAppeared check failed: ").append(reason));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "handleTaskAppeared check failed: %s", reason.toString());
}
@@ -469,7 +470,7 @@ public class ActiveGestureProtoLogProxy {
@NonNull String string,
@Nullable ActiveGestureErrorDetector.GestureEvent gestureEvent) {
ActiveGestureLog.INSTANCE.addLog(string, gestureEvent);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "%s", string);
}
@@ -477,7 +478,7 @@ public class ActiveGestureProtoLogProxy {
ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString(
"onSettledOnEndTarget %s", endTarget),
/* gestureEvent= */ ON_SETTLED_ON_END_TARGET);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG, "onSettledOnEndTarget %s", endTarget);
}
@@ -488,7 +489,7 @@ public class ActiveGestureProtoLogProxy {
velocityY,
angle),
velocityX == 0 && velocityY == 0 ? INVALID_VELOCITY_ON_SWIPE_UP : null);
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"calculateEndTarget: velocities=(x=%fdp/ms, y=%fdp/ms), angle=%f",
velocityX,
@@ -501,7 +502,7 @@ public class ActiveGestureProtoLogProxy {
"Forcefully finishing recents animation: Unexpected task appeared id=%d, pkg=%s",
taskId,
packageName));
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"Forcefully finishing recents animation: Unexpected task appeared id=%d, pkg=%s",
taskId,
@@ -511,7 +512,7 @@ public class ActiveGestureProtoLogProxy {
public static void logCreateTouchRegionForDisplay(int displayRotation,
@NonNull Point displaySize, @NonNull RectF swipeRegion, @NonNull RectF ohmRegion,
int gesturalHeight, int largerGesturalHeight, @NonNull String reason) {
if (!enableActiveGestureProtoLog()) return;
if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(ACTIVE_GESTURE_LOG,
"OrientationTouchTransformer.createRegionForDisplay: "
+ "dispRot=%d, dispSize=%s, swipeRegion=%s, ohmRegion=%s, "
@@ -16,6 +16,8 @@
package com.android.quickstep.util;
import android.util.Log;
import androidx.annotation.NonNull;
import com.android.internal.protolog.ProtoLog;
@@ -26,7 +28,7 @@ import java.util.UUID;
/** Enums used to interface with the ProtoLog API. */
public enum QuickstepProtoLogGroup implements IProtoLogGroup {
ACTIVE_GESTURE_LOG(true, true, false, "ActiveGestureLog"),
ACTIVE_GESTURE_LOG(true, true, Constants.DEBUG_ACTIVE_GESTURE, "ActiveGestureLog"),
RECENTS_WINDOW(true, true, Constants.DEBUG_RECENTS_WINDOW, "RecentsWindow"),
LAUNCHER_STATE_MANAGER(true, true, Constants.DEBUG_STATE_MANAGER, "LauncherStateManager");
@@ -35,7 +37,23 @@ public enum QuickstepProtoLogGroup implements IProtoLogGroup {
private volatile boolean mLogToLogcat;
private final @NonNull String mTag;
public static boolean isProtoLogInitialized() {
if (!Variables.sIsInitialized) {
Log.w(Constants.TAG,
"Attempting to log to ProtoLog before initializing it.",
new IllegalStateException());
}
return Variables.sIsInitialized;
}
public static void initProtoLog() {
if (Variables.sIsInitialized) {
Log.e(Constants.TAG,
"Attempting to re-initialize ProtoLog.", new IllegalStateException());
return;
}
Log.i(Constants.TAG, "Initializing ProtoLog.");
Variables.sIsInitialized = true;
ProtoLog.init(QuickstepProtoLogGroup.values());
}
@@ -95,8 +113,16 @@ public enum QuickstepProtoLogGroup implements IProtoLogGroup {
this.mLogToLogcat = logToLogcat;
}
private static final class Variables {
private static boolean sIsInitialized = false;
}
private static final class Constants {
private static final String TAG = "QuickstepProtoLogGroup";
private static final boolean DEBUG_ACTIVE_GESTURE = false;
private static final boolean DEBUG_RECENTS_WINDOW = false;
private static final boolean DEBUG_STATE_MANAGER = true; // b/279059025, b/325463989
@@ -18,6 +18,7 @@ package com.android.quickstep.util;
import static com.android.launcher3.Flags.enableRecentsWindowProtoLog;
import static com.android.quickstep.util.QuickstepProtoLogGroup.RECENTS_WINDOW;
import static com.android.quickstep.util.QuickstepProtoLogGroup.isProtoLogInitialized;
import androidx.annotation.NonNull;
@@ -36,17 +37,17 @@ import com.android.internal.protolog.common.IProtoLogGroup;
public class RecentsWindowProtoLogProxy {
public static void logOnStateSetStart(@NonNull String stateName) {
if (!enableRecentsWindowProtoLog()) return;
if (!enableRecentsWindowProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(RECENTS_WINDOW, "onStateSetStart: %s", stateName);
}
public static void logOnStateSetEnd(@NonNull String stateName) {
if (!enableRecentsWindowProtoLog()) return;
if (!enableRecentsWindowProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(RECENTS_WINDOW, "onStateSetEnd: %s", stateName);
}
public static void logStartRecentsWindow(boolean isShown, boolean windowViewIsNull) {
if (!enableRecentsWindowProtoLog()) return;
if (!enableRecentsWindowProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(RECENTS_WINDOW,
"Starting recents window: isShow= %b, windowViewIsNull=%b",
isShown,
@@ -54,7 +55,7 @@ public class RecentsWindowProtoLogProxy {
}
public static void logCleanup(boolean isShown) {
if (!enableRecentsWindowProtoLog()) return;
if (!enableRecentsWindowProtoLog() || !isProtoLogInitialized()) return;
ProtoLog.d(RECENTS_WINDOW, "Cleaning up recents window: isShow= %b", isShown);
}
}