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

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

Merge "Use the bounds received in taskAppeared" into rvc-dev

parents 13dcbd32 fbc25fe9
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Looper;
import android.os.RemoteException;
import android.os.RemoteException;
import android.util.Log;
import android.util.Log;
@@ -47,7 +48,9 @@ import com.android.systemui.R;
import com.android.systemui.pip.phone.PipUpdateThread;
import com.android.systemui.pip.phone.PipUpdateThread;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Consumer;


@@ -79,6 +82,7 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
    private final Rect mLastReportedBounds = new Rect();
    private final Rect mLastReportedBounds = new Rect();
    private final int mEnterExitAnimationDuration;
    private final int mEnterExitAnimationDuration;
    private final PipSurfaceTransactionHelper mSurfaceTransactionHelper;
    private final PipSurfaceTransactionHelper mSurfaceTransactionHelper;
    private final Map<IBinder, Rect> mBoundsToRestore = new HashMap<>();


    // These callbacks are called on the update thread
    // These callbacks are called on the update thread
    private final PipAnimationController.PipAnimationCallback mPipAnimationCallback =
    private final PipAnimationController.PipAnimationCallback mPipAnimationCallback =
@@ -222,6 +226,7 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
            throw new RuntimeException("Unable to get leash", e);
            throw new RuntimeException("Unable to get leash", e);
        }
        }
        final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds();
        final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds();
        mBoundsToRestore.put(mToken.asBinder(), currentBounds);
        if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
        if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
            scheduleAnimateResizePip(currentBounds, destinationBounds,
            scheduleAnimateResizePip(currentBounds, destinationBounds,
                    TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, null);
                    TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, null);
@@ -246,8 +251,8 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
            Log.wtf(TAG, "Unrecognized token: " + token);
            Log.wtf(TAG, "Unrecognized token: " + token);
            return;
            return;
        }
        }
        scheduleAnimateResizePip(mLastReportedBounds,
        final Rect boundsToRestore = mBoundsToRestore.remove(token.asBinder());
                info.configuration.windowConfiguration.getBounds(),
        scheduleAnimateResizePip(mLastReportedBounds, boundsToRestore,
                TRANSITION_DIRECTION_TO_FULLSCREEN, mEnterExitAnimationDuration, null);
                TRANSITION_DIRECTION_TO_FULLSCREEN, mEnterExitAnimationDuration, null);
        mInPip = false;
        mInPip = false;
    }
    }