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

Commit b899f626 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Apply PictureInPictureSurfaceTransaction upon reparent" into sc-dev

parents 8af1716c 0df585fb
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.view;
import android.app.ActivityManager;
import android.view.IRemoteAnimationFinishedCallback;
import android.graphics.GraphicBuffer;
import android.graphics.Rect;
import android.window.PictureInPictureSurfaceTransaction;
import android.window.TaskSnapshot;

@@ -39,14 +38,13 @@ interface IRecentsAnimationController {
    TaskSnapshot screenshotTask(int taskId);

    /**
     * Sets the final bounds 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 updated
     * accordingly. This should be called before `finish`
     * 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
     * updated accordingly. This should be called before `finish`
     * @param taskId for which the leash should be updated
     * @param destinationBounds bounds of the final PiP window
     * @param finishTransaction leash operations for the final transform.
     */
     void setFinishTaskBounds(int taskId, in Rect destinationBounds,
     void setFinishTaskTransaction(int taskId,
             in PictureInPictureSurfaceTransaction finishTransaction);

    /**
+19 −0
Original line number Diff line number Diff line
@@ -16,10 +16,13 @@

package android.window;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.SurfaceControl;

import java.util.Objects;

@@ -127,6 +130,22 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable {
                + ")";
    }

    /** Applies {@link PictureInPictureSurfaceTransaction} to a given leash. */
    public static void apply(@NonNull PictureInPictureSurfaceTransaction surfaceTransaction,
            @NonNull SurfaceControl surfaceControl,
            @NonNull SurfaceControl.Transaction tx) {
        final Matrix matrix = new Matrix();
        matrix.setScale(surfaceTransaction.mScaleX, surfaceTransaction.mScaleY);
        if (surfaceTransaction.mRotation != 0) {
            matrix.postRotate(surfaceTransaction.mRotation);
        }
        tx.setMatrix(surfaceControl, matrix, new float[9])
                .setPosition(surfaceControl,
                        surfaceTransaction.mPositionX, surfaceTransaction.mPositionY)
                .setWindowCrop(surfaceControl, surfaceTransaction.getWindowCrop())
                .setCornerRadius(surfaceControl, surfaceTransaction.mCornerRadius);
    }

    public static final @android.annotation.NonNull Creator<PictureInPictureSurfaceTransaction>
            CREATOR =
            new Creator<PictureInPictureSurfaceTransaction>() {
+6 −12
Original line number Diff line number Diff line
@@ -367,12 +367,6 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/DisplayRotation.java"
    },
    "-1729340764": {
      "message": "setFinishTaskBounds(%d): bounds=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimationController.java"
    },
    "-1715268616": {
      "message": "Last window, removing starting window %s",
      "level": "VERBOSE",
@@ -1705,6 +1699,12 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-163974242": {
      "message": "setFinishTaskTransaction(%d): transaction=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimationController.java"
    },
    "-143556958": {
      "message": "resumeNextFocusableActivityWhenRootTaskIsEmpty: %s, go home",
      "level": "DEBUG",
@@ -1897,12 +1897,6 @@
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimationController.java"
    },
    "86989930": {
      "message": "setTaskWindowingMode: moving task=%d to windowingMode=%d toTop=%b",
      "level": "DEBUG",
      "group": "WM_DEBUG_TASKS",
      "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
    },
    "90764070": {
      "message": "Could not report token removal to the window token client.",
      "level": "WARN",
+5 −7
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.shared.system;

import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
import android.view.IRecentsAnimationController;
@@ -72,17 +71,16 @@ public class RecentsAnimationControllerCompat {
    }

    /**
     * Sets the final bounds 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 updated
     * accordingly. This should be called before `finish`
     * 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
     * updated accordingly. This should be called before `finish`
     * @param taskId Task id of the Activity in PiP mode.
     * @param destinationBounds Bounds of the PiP window on home.
     * @param finishTransaction leash operations for the final transform.
     */
    public void setFinishTaskBounds(int taskId, Rect destinationBounds,
    public void setFinishTaskTransaction(int taskId,
            PictureInPictureSurfaceTransaction finishTransaction) {
        try {
            mAnimationController.setFinishTaskBounds(taskId, destinationBounds, finishTransaction);
            mAnimationController.setFinishTaskTransaction(taskId, finishTransaction);
        } catch (RemoteException e) {
            Log.d(TAG, "Failed to set finish task bounds", e);
        }
+2 −2
Original line number Diff line number Diff line
@@ -185,10 +185,10 @@ public class RemoteTransitionCompat implements Parcelable {
            mWrapped.hideCurrentInputMethod();
        }

        @Override public void setFinishTaskBounds(int taskId, Rect destinationBounds,
        @Override public void setFinishTaskTransaction(int taskId,
                PictureInPictureSurfaceTransaction finishTransaction) {
            if (mWrapped != null) {
                mWrapped.setFinishTaskBounds(taskId, destinationBounds, finishTransaction);
                mWrapped.setFinishTaskTransaction(taskId, finishTransaction);
            }
        }

Loading