Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Upgrade to latest GV
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Jan 8, 2020
1 parent 8076475 commit dd5419a
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}


Expand Down
144 changes: 124 additions & 20 deletions app/src/main/cpp/moz_external_vr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -102,106 +103,114 @@ 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 {
Cap_None = 0,
/**
* 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
* are capable of 6DoF tracking but for which requestPresent is not
* 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
* other content on the device, this should be un-set. When
* 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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit dd5419a

Please sign in to comment.