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