androidandroid-manifestandroid-screen-support

Where does android.max_aspect meta make difference?


A recent blog explains that we must use

<meta-data android:name="android.max_aspect" android:value="2.1" />

in <application> element of AndroidManifest.xml for optimal display on super widescreen devices, e.g. Samsung Galaxy S8.

To test this, I installed my app (no max_aspect, no resizeableActivity flags; targetSdkVersion=22, compileSdkVersion=24) on an Android 7.1.1. emulator with custom 2960x1440 resolution. All activities, including immersive, fill the screen with no margins as shown in the blog post.

I added explicit

<meta-data android:name="android.max_aspect" android:value="1.5" />

and this also had no effect on the emulator.

So, the question: is this meta flag only checked on the real devices, or there is some configuration that I missed for my emulator?

Update: I tried to reach Neto Marin, the author of the cited blog post. I found a proud tweet ] about his contribution to the global Android Dev community, but could not get an answer from him.


Solution

  • Letterboxing happens on different devices, like Samsung S8, LG G6, Pixel 2 XL, and some others. It seems to be part of Android 8 and especially 8.1.

    The official Android 8.1 compatibility definition includes the following paragraph:

    [C-0-1] Device implementations with the Configuration.uiMode set as UI_MODE_TYPE_NORMAL MUST have an aspect ratio value between 1.3333 (4:3) and 1.86 (roughly 16:9), unless the app can be deemed as ready to be stretched longer by meeting one of the following conditions:

    • The app has declared that it supports a larger screen aspect ratio through the android.max_aspect metadata value.
    • The app declares it is resizeable via the android:resizeableActivity attribute.
    • The app is targeting API level 26 or higher and does not declare a android:MaxAspectRatio that would restrict the allowed aspect ratio.

    Note that the first two attributes are application-level, while latter attribute belongs to Activity.

    Some vendors allow the end-user to control this further. LG has "App Scaling" menu; Samsung lets you choose "full screen apps" on "Display" Settings.