Skip to content

Instantly share code, notes, and snippets.

@theuni
Created March 11, 2013 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theuni/5136583 to your computer and use it in GitHub Desktop.
Save theuni/5136583 to your computer and use it in GitHub Desktop.
From 211c674f9f99b4057b6a8e230ec3a47b986ccdda Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Mon, 11 Mar 2013 14:48:26 -0400
Subject: [PATCH] jni: OnLoad() is guaranteed to be called before
android_main(), so store the vm/env there.
---
xbmc/android/activity/JNIManager.cpp | 2 ++
xbmc/android/activity/android_main.cpp | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/xbmc/android/activity/JNIManager.cpp b/xbmc/android/activity/JNIManager.cpp
index 8c0e4c6..73058b2 100644
--- a/xbmc/android/activity/JNIManager.cpp
+++ b/xbmc/android/activity/JNIManager.cpp
@@ -20,6 +20,7 @@
#include "JNIManager.h"
#include "XBMCApp.h"
#include "BroadcastReceiver.h"
+#include "JNIThreading.h"
#include <android/log.h>
@@ -76,6 +77,7 @@ bool CAndroidJNIManager::Load(JavaVM* vm, int jniVersion)
if (vm->GetEnv(reinterpret_cast<void**>(&env), jniVersion) != JNI_OK) {
return false;
}
+ xbmc_jni_on_load(vm, env);
m_broadcastReceiver = new CBroadcastReceiver();
RegisterClass(env, m_broadcastReceiver);
diff --git a/xbmc/android/activity/android_main.cpp b/xbmc/android/activity/android_main.cpp
index 5c5ab81..ff363a3 100644
--- a/xbmc/android/activity/android_main.cpp
+++ b/xbmc/android/activity/android_main.cpp
@@ -160,8 +160,6 @@ extern void android_main(struct android_app* state)
{
// make sure that the linker doesn't strip out our glue
app_dummy();
- int val = xbmc_jni_on_load(state->activity->vm, state->activity->env);
- __android_log_print(ANDROID_LOG_VERBOSE, "XBMC","xbmc_jni_on_load returned %i\n",val);
CAndroidJNIManager::GetInstance().SetActivityInstance(state->activity->clazz);
setup_env(state);
CEventLoop eventLoop(state);
--
1.8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment