From 642559bbf3e4a0bec675c41f182c0f45669f6ccc Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 1 Nov 2023 17:19:25 +0000 Subject: [PATCH] Add logs for starting the home activity directly - We need to narrow down how home is being started after a recents transition Bug: 285636175 Test: dumpsys activity service TouchInteractionService Change-Id: I527a69cb045d426f820cfb5c8ba3c95eeff92889 --- .../com/android/quickstep/FallbackSwipeHandler.java | 12 +++++++----- .../com/android/quickstep/OverviewCommandHelper.java | 2 ++ .../android/quickstep/OverviewComponentObserver.java | 11 ++++++++--- .../src/com/android/quickstep/RecentsActivity.java | 3 ++- .../android/quickstep/TouchInteractionService.java | 1 + .../inputconsumers/DeviceLockedInputConsumer.java | 3 ++- .../OverviewWithoutFocusInputConsumer.java | 3 ++- .../ProgressDelegateInputConsumer.java | 3 ++- .../quickstep/interaction/AllSetActivity.java | 3 ++- 9 files changed, 28 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java index c5a88bc073..57b9a396da 100644 --- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java @@ -66,6 +66,7 @@ import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.util.DisplayController; import com.android.quickstep.fallback.FallbackRecentsView; import com.android.quickstep.fallback.RecentsState; +import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties; import com.android.quickstep.util.TransformParams; @@ -151,19 +152,20 @@ public class FallbackSwipeHandler extends return new FallbackPipToHomeAnimationFactory(); } mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration); - startHomeIntent(mActiveAnimationFactory, runningTaskTarget); + startHomeIntent(mActiveAnimationFactory, runningTaskTarget, "FallbackSwipeHandler-home"); return mActiveAnimationFactory; } private void startHomeIntent( @Nullable FallbackHomeAnimationFactory gestureContractAnimationFactory, - @Nullable RemoteAnimationTarget runningTaskTarget) { + @Nullable RemoteAnimationTarget runningTaskTarget, + @NonNull String reason) { ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); Intent intent = new Intent(mGestureState.getHomeIntent()); if (gestureContractAnimationFactory != null && runningTaskTarget != null) { gestureContractAnimationFactory.addGestureContract(intent, runningTaskTarget.taskInfo); } - startHomeIntentSafely(mContext, intent, options.toBundle()); + startHomeIntentSafely(mContext, intent, options.toBundle(), reason); } @Override @@ -185,8 +187,8 @@ public class FallbackSwipeHandler extends // the PiP task appearing. recentsCallback = () -> { callback.run(); - startHomeIntent( - null /* gestureContractAnimationFactory */, null /* runningTaskTarget */); + startHomeIntent(null /* gestureContractAnimationFactory */, + null /* runningTaskTarget */, "FallbackSwipeHandler-resumeLauncher"); }; } else { recentsCallback = callback; diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 833bf5fd16..31fe791faa 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -37,6 +37,7 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.TaskbarUIController; import com.android.launcher3.util.RunnableList; import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener; +import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -220,6 +221,7 @@ public class OverviewCommandHelper { return true; } if (cmd.type == TYPE_HOME) { + ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(TYPE_HOME)"); mService.startActivity(mOverviewComponentObserver.getHomeIntent()); return true; } diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 60713cf28f..0a02e994be 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -39,6 +39,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.util.SimpleBroadcastReceiver; +import com.android.quickstep.util.ActiveGestureLog; import com.android.systemui.shared.system.PackageManagerWrapper; import java.io.PrintWriter; @@ -276,20 +277,24 @@ public final class OverviewComponentObserver { /** * Starts the intent for the current home activity. */ - public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options) { + public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options, + @NonNull String reason) { RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(context); OverviewComponentObserver observer = new OverviewComponentObserver(context, deviceState); Intent intent = observer.getHomeIntent(); observer.onDestroy(); deviceState.destroy(); - startHomeIntentSafely(context, intent, options); + startHomeIntentSafely(context, intent, options, reason); } /** * Starts the intent for the current home activity. */ public static void startHomeIntentSafely( - @NonNull Context context, @NonNull Intent homeIntent, @Nullable Bundle options) { + @NonNull Context context, @NonNull Intent homeIntent, @Nullable Bundle options, + @NonNull String reason) { + ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( + "OverviewComponentObserver.startHomeIntent: ").append(reason)); try { context.startActivity(homeIntent, options); } catch (NullPointerException | ActivityNotFoundException | SecurityException e) { diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 38e896ec06..a6d208abbf 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -95,6 +95,7 @@ import java.util.List; * See {@link com.android.quickstep.views.RecentsView}. */ public final class RecentsActivity extends StatefulActivity { + private static final String TAG = "RecentsActivity"; public static final ActivityTracker ACTIVITY_TRACKER = new ActivityTracker<>(); @@ -428,7 +429,7 @@ public final class RecentsActivity extends StatefulActivity { new RemoteAnimationAdapter(runner, HOME_APPEAR_DURATION, 0), new RemoteTransition(runner.toRemoteTransition(), getIApplicationThread(), "StartHomeFromRecents")); - startHomeIntentSafely(this, options.toBundle()); + startHomeIntentSafely(this, options.toBundle(), TAG); } private final RemoteAnimationFactory mAnimationToHomeFactory = diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 98a9938653..7399c31d0b 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -1299,6 +1299,7 @@ public class TouchInteractionService extends Service { Log.i(TAG, "preloadOverview: forSUWAllSet=" + forSUWAllSet + ", isHomeAndOverviewSame=" + mOverviewComponentObserver.isHomeAndOverviewSame()); + ActiveGestureLog.INSTANCE.addLog("preloadRecentsAnimation"); mTaskAnimationManager.preloadRecentsAnimation(overviewIntent); } diff --git a/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java index 2a355848b5..1b3d759796 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java @@ -68,6 +68,7 @@ import java.util.HashMap; */ public class DeviceLockedInputConsumer implements InputConsumer, RecentsAnimationCallbacks.RecentsAnimationListener, BuilderProxy { + private final String TAG = "DeviceLockedInputConsumer"; private static final String[] STATE_NAMES = DEBUG_STATES ? new String[2] : null; private static int getFlagForIndex(int index, String name) { @@ -220,7 +221,7 @@ public class DeviceLockedInputConsumer implements InputConsumer, } else if (dismissTask) { // For now, just start the home intent so user is prompted to // unlock the device. - startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null); + startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null, TAG); mHomeLaunched = true; } mStateCallback.setState(STATE_HANDLER_INVALIDATED); diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java index b70fe8e03e..41730bbc40 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java @@ -37,6 +37,7 @@ import com.android.systemui.shared.system.InputMonitorCompat; public class OverviewWithoutFocusInputConsumer implements InputConsumer, TriggerSwipeUpTouchTracker.OnSwipeUpListener { + private static final String TAG = "OverviewWithoutFocusInputConsumer"; private final Context mContext; private final InputMonitorCompat mInputMonitor; @@ -77,7 +78,7 @@ public class OverviewWithoutFocusInputConsumer implements InputConsumer, @Override public void onSwipeUp(boolean wasFling, PointF finalVelocity) { - startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null); + startHomeIntentSafely(mContext, mGestureState.getHomeIntent(), null, TAG); BaseActivity activity = BaseDraggingActivity.fromContext(mContext); int state = (mGestureState != null && mGestureState.getEndTarget() != null) ? mGestureState.getEndTarget().containerType diff --git a/quickstep/src/com/android/quickstep/inputconsumers/ProgressDelegateInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/ProgressDelegateInputConsumer.java index c9c64b669c..6dcb7bceff 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/ProgressDelegateInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/ProgressDelegateInputConsumer.java @@ -53,6 +53,7 @@ import java.util.HashMap; public class ProgressDelegateInputConsumer implements InputConsumer, RecentsAnimationCallbacks.RecentsAnimationListener, SingleAxisSwipeDetector.Listener { + private static final String TAG = "ProgressDelegateInputConsumer"; private static final float SWIPE_DISTANCE_THRESHOLD = 0.2f; @@ -165,7 +166,7 @@ public class ProgressDelegateInputConsumer implements InputConsumer, mRecentsAnimationController.finishController(endToRecents /* toRecents */, null /* callback */, false /* sendUserLeaveHint */); } else if (endToRecents) { - startHomeIntentSafely(mContext, null); + startHomeIntentSafely(mContext, null, TAG); } } diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java index 49814df57b..1f6dae63b6 100644 --- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java +++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java @@ -78,6 +78,7 @@ import java.util.Map; * for the gestural system navigation. */ public class AllSetActivity extends Activity { + private static final String TAG = "AllSetActivity"; private static final String LOG_TAG = "AllSetActivity"; private static final String URI_SYSTEM_NAVIGATION_SETTING = @@ -356,7 +357,7 @@ public class AllSetActivity extends Activity { @Override public boolean performAccessibilityAction(View host, int action, Bundle args) { if (action == AccessibilityAction.ACTION_CLICK.getId()) { - startHomeIntentSafely(AllSetActivity.this, null); + startHomeIntentSafely(AllSetActivity.this, null, TAG); finish(); return true; }