blob: b0269e3325bff373ff590335be6e8f35443b0dd1 [file] [log] [blame]
Ruben Brunkc7be3be2016-04-01 17:07:51 -07001/**
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
17package android.service.vr;
18
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070019import android.app.Vr2dDisplayProperties;
Tarandeep Singh89a6c482017-11-21 14:26:11 -080020import android.content.ComponentName;
Ruben Brunkc7be3be2016-04-01 17:07:51 -070021import android.service.vr.IVrStateCallbacks;
Steven Thomasb70845c2017-03-16 14:32:37 -070022import android.service.vr.IPersistentVrStateCallbacks;
Ruben Brunkc7be3be2016-04-01 17:07:51 -070023
24/** @hide */
25interface 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 */
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 */
39 void unregisterListener(in IVrStateCallbacks cb);
40
41 /**
Steven Thomasb70845c2017-03-16 14:32:37 -070042 * Add a callback to be notified when persistent VR mode state changes.
43 *
44 * @param cb the callback instance to add.
45 */
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 */
53 void unregisterPersistentVrStateListener(in IPersistentVrStateCallbacks cb);
54
55 /**
Ruben Brunkc7be3be2016-04-01 17:07:51 -070056 * Return current VR mode state.
57 *
58 * @return {@code true} if VR mode is enabled.
59 */
60 boolean getVrModeState();
61
Zak Cohen56345f42017-01-26 13:54:28 -080062 /**
Santos Cordone6d77232017-08-08 17:11:41 -070063 * Returns the current Persistent VR mode state.
64 *
65 * @return {@code true} if Persistent VR mode is enabled.
66 */
67 boolean getPersistentVrModeEnabled();
68
69 /**
Zak Cohen56345f42017-01-26 13:54:28 -080070 * Sets the persistent VR mode state of a device. When a device is in persistent VR mode it will
71 * remain in VR mode even if the foreground does not specify VR mode being enabled. Mainly used
72 * by VR viewers to indicate that a device is placed in a VR viewer.
73 *
74 * @param enabled true if the device should be placed in persistent VR mode.
75 */
76 void setPersistentVrModeEnabled(in boolean enabled);
Karthik Ravi Shankar3a47ec22017-03-08 18:09:35 -080077
78 /**
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070079 * Sets the resolution and DPI of the vr2d virtual display used to display
Karthik Ravi Shankarcdf9ce72017-04-12 15:31:20 -070080 * 2D applications in VR mode.
81 *
82 * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p>
83 *
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070084 * @param vr2dDisplayProperties Vr2d display properties to be set for
Karthik Ravi Shankarcdf9ce72017-04-12 15:31:20 -070085 * the VR virtual display
86 */
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070087 void setVr2dDisplayProperties(
88 in Vr2dDisplayProperties vr2dDisplayProperties);
Karthik Ravi Shankarcdf9ce72017-04-12 15:31:20 -070089
90 /**
Karthik Ravi Shankar3a47ec22017-03-08 18:09:35 -080091 * Return current virtual display id.
92 *
93 * @return {@link android.view.Display.INVALID_DISPLAY} if there is no virtual display
94 * currently, else return the display id of the virtual display
95 */
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070096 int getVr2dDisplayId();
Ruben Brunk52ea6622017-10-02 23:51:25 -070097
98 /**
99 * Set the component name of the compositor service to bind.
100 *
101 * @param componentName flattened string representing a ComponentName of a Service in the
102 * application's compositor process to bind to, or null to clear the current binding.
103 */
104 void setAndBindCompositor(in String componentName);
Steven Thomas1356ec92017-09-07 11:26:38 -0700105
106 /**
107 * Sets the current standby status of the VR device. Standby mode is only used on standalone vr
108 * devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode.
109 *
110 * @param standy True if the device is entering standby, false if it's exiting standby.
111 */
112 void setStandbyEnabled(boolean standby);
Ruben Brunkc7be3be2016-04-01 17:07:51 -0700113}
114