Merge "Validate aspect ratio on PiP params change." into tm-qpr-dev am: 8975d9a03a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22461774

Change-Id: Id93ca5fc11434dc7872f24ea84d669c42baba85b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mateusz Cicheński
2023-04-05 17:03:39 +00:00
committed by Automerger Merge Worker
2 changed files with 11 additions and 2 deletions

View File

@@ -198,7 +198,7 @@ public class PipBoundsAlgorithm {
/**
* @return whether the given {@param aspectRatio} is valid.
*/
private boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
public boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
return Float.compare(mMinAspectRatio, aspectRatio) <= 0
&& Float.compare(aspectRatio, mMaxAspectRatio) <= 0;
}

View File

@@ -1230,7 +1230,16 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
protected void applyNewPictureInPictureParams(@NonNull PictureInPictureParams params) {
if (mDeferredTaskInfo != null || PipUtils.aspectRatioChanged(params.getAspectRatioFloat(),
mPictureInPictureParams.getAspectRatioFloat())) {
mPipParamsChangedForwarder.notifyAspectRatioChanged(params.getAspectRatioFloat());
if (mPipBoundsAlgorithm.isValidPictureInPictureAspectRatio(
params.getAspectRatioFloat())) {
mPipParamsChangedForwarder.notifyAspectRatioChanged(params.getAspectRatioFloat());
} else {
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
"%s: New aspect ratio is not valid."
+ " hasAspectRatio=%b"
+ " aspectRatio=%f",
TAG, params.hasSetAspectRatio(), params.getAspectRatioFloat());
}
}
if (mDeferredTaskInfo != null
|| PipUtils.remoteActionsChanged(params.getActions(),