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

Commit 2c2ccac1 authored by wilsonshih's avatar wilsonshih
Browse files

Reduce extra binder call for take task snapshot.

It is not necessary to take the task snapshot from the Shell because
it is usually executed in the SystemUI process. The Launcher can perform
the same operation through ActivityManagerWrapper. Which can also help
release the memory since it won't referened by 3 processes.

Flag: EXEMPT bugfix
Bug: 238206323
Test: close task from recents, verify SystemUI won't hold the
snapshot memory

Change-Id: Ib726d3a70f5f2aa33f32b7dc189e7b7a8c2dd1b1
parent 43b05634
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -35,12 +35,6 @@ import com.android.internal.os.IResultReceiver;
 */
interface IRecentsAnimationController {

    /**
     * Takes a screenshot of the task associated with the given {@param taskId}. Only valid for the
     * current set of task ids provided to the handler.
     */
    TaskSnapshot screenshotTask(int taskId);

    /**
     * Sets the final surface transaction on a Task. This is used by Launcher to notify the system
     * that animating Activity to PiP has completed and the associated task surface should be
+0 −13
Original line number Diff line number Diff line
@@ -1226,19 +1226,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
            }
        }

        @Override
        public TaskSnapshot screenshotTask(int taskId) {
            try {
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                        "[%d] RecentsController.screenshotTask: taskId=%d", mInstanceId, taskId);
                return ActivityTaskManager.getService().takeTaskSnapshot(taskId,
                        true /* updateCache */);
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to screenshot task", e);
            }
            return null;
        }

        @Override
        public void setInputConsumerEnabled(boolean enabled) {
            mExecutor.execute(() -> {
+0 −14
Original line number Diff line number Diff line
@@ -21,11 +21,9 @@ import android.util.Log;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import android.window.PictureInPictureSurfaceTransaction;
import android.window.TaskSnapshot;
import android.window.WindowAnimationState;

import com.android.internal.os.IResultReceiver;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.wm.shell.recents.IRecentsAnimationController;

public class RecentsAnimationControllerCompat {
@@ -40,18 +38,6 @@ public class RecentsAnimationControllerCompat {
        mAnimationController = animationController;
    }

    public ThumbnailData screenshotTask(int taskId) {
        try {
            final TaskSnapshot snapshot = mAnimationController.screenshotTask(taskId);
            if (snapshot != null) {
                return ThumbnailData.fromSnapshot(snapshot);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to screenshot task", e);
        }
        return new ThumbnailData();
    }

    public void setInputConsumerEnabled(boolean enabled) {
        try {
            mAnimationController.setInputConsumerEnabled(enabled);