• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## 7.1\. Display and Graphics
2
3Android includes facilities that automatically adjust application assets and UI
4layouts appropriately for the device to ensure that third-party applications
5run well on a [variety of hardware configurations](
6http://developer.android.com/guide/practices/screens_support.html).
7On the Android-compatible display(s) where all third-party Android-compatible
8applications can run, device implementations MUST properly implement these APIs
9and behaviors, as detailed in this section.
10
11The units referenced by the requirements in this section are defined as follows:
12
13*   **physical diagonal size**. The distance in inches between two opposing
14corners of the illuminated portion of the display.
15*   **dots per inch (dpi)**. The number of pixels encompassed by a linear
16horizontal or vertical span of 1”. Where dpi values are listed, both horizontal
17and vertical dpi must fall within the range.
18*   **aspect ratio**. The ratio of the pixels of the longer dimension to the
19shorter dimension of the screen. For example, a display of 480x854 pixels would
20be 854/480 = 1.779, or roughly “16:9”.
21*   **density-independent pixel (dp)**. The virtual pixel unit normalized to a
22160 dpi screen, calculated as: pixels = dps * (density/160).
23
24### 7.1.1\. Screen Configuration
25
26#### 7.1.1.1\. Screen Size and Shape
27
28The Android UI framework supports a variety of different logical screen layout
29sizes, and allows applications to query the current configuration's screen
30layout size via `Configuration.screenLayout` with the `SCREENLAYOUT_SIZE_MASK`
31and `Configuration.smallestScreenWidthDp`.
32
33Device implementations:
34
35*    [C-0-1] MUST report the correct layout size for the
36 `Configuration.screenLayout` as defined in the Android SDK documentation.
37 Specifically, device implementations MUST report the correct logical
38 density-independent pixel (dp) screen dimensions as below:
39
40     *   Devices with the `Configuration.uiMode` set as any value other than
41     UI_MODE_TYPE_WATCH, and reporting a `small` size for the
42     `Configuration.screenLayout`, MUST have at least 426 dp x 320 dp.
43     *   Devices reporting a `normal` size for the `Configuration.screenLayout`,
44     MUST have at least 480 dp x 320 dp.
45     *   Devices reporting a `large` size for the `Configuration.screenLayout`,
46     MUST have at least 640 dp x 480 dp.
47     *   Devices reporting a `xlarge` size for the `Configuration.screenLayout`,
48     MUST have at least 960 dp x 720 dp.
49
50*   [C-0-2] MUST correctly honor applications' stated
51 support for screen sizes through the [<`supports-screens`>](
52 https://developer.android.com/guide/topics/manifest/supports-screens-element.html)
53 attribute in the AndroidManifest.xml, as described
54 in the Android SDK documentation.
55
56*    MAY have the Android-compatible display(s) with rounded corners.
57
58If device implementations support `UI_MODE_TYPE_NORMAL` and include
59Android-compatible display(s) with rounded corners, they:
60
61*    [C-1-1] MUST ensure that at least one of the following requirements
62 is met:
63  *  The radius of the rounded corners is less than or equal to 38 dp.
64  *  When a 15 dp by 15 dp box is anchored at each corner of the logical
65     display, at least one pixel of each box is visible on the screen.
66
67*    SHOULD include user affordance to switch to the display mode with the
68rectangular corners.
69
70If device implementations include an Android-compatible display(s) that is
71foldable, or includes a folding hinge between multiple display panels and makes
72such display(s) available to render third-party apps, they:
73
74*    [C-2-1] MUST implement the latest available stable version of the
75[extensions API](
76https://developer.android.com/jetpack/androidx/releases/window-extensions)
77or the stable version of [sidecar API](
78https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/window/window-sidecar/api/0.1.0-alpha01.txt)
79to be used by [Window Manager Jetpack](
80https://developer.android.com/jetpack/androidx/releases/window) library.
81
82If device implementations include an Android-compatible display(s) that is
83foldable, or includes a folding hinge between multiple display panels and if
84the hinge or fold crosses a fullscreen application window, they:
85
86*    [C-3-1] MUST report the position, bounds and state of hinge or fold through
87     extensions or sidecar APIs to the application.
88
89For details on correctly implementing the sidecar or extension APIs refer
90to the public documentation of [Window Manager Jetpack](
91https://developer.android.com/jetpack/androidx/releases/window).
92
93#### 7.1.1.2\. Screen Aspect Ratio
94
95While there is no restriction to the aspect ratio of the physical display for
96the Android-compatible display(s), the aspect ratio of the logical display
97where third-party apps are rendered, which can be derived from the height and
98width values reported through the [`view.Display`](
99https://developer.android.com/reference/android/view/Display.html)
100APIs and [Configuration](
101https://developer.android.com/reference/android/content/res/Configuration.html)
102APIs, MUST meet the following requirements:
103
104*   [C-0-1] Device implementations with `Configuration.uiMode` set to
105    `UI_MODE_TYPE_NORMAL` MUST have an aspect ratio value less than or equal
106    to 1.86 (roughly 16:9), unless the app meets one of the following
107    conditions:
108
109     *  The app has declared that it supports a larger screen aspect ratio
110     through  the [`android.max_aspect`](
111     https://developer.android.com/guide/practices/screens-distribution)
112     metadata value.
113     *  The app declares it is resizeable via the [android:resizeableActivity](
114     https://developer.android.com/guide/topics/ui/multi-window.html#configuring)
115     attribute.
116     *  The app targets API level 24 or higher and does not declare an
117     [`android:maxAspectRatio`](
118     https://developer.android.com/reference/android/R.attr.html#maxAspectRatio)
119     that would restrict the allowed aspect ratio.
120
121*   [C-0-2] Device implementations with `Configuration.uiMode` set to
122    `UI_MODE_TYPE_NORMAL` MUST have an aspect ratio value equal to or greater
123    than 1.3333 (4:3), unless the app can be stretched wider by meeting one of
124    the following conditions:
125
126     *  The app declares it is resizeable via the [android:resizeableActivity](
127     https://developer.android.com/guide/topics/ui/multi-window.html#configuring)
128     attribute.
129     *  The app declares an [`android:minAspectRatio`](
130     https://developer.android.com/reference/android/R.attr.html#minAspectRatio)
131     that would restrict the allowed aspect ratio.
132
133*   [C-0-3] Device implementations with the `Configuration.uiMode` set as
134    `UI_MODE_TYPE_WATCH` MUST have an aspect ratio value set as 1.0 (1:1).
135
136#### 7.1.1.3\. Screen Density
137
138The Android UI framework defines a set of standard logical densities to help
139application developers target application resources.
140
141*    [C-0-1] By default, device implementations MUST report only one of the
142following logical Android framework densities through the
143[DENSITY_DEVICE_STABLE](
144https://developer.android.com/reference/android/util/DisplayMetrics.html#DENSITY_DEVICE_STABLE)
145API and this value MUST NOT change at any time; however, the device MAY report
146a different arbitrary density according to the display configuration changes
147made by the user (for example, display size) set after initial boot.
148
149    *   120 dpi (ldpi)
150    *   140 dpi (140dpi)
151    *   160 dpi (mdpi)
152    *   180 dpi (180dpi)
153    *   200 dpi (200dpi)
154    *   213 dpi (tvdpi)
155    *   220 dpi (220dpi)
156    *   240 dpi (hdpi)
157    *   260 dpi (260dpi)
158    *   280 dpi (280dpi)
159    *   300 dpi (300dpi)
160    *   320 dpi (xhdpi)
161    *   340 dpi (340dpi)
162    *   360 dpi (360dpi)
163    *   400 dpi (400dpi)
164    *   420 dpi (420dpi)
165    *   480 dpi (xxhdpi)
166    *   560 dpi (560dpi)
167    *   640 dpi (xxxhdpi)
168
169*    Device implementations SHOULD define the standard Android framework density
170     that is numerically closest to the physical density of the screen, unless that
171     logical density pushes the reported screen size below the minimum supported. If
172     the standard Android framework density that is numerically closest to the
173     physical density results in a screen size that is smaller than the smallest
174     supported compatible screen size (320 dp width), device implementations SHOULD
175     report the next lowest standard Android framework density.
176
177
178If there is an affordance to change the display size of the device:
179
180*  [C-1-1] The display size MUST NOT be scaled any larger than 1.5 times the native density or
181   produce an effective minimum screen dimension smaller than 320dp (equivalent
182   to resource qualifier sw320dp), whichever comes first.
183*  [C-1-2] Display size MUST NOT be scaled any smaller than 0.85 times the native density.
184*  To ensure good usability and consistent font sizes, it is RECOMMENDED that the
185   following scaling of Native Display options be provided (while complying with the limits
186   specified above)
187   *  Small: 0.85x
188   *  Default: 1x (Native display scale)
189   *  Large: 1.15x
190   *  Larger: 1.3x
191   *  Largest 1.45x
192
193### 7.1.2\. Display Metrics
194
195If device implementations include the Android-compatible display(s) or
196video output to the Android-compatible display screen(s), they:
197
198*    [C-1-1] MUST report correct values for all Android-compatible display
199metrics defined in the
200 [`android.util.DisplayMetrics`](
201 https://developer.android.com/reference/android/util/DisplayMetrics.html) API.
202
203If device implementations does not include an embedded screen or video output,
204they:
205
206*    [C-2-1] MUST report correct values of the Android-compatible display
207 as defined in the [`android.util.DisplayMetrics`](
208 https://developer.android.com/reference/android/util/DisplayMetrics.html) API
209 for the emulated default `view.Display`.
210
211
212### 7.1.3\. Screen Orientation
213
214Device implementations:
215
216*    [C-0-1] MUST report which screen orientations they support
217     (`android.hardware.screen.portrait` and/or
218     `android.hardware.screen.landscape`) and MUST report at least one supported
219     orientation. For example, a device with a fixed orientation landscape
220     screen, such as a television or laptop, SHOULD only
221     report `android.hardware.screen.landscape`.
222*    [C-0-2] MUST report the correct value for the device’s current
223     orientation, whenever queried via the
224     `android.content.res.Configuration.orientation`,
225     `android.view.Display.getOrientation()`, or other APIs.
226
227If device implementations support both screen orientations, they:
228
229*    [C-1-1] MUST support dynamic orientation by applications to either portrait or landscape screen
230     orientation. That is, the device must respect the application’s request for a specific screen
231     orientation.
232*    [C-1-2] MUST NOT change the reported screen size or density when changing orientation.
233*    MAY select either portrait or landscape orientation as the default.
234
235
236### 7.1.4\. 2D and 3D Graphics Acceleration
237
238#### 7.1.4.1 OpenGL ES
239
240Device implementations:
241
242*   [C-0-1] MUST correctly identify the supported OpenGL ES versions (1.1, 2.0,
243    3.0, 3.1, 3.2) through the managed APIs (such as via the
244    `GLES10.getString()` method) and the native APIs.
245*   [C-0-2] MUST include the support for all the corresponding managed APIs and
246    native APIs for every OpenGL ES versions they identified to support.
247
248If device implementations include a screen or video output, they:
249
250*   [C-1-1] MUST support both OpenGL ES 1.1 and 2.0, as embodied and detailed
251    in the [Android SDK documentation](
252    https://developer.android.com/guide/topics/graphics/opengl.html).
253*   [C-SR] Are STRONGLY RECOMMENDED to support OpenGL ES 3.1.
254*   SHOULD support OpenGL ES 3.2.
255
256If device implementations support any of the OpenGL ES versions, they:
257
258*   [C-2-1] MUST report via the OpenGL ES managed APIs and native APIs any
259    other OpenGL ES extensions they have implemented, and conversely MUST
260    NOT report extension strings that they do not support.
261*   [C-2-2] MUST support the `EGL_KHR_image`, `EGL_KHR_image_base`,
262    `EGL_ANDROID_image_native_buffer`, `EGL_ANDROID_get_native_client_buffer`,
263    `EGL_KHR_wait_sync`, `EGL_KHR_get_all_proc_addresses`,
264    `EGL_ANDROID_presentation_time`, `EGL_KHR_swap_buffers_with_damage`,
265    `EGL_ANDROID_recordable`, and `EGL_ANDROID_GLES_layers` extensions.
266*   [C-SR] Are STRONGLY RECOMMENDED to support the `EGL_KHR_partial_update` and
267    `OES_EGL_image_external` extensions.
268*   SHOULD accurately report via the `getString()` method, any texture
269    compression format that they support, which is typically vendor-specific.
270
271If device implementations declare support for OpenGL ES 3.0, 3.1, or 3.2, they:
272
273*   [C-3-1] MUST export the corresponding function symbols for these version in
274    addition to the OpenGL ES 2.0 function symbols in the libGLESv2.so library.
275*   [SR] Are STRONGLY RECOMMENDED to support the `OES_EGL_image_external_essl3`
276    extension.
277
278If device implementations support OpenGL ES 3.2, they:
279
280*    [C-4-1] MUST support the OpenGL ES Android Extension Pack in its entirety.
281
282If device implementations support the OpenGL ES [Android Extension Pack](
283https://developer.android.com/reference/android/opengl/GLES31Ext.html) in its
284entirety, they:
285
286*   [C-5-1] MUST identify the support through the `android.hardware.opengles.aep`
287    feature flag.
288
289If device implementations expose support for the `EGL_KHR_mutable_render_buffer`
290extension, they:
291
292*   [C-6-1] MUST also support the `EGL_ANDROID_front_buffer_auto_refresh`
293    extension.
294
295#### 7.1.4.2 Vulkan
296
297Android includes support for [Vulkan](
298https://www.khronos.org/registry/vulkan/specs/1.0-wsi&lowbarextensions/xhtml/vkspec.html)
299, a low-overhead, cross-platform API for high-performance 3D graphics.
300
301If device implementations support OpenGL ES 3.1, they:
302
303*    [SR] Are STRONGLY RECOMMENDED to include support for Vulkan 1.1.
304
305If device implementations include a screen or video output, they:
306
307*    SHOULD include support for Vulkan 1.1.
308
309The Vulkan dEQP tests are partitioned into a number of test lists, each with an
310associated date/version.  These are in the Android source tree at
311`external/deqp/android/cts/master/vk-master-YYYY-MM-DD.txt`.  A device that
312supports Vulkan at a self-reported level indicates that it can pass the dEQP
313tests in all test lists from this level and earlier.
314
315If device implementations include support for Vulkan 1.0 or higher, they:
316
317*   [C-1-1] MUST report the correct integer value with the
318    `android.hardware.vulkan.level` and `android.hardware.vulkan.version`
319    feature flags.
320*   [C-1-2] MUST enumerate, at least one `VkPhysicalDevice` for the Vulkan
321    native API [`vkEnumeratePhysicalDevices()`](
322    https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkEnumeratePhysicalDevices.html)
323    .
324*   [C-1-3] MUST fully implement the Vulkan 1.0 APIs for each enumerated
325    `VkPhysicalDevice`.
326*   [C-1-4] MUST enumerate layers, contained in native libraries named as
327    `libVkLayer*.so` in the application package’s native library directory,
328    through the Vulkan native APIs [`vkEnumerateInstanceLayerProperties()`](
329    https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkEnumerateInstanceLayerProperties.html)
330    and [`vkEnumerateDeviceLayerProperties()`](
331    https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkEnumerateDeviceLayerProperties.html)
332    .
333*   [C-1-5] MUST NOT enumerate layers provided by libraries outside of the
334    application package, or provide other ways of tracing or intercepting the
335    Vulkan API, unless the application has the `android:debuggable` attribute
336    set as `true`.
337*   [C-1-6] MUST report all extension strings that they do support via the
338    Vulkan native APIs , and conversely MUST NOT report extension strings
339    that they do not correctly support.
340*   [C-1-7] MUST support the VK_KHR_surface, VK_KHR_android_surface, VK_KHR_swapchain,
341    and VK_KHR_incremental_present extensions.
342*   [C-1-8] MUST report the maximum version of the Vulkan dEQP Tests
343    supported via the `android.software.vulkan.deqp.level` feature flag.
344*   [C-1-9] MUST at least support version `132317953` (from Mar 1st, 2019) as
345    reported in the `android.software.vulkan.deqp.level` feature flag.
346*   [C-1-10] MUST pass all Vulkan dEQP Tests in the test lists between
347    version `132317953` and the version specified in the
348    `android.software.vulkan.deqp.level` feature flag.
349*   [C-SR] Are STRONGLY RECOMMENDED to support the VK_KHR_driver_properties and
350    VK_GOOGLE_display_timing extensions.
351
352If device implementations do not include support for Vulkan 1.0, they:
353
354*   [C-2-1] MUST NOT declare any of the Vulkan feature flags (e.g.
355    `android.hardware.vulkan.level`, `android.hardware.vulkan.version`).
356*   [C-2-2] MUST NOT enumerate any `VkPhysicalDevice` for the Vulkan native API
357    `vkEnumeratePhysicalDevices()`.
358
359If device implementations include support for Vulkan 1.1 and declare any of the
360Vulkan feature flags, they:
361
362*   [C-3-1] MUST expose support for the `SYNC_FD` external semaphore and handle
363    types and the `VK_ANDROID_external_memory_android_hardware_buffer` extension.
364
365#### 7.1.4.3 RenderScript
366
367*    [C-0-1] Device implementations MUST support [Android RenderScript](
368     http://developer.android.com/guide/topics/renderscript/), as detailed
369     in the Android SDK documentation.
370
371#### 7.1.4.4 2D Graphics Acceleration
372
373Android includes a mechanism for applications to declare that they want to
374enable hardware acceleration for 2D graphics at the Application, Activity,
375Window, or View level through the use of a manifest tag
376[android:hardwareAccelerated](
377http://developer.android.com/guide/topics/graphics/hardware-accel.html)
378or direct API calls.
379
380Device implementations:
381
382*    [C-0-1] MUST enable hardware acceleration by default, and MUST
383     disable hardware acceleration if the developer so requests by setting
384     android:hardwareAccelerated="false” or disabling hardware acceleration
385     directly through the Android View APIs.
386*    [C-0-2] MUST exhibit behavior consistent with the
387     Android SDK documentation on [hardware acceleration](
388     http://developer.android.com/guide/topics/graphics/hardware-accel.html).
389
390Android includes a TextureView object that lets developers directly integrate
391hardware-accelerated OpenGL ES textures as rendering targets in a UI hierarchy.
392
393Device implementations:
394
395*    [C-0-3] MUST support the TextureView API, and MUST exhibit
396     consistent behavior with the upstream Android implementation.
397
398#### 7.1.4.5 Wide-gamut Displays
399
400If device implementations claim support for wide-gamut displays through
401[`Configuration.isScreenWideColorGamut()`
402](https://developer.android.com/reference/android/content/res/Configuration.html#isScreenWideColorGamut%28%29)
403, they:
404
405*   [C-1-1] MUST have a color-calibrated display.
406*   [C-1-2] MUST have a display whose gamut covers the sRGB color gamut
407    entirely in CIE 1931 xyY space.
408*   [C-1-3] MUST have a display whose gamut has an area of at least 90% of
409    DCI-P3 in CIE 1931 xyY space.
410*   [C-1-4] MUST support OpenGL ES 3.1 or 3.2 and report it properly.
411*   [C-1-5] MUST advertise support for the `EGL_KHR_no_config_context`,
412    `EGL_EXT_pixel_format_float`, `EGL_KHR_gl_colorspace`,
413    `EGL_EXT_gl_colorspace_scrgb`, `EGL_EXT_gl_colorspace_scrgb_linear`,
414    `EGL_EXT_gl_colorspace_display_p3`, `EGL_EXT_gl_colorspace_display_p3_linear`,
415    and `EGL_EXT_gl_colorspace_display_p3_passthrough`
416    extensions.
417*   [C-SR] Are STRONGLY RECOMMENDED to support `GL_EXT_sRGB`.
418
419Conversely, if device implementations do not support wide-gamut displays, they:
420
421*   [C-2-1] SHOULD cover 100% or more of sRGB in CIE 1931 xyY space, although
422    the screen color gamut is undefined.
423
424### 7.1.5\. Legacy Application Compatibility Mode
425
426Android specifies a “compatibility mode” in which the framework operates in a
427'normal' screen size equivalent (320dp width) mode for the benefit of legacy
428applications not developed for old versions of Android that pre-date
429screen-size independence.
430
431### 7.1.6\. Screen Technology
432
433The Android platform includes APIs that allow applications to render rich
434graphics to an Android-compatible display. Devices MUST support all of these
435APIs as defined by the Android SDK unless specifically allowed in this document.
436
437All of a device implementation's Android-compatible displays:
438
439*   [C-0-1] MUST be capable of rendering 16-bit color graphics.
440*   SHOULD support displays capable of 24-bit color graphics.
441*   [C-0-2] MUST be capable of rendering animations.
442*   [C-0-3] MUST have a pixel aspect ratio (PAR)
443    between 0.9 and 1.15\. That is, the pixel aspect ratio MUST be near square
444    (1.0) with a 10 ~ 15% tolerance.
445
446### 7.1.7\. Secondary Displays
447
448Android includes support for secondary Android-compatible displays to enable
449media sharing capabilities and developer APIs for accessing external displays.
450
451If device implementations support an external display either via a wired,
452wireless, or an embedded additional display connection, they:
453
454*   [C-1-1] MUST implement the [`DisplayManager`](
455    https://developer.android.com/reference/android/hardware/display/DisplayManager.html)
456    system service and API as described in the Android SDK documentation.
457