Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef603e6d authored by Jeremy Sim's avatar Jeremy Sim
Browse files

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
parent c84ecc0f
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }
+5 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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<ACTIVITY_TYPE extends StatefulActivity<STATE_T
            return false;
        }
        if (mSplitSelectStateController.isBothSplitAppsConfirmed()) {
            Log.w(TAG, splitFailureMessage(
                    "confirmSplitSelect", "both apps have already been set"));
            return true;
        }
        // Second task is selected either as an already-running Task or an Intent
@@ -4732,6 +4735,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
            if (!task.isDockable) {
                // Task does not support split screen
                mSplitUnsupportedToast.show();
                Log.w(TAG, splitFailureMessage("confirmSplitSelect",
                        "selected Task (" + task.key.getPackageName()
                                + ") is not dockable / does not support splitscreen"));
                return true;
            }
            mSplitSelectStateController.setSecondTask(task);