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

Commit 5fbbee8e authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Use updated source rect hint in PIP exit animation"

parents 2a4b6d80 2befe0b8
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -403,9 +403,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
                @Override
                public void onTransactionReady(int id, SurfaceControl.Transaction t) {
                    t.apply();
                    scheduleAnimateResizePip(mPipBoundsState.getBounds(),
                            destinationBounds, getValidSourceHintRect(mTaskInfo, destinationBounds),
                            direction, animationDurationMs, null /* updateBoundsCallback */);
                    // Make sure to grab the latest source hint rect as it could have been updated
                    // right after applying the windowing mode change.
                    final Rect sourceHintRect = getValidSourceHintRect(mPictureInPictureParams,
                            destinationBounds);
                    scheduleAnimateResizePip(mPipBoundsState.getBounds(), destinationBounds,
                            sourceHintRect, direction, animationDurationMs,
                            null /* updateBoundsCallback */);
                    mState = State.EXITING_PIP;
                }
            });
@@ -501,7 +505,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds();

        if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
            final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds);
            final Rect sourceHintRect = getValidSourceHintRect(info.pictureInPictureParams,
                    currentBounds);
            scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect,
                    TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration,
                    null /* updateBoundsCallback */);
@@ -518,10 +523,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
     * Returns the source hint rect if it is valid (if provided and is contained by the current
     * task bounds).
     */
    private Rect getValidSourceHintRect(ActivityManager.RunningTaskInfo info, Rect sourceBounds) {
        final Rect sourceHintRect = info.pictureInPictureParams != null
                && info.pictureInPictureParams.hasSourceBoundsHint()
                ? info.pictureInPictureParams.getSourceRectHint()
    private Rect getValidSourceHintRect(PictureInPictureParams params, Rect sourceBounds) {
        final Rect sourceHintRect = params != null
                && params.hasSourceBoundsHint()
                ? params.getSourceRectHint()
                : null;
        if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)) {
            return sourceHintRect;
+21 −22
Original line number Diff line number Diff line
@@ -161,17 +161,18 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
                return;
            }
            ProtoLog.v(WM_DEBUG_WINDOW_ORGANIZER, "Task info changed taskId=%d", task.mTaskId);
            mDeferTaskOrgCallbacksConsumer.accept(() -> {
            if (!task.isOrganized()) {
                // This is safe to ignore if the task is no longer organized
                return;
            }
            try {
                // Purposely notify of task info change immediately instead of deferring (like
                // appear and vanish) to allow info changes (such as new PIP params) to flow
                // without waiting.
                mTaskOrganizer.onTaskInfoChanged(taskInfo);
            } catch (RemoteException e) {
                Slog.e(TAG, "Exception sending onTaskInfoChanged callback", e);
            }
            });
        }

        void onBackPressedOnTaskRoot(Task task) {
@@ -182,7 +183,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
                // by the organizer that don't receive that signal
                return;
            }
            mDeferTaskOrgCallbacksConsumer.accept(() -> {
            if (!task.isOrganized()) {
                // This is safe to ignore if the task is no longer organized
                return;
@@ -192,7 +192,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
            } catch (Exception e) {
                Slog.e(TAG, "Exception sending onBackPressedOnTaskRoot callback", e);
            }
            });
        }
    }