From ef603e6ddd7479aa93dc52373d45d8bc96c04fe2 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Mon, 19 Jun 2023 18:34:20 -0700 Subject: [PATCH] Add logcat logs for splitscreen launch failures This patch makes it so that splitscreen launch failures (when app doesn't support splitscreen, or multi-instance, or if app crashes) are logged in logcat. Fixes: 280494204 Test: Manual Change-Id: If12a0c71e88b7b783be505e8a4caabeecc241dd9 --- .../com/android/quickstep/SystemUiProxy.java | 25 +++++++++++-------- .../com/android/quickstep/util/LogUtils.kt | 5 ++++ .../android/quickstep/views/RecentsView.java | 6 +++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index dd6499bebf..1de264a8c5 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.LogUtils.splitFailureMessage; import android.app.ActivityManager; import android.app.ActivityOptions; @@ -706,7 +707,7 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startTasks(taskId1, options1, taskId2, options2, splitPosition, splitRatio, remoteTransition, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startTasks"); + Log.w(TAG, splitFailureMessage("startTasks", "RemoteException"), e); } } } @@ -719,7 +720,7 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startIntentAndTask(pendingIntent, userId1, options1, taskId, options2, splitPosition, splitRatio, remoteTransition, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startIntentAndTask"); + Log.w(TAG, splitFailureMessage("startIntentAndTask", "RemoteException"), e); } } } @@ -735,7 +736,7 @@ public class SystemUiProxy implements ISystemUiProxy { pendingIntent2, userId2, shortcutInfo2, options2, splitPosition, splitRatio, remoteTransition, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startIntents"); + Log.w(TAG, splitFailureMessage("startIntents", "RemoteException"), e); } } } @@ -748,7 +749,7 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startShortcutAndTask(shortcutInfo, options1, taskId, options2, splitPosition, splitRatio, remoteTransition, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startShortcutAndTask"); + Log.w(TAG, splitFailureMessage("startShortcutAndTask", "RemoteException"), e); } } } @@ -764,7 +765,8 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startTasksWithLegacyTransition(taskId1, options1, taskId2, options2, splitPosition, splitRatio, adapter, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startTasksWithLegacyTransition"); + Log.w(TAG, splitFailureMessage( + "startTasksWithLegacyTransition", "RemoteException"), e); } } } @@ -778,7 +780,8 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, userId1, options1, taskId, options2, splitPosition, splitRatio, adapter, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startIntentAndTaskWithLegacyTransition"); + Log.w(TAG, splitFailureMessage( + "startIntentAndTaskWithLegacyTransition", "RemoteException"), e); } } } @@ -791,7 +794,8 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startShortcutAndTaskWithLegacyTransition(shortcutInfo, options1, taskId, options2, splitPosition, splitRatio, adapter, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startShortcutAndTaskWithLegacyTransition"); + Log.w(TAG, splitFailureMessage( + "startShortcutAndTaskWithLegacyTransition", "RemoteException"), e); } } } @@ -811,7 +815,8 @@ public class SystemUiProxy implements ISystemUiProxy { shortcutInfo1, options1, pendingIntent2, userId2, shortcutInfo2, options2, sidePosition, splitRatio, adapter, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startIntentsWithLegacyTransition"); + Log.w(TAG, splitFailureMessage( + "startIntentsWithLegacyTransition", "RemoteException"), e); } } } @@ -823,7 +828,7 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startShortcut(packageName, shortcutId, position, options, user, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startShortcut"); + Log.w(TAG, splitFailureMessage("startShortcut", "RemoteException"), e); } } } @@ -835,7 +840,7 @@ public class SystemUiProxy implements ISystemUiProxy { mSplitScreen.startIntent(intent, userId, fillInIntent, position, options, instanceId); } catch (RemoteException e) { - Log.w(TAG, "Failed call startIntent"); + Log.w(TAG, splitFailureMessage("startIntent", "RemoteException"), e); } } } diff --git a/quickstep/src/com/android/quickstep/util/LogUtils.kt b/quickstep/src/com/android/quickstep/util/LogUtils.kt index 23a41f6068..e34c4ec8a5 100644 --- a/quickstep/src/com/android/quickstep/util/LogUtils.kt +++ b/quickstep/src/com/android/quickstep/util/LogUtils.kt @@ -20,6 +20,11 @@ import com.android.internal.logging.InstanceIdSequence import com.android.launcher3.logging.InstanceId object LogUtils { + @JvmStatic + fun splitFailureMessage(caller: String, reason: String): String { + return "($caller) Splitscreen aborted: $reason" + } + /** * @return a [Pair] of two InstanceIds but with different types, one that can be used by * framework (if needing to pass through an intent or such) and one used in Launcher diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 421a48c25d..dd44f17cdf 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -54,6 +54,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE; import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; +import static com.android.quickstep.util.LogUtils.splitFailureMessage; import static com.android.quickstep.views.ClearAllButton.DISMISS_ALPHA; import static com.android.quickstep.views.DesktopTaskView.DESKTOP_MODE_SUPPORTED; import static com.android.quickstep.views.OverviewActionsView.FLAG_IS_NOT_TABLET; @@ -4725,6 +4726,8 @@ public abstract class RecentsView