forked from len0rd/rockbox
Android port: handle incoming calls.
Stop explicitely if a call comes in, and resume playback (if it was playing before the call) upon hang up. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27746 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f1184f963a
commit
ca4439ff65
5 changed files with 79 additions and 7 deletions
|
@ -23,14 +23,17 @@
|
|||
#include <jni.h>
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "button.h"
|
||||
#include "audio.h"
|
||||
|
||||
extern JNIEnv *env_ptr;
|
||||
|
||||
extern jobject RockboxService_instance;
|
||||
|
||||
static jclass RockboxTimer_class;
|
||||
static jobject RockboxTimer_instance;
|
||||
static jmethodID java_wait_for_interrupt;
|
||||
static bool initialized = false;
|
||||
|
||||
/*
|
||||
* This is called from the separate Timer java thread. I have not added any
|
||||
* interrupt simulation to it (like the sdl counterpart does),
|
||||
|
@ -49,6 +52,22 @@ Java_org_rockbox_RockboxTimer_timerTask(JNIEnv *env, jobject this)
|
|||
call_tick_tasks();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_rockbox_RockboxTimer_postCallIncoming(JNIEnv *env, jobject this)
|
||||
{
|
||||
(void)env;
|
||||
(void)this;
|
||||
queue_broadcast(SYS_CALL_INCOMING, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_rockbox_RockboxTimer_postCallHungUp(JNIEnv *env, jobject this)
|
||||
{
|
||||
(void)env;
|
||||
(void)this;
|
||||
queue_broadcast(SYS_CALL_HUNG_UP, 0);
|
||||
}
|
||||
|
||||
void tick_start(unsigned int interval_in_ms)
|
||||
{
|
||||
JNIEnv e = *env_ptr;
|
||||
|
@ -57,11 +76,12 @@ void tick_start(unsigned int interval_in_ms)
|
|||
jmethodID constructor = e->GetMethodID(env_ptr,
|
||||
RockboxTimer_class,
|
||||
"<init>",
|
||||
"(J)V");
|
||||
"(Lorg/rockbox/RockboxService;J)V");
|
||||
/* the constructor will do the tick_start */
|
||||
RockboxTimer_instance = e->NewObject(env_ptr,
|
||||
RockboxTimer_class,
|
||||
constructor,
|
||||
RockboxService_instance,
|
||||
(jlong)interval_in_ms);
|
||||
|
||||
/* get our wfi func also */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue