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

Commit 67f31199 authored by Winson Chung's avatar Winson Chung
Browse files

Exposing content insets and minimized home bounds for recents transition

- In order to calculate the final target rect and window clip for the
  app currently transitioning into the task view in launcher (similar to
  how we did in SysUI), we need to provide the content insets and bounds
  for both the app and launcher (whose activity may not yet have been
  shown).  For the existing recents transition, this was calculated
  internally in the AppTransition aspect-scaled transition, but now that
  we are implementing this via remote animations, the same information is
  needed in the implementation of the recents animation runner.

Bug: 70294936
Test: Swipe up from launcher with window transitions when in multi window
Change-Id: I2afc6bdfe112cc7bb1b07ba65213653f6f0634f9
parent bca6e66c
Loading
Loading
Loading
Loading
+15 −3
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.view;
package android.view;


import android.graphics.Rect;
import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationController;


@@ -28,15 +29,26 @@ import android.view.IRecentsAnimationController;
oneway interface IRecentsAnimationRunner {
oneway interface IRecentsAnimationRunner {


    /**
    /**
     * Called when the system is ready for the handler to start animating all the visible tasks.
     * Deprecated, to be removed once Launcher updates
     */
     */
    void onAnimationStart(in IRecentsAnimationController controller,
    void onAnimationStart(in IRecentsAnimationController controller,
            in RemoteAnimationTarget[] apps);
            in RemoteAnimationTarget[] apps) = 0;


    /**
    /**
     * Called when the system needs to cancel the current animation. This can be due to the
     * Called when the system needs to cancel the current animation. This can be due to the
     * 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.
     */
     */
    void onAnimationCanceled();
    void onAnimationCanceled() = 1;

    /**
     * Called when the system is ready for the handler to start animating all the visible tasks.
     *
     * @param homeContentInsets The current home app content insets
     * @param minimizedHomeBounds Specifies the bounds of the minimized home app, will be
     *                            {@code null} if the device is not currently in split screen
     */
    void onAnimationStart_New(in IRecentsAnimationController controller,
            in RemoteAnimationTarget[] apps, in Rect homeContentInsets,
            in Rect minimizedHomeBounds) = 2;
}
}
+10 −2
Original line number Original line Diff line number Diff line
@@ -78,6 +78,11 @@ public class RemoteAnimationTarget implements Parcelable {
     */
     */
    public final Rect clipRect;
    public final Rect clipRect;


    /**
     * The insets of the main app window.
     */
    public final Rect contentInsets;

    /**
    /**
     * The index of the element in the tree in prefix order. This should be used for z-layering
     * The index of the element in the tree in prefix order. This should be used for z-layering
     * to preserve original z-layer order in the hierarchy tree assuming no "boosting" needs to
     * to preserve original z-layer order in the hierarchy tree assuming no "boosting" needs to
@@ -105,13 +110,14 @@ public class RemoteAnimationTarget implements Parcelable {
    public final WindowConfiguration windowConfiguration;
    public final WindowConfiguration windowConfiguration;


    public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
    public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
            Rect clipRect, int prefixOrderIndex, Point position, Rect sourceContainerBounds,
            Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
            WindowConfiguration windowConfig) {
            Rect sourceContainerBounds, WindowConfiguration windowConfig) {
        this.mode = mode;
        this.mode = mode;
        this.taskId = taskId;
        this.taskId = taskId;
        this.leash = leash;
        this.leash = leash;
        this.isTranslucent = isTranslucent;
        this.isTranslucent = isTranslucent;
        this.clipRect = new Rect(clipRect);
        this.clipRect = new Rect(clipRect);
        this.contentInsets = new Rect(contentInsets);
        this.prefixOrderIndex = prefixOrderIndex;
        this.prefixOrderIndex = prefixOrderIndex;
        this.position = new Point(position);
        this.position = new Point(position);
        this.sourceContainerBounds = new Rect(sourceContainerBounds);
        this.sourceContainerBounds = new Rect(sourceContainerBounds);
@@ -124,6 +130,7 @@ public class RemoteAnimationTarget implements Parcelable {
        leash = in.readParcelable(null);
        leash = in.readParcelable(null);
        isTranslucent = in.readBoolean();
        isTranslucent = in.readBoolean();
        clipRect = in.readParcelable(null);
        clipRect = in.readParcelable(null);
        contentInsets = in.readParcelable(null);
        prefixOrderIndex = in.readInt();
        prefixOrderIndex = in.readInt();
        position = in.readParcelable(null);
        position = in.readParcelable(null);
        sourceContainerBounds = in.readParcelable(null);
        sourceContainerBounds = in.readParcelable(null);
@@ -142,6 +149,7 @@ public class RemoteAnimationTarget implements Parcelable {
        dest.writeParcelable(leash, 0 /* flags */);
        dest.writeParcelable(leash, 0 /* flags */);
        dest.writeBoolean(isTranslucent);
        dest.writeBoolean(isTranslucent);
        dest.writeParcelable(clipRect, 0 /* flags */);
        dest.writeParcelable(clipRect, 0 /* flags */);
        dest.writeParcelable(contentInsets, 0 /* flags */);
        dest.writeInt(prefixOrderIndex);
        dest.writeInt(prefixOrderIndex);
        dest.writeParcelable(position, 0 /* flags */);
        dest.writeParcelable(position, 0 /* flags */);
        dest.writeParcelable(sourceContainerBounds, 0 /* flags */);
        dest.writeParcelable(sourceContainerBounds, 0 /* flags */);
