summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sergey Nikolaienkov <sergeynv@google.com> 2020-08-31 17:16:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-08-31 17:16:00 +0000
commita90f6e059f28e139f7457316bcd39036e09d122f (patch)
tree1328cebba761156962c067e0dd349c2d1c7a098f
parent4b0d128b93d655e92238f086832b60fbba990155 (diff)
parent600fe82949dcc9f5080503b9769f6be478b67747 (diff)
Merge "Fix checking if PiP aspect ratio has changed"
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
index c956702c9216..6f44090d2744 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
@@ -47,6 +47,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;
+import android.util.Rational;
import android.util.Size;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
@@ -684,13 +685,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements ShellTaskOrganize
* {@link PictureInPictureParams} would affect the bounds.
*/
private boolean applyPictureInPictureParams(@NonNull PictureInPictureParams params) {
- final boolean changed = (mPictureInPictureParams == null) || !Objects.equals(
- mPictureInPictureParams.getAspectRatioRational(), params.getAspectRatioRational());
- if (changed) {
- mPictureInPictureParams = params;
+ final Rational currentAspectRatio =
+ mPictureInPictureParams != null ? mPictureInPictureParams.getAspectRatioRational()
+ : null;
+ final boolean aspectRatioChanged = !Objects.equals(currentAspectRatio,
+ params.getAspectRatioRational());
+ mPictureInPictureParams = params;
+ if (aspectRatioChanged) {
mPipBoundsHandler.onAspectRatioChanged(params.getAspectRatio());
}
- return changed;
+ return aspectRatioChanged;
}
/**