mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Add some logs when failing to launch a task from recents.
Bug: 78514113 Change-Id: I5fb6996cb566c93ebe72258e4f7f5423d4b55bc1
This commit is contained in:
@@ -202,6 +202,8 @@ public class TaskSystemShortcut<T extends SystemShortcut> 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<T extends SystemShortcut> 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);
|
||||
|
||||
@@ -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<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 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user