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

Commit 79aff6d

Browse files
bluemarvinMortimerGoro
authored andcommitted
Fix entitlement check when FxR is restarted after an exit (#1355)
1 parent d842444 commit 79aff6d

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ struct DeviceDelegateOculusVR::State {
605605
vrb::RenderContextWeak context;
606606
android_app* app = nullptr;
607607
bool initialized = false;
608-
bool platformSDKInitialized = false;
608+
bool applicationEntitled = false;
609609
bool layersEnabled = true;
610610
ovrJava java = {};
611611
ovrMobile* ovr = nullptr;
@@ -710,16 +710,21 @@ struct DeviceDelegateOculusVR::State {
710710
VRB_DEBUG("Detected Unknown Oculus device");
711711
}
712712

713-
ovrRequest result = ovr_PlatformInitializeAndroidAsynchronous(appId, java.ActivityObject, java.Env);
713+
if (!ovr_IsPlatformInitialized()) {
714+
ovrRequest result = ovr_PlatformInitializeAndroidAsynchronous(appId, java.ActivityObject,
715+
java.Env);
714716

715-
if (invalidRequestID == result) {
716-
// Initialization failed which means either the oculus service isn’t on the machine or they’ve hacked their DLL.
717-
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous failed: %d", (int32_t)result);
717+
if (invalidRequestID == result) {
718+
// Initialization failed which means either the oculus service isn’t on the machine or they’ve hacked their DLL.
719+
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous failed: %d", (int32_t) result);
718720
#if STORE_BUILD == 1
719-
VRBrowser::HaltActivity(0);
721+
VRBrowser::HaltActivity(0);
720722
#endif
721-
} else {
722-
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous succeeded");
723+
} else {
724+
VRB_LOG("ovr_PlatformInitializeAndroidAsynchronous succeeded");
725+
ovr_Entitlement_GetIsViewerEntitled();
726+
}
727+
} else if (!applicationEntitled) {
723728
ovr_Entitlement_GetIsViewerEntitled();
724729
}
725730
}
@@ -1243,7 +1248,7 @@ DeviceDelegateOculusVR::SetCPULevel(const device::CPULevel aLevel) {
12431248

12441249
void
12451250
DeviceDelegateOculusVR::ProcessEvents() {
1246-
if (m.platformSDKInitialized) {
1251+
if (m.applicationEntitled) {
12471252
return;
12481253
}
12491254

@@ -1264,15 +1269,18 @@ DeviceDelegateOculusVR::ProcessEvents() {
12641269
}
12651270
break;
12661271
case ovrMessage_Entitlement_GetIsViewerEntitled:
1267-
m.platformSDKInitialized = true;
12681272
if (ovr_Message_IsError(message)) {
12691273
VRB_LOG("User is not entitled");
12701274
#if STORE_BUILD == 1
12711275
VRBrowser::HaltActivity(0);
1276+
#else
1277+
// No need to process events anymore.
1278+
m.applicationEntitled = true;
12721279
#endif
12731280
}
12741281
else {
12751282
VRB_LOG("User is entitled");
1283+
m.applicationEntitled = true;
12761284
}
12771285
break;
12781286
default:

0 commit comments

Comments
 (0)