Zak Cohen | 56345f4 | 2017-01-26 13:54:28 -0800 | [diff] [blame^] | 1 | package android.app; |
| 2 | |
| 3 | |
| 4 | import android.annotation.SystemApi; |
| 5 | import android.content.ComponentName; |
| 6 | import android.os.RemoteException; |
| 7 | import android.service.vr.IVrManager; |
| 8 | |
| 9 | /** |
| 10 | * Used to control aspects of a devices Virtual Reality (VR) capabilities. |
| 11 | * <p> |
| 12 | * You do not instantiate this class directly; instead, retrieve it through |
| 13 | * {@link android.content.Context#getSystemService}. |
| 14 | * @hide |
| 15 | */ |
| 16 | @SystemApi |
| 17 | public class VrManager { |
| 18 | private final IVrManager mService; |
| 19 | |
| 20 | /** |
| 21 | * {@hide} |
| 22 | */ |
| 23 | public VrManager(IVrManager service) { |
| 24 | mService = service; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Sets the persistent VR mode state of a device. When a device is in persistent VR mode it will |
| 29 | * remain in VR mode even if the foreground does not specify Vr mode being enabled. Mainly used |
| 30 | * by VR viewers to indicate that a device is placed in a VR viewer. |
| 31 | * |
| 32 | * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p> |
| 33 | * |
| 34 | * @see Activity#setVrModeEnabled(boolean, ComponentName) |
| 35 | * @param enabled true if the device should be placed in persistent VR mode. |
| 36 | */ |
| 37 | public void setPersistentVrModeEnabled(boolean enabled) { |
| 38 | try { |
| 39 | mService.setPersistentVrModeEnabled(enabled); |
| 40 | } catch (RemoteException e) { |
| 41 | e.rethrowFromSystemServer(); |
| 42 | } |
| 43 | } |
| 44 | } |