Ruben Brunk | c7be3be | 2016-04-01 17:07:51 -0700 | [diff] [blame] | 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 | |
Karthik Ravi Shankar | 2b9aaed | 2017-05-01 01:34:19 -0700 | [diff] [blame] | 19 | import android.app.Vr2dDisplayProperties; |
Tarandeep Singh | 89a6c48 | 2017-11-21 14:26:11 -0800 | [diff] [blame] | 20 | import android.content.ComponentName; |
Ruben Brunk | c7be3be | 2016-04-01 17:07:51 -0700 | [diff] [blame] | 21 | import android.service.vr.IVrStateCallbacks; |
Steven Thomas | b70845c | 2017-03-16 14:32:37 -0700 | [diff] [blame] | 22 | import android.service.vr.IPersistentVrStateCallbacks; |
Ruben Brunk | c7be3be | 2016-04-01 17:07:51 -0700 | [diff] [blame] | 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 | */ |
| 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 Thomas | b70845c | 2017-03-16 14:32:37 -0700 | [diff] [blame] | 42 | * 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 Brunk | c7be3be | 2016-04-01 17:07:51 -0700 | [diff] [blame] | 56 | * Return current VR mode state. |
| 57 | * |
| 58 | * @return {@code true} if VR mode is enabled. |
| 59 | */ |
| 60 | boolean getVrModeState(); |
| 61 | |
Zak Cohen | 56345f4 | 2017-01-26 13:54:28 -0800 | [diff] [blame] | 62 | /** |
Santos Cordon | e6d7723 | 2017-08-08 17:11:41 -0700 | [diff] [blame] | 63 | * 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 Cohen | 56345f4 | 2017-01-26 13:54:28 -0800 | [diff] [blame] | 70 | * 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 Shankar | 3a47ec2 | 2017-03-08 18:09:35 -0800 | [diff] [blame] | 77 | |
| 78 | /** |
Karthik Ravi Shankar | 2b9aaed | 2017-05-01 01:34:19 -0700 | [diff] [blame] | 79 | * Sets the resolution and DPI of the vr2d virtual display used to display |
Karthik Ravi Shankar | cdf9ce7 | 2017-04-12 15:31:20 -0700 | [diff] [blame] | 80 | * 2D applications in VR mode. |
| 81 | * |
| 82 | * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p> |
| 83 | * |
Karthik Ravi Shankar | 2b9aaed | 2017-05-01 01:34:19 -0700 | [diff] [blame] | 84 | * @param vr2dDisplayProperties Vr2d display properties to be set for |
Karthik Ravi Shankar | cdf9ce7 | 2017-04-12 15:31:20 -0700 | [diff] [blame] | 85 | * the VR virtual display |
| 86 | */ |
Karthik Ravi Shankar | 2b9aaed | 2017-05-01 01:34:19 -0700 | [diff] [blame] | 87 | void setVr2dDisplayProperties( |
| 88 | in Vr2dDisplayProperties vr2dDisplayProperties); |
Karthik Ravi Shankar | cdf9ce7 | 2017-04-12 15:31:20 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
Karthik Ravi Shankar | 3a47ec2 | 2017-03-08 18:09:35 -0800 | [diff] [blame] | 91 | * 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 Shankar | 2b9aaed | 2017-05-01 01:34:19 -0700 | [diff] [blame] | 96 | int getVr2dDisplayId(); |
Ruben Brunk | 52ea662 | 2017-10-02 23:51:25 -0700 | [diff] [blame] | 97 | |
| 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 Thomas | 1356ec9 | 2017-09-07 11:26:38 -0700 | [diff] [blame] | 105 | |
| 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 Brunk | c7be3be | 2016-04-01 17:07:51 -0700 | [diff] [blame] | 113 | } |
| 114 | |