Home | History | Annotate | Download | only in vr
      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      */
     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     /**
     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     /**
     56      * Return current VR mode state.
     57      *
     58      * @return {@code true} if VR mode is enabled.
     59      */
     60     boolean getVrModeState();
     61 
     62     /**
     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     /**
     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);
     77 
     78     /**
     79      * Sets the resolution and DPI of the vr2d virtual display used to display
     80      * 2D applications in VR mode.
     81      *
     82      * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p>
     83      *
     84      * @param vr2dDisplayProperties Vr2d display properties to be set for
     85      * the VR virtual display
     86      */
     87     void setVr2dDisplayProperties(
     88             in Vr2dDisplayProperties vr2dDisplayProperties);
     89 
     90     /**
     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      */
     96     int getVr2dDisplayId();
     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);
    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);
    113 
    114     /**
    115      * Start VR Input method for the given packageName in {@param componentName}.
    116      * This method notifies InputMethodManagerService to use VR IME instead of
    117      * regular phone IME.
    118      */
    119     void setVrInputMethod(in ComponentName componentName);
    120 
    121 }
    122 
    123