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

Commit 94124ff4 authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Snapshot all tasks in pending recents animation when rotating devices"...

Merge "Snapshot all tasks in pending recents animation when rotating devices" into sc-v2-dev am: b1626ac3 am: f71de800

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16192190

Change-Id: Ic27bae28a092ac90be2b0cf2e940858aa54c8625
parents 2396efe8 f71de800
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -25,7 +25,6 @@ import static org.hamcrest.core.Is.is;


import android.app.ActivityManager;
import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.ActivityTaskManager;
import android.window.TaskSnapshot;
import android.app.IActivityTaskManager;
import android.app.IActivityTaskManager;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
@@ -41,6 +40,7 @@ import android.util.Pair;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
import android.window.TaskSnapshot;


import androidx.test.filters.LargeTest;
import androidx.test.filters.LargeTest;
import androidx.test.runner.lifecycle.Stage;
import androidx.test.runner.lifecycle.Stage;
@@ -210,7 +210,8 @@ public class RecentsAnimationPerfTest extends WindowManagerPerfTestBase
            }
            }


            @Override
            @Override
            public void onAnimationCanceled(TaskSnapshot taskSnapshot) throws RemoteException {
            public void onAnimationCanceled(int[] taskIds, TaskSnapshot[] taskSnapshots)
                    throws RemoteException {
                Assume.assumeNoException(
                Assume.assumeNoException(
                        new AssertionError("onAnimationCanceled should not be called"));
                        new AssertionError("onAnimationCanceled should not be called"));
            }
            }
+8 −6
Original line number Original line Diff line number Diff line
@@ -35,15 +35,17 @@ oneway interface IRecentsAnimationRunner {
     * wallpaper not drawing in time, or the handler not finishing the animation within a predefined
     * wallpaper not drawing in time, or the handler not finishing the animation within a predefined
     * amount of time.
     * amount of time.
     *
     *
     * @param taskSnapshot If the snapshot is null, the animation will be cancelled and the leash
     * @param taskIds Indicates tasks with cancelling snapshot.
     *                     will be inactive immediately. Otherwise, the contents of the task will be
     * @param taskSnapshots If the snapshots is null, the animation will be cancelled and the leash
     *                     replaced with {@param taskSnapshot}, such that the runner's leash is
     *                      will be inactive immediately. Otherwise, the contents of the tasks will
     *                      be replaced with {@param taskSnapshots}, such that the runner's leash is
     *                      still active. As soon as the runner doesn't need the leash anymore, it
     *                      still active. As soon as the runner doesn't need the leash anymore, it
     *                      must call {@link IRecentsAnimationController#cleanupScreenshot).
     *                      must call {@link IRecentsAnimationController#cleanupScreenshot).
     *
     *
     * @see {@link RecentsAnimationController#cleanupScreenshot}
     * @see {@link RecentsAnimationController#cleanupScreenshot}
     */
     */
    void onAnimationCanceled(in @nullable TaskSnapshot taskSnapshot) = 1;
    void onAnimationCanceled(in @nullable int[] taskIds,
            in @nullable TaskSnapshot[] taskSnapshots) = 1;


    /**
    /**
     * Called when the system is ready for the handler to start animating all the visible tasks.
     * Called when the system is ready for the handler to start animating all the visible tasks.
+15 −1
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import static android.graphics.Bitmap.Config.ARGB_8888;


import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_UNDEFINED;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_UNDEFINED;


import android.window.TaskSnapshot;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Point;
@@ -30,6 +29,9 @@ import android.graphics.Rect;
import android.hardware.HardwareBuffer;
import android.hardware.HardwareBuffer;
import android.util.Log;
import android.util.Log;
import android.view.WindowInsetsController.Appearance;
import android.view.WindowInsetsController.Appearance;
import android.window.TaskSnapshot;

import java.util.HashMap;


/**
/**
 * Data for a single thumbnail.
 * Data for a single thumbnail.
@@ -80,6 +82,18 @@ public class ThumbnailData {
        return thumbnail;
        return thumbnail;
    }
    }


    public static HashMap<Integer, ThumbnailData> wrap(int[] taskIds, TaskSnapshot[] snapshots) {
        HashMap<Integer, ThumbnailData> temp = new HashMap<>();
        if (taskIds == null || snapshots == null || taskIds.length != snapshots.length) {
            return temp;
        }

        for (int i = snapshots.length - 1; i >= 0; i--) {
            temp.put(taskIds[i], new ThumbnailData(snapshots[i]));
        }
        return temp;
    }

    public ThumbnailData(TaskSnapshot snapshot) {
    public ThumbnailData(TaskSnapshot snapshot) {
        thumbnail = makeThumbnail(snapshot);
        thumbnail = makeThumbnail(snapshot);
        insets = new Rect(snapshot.getContentInsets());
        insets = new Rect(snapshot.getContentInsets());
+3 −3
Original line number Original line Diff line number Diff line
@@ -28,7 +28,6 @@ import android.app.ActivityClient;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.app.ActivityManager.RecentTaskInfo;
import android.app.ActivityManager.RecentTaskInfo;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.RunningTaskInfo;
import android.window.TaskSnapshot;
import android.app.ActivityOptions;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.ActivityTaskManager;
import android.app.AppGlobals;
import android.app.AppGlobals;
@@ -50,6 +49,7 @@ import android.util.Log;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
import android.window.TaskSnapshot;


import com.android.internal.app.IVoiceInteractionManagerService;
import com.android.internal.app.IVoiceInteractionManagerService;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task;
@@ -189,9 +189,9 @@ public class ActivityManagerWrapper {
                    }
                    }


                    @Override
                    @Override
                    public void onAnimationCanceled(TaskSnapshot taskSnapshot) {
                    public void onAnimationCanceled(int[] taskIds, TaskSnapshot[] taskSnapshots) {
                        animationHandler.onAnimationCanceled(
                        animationHandler.onAnimationCanceled(
                                taskSnapshot != null ? new ThumbnailData(taskSnapshot) : null);
                                ThumbnailData.wrap(taskIds, taskSnapshots));
                    }
                    }


                    @Override
                    @Override
+5 −3
Original line number Original line Diff line number Diff line
@@ -39,12 +39,14 @@ public class RecentsAnimationControllerCompat {


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


    public void setInputConsumerEnabled(boolean enabled) {
    public void setInputConsumerEnabled(boolean enabled) {
Loading