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

Commit 02572f5d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8926023 from bca7840e to tm-qpr1-release

Change-Id: I31982f36f327e6b02761788f899ce91c335211a2
parents 2223d96d bca7840e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ public final class ViewRootImpl implements ViewParent,
     * @hide
     */
    public static final boolean CAPTION_ON_SHELL =
            SystemProperties.getBoolean("persist.debug.caption_on_shell", false);
            SystemProperties.getBoolean("persist.wm.debug.caption_on_shell", false);

    /**
     * Whether the client should compute the window frame on its own.
+6 −0
Original line number Diff line number Diff line
@@ -503,6 +503,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                            updateMovementBounds(null /* toBounds */, false /* fromRotation */,
                                    false /* fromImeAdjustment */, false /* fromShelfAdjustment */,
                                    null /* windowContainerTransaction */);
                        } else {
                            // when we enter pip for the first time, the destination bounds and pip
                            // bounds will already match, since they are calculated prior to
                            // starting the animation, so we only need to update the min/max size
                            // that is used for e.g. double tap to maximized state
                            mTouchHandler.updateMinMaxSize(ratio);
                        }
                    }

+22 −7
Original line number Diff line number Diff line
@@ -412,13 +412,7 @@ public class PipTouchHandler {
                mPipBoundsState.getExpandedBounds(), insetBounds, expandedMovementBounds,
                bottomOffset);

        if (mPipResizeGestureHandler.isUsingPinchToZoom()) {
            updatePinchResizeSizeConstraints(insetBounds, normalBounds, aspectRatio);
        } else {
            mPipResizeGestureHandler.updateMinSize(normalBounds.width(), normalBounds.height());
            mPipResizeGestureHandler.updateMaxSize(mPipBoundsState.getExpandedBounds().width(),
                    mPipBoundsState.getExpandedBounds().height());
        }
        updatePipSizeConstraints(insetBounds, normalBounds, aspectRatio);

        // The extra offset does not really affect the movement bounds, but are applied based on the
        // current state (ime showing, or shelf offset) when we need to actually shift
@@ -487,6 +481,27 @@ public class PipTouchHandler {
        }
    }

    /**
     * Update the values for min/max allowed size of picture in picture window based on the aspect
     * ratio.
     * @param aspectRatio aspect ratio to use for the calculation of min/max size
     */
    public void updateMinMaxSize(float aspectRatio) {
        updatePipSizeConstraints(mInsetBounds, mPipBoundsState.getNormalBounds(),
                aspectRatio);
    }

    private void updatePipSizeConstraints(Rect insetBounds, Rect normalBounds,
            float aspectRatio) {
        if (mPipResizeGestureHandler.isUsingPinchToZoom()) {
            updatePinchResizeSizeConstraints(insetBounds, normalBounds, aspectRatio);
        } else {
            mPipResizeGestureHandler.updateMinSize(normalBounds.width(), normalBounds.height());
            mPipResizeGestureHandler.updateMaxSize(mPipBoundsState.getExpandedBounds().width(),
                    mPipBoundsState.getExpandedBounds().height());
        }
    }

    private void updatePinchResizeSizeConstraints(Rect insetBounds, Rect normalBounds,
            float aspectRatio) {
        final int shorterLength = Math.min(mPipBoundsState.getDisplayBounds().width(),
+41 −10
Original line number Diff line number Diff line
@@ -337,17 +337,39 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
    }

    public void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) {
        options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options,
                null /* wct */);

        final int[] result = new int[1];
        IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() {
            @Override
            public void onAnimationStart(@WindowManager.TransitionOldType int transit,
                    RemoteAnimationTarget[] apps,
                    RemoteAnimationTarget[] wallpapers,
                    RemoteAnimationTarget[] nonApps,
                    final IRemoteAnimationFinishedCallback finishedCallback) {
                try {
                    finishedCallback.onAnimationFinished();
                } catch (RemoteException e) {
                    Slog.e(TAG, "Failed to invoke onAnimationFinished", e);
                }
                if (result[0] == START_SUCCESS || result[0] == START_TASK_TO_FRONT) {
                    final WindowContainerTransaction evictWct = new WindowContainerTransaction();
            mStageCoordinator.prepareEvictChildTasks(position, evictWct);
            final int result =
                    ActivityTaskManager.getService().startActivityFromRecents(taskId, options);
            if (result == START_SUCCESS || result == START_TASK_TO_FRONT) {
                    mStageCoordinator.prepareEvictNonOpeningChildTasks(position, apps, evictWct);
                    mSyncQueue.queue(evictWct);
                }
            }
            @Override
            public void onAnimationCancelled(boolean isKeyguardOccluded) {
            }
        };
        options = mStageCoordinator.resolveStartStage(STAGE_TYPE_UNDEFINED, position, options,
                null /* wct */);
        RemoteAnimationAdapter wrappedAdapter = new RemoteAnimationAdapter(wrapper,
                0 /* duration */, 0 /* statusBarTransitionDelay */);
        ActivityOptions activityOptions = ActivityOptions.fromBundle(options);
        activityOptions.update(ActivityOptions.makeRemoteAnimation(wrappedAdapter));

        try {
            result[0] = ActivityTaskManager.getService().startActivityFromRecents(taskId,
                    activityOptions.toBundle());
        } catch (RemoteException e) {
            Slog.e(TAG, "Failed to launch task", e);
        }
@@ -403,7 +425,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,

        // Flag with MULTIPLE_TASK if this is launching the same activity into both sides of the
        // split.
        if (isLaunchingAdjacently(intent.getIntent(), position)) {
        if (shouldAddMultipleTaskFlag(intent.getIntent(), position)) {
            fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK");
        }
@@ -418,8 +440,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,

    /** Returns {@code true} if it's launching the same component on both sides of the split. */
    @VisibleForTesting
    boolean isLaunchingAdjacently(@Nullable Intent startIntent,
            @SplitPosition int position) {
    boolean shouldAddMultipleTaskFlag(@Nullable Intent startIntent, @SplitPosition int position) {
        if (startIntent == null) {
            return false;
        }
@@ -430,6 +451,16 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
        }

        if (isSplitScreenVisible()) {
            // To prevent users from constantly dropping the same app to the same side resulting in
            // a large number of instances in the background.
            final ActivityManager.RunningTaskInfo targetTaskInfo = getTaskInfo(position);
            final ComponentName targetActivity = targetTaskInfo != null
                    ? targetTaskInfo.baseIntent.getComponent() : null;
            if (Objects.equals(launchingActivity, targetActivity)) {
                return false;
            }

            // Allow users to start a new instance the same to adjacent side.
            final ActivityManager.RunningTaskInfo pairedTaskInfo =
                    getTaskInfo(SplitLayout.reversePosition(position));
            final ComponentName pairedActivity = pairedTaskInfo != null
Loading