[Remoting Android] Fix cutout bugs
CL 1174982 only fixes layout issues when the screen has two cutouts that
cancels each other when calculating the center of the safe area. We
still have layout issues in single cutout scenario. This CL fixes these
bugs:
* Fix the calculation of the safe area center. It should be
  (width + inset.left - inset.right) / 2 instead of
  width / 2 + inset.left - inset.right. Same thing for y coordinate
  calculation.
* The letterbox padding doesn't need to account for the safe insets
  since GetViewportScreenCenter() and GetViewportBounds() already
  account for that. Undoing the letterbox changes.
* The SystemUIRect already takes cutouts into consideration. Since we
  no longer include safe insets in the letterbox padding, this CL makes
  DesktopCanvas ignore safe insets during calculation when the
  SystemUIRect is provided so that we don't double-apply the adjustment.
Scenarios manually tested:
{no cutout, 1 cutout, 2 symmetrical cutouts on top and bottom} x
{portrait mode, landscape mode} x
{touch input mode, trackpad input mode} x
{desktop < screen (letterboxes showing),
 desktop >= screen (no letterbox)} x
{keyboard showing, keyboard not showing}
Bug: 831670
Change-Id: I0ad192b2a199c8c1d4d7740b52d4b074c3626640
Reviewed-on: https://chromium-review.googlesource.com/1185631Reviewed-by:  Joe Downing <joedow@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585277}
Joe Downing <joedow@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585277}
Showing
Please register or sign in to comment