Validate aspect ratio on PiP params change.
If the params do not provide the aspect ratio we will return 0f, which impacts further computations on e.g. pinch resize gesture. Bug: 276455406 Test: manually modify ApiDemos to not provide aspect ratio, enter PiP and verify that aspect ratio is set to default value instead of 0 Change-Id: Ie734a4e35ccbccdad5a2bee0f0e1bd507dcc1025
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user