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

Commit 149758da authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Using original taskInfo to create the taskKey instead of fake data"...

Merge "Using original taskInfo to create the taskKey instead of fake data" into ub-launcher3-rvc-qpr-dev am: 054280db

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12142606

Change-Id: I87b357e1ce4a30f255598d481ce99fee63ac9d9d
parents 24d44a77 054280db
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.app.ActivityManager.RunningTaskInfo;
import android.util.Log;
import android.view.animation.Interpolator;

@@ -52,17 +53,17 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend

    private final BaseActivityInterface<?, T> mActivityInterface;
    // The id of the currently running task that is transitioning to overview.
    private final int mTargetTaskId;
    private final RunningTaskInfo mTargetTask;
    private final RecentsAnimationDeviceState mDeviceState;

    private T mActivity;
    private RecentsView mRecentsView;

    AppToOverviewAnimationProvider(
            BaseActivityInterface<?, T> activityInterface, int targetTaskId,
            BaseActivityInterface<?, T> activityInterface, RunningTaskInfo targetTask,
            RecentsAnimationDeviceState deviceState) {
        mActivityInterface = activityInterface;
        mTargetTaskId = targetTaskId;
        mTargetTask = targetTask;
        mDeviceState = deviceState;
    }

@@ -73,7 +74,7 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend
     * @param wasVisible true if it was visible before
     */
    boolean onActivityReady(T activity, Boolean wasVisible) {
        activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTaskId);
        activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTask);
        AbstractFloatingView.closeAllOpenViews(activity, wasVisible);
        BaseActivityInterface.AnimationFactory factory = mActivityInterface.prepareRecentsUI(
                mDeviceState,
@@ -122,7 +123,8 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend
                wallpaperTargets, MODE_CLOSING);

        // Use the top closing app to determine the insets for the animation
        RemoteAnimationTargetCompat runningTaskTarget = targets.findTask(mTargetTaskId);
        RemoteAnimationTargetCompat runningTaskTarget = mTargetTask == null ? null
                : targets.findTask(mTargetTask.taskId);
        if (runningTaskTarget == null) {
            Log.e(TAG, "No closing app");
            return pa.buildAnim();
+1 −1
Original line number Diff line number Diff line
@@ -421,7 +421,7 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
    }

    protected void notifyGestureAnimationStartToRecents() {
        mRecentsView.onGestureAnimationStart(mGestureState.getRunningTaskId());
        mRecentsView.onGestureAnimationStart(mGestureState.getRunningTask());
    }

    private void launcherFrameDrawn() {
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ public class OverviewCommandHelper {
            mActivityInterface = mOverviewComponentObserver.getActivityInterface();
            mCreateTime = SystemClock.elapsedRealtime();
            mAnimationProvider = new AppToOverviewAnimationProvider<>(mActivityInterface,
                    RecentsModel.getRunningTaskId(), mDeviceState);
                    ActivityManagerWrapper.getInstance().getRunningTask(), mDeviceState);

            // Preload the plan
            mRecentsModel.getTasks(null);
+5 −4
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity>
     */
    public void onGestureAnimationStartOnHome(RunningTaskInfo homeTaskInfo) {
        mHomeTaskInfo = homeTaskInfo;
        onGestureAnimationStart(homeTaskInfo == null ? -1 : homeTaskInfo.taskId);
        onGestureAnimationStart(homeTaskInfo);
    }

    /**
@@ -107,14 +107,15 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity>
    }

    @Override
    protected boolean shouldAddDummyTaskView(int runningTaskId) {
        if (mHomeTaskInfo != null && mHomeTaskInfo.taskId == runningTaskId
    protected boolean shouldAddDummyTaskView(RunningTaskInfo runningTaskInfo) {
        if (mHomeTaskInfo != null && runningTaskInfo != null &&
                mHomeTaskInfo.taskId == runningTaskInfo.taskId
                && getTaskViewCount() == 0) {
            // Do not add a dummy task if we are running over home with empty recents, so that we
            // show the empty recents message instead of showing a dummy task and later removing it.
            return false;
        }
        return super.shouldAddDummyTaskView(runningTaskId);
        return super.shouldAddDummyTaskView(runningTaskInfo);
    }

    @Override
+12 −13
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -135,6 +136,7 @@ import com.android.quickstep.util.TransformParams;
import com.android.systemui.plugins.ResourceProvider;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.LauncherEventUtil;
@@ -147,7 +149,7 @@ import java.util.function.Consumer;
/**
 * A list of recent tasks.
 */
@TargetApi(Build.VERSION_CODES.P)
@TargetApi(Build.VERSION_CODES.R)
public abstract class RecentsView<T extends StatefulActivity> extends PagedView implements
        Insettable, TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback,
        InvariantDeviceProfile.OnIDPChangeListener, TaskVisualsChangeListener,
@@ -1039,10 +1041,10 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
    /**
     * Called when a gesture from an app is starting.
     */
    public void onGestureAnimationStart(int runningTaskId) {
    public void onGestureAnimationStart(RunningTaskInfo runningTaskInfo) {
        // This needs to be called before the other states are set since it can create the task view
        mOrientationState.setGestureActive(true);
        showCurrentTask(runningTaskId);
        showCurrentTask(runningTaskInfo);
        setEnableFreeScroll(false);
        setEnableDrawingLiveTile(false);
        setRunningTaskHidden(true);
@@ -1120,8 +1122,8 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
    /**
     * Returns true if we should add a dummy taskView for the running task id
     */
    protected boolean shouldAddDummyTaskView(int runningTaskId) {
        return getTaskView(runningTaskId) == null;
    protected boolean shouldAddDummyTaskView(RunningTaskInfo runningTaskInfo) {
        return runningTaskInfo != null && getTaskView(runningTaskInfo.taskId) == null;
    }

    /**
@@ -1130,8 +1132,8 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
     * All subsequent calls to reload will keep the task as the first item until {@link #reset()}
     * is called.  Also scrolls the view to this task.
     */
    public void showCurrentTask(int runningTaskId) {
        if (shouldAddDummyTaskView(runningTaskId)) {
    public void showCurrentTask(RunningTaskInfo runningTaskInfo) {
        if (shouldAddDummyTaskView(runningTaskInfo)) {
            boolean wasEmpty = getChildCount() == 0;
            // Add an empty view for now until the task plan is loaded and applied
            final TaskView taskView = mTaskViewPool.getView();
@@ -1141,10 +1143,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
            }
            // The temporary running task is only used for the duration between the start of the
            // gesture and the task list is loaded and applied
            mTmpRunningTask = new Task(new Task.TaskKey(runningTaskId, 0, new Intent(),
                    new ComponentName(getContext(), getClass()), 0, 0), null, null, "", "", 0, 0,
                    false, true, false, false, new ActivityManager.TaskDescription(), 0,
                    new ComponentName("", ""), false);
            mTmpRunningTask = Task.from(new TaskKey(runningTaskInfo), runningTaskInfo, false);
            taskView.bind(mTmpRunningTask, mOrientationState);

            // Measure and layout immediately so that the scroll values is updated instantly
@@ -1155,7 +1154,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        }

        boolean runningTaskTileHidden = mRunningTaskTileHidden;
        setCurrentTask(runningTaskId);
        setCurrentTask(runningTaskInfo == null ? -1 : runningTaskInfo.taskId);
        setCurrentPage(getRunningTaskIndex());
        setRunningTaskViewShowScreenshot(false);
        setRunningTaskHidden(runningTaskTileHidden);
@@ -1673,7 +1672,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
                : View.LAYOUT_DIRECTION_RTL);
        mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
        mActivity.getDragLayer().recreateControllers();
        boolean isInLandscape = mOrientationState.getTouchRotation() != 0
        boolean isInLandscape = mOrientationState.getTouchRotation() != ROTATION_0
                || mOrientationState.getRecentsActivityRotation() != ROTATION_0;
        mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
                !mOrientationState.canRecentsActivityRotate() && isInLandscape);
Loading