API reference

VolumetricWindowManager Class

This class provides APIs to query volumetric windows and manipulate their placement, movement, layout, and visibility.

Methods

addOnWindowChangeListener ( activity , executor , listener )
Add a listener to listen for volumetric window changes.
Apps can listen for changes to their own volumetric windows.
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.addOnWindowChangeListener(Activity activity, Executor executor, OnWindowChangeListener listener)
Parameters
activity: Activity  Activity associated with volumetric windows to listen for changes to
executor: Executor  thread which runs listener callbacks
listener: OnWindowChangeListener  listener to invoke when the windows change
Returns
void
addWindow ( params , executor , callback )
Add a volumetric window.
Apps typically use this method to add a child volumetric window and must supply a parent window token.
The VolumetricWindowPlacementParams supports windows of the following types:
The PendingIntent⁠ and SurfaceControlViewHost.SurfacePackage⁠ payloads are mutually exclusive: a volumetric window may have only one content source. Setting both on the VolumetricWindowPlacementParams.Builder causes VolumetricWindowPlacementParams.Builder.build() to throw IllegalArgumentException⁠.
Apps can add child windows to one of their Activities by specifying the Activity's VolumetricWindowToken as the parent window token. The parent window token can be retrieved via ActivityExt.getVolumetricWindowToken(Activity).
Apps can also add child windows to other child windows, passing the token returned in the VolumetricWindowPlacementCallback.onSuccess(VolumetricWindowToken) callback for the parent window, or by retrieving the token from a child Activity using ActivityExt.getVolumetricWindowToken(android.app.Activity) or from a child View's window using WindowExt.getVolumetricWindowToken(Window).
Permissions:
  • A hosted manager doesn't require permission to add a hosted window
  • Any app can add a child of one of its Activities or another child window it owns
  • (System Only) Top-level windows are limited to VOLUMETRIC_WINDOW_TYPE_APP_PLACEHOLDER and VOLUMETRIC_WINDOW_TYPE_BIOMETRIC_PROMPT
  • (System Only) Explicit window types are limited to VOLUMETRIC_WINDOW_TYPE_APP_PLACEHOLDER and VOLUMETRIC_WINDOW_TYPE_BIOMETRIC_PROMPT; both require horizonos.permission.ADD_ROOT_VOLUMETRIC_WINDOW
  • Other explicit volumetric window types are rejected with VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_INVALID_PARAMS
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.addWindow(VolumetricWindowPlacementParams params, Executor executor, VolumetricWindowPlacementCallback callback)
Parameters
executor: Executor  thread which executes the callback
callback: VolumetricWindowPlacementCallback  callback to listen to the placement result
Returns
void
applyTransaction ( transaction )
Apply a window transaction.
Holders of horizonos.permission.MANAGE_VOLUMETRIC_WINDOWS can apply transactions for all volumetric windows. Hosted volumetric window managers can apply changes to their own hosted volumetric windows. Other apps can request transactions, but the system can deny the request.
If the transaction has no changes, this method returns immediately without sending the empty transaction.
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.applyTransaction(VolumetricWindowTransaction transaction)
Parameters
transaction: VolumetricWindowTransaction  transaction to apply
Returns
void
getHostedManager ()
Create a hosted volumetric window manager that manages child volumetric windows hosted by the Activity context of this manager.
The hosted manager can add and modify its hosted child windows without requiring the global volumetric window management permission.
The Activity context of this manager must be an immersive VR activity that already has a volumetric window token; the returned manager hosts its child windows under that token.
Each call builds a new manager, and a hosted manager keeps per-window state for the children driven through it. Callers should create one and hold onto it rather than creating one per child, or windows driven through an earlier manager stop behaving correctly. Prefer ERROR(/#createHostedManager()), whose name says so; this method is equivalent and has never returned a shared instance. The manager can send transactions only for child windows added with addWindow(VolumetricWindowPlacementParams, Executor, VolumetricWindowPlacementCallback).
Signature
VolumetricWindowManager metavr.app.volumetricwindow.VolumetricWindowManager.getHostedManager()
Returns
VolumetricWindowManager  if the context is not an activity
removeOnWindowChangeListener ( activity , listener )
Remove a previously added volumetric window change listener.
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.removeOnWindowChangeListener(Activity activity, OnWindowChangeListener listener)
Parameters
activity: Activity  Activity associated with the listener
listener: OnWindowChangeListener  listener to remove
Returns
void

Inner Classes

OnWindowChangeListener Interface

Interface to receive changes to volumetric windows.

Methods

onWindowsChanged ( windows )
Callback that is triggered when volumetric windows change.
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.OnWindowChangeListener.onWindowsChanged(List windows)
Parameters
windows: List  updated volumetric window information
Returns
void

VolumetricWindowPlacementCallback Interface

Interface to listen to the result of a volumetric window placement.

Static Fields

ERROR_ACTIVITY_LAUNCH_FAILURE : final int
Error code indicating that activity launch failed.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_ACTIVITY_LAUNCH_FAILURE
ERROR_INVALID_PARAMS : final int
Error code indicating that the given placement params were invalid.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_INVALID_PARAMS
ERROR_INVALID_PARENT : final int
Error code indicating that an invalid parent volumetric window was used.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_INVALID_PARENT
ERROR_NON_HOSTED_MANAGER : final int
Error code indicating that a non-hosted volumetric window manager was used.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_NON_HOSTED_MANAGER
ERROR_POLICY_VIOLATION : final int
Error code indicating that the placement was rejected by a system policy.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_POLICY_VIOLATION
ERROR_SURFACE_PACKAGE_PLACEMENT_FAILURE : final int
Error code indicating that placing a SurfaceControlViewHost failed.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_SURFACE_PACKAGE_PLACEMENT_FAILURE
ERROR_WINDOW_PLACEMENT_FAILURE : final int
Error code indicating that placing a volumetric window failed.
Signature
final int metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.ERROR_WINDOW_PLACEMENT_FAILURE

Methods

onFailure ( errorCode , errorMessage )
Callback when the attempt to add the volumetric window fails.
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.onFailure(int errorCode, String errorMessage)
Parameters
errorCode: int  error code of the failure Value is either
errorMessage: String  error message of the failure
Returns
void
onSuccess ( token )
Callback when the volumetric window is successfully added.
Signature
void metavr.app.volumetricwindow.VolumetricWindowManager.VolumetricWindowPlacementCallback.onSuccess(VolumetricWindowToken token)
Parameters
token: VolumetricWindowToken  the token of the added volumetric window
Returns
void