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
This commit is contained in:
Ben Lin
2020-04-07 17:15:21 -07:00
parent b1cd7d54a1
commit 3cd7bc3fb3
2 changed files with 2 additions and 12 deletions

View File

@@ -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

View File

@@ -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());
}
/**