+12 −1
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@ import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.content.res.Resources.NotFoundException;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Bundle;
@@ -57,6 +58,7 @@ import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.IRecentsAnimationRunner;


import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
import android.view.WindowManagerGlobal;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -271,11 +273,20 @@ public class ActivityManagerWrapper {
                runner = new IRecentsAnimationRunner.Stub() {
                runner = new IRecentsAnimationRunner.Stub() {
                    public void onAnimationStart(IRecentsAnimationController controller,
                    public void onAnimationStart(IRecentsAnimationController controller,
                            RemoteAnimationTarget[] apps) {
                            RemoteAnimationTarget[] apps) {
                        final Rect stableInsets = new Rect();
                        WindowManagerWrapper.getInstance().getStableInsets(stableInsets);
                        onAnimationStart_New(controller, apps, stableInsets, null);
                    }

                    public void onAnimationStart_New(IRecentsAnimationController controller,
                            RemoteAnimationTarget[] apps, Rect homeContentInsets,
                            Rect minimizedHomeBounds) {
                        final RecentsAnimationControllerCompat controllerCompat =
                        final RecentsAnimationControllerCompat controllerCompat =
                                new RecentsAnimationControllerCompat(controller);
                                new RecentsAnimationControllerCompat(controller);
                        final RemoteAnimationTargetCompat[] appsCompat =
                        final RemoteAnimationTargetCompat[] appsCompat =
                                RemoteAnimationTargetCompat.wrap(apps);
                                RemoteAnimationTargetCompat.wrap(apps);
                        animationHandler.onAnimationStart(controllerCompat, appsCompat);
                        animationHandler.onAnimationStart(controllerCompat, appsCompat,
                                homeContentInsets, minimizedHomeBounds);
                    }
                    }


                    public void onAnimationCanceled() {
                    public void onAnimationCanceled() {
+3 −1
Original line number Original line Diff line number Diff line
@@ -16,13 +16,15 @@


package com.android.systemui.shared.system;
package com.android.systemui.shared.system;


import android.graphics.Rect;

public interface RecentsAnimationListener {
public interface RecentsAnimationListener {


    /**
    /**
     * Called when the animation into Recents can start. This call is made on the binder thread.
     * Called when the animation into Recents can start. This call is made on the binder thread.
     */
     */
    void onAnimationStart(RecentsAnimationControllerCompat controller,
    void onAnimationStart(RecentsAnimationControllerCompat controller,
            RemoteAnimationTargetCompat[] apps);
            RemoteAnimationTargetCompat[] apps, Rect homeContentInsets, Rect minimizedHomeBounds);


    /**
    /**
     * Called when the animation into Recents was canceled. This call is made on the binder thread.
     * Called when the animation into Recents was canceled. This call is made on the binder thread.
+20 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,9 @@


package com.android.systemui.shared.system;
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.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.view.RemoteAnimationTarget;
import android.view.RemoteAnimationTarget;
@@ -37,7 +40,10 @@ public class RemoteAnimationTargetCompat {
    public final Point position;
    public final Point position;
    public final Rect sourceContainerBounds;
    public final Rect sourceContainerBounds;


    private final RemoteAnimationTarget mTarget;

    public RemoteAnimationTargetCompat(RemoteAnimationTarget app) {
    public RemoteAnimationTargetCompat(RemoteAnimationTarget app) {
        mTarget = app;
        taskId = app.taskId;
        taskId = app.taskId;
        mode = app.mode;
        mode = app.mode;
        leash = new SurfaceControlCompat(app.leash);
        leash = new SurfaceControlCompat(app.leash);
@@ -56,4 +62,18 @@ public class RemoteAnimationTargetCompat {
        }
        }
        return appsCompat;
        return appsCompat;
    }
    }

    /**
     * TODO: Get as a method for compatibility (will move into ctor once Launcher updates)
     */
    public Rect getContentInsets() {
        return mTarget.contentInsets;
    }

    /**
     * TODO: Get as a method for compatibility (will move into ctor once Launcher updates)
     */
    public boolean isAssistantActivityType() {
        return mTarget.windowConfiguration.getActivityType() == ACTIVITY_TYPE_ASSISTANT;
    }
}
}
 No newline at end of file
Loading