diff --git a/quickstep/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/src/com/android/quickstep/TaskSystemShortcut.java index a82c679244..7c69a8de34 100644 --- a/quickstep/src/com/android/quickstep/TaskSystemShortcut.java +++ b/quickstep/src/com/android/quickstep/TaskSystemShortcut.java @@ -202,6 +202,8 @@ public class TaskSystemShortcut extends SystemShortcut public static class Pin extends TaskSystemShortcut { + private static final String TAG = Pin.class.getSimpleName(); + private Handler mHandler; public Pin() { @@ -231,6 +233,8 @@ public class TaskSystemShortcut extends SystemShortcut } 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 9ab1e04233..5fff51cd12 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.text.TextPaint; 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 @@ import java.util.function.Consumer; @TargetApi(Build.VERSION_CODES.P) public abstract class RecentsView 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 @@ public abstract class RecentsView extends PagedView impl anim.play(drawableAnim); anim.setDuration(duration); - Consumer onTaskLaunchFinish = (r) -> { - onTaskLaunched(r); + Consumer 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 8c1076a972..a9b24e567c 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.graphics.Rect; 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 @@ import java.util.function.Consumer; */ 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 class TaskView extends FrameLayout implements TaskCallbacks, PageCallback } 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 resultCallback, @@ -317,4 +324,12 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback 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; + } }