summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/android')
-rw-r--r--firmware/target/hosted/android/kernel-android.c18
-rw-r--r--firmware/target/hosted/android/system-android.c22
-rw-r--r--firmware/target/hosted/android/telephony-android.c54
3 files changed, 70 insertions, 24 deletions
diff --git a/firmware/target/hosted/android/kernel-android.c b/firmware/target/hosted/android/kernel-android.c
index 636c849c24..c0d927d026 100644
--- a/firmware/target/hosted/android/kernel-android.c
+++ b/firmware/target/hosted/android/kernel-android.c
@@ -52,22 +52,6 @@ Java_org_rockbox_RockboxTimer_timerTask(JNIEnv *env, jobject this)
52 call_tick_tasks(); 52 call_tick_tasks();
53} 53}
54 54
55JNIEXPORT void JNICALL
56Java_org_rockbox_RockboxTimer_postCallIncoming(JNIEnv *env, jobject this)
57{
58 (void)env;
59 (void)this;
60 queue_broadcast(SYS_CALL_INCOMING, 0);
61}
62
63JNIEXPORT void JNICALL
64Java_org_rockbox_RockboxTimer_postCallHungUp(JNIEnv *env, jobject this)
65{
66 (void)env;
67 (void)this;
68 queue_broadcast(SYS_CALL_HUNG_UP, 0);
69}
70
71void tick_start(unsigned int interval_in_ms) 55void tick_start(unsigned int interval_in_ms)
72{ 56{
73 JNIEnv e = *env_ptr; 57 JNIEnv e = *env_ptr;
@@ -76,7 +60,7 @@ void tick_start(unsigned int interval_in_ms)
76 jmethodID constructor = e->GetMethodID(env_ptr, 60 jmethodID constructor = e->GetMethodID(env_ptr,
77 RockboxTimer_class, 61 RockboxTimer_class,
78 "<init>", 62 "<init>",
79 "(Lorg/rockbox/RockboxService;J)V"); 63 "(Landroid/content/Context;J)V");
80 /* the constructor will do the tick_start */ 64 /* the constructor will do the tick_start */
81 RockboxTimer_instance = e->NewObject(env_ptr, 65 RockboxTimer_instance = e->NewObject(env_ptr,
82 RockboxTimer_class, 66 RockboxTimer_class,
diff --git a/firmware/target/hosted/android/system-android.c b/firmware/target/hosted/android/system-android.c
index 7d1fe9d458..009630eeaa 100644
--- a/firmware/target/hosted/android/system-android.c
+++ b/firmware/target/hosted/android/system-android.c
@@ -24,10 +24,6 @@
24#include "config.h" 24#include "config.h"
25#include "system.h" 25#include "system.h"
26 26
27void system_exception_wait(void) { }
28void system_reboot(void) { }
29void power_off(void) { }
30void system_init(void) { }
31 27
32 28
33/* global fields for use with various JNI calls */ 29/* global fields for use with various JNI calls */
@@ -40,6 +36,21 @@ uintptr_t *stackend;
40 36
41extern int main(void); 37extern int main(void);
42extern void powermgmt_init_target(void); 38extern void powermgmt_init_target(void);
39extern void telephony_init_device(void);
40
41void system_exception_wait(void) { }
42void system_reboot(void) { }
43void power_off(void) { }
44
45void system_init(void)
46{
47 /* no better place yet, most of powermgmt.c is #ifdef'd out for non-native
48 * builds */
49 powermgmt_init_target();
50 /* also no better place yet */
51 telephony_init_device();
52}
53
43/* this is the entry point of the android app initially called by jni */ 54/* this is the entry point of the android app initially called by jni */
44JNIEXPORT void JNICALL 55JNIEXPORT void JNICALL
45Java_org_rockbox_RockboxService_main(JNIEnv *env, jobject this) 56Java_org_rockbox_RockboxService_main(JNIEnv *env, jobject this)
@@ -57,8 +68,5 @@ Java_org_rockbox_RockboxService_main(JNIEnv *env, jobject this)
57 RockboxService_instance = this; 68 RockboxService_instance = this;
58 RockboxService_class = (*env)->GetObjectClass(env, this); 69 RockboxService_class = (*env)->GetObjectClass(env, this);
59 70
60 /* no better place yet, most of powermgmt.c is #ifdef'd out for non-native
61 * builds */
62 powermgmt_init_target();
63 main(); 71 main();
64} 72}
diff --git a/firmware/target/hosted/android/telephony-android.c b/firmware/target/hosted/android/telephony-android.c
new file mode 100644
index 0000000000..771b7a973a
--- /dev/null
+++ b/firmware/target/hosted/android/telephony-android.c
@@ -0,0 +1,54 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Thomas Martitz
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#include <jni.h>
24#include "kernel.h"
25
26extern JNIEnv *env_ptr;
27extern RockboxService_instance;
28
29
30void telephony_init_device(void)
31{
32 JNIEnv e = *env_ptr;
33 jclass class = e->FindClass(env_ptr, "org/rockbox/RockboxTelephony");
34 jmethodID constructor = e->GetMethodID(env_ptr, class, "<init>", "(Landroid/content/Context;)V");
35
36 e->NewObject(env_ptr, class, constructor, RockboxService_instance);
37}
38
39
40JNIEXPORT void JNICALL
41Java_org_rockbox_RockboxTelephony_postCallIncoming(JNIEnv *env, jobject this)
42{
43 (void)env;
44 (void)this;
45 queue_broadcast(SYS_CALL_INCOMING, 0);
46}
47
48JNIEXPORT void JNICALL
49Java_org_rockbox_RockboxTelephony_postCallHungUp(JNIEnv *env, jobject this)
50{
51 (void)env;
52 (void)this;
53 queue_broadcast(SYS_CALL_HUNG_UP, 0);
54}