Do not apply transparent policy if orientation is respected
On device with config_letterboxIsEnabledForTranslucentActivities=true,
the translucent activity will inherit the configuration of opaque
activity in the same task.
But if the orientation of activity can affect display, i.e.
ignore-orientation is not set (such as outer screen of foldable device),
then ideally the behavior should be similar to regular phone.
This change makes that it is possible to switch between inherit and
non-inherit at runtime. The TransparentPolicy is still initialized
if AppCompatConfiguration#isTranslucentLetterboxingEnabled is true.
But its configuration override policy will be no-op if the translucent
activity can affect display orientation. And once the display becomes
ignoring requested orientation, the policy can still apply the override
from the existed info.
That allows the scenario:
On folded screen, a task contains a top portrait translucent activity.
And the bottom activity is visible with fixed landscape orientation.
After switching to unfold display, the translucent activity will
follow the bottom activity's bounds and orientation.
Bug: 278097747
Flag: com.android.window.flags.respect_non_top_visible_fixed_orientation
Test: atest TransparentPolicyTest# \
testNotRunStrategyToTranslucentActivitiesIfRespectOrientation
Change-Id: Id9861c908420961efb945e36fb50a13ea4de7e8f
5 files changed