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

Add application notes to crash report #3106

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/cpp/VRBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -86,6 +88,7 @@ jmethodID sHaltActivity = nullptr;
jmethodID sHandlePoorPerformance = nullptr;
jmethodID sOnAppLink = nullptr;
jmethodID sDisableLayers = nullptr;
jmethodID sAppendAppNotesToCrashReport = nullptr;
}

namespace crow {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -167,6 +171,7 @@ VRBrowser::ShutdownJava() {
sOnAppLink = nullptr;
sDisableLayers = nullptr;
sEnv = nullptr;
kAppendAppNotesToCrashReport = nullptr;
}

void
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions app/src/main/cpp/VRBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down