1 /** 2 * Copyright (c) 2016, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.service.vr; 18 19 import android.app.Vr2dDisplayProperties; 20 import android.content.ComponentName; 21 import android.service.vr.IVrStateCallbacks; 22 import android.service.vr.IPersistentVrStateCallbacks; 23 24 /** @hide */ 25 interface IVrManager { 26 27 /** 28 * Add a callback to be notified when VR mode state changes. 29 * 30 * @param cb the callback instance to add. 31 */ registerListener(in IVrStateCallbacks cb)32 void registerListener(in IVrStateCallbacks cb); 33 34 /** 35 * Remove the callack from the current set of registered callbacks. 36 * 37 * @param cb the callback to remove. 38 */ unregisterListener(in IVrStateCallbacks cb)39 void unregisterListener(in IVrStateCallbacks cb); 40 41 /** 42 * Add a callback to be notified when persistent VR mode state changes. 43 * 44 * @param cb the callback instance to add. 45 */ registerPersistentVrStateListener(in IPersistentVrStateCallbacks cb)46 void registerPersistentVrStateListener(in IPersistentVrStateCallbacks cb); 47 48 /** 49 * Remove the callack from the current set of registered callbacks. 50 * 51 * @param cb the callback to remove. 52 */ unregisterPersistentVrStateListener(in IPersistentVrStateCallbacks cb)53 void unregisterPersistentVrStateListener(in IPersistentVrStateCallbacks cb); 54 55 /** 56 * Return current VR mode state. 57 * 58 * @return {@code true} if VR mode is enabled. 59 */ 60 @UnsupportedAppUsage getVrModeState()61 boolean getVrModeState(); 62 63 /** 64 * Returns the current Persistent VR mode state. 65 * 66 * @return {@code true} if Persistent VR mode is enabled. 67 */ getPersistentVrModeEnabled()68 boolean getPersistentVrModeEnabled(); 69 70 /** 71 * Sets the persistent VR mode state of a device. When a device is in persistent VR mode it will 72 * remain in VR mode even if the foreground does not specify VR mode being enabled. Mainly used 73 * by VR viewers to indicate that a device is placed in a VR viewer. 74 * 75 * @param enabled true if the device should be placed in persistent VR mode. 76 */ setPersistentVrModeEnabled(in boolean enabled)77 void setPersistentVrModeEnabled(in boolean enabled); 78 79 /** 80 * Sets the resolution and DPI of the vr2d virtual display used to display 81 * 2D applications in VR mode. 82 * 83 * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p> 84 * 85 * @param vr2dDisplayProperties Vr2d display properties to be set for 86 * the VR virtual display 87 */ setVr2dDisplayProperties( in Vr2dDisplayProperties vr2dDisplayProperties)88 void setVr2dDisplayProperties( 89 in Vr2dDisplayProperties vr2dDisplayProperties); 90 91 /** 92 * Return current virtual display id. 93 * 94 * @return {@link android.view.Display.INVALID_DISPLAY} if there is no virtual display 95 * currently, else return the display id of the virtual display 96 */ 97 @UnsupportedAppUsage getVr2dDisplayId()98 int getVr2dDisplayId(); 99 100 /** 101 * Set the component name of the compositor service to bind. 102 * 103 * @param componentName flattened string representing a ComponentName of a Service in the 104 * application's compositor process to bind to, or null to clear the current binding. 105 */ setAndBindCompositor(in String componentName)106 void setAndBindCompositor(in String componentName); 107 108 /** 109 * Sets the current standby status of the VR device. Standby mode is only used on standalone vr 110 * devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode. 111 * 112 * @param standy True if the device is entering standby, false if it's exiting standby. 113 */ setStandbyEnabled(boolean standby)114 void setStandbyEnabled(boolean standby); 115 } 116 117