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

Commit 9ae484b9 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Log dismissing or launching recent tasks" into ub-launcher3-master

parents 3541ac10 9bd862e5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.util.SysuiEventLogger;
@@ -182,7 +183,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
        }

        if (mPendingAnimation != null) {
            mPendingAnimation.finish(false);
            mPendingAnimation.finish(false, Touch.SWIPE);
            mPendingAnimation = null;
        }

+3 −10
Original line number Diff line number Diff line
@@ -30,11 +30,10 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;
import com.android.launcher3.util.PendingAnimation;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;

@@ -152,7 +151,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
            mCurrentAnimation.setPlayFraction(0);
        }
        if (mPendingAnimation != null) {
            mPendingAnimation.finish(false);
            mPendingAnimation.finish(false, Touch.SWIPE);
            mPendingAnimation = null;
        }

@@ -249,15 +248,9 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>

    private void onCurrentAnimationEnd(boolean wasSuccess, int logAction) {
        if (mPendingAnimation != null) {
            mPendingAnimation.finish(wasSuccess);
            mPendingAnimation.finish(wasSuccess, logAction);
            mPendingAnimation = null;
        }
        if (wasSuccess) {
            if (!mCurrentAnimationIsGoingUp) {
                mActivity.getUserEventDispatcher().logTaskLaunch(logAction,
                        Direction.DOWN, mTaskBeingDragged.getTask().getTopComponent());
            }
        }
        mDetector.finishedScrolling();
        mTaskBeingDragged = null;
        mCurrentAnimation = null;
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.util.Log;

import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.util.ComponentKey;
import com.android.systemui.shared.recents.model.Task;

/**
@@ -48,4 +49,8 @@ public class TaskUtils {
        return userManagerCompat.getBadgedLabelForUser(
            applicationInfo.loadLabel(packageManager), user);
    }

    public static ComponentKey getComponentKeyForTask(Task.TaskKey taskKey) {
        return new ComponentKey(taskKey.getComponent(), UserHandle.of(taskKey.userId));
    }
}
+22 −7
Original line number Diff line number Diff line
@@ -59,12 +59,15 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.Themes;
import com.android.quickstep.QuickScrubController;
import com.android.quickstep.RecentsAnimationInterpolator;
import com.android.quickstep.RecentsAnimationInterpolator.TaskWindowBounds;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskUtils;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.RecentsTaskLoader;
import com.android.systemui.shared.recents.model.Task;
@@ -317,7 +320,7 @@ public abstract class RecentsView<T extends BaseActivity>

    private void applyLoadPlan(RecentsTaskLoadPlan loadPlan) {
        if (mPendingAnimation != null) {
            mPendingAnimation.addEndListener((b) -> applyLoadPlan(loadPlan));
            mPendingAnimation.addEndListener((onEndListener) -> applyLoadPlan(loadPlan));
            return;
        }
        TaskStack stack = loadPlan != null ? loadPlan.getTaskStack() : null;
@@ -747,10 +750,16 @@ public abstract class RecentsView<T extends BaseActivity>
        }

        mPendingAnimation = pendingAnimation;
        mPendingAnimation.addEndListener((isSuccess) -> {
           if (isSuccess) {
        mPendingAnimation.addEndListener((onEndListener) -> {
           if (onEndListener.isSuccess) {
               if (removeTask) {
                   ActivityManagerWrapper.getInstance().removeTask(taskView.getTask().key.id);
                   Task task = taskView.getTask();
                   if (task != null) {
                       ActivityManagerWrapper.getInstance().removeTask(task.key.id);
                       mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(
                               onEndListener.logAction, Direction.UP,
                               TaskUtils.getComponentKeyForTask(task.key));
                   }
               }
               removeView(taskView);
               if (getChildCount() == 0) {
@@ -792,7 +801,7 @@ public abstract class RecentsView<T extends BaseActivity>
        AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(
                pendingAnim.anim, DISMISS_TASK_DURATION);
        controller.dispatchOnStart();
        controller.setEndAction(() -> pendingAnim.finish(true));
        controller.setEndAction(() -> pendingAnim.finish(true, Touch.SWIPE));
        controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
        controller.start();
    }
@@ -1049,9 +1058,15 @@ public abstract class RecentsView<T extends BaseActivity>
        anim.setDuration(duration);

        mPendingAnimation = new PendingAnimation(anim);
        mPendingAnimation.addEndListener((isSuccess) -> {
            if (isSuccess) {
        mPendingAnimation.addEndListener((onEndListener) -> {
            if (onEndListener.isSuccess) {
                tv.launchTask(false);
                Task task = tv.getTask();
                if (task != null) {
                    mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(
                            onEndListener.logAction, Direction.DOWN,
                            TaskUtils.getComponentKeyForTask(task.key));
                }
            } else {
                resetTaskVisuals();
            }
+11 −1
Original line number Diff line number Diff line
@@ -31,11 +31,15 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;

import com.android.launcher3.BaseActivity;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.quickstep.RecentsAnimationInterpolator;
import com.android.quickstep.TaskSystemShortcut;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.views.RecentsView.PageCallbacks;
import com.android.quickstep.views.RecentsView.ScrollState;
import com.android.systemui.shared.recents.model.Task;
@@ -82,7 +86,13 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback

    public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setOnClickListener((view) -> launchTask(true /* animate */));
        setOnClickListener((view) -> {
            if (mTask != null) {
                launchTask(true /* animate */);
                BaseActivity.fromContext(context).getUserEventDispatcher().logTaskLaunchOrDismiss(
                        Touch.TAP, Direction.NONE, TaskUtils.getComponentKeyForTask(mTask.key));
            }
        });
        setOutlineProvider(new TaskOutlineProvider(getResources()));
    }

Loading