Skip to content
Commit d0051864 authored by Oleg Blinnikov's avatar Oleg Blinnikov
Browse files

Per-app override sandboxing View API to Activity bounds

Some applications assume that they occupy the whole screen and therefore
use the display coordinates in their calculations. This can lead to
shifted or out of bounds UI elements in case the activity is Letterboxed
or is in split-screen mode.

OVERRIDE_SANDBOX_VIEW_BOUNDS_APIS change id forces the packages it is
applied to sandbox View API to Activity bounds for:

android.view.View#getBoundsOnScreen
android.view.View#getLocationOnScreen
android.view.View#getWindowVisibleDisplayFrame
android.view.View#getWindowDisplayFrame

This sandboxing is happening indirectly in android.view.ViewRootImpl through
android.view.ViewRootImpl#getWindowVisibleDisplayFrame,
android.view.ViewRootImpl#getDisplayFrame respectively.

Application developers can opt-out of this treatment by using the
following configuration in their manifest:

<application>
    <property
      android:name=
      "android.window.PROPERTY_COMPAT_ALLOW_SANDBOXING_VIEW_BOUNDS_APIS"
     android:value="false"/>
</application>

The difference between this CL and the previous attempt in
commit:Ia064d26b46402a04056f498a1ed5c090a6d1b965 is that in the current
CL the window bounds are found with windowConfiguration.getBounds(),
which is subtracted from displayFrame to make the latter appear as
occupying the whole screen without letterbox or multi-window mode.
getBounds also takes compatScale and overrideScale into account so no
additional scaling is needed.

This compat change is taking effect only in non-system
processes, this important because all compat changes are enabled for
the system process. For example this compat change may impact ANR dialog
created within the system process, but it does not require this compat
change to be enabled.

Test: atest CtsWindowManagerDeviceTestCases:CompatChangeTests
Bug: 234799838
Change-Id: If69772bea750380e9f127cea31141a5f953c4e30
Merged-In: If69772bea750380e9f127cea31141a5f953c4e30
parent a100480a
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