diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java index 6eca53e98..283fc7550 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java @@ -49,6 +49,7 @@ import org.mozilla.vrbrowser.browser.Accounts; import org.mozilla.vrbrowser.browser.PermissionDelegate; import org.mozilla.vrbrowser.browser.SettingsStore; +import org.mozilla.vrbrowser.browser.engine.EngineProvider; import org.mozilla.vrbrowser.browser.engine.Session; import org.mozilla.vrbrowser.browser.engine.SessionStore; import org.mozilla.vrbrowser.crashreporting.CrashReporterService; @@ -252,6 +253,8 @@ protected void onCreate(Bundle savedInstanceState) { SessionStore.get().initializeStores(this); SessionStore.get().setLocales(LocaleUtils.getPreferredLanguageTags(this)); + EngineProvider.INSTANCE.getOrCreateRuntime(this).appendAppNotesToCrashReport("Firefox Reality " + BuildConfig.VERSION_NAME + "-" + BuildConfig.VERSION_CODE + "-" + BuildConfig.FLAVOR + "-" + BuildConfig.BUILD_TYPE + " (" + BuildConfig.GIT_HASH + ")"); + // Create broadcast receiver for getting crash messages from crash process IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(CrashReporterService.CRASH_ACTION); @@ -1209,6 +1212,12 @@ private void disableLayers() { }); } + @Keep + @SuppressWarnings("unused") + private void appendAppNotesToCrashReport(String aNotes) { + runOnUiThread(() -> EngineProvider.INSTANCE.getOrCreateRuntime(VRBrowserActivity.this).appendAppNotesToCrashReport(aNotes)); + } + private SurfaceTexture createSurfaceTexture() { int[] ids = new int[1]; GLES20.glGenTextures(1, ids, 0); diff --git a/app/src/main/cpp/VRBrowser.cpp b/app/src/main/cpp/VRBrowser.cpp index 4c49544b3..f5d1b76f0 100644 --- a/app/src/main/cpp/VRBrowser.cpp +++ b/app/src/main/cpp/VRBrowser.cpp @@ -58,6 +58,8 @@ const char* kOnAppLink = "onAppLink"; const char* kOnAppLinkSignature = "(Ljava/lang/String;)V"; const char* kDisableLayers = "disableLayers"; const char* kDisableLayersSignature = "()V"; +const char* kAppendAppNotesToCrashReport = "appendAppNotesToCrashReport"; +const char* kAppendAppNotesToCrashReportSignature = "(Ljava/lang/String;)V"; JNIEnv* sEnv = nullptr; jclass sBrowserClass = nullptr; @@ -86,6 +88,7 @@ jmethodID sHaltActivity = nullptr; jmethodID sHandlePoorPerformance = nullptr; jmethodID sOnAppLink = nullptr; jmethodID sDisableLayers = nullptr; +jmethodID sAppendAppNotesToCrashReport = nullptr; } namespace crow { @@ -129,6 +132,7 @@ VRBrowser::InitializeJava(JNIEnv* aEnv, jobject aActivity) { sHandlePoorPerformance = FindJNIMethodID(sEnv, sBrowserClass, kHandlePoorPerformance, kHandlePoorPerformanceSignature); sOnAppLink = FindJNIMethodID(sEnv, sBrowserClass, kOnAppLink, kOnAppLinkSignature); sDisableLayers = FindJNIMethodID(sEnv, sBrowserClass, kDisableLayers, kDisableLayersSignature); + sAppendAppNotesToCrashReport = FindJNIMethodID(sEnv, sBrowserClass, kAppendAppNotesToCrashReport, kAppendAppNotesToCrashReportSignature); } void @@ -167,6 +171,7 @@ VRBrowser::ShutdownJava() { sOnAppLink = nullptr; sDisableLayers = nullptr; sEnv = nullptr; + kAppendAppNotesToCrashReport = nullptr; } void @@ -376,4 +381,13 @@ VRBrowser::DisableLayers() { CheckJNIException(sEnv, __FUNCTION__); } +void +VRBrowser::AppendAppNotesToCrashLog(const std::string& aNotes) { + if (!ValidateMethodID(sEnv, sActivity, sAppendAppNotesToCrashReport, __FUNCTION__)) { return; } + jstring notes = sEnv->NewStringUTF(aNotes.c_str()); + sEnv->CallVoidMethod(sActivity, sAppendAppNotesToCrashReport, notes); + sEnv->DeleteLocalRef(notes); + CheckJNIException(sEnv, __FUNCTION__); +} + } // namespace crow diff --git a/app/src/main/cpp/VRBrowser.h b/app/src/main/cpp/VRBrowser.h index 6dba20f46..676bd3968 100644 --- a/app/src/main/cpp/VRBrowser.h +++ b/app/src/main/cpp/VRBrowser.h @@ -42,6 +42,7 @@ void HaltActivity(const jint aReason); void HandlePoorPerformance(); void OnAppLink(const std::string& aJSON); void DisableLayers(); +void AppendAppNotesToCrashLog(const std::string& aNotes); } // namespace VRBrowser; } // namespace crow diff --git a/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp b/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp index 156ba4ff3..e4a57040e 100644 --- a/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp +++ b/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp @@ -148,6 +148,11 @@ struct DeviceDelegateOculusVR::State { } initialized = true; + std::string version = vrapi_GetVersionString(); + std::string notes = "Oculus Driver Version: "; + notes += version; + VRBrowser::AppendAppNotesToCrashLog(notes); + layersEnabled = VRBrowser::AreLayersEnabled(); SetRenderSize(device::RenderMode::StandAlone);