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.service.vr.IVrStateCallbacks;
21 import android.service.vr.IPersistentVrStateCallbacks;
22 
23 /** @hide */
24 interface IVrManager {
25 
26     /**
27      * Add a callback to be notified when VR mode state changes.
28      *
29      * @param cb the callback instance to add.
30      */
registerListener(in IVrStateCallbacks cb)31     void registerListener(in IVrStateCallbacks cb);
32 
33     /**
34      * Remove the callack from the current set of registered callbacks.
35      *
36      * @param cb the callback to remove.
37      */
unregisterListener(in IVrStateCallbacks cb)38     void unregisterListener(in IVrStateCallbacks cb);
39 
40     /**
41      * Add a callback to be notified when persistent VR mode state changes.
42      *
43      * @param cb the callback instance to add.
44      */
registerPersistentVrStateListener(in IPersistentVrStateCallbacks cb)45     void registerPersistentVrStateListener(in IPersistentVrStateCallbacks cb);
46 
47     /**
48      * Remove the callack from the current set of registered callbacks.
49      *
50      * @param cb the callback to remove.
51      */
unregisterPersistentVrStateListener(in IPersistentVrStateCallbacks cb)52     void unregisterPersistentVrStateListener(in IPersistentVrStateCallbacks cb);
53 
54     /**
55      * Return current VR mode state.
56      *
57      * @return {@code true} if VR mode is enabled.
58      */
getVrModeState()59     boolean getVrModeState();
60 
61     /**
62      * Sets the persistent VR mode state of a device. When a device is in persistent VR mode it will
63      * remain in VR mode even if the foreground does not specify VR mode being enabled. Mainly used
64      * by VR viewers to indicate that a device is placed in a VR viewer.
65      *
66      * @param enabled true if the device should be placed in persistent VR mode.
67      */
setPersistentVrModeEnabled(in boolean enabled)68     void setPersistentVrModeEnabled(in boolean enabled);
69 
70     /**
71      * Sets the resolution and DPI of the vr2d virtual display used to display
72      * 2D applications in VR mode.
73      *
74      * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p>
75      *
76      * @param vr2dDisplayProperties Vr2d display properties to be set for
77      * the VR virtual display
78      */
setVr2dDisplayProperties( in Vr2dDisplayProperties vr2dDisplayProperties)79     void setVr2dDisplayProperties(
80             in Vr2dDisplayProperties vr2dDisplayProperties);
81 
82     /**
83      * Return current virtual display id.
84      *
85      * @return {@link android.view.Display.INVALID_DISPLAY} if there is no virtual display
86      * currently, else return the display id of the virtual display
87      */
getVr2dDisplayId()88     int getVr2dDisplayId();
89 }
90 
91