diff --git a/app/build.gradle b/app/build.gradle index 1222195ec..3a33e71c1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,7 +49,7 @@ android { minSdkVersion build_versions.min_sdk targetSdkVersion build_versions.target_sdk versionCode 1 - versionName "7" + versionName "7.1" buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\"" buildConfigField "Boolean", "DISABLE_CRASH_RESTART", getCrashRestartDisabled() testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/PermissionDelegate.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/PermissionDelegate.java index d3d8b0b27..1dc6367cf 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/PermissionDelegate.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/PermissionDelegate.java @@ -115,6 +115,9 @@ public void onAndroidPermissionsRequest(GeckoSession aSession, String[] permissi @Override public void onContentPermissionRequest(GeckoSession aSession, String aUri, int aType, Callback callback) { Log.d(LOGTAG, "onContentPermissionRequest: " + aUri + " " + aType); + if (aType == PERMISSION_XR) { + callback.grant(); + } PermissionWidget.PermissionType type; if (aType == PERMISSION_DESKTOP_NOTIFICATION) { type = PermissionWidget.PermissionType.Notification; diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/EngineProvider.kt b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/EngineProvider.kt index 552099f68..11fdb5b1e 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/EngineProvider.kt +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/EngineProvider.kt @@ -52,7 +52,7 @@ object EngineProvider { runtime = GeckoRuntime.create(context, builder.build()) for (extension in WEB_EXTENSIONS) { val path = "resource://android/assets/web_extensions/$extension/" - runtime!!.registerWebExtension(WebExtension(path)) + runtime!!.registerWebExtension(WebExtension(path, runtime!!.webExtensionController)) } diff --git a/app/src/main/cpp/moz_external_vr.h b/app/src/main/cpp/moz_external_vr.h index 3f78c6cc8..e2b48dbaa 100644 --- a/app/src/main/cpp/moz_external_vr.h +++ b/app/src/main/cpp/moz_external_vr.h @@ -47,8 +47,8 @@ namespace gfx { // and mapped files if we have both release and nightlies // running at the same time? Or...what if we have multiple // release builds running on same machine? (Bug 1563232) -#define SHMEM_VERSION "0.0.4" -static const int32_t kVRExternalVersion = 11; +#define SHMEM_VERSION "0.0.7" +static const int32_t kVRExternalVersion = 14; // We assign VR presentations to groups with a bitmask. // Currently, we will only display either content or chrome. @@ -63,6 +63,7 @@ static const uint32_t kVRGroupAll = 0xffffffff; static const int kVRDisplayNameMaxLen = 256; static const int kVRControllerNameMaxLen = 256; +static const int kProfileNameListMaxLen = 256; static const int kVRControllerMaxCount = 16; static const int kVRControllerMaxButtons = 64; static const int kVRControllerMaxAxis = 16; @@ -102,30 +103,38 @@ enum class ControllerCapabilityFlags : uint16_t { /** * Cap_Position is set if the Gamepad is capable of tracking its position. */ - Cap_Position = 1 << 1, + Cap_Position = 1 << 1, /** * Cap_Orientation is set if the Gamepad is capable of tracking its * orientation. */ - Cap_Orientation = 1 << 2, + Cap_Orientation = 1 << 2, /** * Cap_AngularAcceleration is set if the Gamepad is capable of tracking its * angular acceleration. */ - Cap_AngularAcceleration = 1 << 3, + Cap_AngularAcceleration = 1 << 3, /** * Cap_LinearAcceleration is set if the Gamepad is capable of tracking its * linear acceleration. */ - Cap_LinearAcceleration = 1 << 4, + Cap_LinearAcceleration = 1 << 4, + /** + * Cap_GripSpacePosition is set if the Gamepad has a grip space position. + */ + Cap_GripSpacePosition = 1 << 5, /** * Cap_All used for validity checking during IPC serialization */ - Cap_All = (1 << 5) - 1 + Cap_All = (1 << 6) - 1 }; #endif // ifndef MOZILLA_INTERNAL_API +enum class TargetRayMode : uint8_t { Gaze, TrackedPointer, Screen }; + +enum class GamepadMappingType : uint8_t { _empty, Standard, XRStandard }; + enum class VRDisplayBlendMode : uint8_t { Opaque, Additive, AlphaBlend }; enum class VRDisplayCapabilityFlags : uint16_t { @@ -133,12 +142,12 @@ enum class VRDisplayCapabilityFlags : uint16_t { /** * Cap_Position is set if the VRDisplay is capable of tracking its position. */ - Cap_Position = 1 << 1, + Cap_Position = 1 << 1, /** * Cap_Orientation is set if the VRDisplay is capable of tracking its * orientation. */ - Cap_Orientation = 1 << 2, + Cap_Orientation = 1 << 2, /** * Cap_Present is set if the VRDisplay is capable of presenting content to an * HMD or similar device. Can be used to indicate "magic window" devices that @@ -146,7 +155,7 @@ enum class VRDisplayCapabilityFlags : uint16_t { * meaningful. If false then calls to requestPresent should always fail, and * getEyeParameters should return null. */ - Cap_Present = 1 << 3, + Cap_Present = 1 << 3, /** * Cap_External is set if the VRDisplay is separate from the device's * primary display. If presenting VR content will obscure @@ -154,54 +163,54 @@ enum class VRDisplayCapabilityFlags : uint16_t { * un-set, the application should not attempt to mirror VR content * or update non-VR UI because that content will not be visible. */ - Cap_External = 1 << 4, + Cap_External = 1 << 4, /** * Cap_AngularAcceleration is set if the VRDisplay is capable of tracking its * angular acceleration. */ - Cap_AngularAcceleration = 1 << 5, + Cap_AngularAcceleration = 1 << 5, /** * Cap_LinearAcceleration is set if the VRDisplay is capable of tracking its * linear acceleration. */ - Cap_LinearAcceleration = 1 << 6, + Cap_LinearAcceleration = 1 << 6, /** * Cap_StageParameters is set if the VRDisplay is capable of room scale VR * and can report the StageParameters to describe the space. */ - Cap_StageParameters = 1 << 7, + Cap_StageParameters = 1 << 7, /** * Cap_MountDetection is set if the VRDisplay is capable of sensing when the * user is wearing the device. */ - Cap_MountDetection = 1 << 8, + Cap_MountDetection = 1 << 8, /** * Cap_PositionEmulated is set if the VRDisplay is capable of setting a * emulated position (e.g. neck model) even if still doesn't support 6DOF * tracking. */ - Cap_PositionEmulated = 1 << 9, + Cap_PositionEmulated = 1 << 9, /** * Cap_Inline is set if the device can be used for WebXR inline sessions * where the content is displayed within an element on the page. */ - Cap_Inline = 1 << 10, + Cap_Inline = 1 << 10, /** * Cap_ImmersiveVR is set if the device can give exclusive access to the * XR device display and that content is not intended to be integrated * with the user's environment */ - Cap_ImmersiveVR = 1 << 11, + Cap_ImmersiveVR = 1 << 11, /** * Cap_ImmersiveAR is set if the device can give exclusive access to the * XR device display and that content is intended to be integrated with * the user's environment. */ - Cap_ImmersiveAR = 1 << 12, + Cap_ImmersiveAR = 1 << 12, /** * Cap_All used for validity checking during IPC serialization */ - Cap_All = (1 << 13) - 1 + Cap_All = (1 << 13) - 1 }; #ifdef MOZILLA_INTERNAL_API @@ -332,6 +341,37 @@ struct VRControllerState { #else ControllerHand hand; #endif + // https://immersive-web.github.io/webxr/#enumdef-xrtargetraymode + TargetRayMode targetRayMode; + + // Space-delimited list of input profile names, in decending order + // of specificity. + // https://immersive-web.github.io/webxr/#dom-xrinputsource-profiles + char profiles[kProfileNameListMaxLen]; + + // https://immersive-web.github.io/webxr-gamepads-module/#enumdef-gamepadmappingtype + GamepadMappingType mappingType; + + // Start frame ID of the most recent primary select + // action, or 0 if the select action has never occurred. + uint64_t selectActionStartFrameId; + // End frame Id of the most recent primary select + // action, or 0 if action never occurred. + // If selectActionStopFrameId is less than + // selectActionStartFrameId, then the select + // action has not ended yet. + uint64_t selectActionStopFrameId; + + // start frame Id of the most recent primary squeeze + // action, or 0 if the squeeze action has never occurred. + uint64_t squeezeActionStartFrameId; + // End frame Id of the most recent primary squeeze + // action, or 0 if action never occurred. + // If squeezeActionStopFrameId is less than + // squeezeActionStartFrameId, then the squeeze + // action has not ended yet. + uint64_t squeezeActionStopFrameId; + uint32_t numButtons; uint32_t numAxes; uint32_t numHaptics; @@ -347,9 +387,20 @@ struct VRControllerState { #else ControllerCapabilityFlags flags; #endif + + // When Cap_Position is set in flags, pose corresponds + // to the controllers' pose in target ray space: + // https://immersive-web.github.io/webxr/#dom-xrinputsource-targetrayspace VRPose pose; + + // When Cap_GripSpacePosition is set in flags, gripPose corresponds + // to the controllers' pose in grip space: + // https://immersive-web.github.io/webxr/#dom-xrinputsource-gripspace + VRPose gripPose; + bool isPositionValid; bool isOrientationValid; + #ifdef MOZILLA_INTERNAL_API void Clear() { memset(this, 0, sizeof(VRControllerState)); } #endif @@ -421,6 +472,23 @@ struct VRBrowserState { #if defined(__ANDROID__) bool shutdown; #endif // defined(__ANDROID__) + /** + * In order to support WebXR's navigator.xr.IsSessionSupported call without + * displaying any permission dialogue, it is necessary to have a safe way to + * detect the capability of running a VR or AR session without activating XR + * runtimes or powering on hardware. + * + * API's such as OpenVR make no guarantee that hardware and software won't be + * left activated after enumerating devices, so each backend in gfx/vr/service + * must allow for more granular detection of capabilities. + * + * When detectRuntimesOnly is true, the initialization exits early after + * reporting the presence of XR runtime software. + * + * The result of the runtime detection is reported with the Cap_ImmersiveVR + * and Cap_ImmersiveAR bits in VRDisplayState.flags. + */ + bool detectRuntimesOnly; bool presentationActive; bool navigationTransitionActive; VRLayerState layerState[kVRLayerMaxCount]; @@ -475,6 +543,41 @@ struct VRWindowState { char signalName[32]; }; +enum class VRTelemetryId : uint8_t { + NONE = 0, + INSTALLED_FROM = 1, + ENTRY_METHOD = 2, + FIRST_RUN = 3, + TOTAL = 4, +}; + +enum class VRTelemetryInstallFrom: uint8_t { + User = 0, + FxR = 1, + HTC = 2, + Valve = 3, + TOTAL = 4, +}; + +enum class VRTelemetryEntryMethod: uint8_t { + SystemBtn = 0, + Library = 1, + Gaze = 2, + TOTAL = 3, +}; + +struct VRTelemetryState { + uint32_t uid; + + bool installedFrom : 1; + bool entryMethod : 1; + bool firstRun : 1; + + uint8_t installedFromValue : 3; + uint8_t entryMethodValue : 3; + bool firstRunValue : 1; +}; + struct VRExternalShmem { int32_t version; int32_t size; @@ -502,6 +605,7 @@ struct VRExternalShmem { #endif // !defined(__ANDROID__) #if defined(XP_WIN) VRWindowState windowState; + VRTelemetryState telemetryState; #endif #ifdef MOZILLA_INTERNAL_API void Clear() volatile { diff --git a/versions.gradle b/versions.gradle index 468a88b25..86361f82c 100644 --- a/versions.gradle +++ b/versions.gradle @@ -24,7 +24,7 @@ ext.deps = [:] def versions = [:] // GeckoView versions can be found here: // https://maven.mozilla.org/?prefix=maven2/org/mozilla/geckoview/ -versions.gecko_view = "72.0.20191126093448" +versions.gecko_view = "74.0.20200107215758" versions.android_components = "21.0.0" // Note that android-components also depends on application-services, // and in fact is our main source of appservices-related functionality.