1## 7.9\. Virtual Reality
2
3Android includes APIs and facilities to build "Virtual Reality" (VR)
4applications including high quality mobile VR experiences. Device
5implementations MUST properly implement these APIs and behaviors,
6as detailed in this section.
7
8### 7.9.1\. Virtual Reality Mode
9
10Android includes support for [VR Mode](
11https://developer.android.com/reference/android/app/Activity.html#setVrModeEnabled%28boolean, android.content.ComponentName%29),
12a feature which handles stereoscopic rendering of notifications and disables
13monocular system UI components while a VR application has user focus.
14
15### 7.9.2\. Virtual Reality Mode - High Performance
16
17If device implementations support VR mode, they:
18
19*   [C-1-1] MUST have at least 2 physical cores.
20*   [C-1-2] MUST declare the `android.hardware.vr.high_performance` feature.
21*   [C-1-3] MUST support sustained performance mode.
22*   [C-1-4] MUST support OpenGL ES 3.2.
23*   [C-1-5] MUST support `android.hardware.vulkan.level` 0.
24*   SHOULD support `android.hardware.vulkan.level` 1 or higher.
25*   [C-1-6] MUST implement
26    [`EGL_KHR_mutable_render_buffer`](https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_mutable_render_buffer.txt),
27    [`EGL_ANDROID_front_buffer_auto_refresh`](https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_front_buffer_auto_refresh.txt),
28    [`EGL_ANDROID_get_native_client_buffer`](https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_get_native_client_buffer.txt),
29    [`EGL_KHR_fence_sync`](https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt),
30    [`EGL_KHR_wait_sync`](https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_wait_sync.txt),
31    [`EGL_IMG_context_priority`](https://www.khronos.org/registry/EGL/extensions/IMG/EGL_IMG_context_priority.txt),
32    [`EGL_EXT_protected_content`](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_protected_content.txt),
33    [`EGL_EXT_image_gl_colorspace`](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_gl_colorspace.txt),
34    and expose the extensions in the list of available EGL extensions.
35*   [C-1-8] MUST implement
36    [`GL_EXT_multisampled_render_to_texture2`](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture2.txt),
37    [`GL_OVR_multiview`](https://www.khronos.org/registry/OpenGL/extensions/OVR/OVR_multiview.txt),
38    [`GL_OVR_multiview2`](https://www.khronos.org/registry/OpenGL/extensions/OVR/OVR_multiview2.txt),
39    [`GL_OVR_multiview_multisampled_render_to_texture`](https://www.khronos.org/registry/OpenGL/extensions/OVR/OVR_multiview_multisampled_render_to_texture.txt),
40    [`GL_EXT_protected_textures`](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_protected_textures.txt),
41    and expose the extensions in the list of available GL extensions.
42*   [C-SR] Are STRONGLY RECOMMENDED to implement
43    [`GL_EXT_external_buffer`](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_external_buffer.txt),
44    [`GL_EXT_EGL_image_array`](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_EGL_image_array.txt),
45    and expose the extensions in the list of available GL extensions.
46*   [C-SR] Are STRONGLY RECOMMENDED to support Vulkan 1.1.
47*   [C-SR] Are STRONGLY RECOMMENDED to implement
48    [`VK_ANDROID_external_memory_android_hardware_buffer`](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_ANDROID_external_memory_android_hardware_buffer),
49    [`VK_GOOGLE_display_timing`](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_GOOGLE_display_timing),
50    [`VK_KHR_shared_presentable_image`](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_KHR_shared_presentable_image),
51    and expose it in the list of available Vulkan extensions.
52*   [C-SR] Are STRONGLY RECOMMENDED to expose at least one Vulkan queue family where `flags`
53    contain both `VK_QUEUE_GRAPHICS_BIT` and `VK_QUEUE_COMPUTE_BIT`,
54    and `queueCount` is at least 2.
55*   [C-1-7] The GPU and display MUST be able to synchronize access to the shared
56    front buffer such that alternating-eye rendering of VR content at 60fps with two
57    render contexts will be displayed with no visible tearing artifacts.
58*   [C-1-9] MUST implement support for [`AHardwareBuffer`](https://developer.android.com/ndk/reference/hardware__buffer_8h.html)
59    flags `AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER`,
60    `AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA` and
61    `AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT`
62    as described in the NDK.
63*   [C-1-10] MUST implement support for `AHardwareBuffer`s with any
64    combination of the usage flags
65    `AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT`,
66    `AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE`,
67    `AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT`
68    for at least the following formats:
69    `AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM`,
70    `AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM`,
71    `AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM`,
72    `AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT`.
73*   [C-SR] Are STRONGLY RECOMMENDED to support the allocation of `AHardwareBuffer`s
74    with more than one layer and flags and formats specified in C-1-10.
75*   [C-1-11] MUST support H.264 decoding at least 3840 x 2160 at 30fps,
76    compressed to an average of 40Mbps (equivalent to 4 instances of
77    1920 x1080 at 30 fps-10 Mbps or 2 instances of 1920 x 1080 at 60 fps-20 Mbps).
78*   [C-1-12] MUST support HEVC and VP9, MUST be capable of decoding at least
79    1920 x 1080 at 30 fps compressed to an average of 10 Mbps and SHOULD be
80    capable of decoding 3840 x 2160 at 30 fps-20 Mbps (equivalent to
81    4 instances of 1920 x 1080 at 30 fps-5 Mbps).
82*   [C-1-13] MUST support `HardwarePropertiesManager.getDeviceTemperatures` API
83    and return accurate values for skin temperature.
84*   [C-1-14] MUST have an embedded screen, and its resolution MUST be at least
85    1920 x 1080.
86*   [C-SR] Are STRONGLY RECOMMENDED to have a display resolution of at least
87    2560 x 1440.
88*   [C-1-15] The display MUST update at least 60 Hz while in VR Mode.
89*   [C-1-17] The display MUST support a low-persistence mode with ≤ 5 milliseconds
90    persistence, persistence being defined as the amount of time for
91    which a pixel is emitting light.
92*   [C-1-18] MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension
93    [section 7.4.3](#7_4_3_bluetooth).
94*   [C-1-19] MUST support and properly report
95    [Direct Channel Type](https://developer.android.com/reference/android/hardware/Sensor#isDirectChannelTypeSupported%28int%29)
96    for all of the following default sensor types:
97      * `TYPE_ACCELEROMETER`
98      * `TYPE_ACCELEROMETER_UNCALIBRATED`
99      * `TYPE_GYROSCOPE`
100      * `TYPE_GYROSCOPE_UNCALIBRATED`
101      * `TYPE_MAGNETIC_FIELD`
102      * `TYPE_MAGNETIC_FIELD_UNCALIBRATED`
103*   [C-SR] Are STRONGLY RECOMMENDED to support the
104    [`TYPE_HARDWARE_BUFFER`](https://developer.android.com/reference/android/hardware/SensorDirectChannel.html#TYPE_HARDWARE_BUFFER)
105    direct channel type for all Direct Channel Types listed above.
106*   [C-1-21] MUST meet the gyroscope, accelerometer, and magnetometer related
107    requirements for `android.hardware.hifi_sensors`, as specified in
108    [section 7.3.9](#7_3_9_high_fidelity_sensors).
109*   [C-SR] Are STRONGLY RECOMMENDED to support the
110    `android.hardware.sensor.hifi_sensors` feature.
111*   [C-1-22] MUST have end-to-end motion to photon latency not higher than
112    28 milliseconds.
113*   [C-SR] Are STRONGLY RECOMMENDED to have end-to-end motion to photon latency
114    not higher than 20 milliseconds.
115*   [C-1-23] MUST have first-frame ratio, which is the ratio between the
116    brightness of pixels on the first frame after a transition from black to
117    white and the brightness of white pixels in steady state, of at least 85%.
118*   [C-SR] Are STRONGLY RECOMMENDED to have first-frame ratio of at least 90%.
119*   MAY provide an exclusive core to the foreground
120    application and MAY support the `Process.getExclusiveCores` API to return
121    the numbers of the cpu cores that are exclusive to the top foreground
122    application.
123
124If exclusive core is supported, then the core:
125
126*   [C-2-1] MUST not allow any other userspace processes to run on it
127(except device drivers used by the application), but MAY allow some kernel
128processes to run as necessary.
129