summaryrefslogtreecommitdiffstats
path: root/apps/hosted
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2011-03-11 19:23:00 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2011-03-11 19:23:00 +0000
commitc2ee32b22aa50101fc092f610927cfbdd9a2d8f1 (patch)
tree9104a62064dda0643c9604c63dee83a74c489d91 /apps/hosted
parent66f2a08f8a37933b9eff79ceabdc2cb42706e48c (diff)
downloadrockbox-c2ee32b22aa50101fc092f610927cfbdd9a2d8f1.tar.gz
rockbox-c2ee32b22aa50101fc092f610927cfbdd9a2d8f1.zip
Partly revert "Android: use NewGlobalRef for references that are used globally"
The added complexity wasn't needed for most subsystems, as main() never returns so local references can't be freed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29570 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/hosted')
-rw-r--r--apps/hosted/android/keyboard.c11
-rw-r--r--apps/hosted/android/notification.c7
-rw-r--r--apps/hosted/android/yesno.c17
3 files changed, 15 insertions, 20 deletions
diff --git a/apps/hosted/android/keyboard.c b/apps/hosted/android/keyboard.c
index 460011c4f7..f9bbcbb261 100644
--- a/apps/hosted/android/keyboard.c
+++ b/apps/hosted/android/keyboard.c
@@ -61,17 +61,14 @@ static void kdb_init(void)
{
semaphore_init(&kbd_wakeup, 1, 0);
/* get the class and its constructor */
- jclass kbInput_class = e->FindClass(env_ptr,
+ RockboxKeyboardInput_class = e->FindClass(env_ptr,
"org/rockbox/RockboxKeyboardInput");
- RockboxKeyboardInput_class = e->NewGlobalRef(env_ptr, kbInput_class);
jmethodID constructor = e->GetMethodID(env_ptr,
RockboxKeyboardInput_class,
"<init>", "()V");
- jobject kbInput_instance = e->NewObject(env_ptr,
- RockboxKeyboardInput_class,
- constructor);
- RockboxKeyboardInput_instance = e->NewGlobalRef(env_ptr,
- kbInput_instance);
+ RockboxKeyboardInput_instance = e->NewObject(env_ptr,
+ RockboxKeyboardInput_class,
+ constructor);
kbd_inputfunc = e->GetMethodID(env_ptr, RockboxKeyboardInput_class,
"kbd_input",
"(Ljava/lang/String;"
diff --git a/apps/hosted/android/notification.c b/apps/hosted/android/notification.c
index 1c89c51357..e7c425b7c1 100644
--- a/apps/hosted/android/notification.c
+++ b/apps/hosted/android/notification.c
@@ -128,14 +128,13 @@ void notification_init(void)
JNIEnv e = *env_ptr;
jfieldID nNM = e->GetFieldID(env_ptr, RockboxService_class,
"fg_runner", "Lorg/rockbox/Helper/RunForegroundManager;");
- jobject nMN_instance = e->GetObjectField(env_ptr,
- RockboxService_instance, nNM);
- if (nMN_instance == NULL)
+ NotificationManager_instance = e->GetObjectField(env_ptr,
+ RockboxService_instance, nNM);
+ if (NotificationManager_instance == NULL)
{
DEBUGF("Failed to get RunForegroundManager instance. Performance will be bad");
return;
}
- NotificationManager_instance = e->NewGlobalRef(env_ptr, nMN_instance);
jclass class = e->GetObjectClass(env_ptr, NotificationManager_instance);
updateNotification = e->GetMethodID(env_ptr, class, "updateNotification",
diff --git a/apps/hosted/android/yesno.c b/apps/hosted/android/yesno.c
index de6ec99a3c..2e85ea2bc1 100644
--- a/apps/hosted/android/yesno.c
+++ b/apps/hosted/android/yesno.c
@@ -52,21 +52,20 @@ static void yesno_init(JNIEnv *env_ptr)
{
semaphore_init(&yesno_done, 1, 0);
/* get the class and its constructor */
- jclass yesno_class = e->FindClass(env_ptr,
- "org/rockbox/RockboxYesno");
+ jclass RockboxYesno_class = e->FindClass(env_ptr,
+ "org/rockbox/RockboxYesno");
jmethodID constructor = e->GetMethodID(env_ptr,
- yesno_class,
+ RockboxYesno_class,
"<init>", "()V");
- jobject yesno_instance = e->NewObject(env_ptr,
- yesno_class,
- constructor);
- RockboxYesno_instance = e->NewGlobalRef(env_ptr, yesno_instance);
- yesno_func = e->GetMethodID(env_ptr, yesno_class,
+ RockboxYesno_instance = e->NewObject(env_ptr,
+ RockboxYesno_class,
+ constructor);
+ yesno_func = e->GetMethodID(env_ptr, RockboxYesno_class,
"yesno_display",
"(Ljava/lang/String;"
"Ljava/lang/String;"
"Ljava/lang/String;)V");
- yesno_is_usable = e->GetMethodID(env_ptr, yesno_class,
+ yesno_is_usable = e->GetMethodID(env_ptr, RockboxYesno_class,
"is_usable", "()Z");
}
/* need to get it every time incase the activity died/restarted */