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

Commit 3cd7bc3f authored by Ben Lin's avatar Ben Lin
Browse files

PIP: Start consulting TaskOrganizer for bounds instead of framework.

SysteUI now owns the PIP surface and its movement, etc, and should be
the source of truth for MotionHelper to ask for current PIP bounds. We
can then avoid making a call to framework to query this.

Bug: 153369299
Test: atest PinnedStackTests
Change-Id: If614a1cefb4b28ad7177ad6569371e5aa077153d
parent b1cd7d54
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class PipTaskOrganizer extends TaskOrganizer {
        @Override
        public void onPipAnimationEnd(SurfaceControl.Transaction tx,
                PipAnimationController.PipTransitionAnimator animator) {
            finishResize(tx, animator.getDestinationBounds(), animator.getTransitionDirection());
            mMainHandler.post(() -> {
                for (int i = mPipTransitionCallbacks.size() - 1; i >= 0; i--) {
                    final PipTransitionCallback callback = mPipTransitionCallbacks.get(i);
@@ -110,7 +111,6 @@ public class PipTaskOrganizer extends TaskOrganizer {
                            animator.getTransitionDirection());
                }
            });
            finishResize(tx, animator.getDestinationBounds(), animator.getTransitionDirection());
        }

        @Override
+1 −11
Original line number Diff line number Diff line
@@ -16,12 +16,10 @@

package com.android.systemui.pip.phone;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager.StackInfo;
import android.app.IActivityTaskManager;
import android.content.Context;
import android.graphics.Point;
@@ -166,15 +164,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
     */
    void synchronizePinnedStackBounds() {
        cancelAnimations();
        try {
            StackInfo stackInfo = mActivityTaskManager.getStackInfo(
                    WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED);
            if (stackInfo != null) {
                mBounds.set(stackInfo.bounds);
            }
        } catch (RemoteException e) {
            Log.w(TAG, "Failed to get pinned stack bounds");
        }
        mBounds.set(mPipTaskOrganizer.getLastReportedBounds());
    }

    /**