Add debugging information on PiP content overlay
Added the reason for creating the overlay. Updated
SwipePipToHomeAnimator constructor also due to the fact the source rect
hint from Builder class is never empty.
Bug: 330488822
Test: manually, follow the reproduce path
Flag: NA
Change-Id: Id98ce799d7c96fff3279c0df0fa49084a49d563a
diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
index 6c89be1..f823aff 100644
--- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
@@ -112,7 +112,7 @@
@NonNull ActivityInfo activityInfo,
int appIconSizePx,
@NonNull SurfaceControl leash,
- @Nullable Rect sourceRectHint,
+ @NonNull Rect sourceRectHint,
@NonNull Rect appBounds,
@NonNull Matrix homeToWindowPositionMap,
@NonNull RectF startBounds,
@@ -135,22 +135,25 @@
mDestinationBoundsTransformed.set(destinationBoundsTransformed);
mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius, shadowRadius);
- if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width()
- || sourceRectHint.height() < destinationBounds.height())) {
+ String reasonForCreateOverlay = null; // For debugging purpose.
+ if (sourceRectHint.isEmpty()) {
+ reasonForCreateOverlay = "Source rect hint is empty";
+ } else if (sourceRectHint.width() < destinationBounds.width()
+ || sourceRectHint.height() < destinationBounds.height()) {
// This is a situation in which the source hint rect on at least one axis is smaller
// than the destination bounds, which presents a problem because we would have to scale
// up that axis to fit the bounds. So instead, just fallback to the non-source hint
// animation in this case.
- sourceRectHint = null;
- }
-
- if (sourceRectHint != null && !appBounds.contains(sourceRectHint)) {
+ reasonForCreateOverlay = "Source rect hint is too small " + sourceRectHint;
+ sourceRectHint.setEmpty();
+ } else if (!appBounds.contains(sourceRectHint)) {
// This is a situation in which the source hint rect is outside the app bounds, so it is
// not a valid rectangle to use for cropping app surface
- sourceRectHint = null;
+ sourceRectHint.setEmpty();
+ reasonForCreateOverlay = "Source rect hint exceeds display bounds " + sourceRectHint;
}
- if (sourceRectHint == null) {
+ if (sourceRectHint.isEmpty()) {
mSourceRectHint.setEmpty();
mSourceHintRectInsets = null;
@@ -162,6 +165,7 @@
new IconProvider(context).getIcon(mActivityInfo), appIconSizePx);
final SurfaceControl.Transaction tx = new SurfaceControl.Transaction();
mPipContentOverlay.attach(tx, mLeash);
+ Log.d(TAG, getContentOverlay() + " is created: " + reasonForCreateOverlay);
} else {
mSourceRectHint.set(sourceRectHint);
mSourceHintRectInsets = new Rect(sourceRectHint.left - appBounds.left,