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

Commit 141f6dc1 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8837442 from abeae705 to tm-qpr1-release

Change-Id: Ibf08b15cb52ddc2d72ec555f1e6a76e9625ca5cd
parents 192d594a abeae705
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1149,7 +1149,6 @@ public class ActivityOptions extends ComponentOptions {
        opts.mLaunchIntoPipParams = new PictureInPictureParams.Builder(pictureInPictureParams)
                .setIsLaunchIntoPip(true)
                .build();
        opts.mLaunchBounds = new Rect(pictureInPictureParams.getSourceRectHint());
        return opts;
    }

+3 −1
Original line number Diff line number Diff line
@@ -1130,7 +1130,9 @@ public class AppWidgetManager {
     * @param intent        The intent of the service which will be providing the data to the
     *                      RemoteViewsAdapter.
     * @param connection    The callback interface to be notified when a connection is made or lost.
     * @param flags         Flags used for binding to the service
     * @param flags         Flags used for binding to the service. Currently only
     *                     {@link Context#BIND_AUTO_CREATE} and
     *                     {@link Context#BIND_FOREGROUND_SERVICE_WHILE_AWAKE} are supported.
     *
     * @see Context#getServiceDispatcher(ServiceConnection, Handler, int)
     * @hide
+22 −6
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ import com.android.launcher3.icons.IconProvider;
import com.android.wm.shell.R;
import com.android.wm.shell.common.SurfaceUtils;

import java.util.function.Consumer;

/**
 * Handles split decor like showing resizing hint for a specific split.
 */
@@ -212,7 +214,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
                newBounds.height() / 2 - mIconSize / 2);

        if (animate) {
            startFadeAnimation(show, false /* isResized */);
            startFadeAnimation(show, null /* finishedConsumer */);
            mShown = show;
        }
    }
@@ -243,15 +245,29 @@ public class SplitDecorManager extends WindowlessWindowManager {
            mFadeAnimator.cancel();
        }
        if (mShown) {
            startFadeAnimation(false /* show */, true /* isResized */);
            mShown = false;
            fadeOutDecor(null /* finishedCallback */);
        } else {
            // Decor surface is hidden so release it directly.
            releaseDecor(t);
        }
    }

    private void startFadeAnimation(boolean show, boolean isResized) {
    /** Fade-out decor surface with animation end callback, if decor is hidden, run the callback
     * directly. */
    public void fadeOutDecor(Runnable finishedCallback) {
        if (mShown) {
            startFadeAnimation(false /* show */, transaction -> {
                releaseDecor(transaction);
                if (finishedCallback != null) finishedCallback.run();
            });
            mShown = false;
        } else {
            if (finishedCallback != null) finishedCallback.run();
        }
    }

    private void startFadeAnimation(boolean show,
            Consumer<SurfaceControl.Transaction> finishedConsumer) {
        final SurfaceControl.Transaction animT = new SurfaceControl.Transaction();
        mFadeAnimator = ValueAnimator.ofFloat(0f, 1f);
        mFadeAnimator.setDuration(FADE_DURATION);
@@ -285,8 +301,8 @@ public class SplitDecorManager extends WindowlessWindowManager {
                        animT.hide(mIconLeash);
                    }
                }
                if (isResized) {
                    releaseDecor(animT);
                if (finishedConsumer != null) {
                    finishedConsumer.accept(animT);
                }
                animT.apply();
                animT.close();
+14 −3
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import static com.android.wm.shell.animation.Interpolators.SLOWDOWN_INTERPOLATOR
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DRAG_DIVIDER;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -449,11 +450,13 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
        switch (snapTarget.flag) {
            case FLAG_DISMISS_START:
                flingDividePosition(currentPosition, snapTarget.position,
                        () -> mSplitLayoutHandler.onSnappedToDismiss(false /* bottomOrRight */));
                        () -> mSplitLayoutHandler.onSnappedToDismiss(false /* bottomOrRight */,
                                EXIT_REASON_DRAG_DIVIDER));
                break;
            case FLAG_DISMISS_END:
                flingDividePosition(currentPosition, snapTarget.position,
                        () -> mSplitLayoutHandler.onSnappedToDismiss(true /* bottomOrRight */));
                        () -> mSplitLayoutHandler.onSnappedToDismiss(true /* bottomOrRight */,
                                EXIT_REASON_DRAG_DIVIDER));
                break;
            default:
                flingDividePosition(currentPosition, snapTarget.position,
@@ -509,6 +512,14 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                isLandscape ? DOCKED_LEFT : DOCKED_TOP /* dockSide */);
    }

    /** Fling divider from current position to end or start position then exit */
    public void flingDividerToDismiss(boolean toEnd, int reason) {
        final int target = toEnd ? mDividerSnapAlgorithm.getDismissEndTarget().position
                : mDividerSnapAlgorithm.getDismissStartTarget().position;
        flingDividePosition(getDividePosition(), target,
                () -> mSplitLayoutHandler.onSnappedToDismiss(toEnd, reason));
    }

    @VisibleForTesting
    void flingDividePosition(int from, int to, @Nullable Runnable flingFinishedCallback) {
        if (from == to) {
@@ -758,7 +769,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
    public interface SplitLayoutHandler {

        /** Calls when dismissing split. */
        void onSnappedToDismiss(boolean snappedToEnd);
        void onSnappedToDismiss(boolean snappedToEnd, int reason);

        /**
         * Calls when resizing the split bounds.
+2 −2
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ public class PipTransition extends PipTransitionController {
    }

    @Override
    public void onTransitionMerged(@NonNull IBinder transition) {
    public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted) {
        if (transition != mExitTransition) {
            return;
        }
@@ -328,7 +328,7 @@ public class PipTransition extends PipTransitionController {
        }
        // Unset exitTransition AFTER cancel so that finishResize knows we are merging.
        mExitTransition = null;
        if (!cancelled) return;
        if (!cancelled || aborted) return;
        final ActivityManager.RunningTaskInfo taskInfo = mPipOrganizer.getTaskInfo();
        if (taskInfo != null) {
            startExpandAnimation(taskInfo, mPipOrganizer.getSurfaceControl(),
Loading