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

Commit

Permalink
Fix entitlement check when FxR is restarted after an exit (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin authored and MortimerGoro committed Jul 3, 2019
1 parent d842444 commit 79aff6d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ struct DeviceDelegateOculusVR::State {
vrb::RenderContextWeak context;
android_app* app = nullptr;
bool initialized = false;
bool platformSDKInitialized = false;
bool applicationEntitled = false;
bool layersEnabled = true;
ovrJava java = {};
ovrMobile* ovr = nullptr;
Expand Down Expand Up @@ -710,16 +710,21 @@ struct DeviceDelegateOculusVR::State {
VRB_DEBUG("Detected Unknown Oculus device");
}

ovrRequest result = ovr_PlatformInitializeAndroidAsynchronous(appId, java.ActivityObject, java.Env);
if (!ovr_IsPlatformInitialized()) {
ovrRequest result = ovr_PlatformInitializeAndroidAsynchronous(appId, java.ActivityObject,
java.Env);

if (invalidRequestID == result) {
// Initialization failed which means either the oculus service isn’t on the machine or they’ve hacked their DLL.
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous failed: %d", (int32_t)result);
if (invalidRequestID == result) {
// Initialization failed which means either the oculus service isn’t on the machine or they’ve hacked their DLL.
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous failed: %d", (int32_t) result);
#if STORE_BUILD == 1
VRBrowser::HaltActivity(0);
VRBrowser::HaltActivity(0);
#endif
} else {
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous succeeded");
} else {
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous succeeded");
ovr_Entitlement_GetIsViewerEntitled();
}
} else if (!applicationEntitled) {
ovr_Entitlement_GetIsViewerEntitled();
}
}
Expand Down Expand Up @@ -1243,7 +1248,7 @@ DeviceDelegateOculusVR::SetCPULevel(const device::CPULevel aLevel) {

void
DeviceDelegateOculusVR::ProcessEvents() {
if (m.platformSDKInitialized) {
if (m.applicationEntitled) {
return;
}

Expand All @@ -1264,15 +1269,18 @@ DeviceDelegateOculusVR::ProcessEvents() {
}
break;
case ovrMessage_Entitlement_GetIsViewerEntitled:
m.platformSDKInitialized = true;
if (ovr_Message_IsError(message)) {
VRB_LOG("User is not entitled");
#if STORE_BUILD == 1
VRBrowser::HaltActivity(0);
#else
// No need to process events anymore.
m.applicationEntitled = true;
#endif
}
else {
VRB_LOG("User is entitled");
m.applicationEntitled = true;
}
break;
default:
Expand Down

0 comments on commit 79aff6d

Please sign in to comment.