summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-07-07 09:14:57 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-07 09:14:57 -0700
commit97250d5c4ab5c36dc4f7cf1d9d48157ed934615d (patch)
treee1075093796bc528940a2159adc557e20c3b1edb /core/jni
parent054e3d5e17378bc3419c8f80c3f204b270d733e8 (diff)
parente24901d3adb28fff72821d4e8e2ccc25b2184550 (diff)
downloadframeworks_base-97250d5c4ab5c36dc4f7cf1d9d48157ed934615d.zip
frameworks_base-97250d5c4ab5c36dc4f7cf1d9d48157ed934615d.tar.gz
frameworks_base-97250d5c4ab5c36dc4f7cf1d9d48157ed934615d.tar.bz2
am e24901d3: am 68267415: Add new native Looper API.
Merge commit 'e24901d3adb28fff72821d4e8e2ccc25b2184550' * commit 'e24901d3adb28fff72821d4e8e2ccc25b2184550': Add new native Looper API.
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_app_NativeActivity.cpp22
-rw-r--r--core/jni/android_os_MessageQueue.cpp6
2 files changed, 25 insertions, 3 deletions
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index dab1dba..af61b80 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -166,6 +166,9 @@ struct NativeCode {
void* dlhandle;
ANativeActivity_createFunc* createActivityFunc;
+ String8 internalDataPath;
+ String8 externalDataPath;
+
sp<ANativeWindow> nativeWindow;
jobject inputChannel;
struct MyInputQueue* nativeInputQueue;
@@ -204,7 +207,8 @@ static bool mainWorkCallback(int fd, int events, void* data) {
// ------------------------------------------------------------------------
static jint
-loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jobject messageQueue)
+loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jobject messageQueue,
+ jstring internalDataDir, jstring externalDataDir, int sdkVersion)
{
const char* pathStr = env->GetStringUTFChars(path, NULL);
NativeCode* code = NULL;
@@ -247,6 +251,19 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jobject messageQ
}
code->activity.env = env;
code->activity.clazz = env->NewGlobalRef(clazz);
+
+ const char* dirStr = env->GetStringUTFChars(internalDataDir, NULL);
+ code->internalDataPath = dirStr;
+ code->activity.internalDataPath = code->internalDataPath.string();
+ env->ReleaseStringUTFChars(path, dirStr);
+
+ dirStr = env->GetStringUTFChars(externalDataDir, NULL);
+ code->externalDataPath = dirStr;
+ code->activity.externalDataPath = code->externalDataPath.string();
+ env->ReleaseStringUTFChars(path, dirStr);
+
+ code->activity.sdkVersion = sdkVersion;
+
code->createActivityFunc(&code->activity, NULL, 0);
}
@@ -420,7 +437,8 @@ onInputChannelDestroyed_native(JNIEnv* env, jobject clazz, jint handle, jobject
}
static const JNINativeMethod g_methods[] = {
- { "loadNativeCode", "(Ljava/lang/String;Landroid/os/MessageQueue;)I", (void*)loadNativeCode_native },
+ { "loadNativeCode", "(Ljava/lang/String;Landroid/os/MessageQueue;Ljava/lang/String;Ljava/lang/String;I)I",
+ (void*)loadNativeCode_native },
{ "unloadNativeCode", "(I)V", (void*)unloadNativeCode_native },
{ "onStartNative", "(I)V", (void*)onStart_native },
{ "onResumeNative", "(I)V", (void*)onResume_native },
diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp
index 030d6c7..961f806 100644
--- a/core/jni/android_os_MessageQueue.cpp
+++ b/core/jni/android_os_MessageQueue.cpp
@@ -51,7 +51,11 @@ private:
// ----------------------------------------------------------------------------
NativeMessageQueue::NativeMessageQueue() {
- mPollLoop = new PollLoop();
+ mPollLoop = PollLoop::getForThread();
+ if (mPollLoop == NULL) {
+ mPollLoop = new PollLoop();
+ PollLoop::setForThread(mPollLoop);
+ }
}
NativeMessageQueue::~NativeMessageQueue() {