Merge "Prevent updating aspect ratio unless it is different."

This commit is contained in:
Winson Chung
2017-03-21 19:59:33 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 11 deletions

View File

@@ -298,6 +298,13 @@ class PinnedStackController {
}
}
/**
* @return the current aspect ratio.
*/
float getAspectRatio() {
return mAspectRatio;
}
/**
* Sets the current set of actions.
*/

View File

@@ -82,19 +82,17 @@ public class PinnedStackWindowController extends StackWindowController {
return;
}
final int displayId = mContainer.getDisplayContent().getDisplayId();
final Rect toBounds = mService.getPictureInPictureBounds(displayId, aspectRatio);
final Rect targetBounds = new Rect();
mContainer.getAnimatingBounds(targetBounds);
if (!toBounds.equals(targetBounds)) {
animateResizePinnedStack(toBounds, -1 /* duration */);
}
final PinnedStackController pinnedStackController =
mContainer.getDisplayContent().getPinnedStackController();
pinnedStackController.setAspectRatio(
pinnedStackController.isValidPictureInPictureAspectRatio(aspectRatio)
? aspectRatio : -1f);
if (Float.compare(aspectRatio, pinnedStackController.getAspectRatio()) != 0) {
final int displayId = mContainer.getDisplayContent().getDisplayId();
final Rect toBounds = mService.getPictureInPictureBounds(displayId, aspectRatio);
animateResizePinnedStack(toBounds, -1 /* duration */);
pinnedStackController.setAspectRatio(
pinnedStackController.isValidPictureInPictureAspectRatio(aspectRatio)
? aspectRatio : -1f);
}
}
}