| 92 | } |
| 93 | |
| 94 | void Runtime::Init(JavaVM* vm, void* reserved) { |
| 95 | __android_log_print(ANDROID_LOG_INFO, "TNS.Runtime", |
| 96 | "NativeScript Runtime Version %s, commit %s", |
| 97 | NATIVE_SCRIPT_RUNTIME_VERSION, |
| 98 | NATIVE_SCRIPT_RUNTIME_COMMIT_SHA); |
| 99 | |
| 100 | if (Runtime::s_jvm == nullptr) { |
| 101 | s_jvm = vm; |
| 102 | |
| 103 | JEnv::Init(s_jvm); |
| 104 | } |
| 105 | |
| 106 | // handle SIGABRT/SIGSEGV only on API level > 20 as the handling is not so |
| 107 | // efficient in older versions |
| 108 | if (m_androidVersion > 20) { |
| 109 | struct sigaction action; |
| 110 | action.sa_handler = SIG_handler; |
| 111 | sigaction(SIGABRT, &action, NULL); |
| 112 | sigaction(SIGSEGV, &action, NULL); |
| 113 | } |
| 114 | // Set terminate handler for uncaught exceptions |
| 115 | std::set_terminate(LogAndAbortUncaught); |
| 116 | } |
| 117 | |
| 118 | int Runtime::GetAndroidVersion() { |
| 119 | char sdkVersion[PROP_VALUE_MAX]; |
no test coverage detected