Add some logs when failing to launch a task from recents.

Bug: 78514113
Change-Id: I5fb6996cb566c93ebe72258e4f7f5423d4b55bc1
This commit is contained in:
Winson Chung
2018-04-25 11:14:57 -07:00
parent 69ac60381c
commit 80602a94ec
3 changed files with 28 additions and 3 deletions
@@ -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<Boolean> 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;
}
}