From c6d3ea678fbc871e28d7374ac47fddbf1442a568 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 20 Sep 2023 11:36:52 -0400 Subject: [PATCH] Add error detection for missing recent tasks list in SystemUiProxy There are ways for launcher to lose the recent tasks reference, in which case SystemUiProxy will quietly fail to start the recents activity. Flag: not needed Fixes: 301257750 Test: programmatically forced the error condition and checked the logs Change-Id: I1cad6a3dfd2605f275672d1dcd8c83bdb965d73f --- quickstep/src/com/android/quickstep/SystemUiProxy.java | 3 +++ .../quickstep/util/ActiveGestureErrorDetector.java | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 5da41ae110..1dc777d8cd 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -19,6 +19,7 @@ import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; +import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.RECENT_TASKS_MISSING; import static com.android.quickstep.util.LogUtils.splitFailureMessage; import android.app.ActivityManager; @@ -63,6 +64,7 @@ import com.android.internal.view.AppearanceRegion; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.SplitConfigurationOptions; +import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.AssistUtils; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -1372,6 +1374,7 @@ public class SystemUiProxy implements ISystemUiProxy { public boolean startRecentsActivity(Intent intent, ActivityOptions options, RecentsAnimationListener listener) { if (mRecentTasks == null) { + ActiveGestureLog.INSTANCE.trackEvent(RECENT_TASKS_MISSING); return false; } final IRecentsAnimationRunner runner = new IRecentsAnimationRunner.Stub() { diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java index 8335523758..3c08f21c43 100644 --- a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java +++ b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java @@ -37,7 +37,7 @@ public class ActiveGestureErrorDetector { START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION, CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION, CLEANUP_SCREENSHOT, SCROLLER_ANIMATION_ABORTED, TASK_APPEARED, EXPECTING_TASK_APPEARED, - FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED, + FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED, RECENT_TASKS_MISSING, /** * These GestureEvents are specifically associated to state flags that get set in @@ -218,6 +218,14 @@ public class ActiveGestureErrorDetector { + "set before/without startRecentsAnimation.", writer); break; + case RECENT_TASKS_MISSING: + errorDetected |= printErrorIfTrue( + true, + prefix, + /* errorMessage= */ "SystemUiProxy.mRecentTasks missing," + + " couldn't start the recents activity", + writer); + break; case MOTION_DOWN: case SET_END_TARGET: case SET_END_TARGET_HOME: