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

Commit 593e9567 authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Adding isNotInRecents to RemoteAnimationTarget

For animations required by Recents, we calculate whether the task is
going to be presented in Recents UI.

Bug: 70789568
Test: Manual: swipe a normal app to Recents; swipe an app with a
      half-screen assistant on top of it to Recents.

Change-Id: I1ec9c36865dd4f57e843ae58811f90f3096365a5
parent a42585c3
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -109,9 +109,14 @@ public class RemoteAnimationTarget implements Parcelable {
     */
    public final WindowConfiguration windowConfiguration;

    /**
     * Whether the task is not presented in Recents UI.
     */
    public boolean isNotInRecents;

    public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
            Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
            Rect sourceContainerBounds, WindowConfiguration windowConfig) {
            Rect sourceContainerBounds, WindowConfiguration windowConfig, boolean isNotInRecents) {
        this.mode = mode;
        this.taskId = taskId;
        this.leash = leash;
@@ -122,6 +127,7 @@ public class RemoteAnimationTarget implements Parcelable {
        this.position = new Point(position);
        this.sourceContainerBounds = new Rect(sourceContainerBounds);
        this.windowConfiguration = windowConfig;
        this.isNotInRecents = isNotInRecents;
    }

    public RemoteAnimationTarget(Parcel in) {
@@ -135,6 +141,7 @@ public class RemoteAnimationTarget implements Parcelable {
        position = in.readParcelable(null);
        sourceContainerBounds = in.readParcelable(null);
        windowConfiguration = in.readParcelable(null);
        isNotInRecents = in.readBoolean();
    }

    @Override
@@ -154,6 +161,7 @@ public class RemoteAnimationTarget implements Parcelable {
        dest.writeParcelable(position, 0 /* flags */);
        dest.writeParcelable(sourceContainerBounds, 0 /* flags */);
        dest.writeParcelable(windowConfiguration, 0 /* flags */);
        dest.writeBoolean(isNotInRecents);
    }

    public static final Creator<RemoteAnimationTarget> CREATOR
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.shared.system;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;

import android.app.WindowConfiguration;
import android.graphics.Point;
import android.graphics.Rect;
import android.view.RemoteAnimationTarget;
@@ -39,6 +38,7 @@ public class RemoteAnimationTargetCompat {
    public final int prefixOrderIndex;
    public final Point position;
    public final Rect sourceContainerBounds;
    public final boolean isNotInRecents;

    private final RemoteAnimationTarget mTarget;

@@ -52,6 +52,7 @@ public class RemoteAnimationTargetCompat {
        position = app.position;
        sourceContainerBounds = app.sourceContainerBounds;
        prefixOrderIndex = app.prefixOrderIndex;
        isNotInRecents = app.isNotInRecents;
    }

    public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) {
+19 −0
Original line number Diff line number Diff line
@@ -827,6 +827,25 @@ class RecentTasks {
        return mTasks;
    }

    /**
     * @return ids of tasks that are presented in Recents UI.
     */
    SparseBooleanArray getRecentTaskIds() {
        final SparseBooleanArray res = new SparseBooleanArray();
        final int size = mTasks.size();
        int numVisibleTasks = 0;
        for (int i = 0; i < size; i++) {
            final TaskRecord tr = mTasks.get(i);
            if (isVisibleRecentTask(tr)) {
                numVisibleTasks++;
                if (isInVisibleRange(tr, numVisibleTasks)) {
                    res.put(tr.taskId, true);
                }
            }
        }
        return res;
    }

    /**
     * @return the task in the task list with the given {@param id} if one exists.
     */
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.am;

import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
@@ -136,7 +135,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
            // started
            mWindowManager.cancelRecentsAnimation();
            mWindowManager.initializeRecentsAnimation(recentsAnimationRunner, this,
                    display.mDisplayId);
                    display.mDisplayId, mStackSupervisor.mRecentTasks.getRecentTaskIds());

            // If we updated the launch-behind state, update the visibility of the activities after
            // we fetch the visible tasks to be controlled by the animation
+11 −8
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@ import android.app.WindowConfiguration;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;
import android.util.SparseBooleanArray;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
@@ -175,7 +175,7 @@ public class RecentsAnimationController {
     * because it may call cancelAnimation() which needs to properly clean up the controller
     * in the window manager.
     */
    public void initialize() {
    public void initialize(SparseBooleanArray recentTaskIds) {
        // Make leashes for each of the visible tasks and add it to the recents animation to be
        // started
        final DisplayContent dc = mService.mRoot.getDisplayContent(mDisplayId);
@@ -189,7 +189,7 @@ public class RecentsAnimationController {
                    || config.getActivityType() == ACTIVITY_TYPE_HOME) {
                continue;
            }
            addAnimation(task);
            addAnimation(task, !recentTaskIds.get(task.mTaskId));
        }

        // Skip the animation if there is nothing to animate
@@ -216,11 +216,12 @@ public class RecentsAnimationController {
        mService.mWindowPlacerLocked.performSurfacePlacement();
    }

    private void addAnimation(Task task) {
    private void addAnimation(Task task, boolean isRecentTaskInvisible) {
        if (DEBUG) Log.d(TAG, "addAnimation(" + task.getName() + ")");
        final SurfaceAnimator anim = new SurfaceAnimator(task, null /* animationFinishedCallback */,
                mService);
        final TaskAnimationAdapter taskAdapter = new TaskAnimationAdapter(task);
        final TaskAnimationAdapter taskAdapter = new TaskAnimationAdapter(task,
                isRecentTaskInvisible);
        anim.startAnimation(task.getPendingTransaction(), taskAdapter, false /* hidden */);
        task.commitPendingTransaction();
        mPendingAnimations.add(taskAdapter);
@@ -343,12 +344,14 @@ public class RecentsAnimationController {

    private class TaskAnimationAdapter implements AnimationAdapter {

        private Task mTask;
        private final Task mTask;
        private SurfaceControl mCapturedLeash;
        private OnAnimationFinishedCallback mCapturedFinishCallback;
        private final boolean mIsRecentTaskInvisible;

        TaskAnimationAdapter(Task task) {
        TaskAnimationAdapter(Task task, boolean isRecentTaskInvisible) {
            mTask = task;
            mIsRecentTaskInvisible = isRecentTaskInvisible;
        }

        RemoteAnimationTarget createRemoteAnimationApp() {
@@ -361,7 +364,7 @@ public class RecentsAnimationController {
            return new RemoteAnimationTarget(mTask.mTaskId, MODE_CLOSING, mCapturedLeash,
                    !mTask.fillsParent(), mainWindow.mWinAnimator.mLastClipRect,
                    mainWindow.mContentInsets, mTask.getPrefixOrderIndex(), position, bounds,
                    mTask.getWindowConfiguration());
                    mTask.getWindowConfiguration(), mIsRecentTaskInvisible);
        }

        @Override
Loading