Add some logs when failing to launch a task from recents.
Bug: 78514113
Change-Id: I5fb6996cb566c93ebe72258e4f7f5423d4b55bc1
diff --git a/quickstep/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/src/com/android/quickstep/TaskSystemShortcut.java
index a82c679..7c69a8d 100644
--- a/quickstep/src/com/android/quickstep/TaskSystemShortcut.java
+++ b/quickstep/src/com/android/quickstep/TaskSystemShortcut.java
@@ -202,6 +202,8 @@
public static class Pin extends TaskSystemShortcut {
+ private static final String TAG = Pin.class.getSimpleName();
+
private Handler mHandler;
public Pin() {
@@ -231,6 +233,8 @@
} catch (RemoteException e) {
Log.w(TAG, "Failed to start screen pinning: ", e);
}
+ } else {
+ Log.w(TAG, taskView.getLaunchTaskFailedMsg());
}
};
taskView.launchTask(true, resultCallback, mHandler);
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 9ab1e04..5fff51c 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -41,6 +41,7 @@
import android.util.ArraySet;
import android.util.AttributeSet;
import android.util.FloatProperty;
+import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -85,6 +86,8 @@
@TargetApi(Build.VERSION_CODES.P)
public abstract class RecentsView<T extends BaseActivity> extends PagedView implements Insettable {
+ private static final String TAG = RecentsView.class.getSimpleName();
+
public static final boolean DEBUG_SHOW_CLEAR_ALL_BUTTON = false;
private final Rect mTempRect = new Rect();
@@ -1156,10 +1159,13 @@
anim.play(drawableAnim);
anim.setDuration(duration);
- Consumer<Boolean> onTaskLaunchFinish = (r) -> {
- onTaskLaunched(r);
+ Consumer<Boolean> onTaskLaunchFinish = (result) -> {
+ onTaskLaunched(result);
tv.setVisibility(VISIBLE);
getOverlay().remove(drawable);
+ if (!result) {
+ Log.w(TAG, tv.getLaunchTaskFailedMsg());
+ }
};
mPendingAnimation = new PendingAnimation(anim);
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 8c1076a..a9b24e5 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -30,6 +30,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -59,6 +60,8 @@
*/
public class TaskView extends FrameLayout implements TaskCallbacks, PageCallbacks {
+ private static final String TAG = TaskView.class.getSimpleName();
+
/** A curve of x from 0 to 1, where 0 is the center of the screen and 1 is the edge. */
private static final TimeInterpolator CURVE_INTERPOLATOR
= x -> (float) -Math.cos(x * Math.PI) / 2f + .5f;
@@ -136,7 +139,11 @@
}
public void launchTask(boolean animate) {
- launchTask(animate, null, null);
+ launchTask(animate, (result) -> {
+ if (!result) {
+ Log.w(TAG, getLaunchTaskFailedMsg());
+ }
+ }, getHandler());
}
public void launchTask(boolean animate, Consumer<Boolean> resultCallback,
@@ -317,4 +324,12 @@
return super.performAccessibilityAction(action, arguments);
}
+
+ public String getLaunchTaskFailedMsg() {
+ String msg = "Failed to launch task";
+ if (mTask != null) {
+ msg += " (task=" + mTask.key.baseIntent + " userId=" + mTask.key.userId + ")";
+ }
+ return msg;
+ }
}