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

Commit c5e289d4 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Workaround launching PiP task with CLEAR_TASK & NEW_TASK flag." into oc-dev

parents a20b6ba1 e6385a23
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -39,8 +39,11 @@ oneway interface ITaskStackListener {
     * Called whenever IActivityManager.startActivity is called on an activity that is already
     * running in the pinned stack and the activity is not actually started, but the task is either
     * brought to the front or a new Intent is delivered to it.
     *
     * @param clearedTask whether or not the launch activity also cleared the task as a part of
     * starting
     */
    void onPinnedActivityRestartAttempt();
    void onPinnedActivityRestartAttempt(boolean clearedTask);

    /**
     * Called whenever the pinned stack is starting animating a resize.
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
    }

    @Override
    public void onPinnedActivityRestartAttempt() throws RemoteException {
    public void onPinnedActivityRestartAttempt(boolean clearedTask) throws RemoteException {
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -107,12 +107,12 @@ public class PipManager implements BasePipManager {
        }

        @Override
        public void onPinnedActivityRestartAttempt() {
        public void onPinnedActivityRestartAttempt(boolean clearedTask) {
            if (!checkCurrentUserId(false /* debug */)) {
                return;
            }

            mTouchHandler.getMotionHelper().expandPip();
            mTouchHandler.getMotionHelper().expandPip(clearedTask /* skipAnimation */);
        }
    };

+15 −4
Original line number Diff line number Diff line
@@ -140,14 +140,25 @@ public class PipMotionHelper {
     * Resizes the pinned stack back to fullscreen.
     */
    void expandPip() {
        expandPip(false /* skipAnimation */);
    }

    /**
     * Resizes the pinned stack back to fullscreen.
     */
    void expandPip(boolean skipAnimation) {
        cancelAnimations();
        mHandler.post(() -> {
            try {
                if (skipAnimation) {
                    mActivityManager.moveTasksToFullscreenStack(PINNED_STACK_ID, true /* onTop */);
                } else {
                    mActivityManager.resizeStack(PINNED_STACK_ID, null /* bounds */,
                            true /* allowResizeInDockedMode */, true /* preserveWindows */,
                            true /* animate */, EXPAND_STACK_TO_FULLSCREEN_DURATION);
                }
            } catch (RemoteException e) {
                Log.e(TAG, "Error showing PiP menu activity", e);
                Log.e(TAG, "Error expanding PiP activity", e);
            }
        });
    }
+1 −1
Original line number Diff line number Diff line
@@ -625,7 +625,7 @@ public class PipManager implements BasePipManager {
        }

        @Override
        public void onPinnedActivityRestartAttempt() {
        public void onPinnedActivityRestartAttempt(boolean clearedTask) {
            if (DEBUG) Log.d(TAG, "onPinnedActivityRestartAttempt()");
            if (!checkCurrentUserId(DEBUG)) {
                return;
Loading