blob: a8293b47db30d669a72d6fdf2bc06c0d7edd2ef4 [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 */
Andrei Onea4aa2a202019-02-27 14:22:05 +000060 @UnsupportedAppUsage
Ruben Brunkc7be3be2016-04-01 17:07:51 -070061 boolean getVrModeState();
62
Zak Cohen56345f42017-01-26 13:54:28 -080063 /**
Santos Cordone6d77232017-08-08 17:11:41 -070064 * Returns the current Persistent VR mode state.
65 *
66 * @return {@code true} if Persistent VR mode is enabled.
67 */
68 boolean getPersistentVrModeEnabled();
69
70 /**
Zak Cohen56345f42017-01-26 13:54:28 -080071 * 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 */
77 void setPersistentVrModeEnabled(in boolean enabled);
Karthik Ravi Shankar3a47ec22017-03-08 18:09:35 -080078
79 /**
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070080 * Sets the resolution and DPI of the vr2d virtual display used to display
Karthik Ravi Shankarcdf9ce72017-04-12 15:31:20 -070081 * 2D applications in VR mode.
82 *
83 * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p>
84 *
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070085 * @param vr2dDisplayProperties Vr2d display properties to be set for
Karthik Ravi Shankarcdf9ce72017-04-12 15:31:20 -070086 * the VR virtual display
87 */
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070088 void setVr2dDisplayProperties(
89 in Vr2dDisplayProperties vr2dDisplayProperties);
Karthik Ravi Shankarcdf9ce72017-04-12 15:31:20 -070090
91 /**
Karthik Ravi Shankar3a47ec22017-03-08 18:09:35 -080092 * 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 */
Andrei Onea4aa2a202019-02-27 14:22:05 +000097 @UnsupportedAppUsage
Karthik Ravi Shankar2b9aaed2017-05-01 01:34:19 -070098 int getVr2dDisplayId();
Ruben Brunk52ea6622017-10-02 23:51:25 -070099
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 */
106 void setAndBindCompositor(in String componentName);
Steven Thomas1356ec92017-09-07 11:26:38 -0700107
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 */
114 void setStandbyEnabled(boolean standby);
Ruben Brunkc7be3be2016-04-01 17:07:51 -0700115}
116