Skip to content
Commit 04164186 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Don't involve decor inset into app bounds of fixed aspect ratio app

Assume the display size is 1000x2000 with a system decor height 100 at
top (e.g. cutout). For an activity declared max aspect ratio as 1.5:1,
its bounds will be (0,0,1000,1600) because decor region is also included.
And the app bounds should be 1000x1500 (0,100,1000,1600) that fits the
declared aspect ratio.

The original problem is that the app bounds is set to override bounds
directly (without intersecting with parent app bounds), so the aspect
ratio becomes 1.6:1 that doesn't match the declaration.

Since non-resizable activity with fixed aspect ratio will follow the
policy of size compatibility mode: fixed screen relative configuration
across display changes, now the app bounds (intersected with parent app
bounds) also becomes a part of override configuration. That makes sure
the app bounds keeps the declared aspect ratio.

Because the app bounds may contain offset that is occupied by the decor
insets, the offset is applied when parent also has the insets at the
corresponding side. This is just to avoid losing the original insets
information, although currently it may not be used.

Bug: 112288258
Fixes: 127661671
Fixes: 127667028
Test: atest AspectRatioTests
Test: atest AspectRatioSdk25Tests
Test: atest ActivityRecordTests# \
      testSizeCompatMode_FixedAspectRatioBoundsWithDecor
Test: atest ActivityDisplayTests#testHandleActivitySizeCompatMode

Change-Id: I7850a556862e1060876ca094fd919d78ddc4185e
parent 153edfc3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment