Merge "Validate aspect ratio on PiP params change." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8975d9a03a
@@ -198,7 +198,7 @@ public class PipBoundsAlgorithm {
|
|||||||
/**
|
/**
|
||||||
* @return whether the given {@param aspectRatio} is valid.
|
* @return whether the given {@param aspectRatio} is valid.
|
||||||
*/
|
*/
|
||||||
private boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
|
public boolean isValidPictureInPictureAspectRatio(float aspectRatio) {
|
||||||
return Float.compare(mMinAspectRatio, aspectRatio) <= 0
|
return Float.compare(mMinAspectRatio, aspectRatio) <= 0
|
||||||
&& Float.compare(aspectRatio, mMaxAspectRatio) <= 0;
|
&& Float.compare(aspectRatio, mMaxAspectRatio) <= 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1230,7 +1230,16 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
protected void applyNewPictureInPictureParams(@NonNull PictureInPictureParams params) {
|
protected void applyNewPictureInPictureParams(@NonNull PictureInPictureParams params) {
|
||||||
if (mDeferredTaskInfo != null || PipUtils.aspectRatioChanged(params.getAspectRatioFloat(),
|
if (mDeferredTaskInfo != null || PipUtils.aspectRatioChanged(params.getAspectRatioFloat(),
|
||||||
mPictureInPictureParams.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
|
if (mDeferredTaskInfo != null
|
||||||
|| PipUtils.remoteActionsChanged(params.getActions(),
|
|| PipUtils.remoteActionsChanged(params.getActions(),
|
||||||
|
|||||||
Reference in New Issue
Block a user