summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-06-29 12:18:58 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-06-29 12:18:58 -0700
commitb5f05d0018d72531e40c2afadfee90e9bc0c8893 (patch)
tree928953bd29d60f381c9b9b28d255648ff8f8a96e /core/jni
parentd6dcec4f79737623051378cb99858a4032fa8005 (diff)
parent0934fbb6b81006fdf6a76b6519201d2f472a1908 (diff)
downloadframeworks_base-b5f05d0018d72531e40c2afadfee90e9bc0c8893.zip
frameworks_base-b5f05d0018d72531e40c2afadfee90e9bc0c8893.tar.gz
frameworks_base-b5f05d0018d72531e40c2afadfee90e9bc0c8893.tar.bz2
am 0934fbb6: Merge "Update native activity & event APIs to follow correct conventions." into gingerbread
Merge commit '0934fbb6b81006fdf6a76b6519201d2f472a1908' into gingerbread-plus-aosp * commit '0934fbb6b81006fdf6a76b6519201d2f472a1908': Update native activity & event APIs to follow correct conventions.
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_app_NativeActivity.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp
index 5e5e47e..a22b353 100644
--- a/core/jni/android_app_NativeActivity.cpp
+++ b/core/jni/android_app_NativeActivity.cpp
@@ -29,7 +29,7 @@ namespace android
{
struct NativeCode {
- NativeCode(void* _dlhandle, android_activity_create_t* _createFunc) {
+ NativeCode(void* _dlhandle, ANativeActivity_createFunc* _createFunc) {
memset(&activity, sizeof(activity), 0);
memset(&callbacks, sizeof(callbacks), 0);
dlhandle = _dlhandle;
@@ -73,7 +73,7 @@ struct NativeCode {
sp<InputChannel> ic =
android_view_InputChannel_getInputChannel(activity.env, _channel);
if (ic != NULL) {
- nativeInputQueue = new input_queue_t(ic);
+ nativeInputQueue = new AInputQueue(ic);
if (nativeInputQueue->getConsumer().initialize() != android::OK) {
delete nativeInputQueue;
nativeInputQueue = NULL;
@@ -86,15 +86,15 @@ struct NativeCode {
return OK;
}
- android_activity_t activity;
- android_activity_callbacks_t callbacks;
+ ANativeActivity activity;
+ ANativeActivityCallbacks callbacks;
void* dlhandle;
- android_activity_create_t* createActivityFunc;
+ ANativeActivity_createFunc* createActivityFunc;
jobject surface;
jobject inputChannel;
- struct input_queue_t* nativeInputQueue;
+ struct AInputQueue* nativeInputQueue;
};
static jint
@@ -108,14 +108,19 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path)
env->ReleaseStringUTFChars(path, pathStr);
if (handle != NULL) {
- code = new NativeCode(handle, (android_activity_create_t*)
- dlsym(handle, "android_onCreateActivity"));
+ code = new NativeCode(handle, (ANativeActivity_createFunc*)
+ dlsym(handle, "ANativeActivity_onCreate"));
if (code->createActivityFunc == NULL) {
- LOGW("android_onCreateActivity not found");
+ LOGW("ANativeActivity_onCreate not found");
delete code;
return 0;
}
code->activity.callbacks = &code->callbacks;
+ if (env->GetJavaVM(&code->activity.vm) < 0) {
+ LOGW("NativeActivity GetJavaVM failed");
+ delete code;
+ return 0;
+ }
code->activity.env = env;
code->activity.clazz = clazz;
code->createActivityFunc(&code->activity, NULL, 0);
@@ -219,7 +224,7 @@ onSurfaceCreated_native(JNIEnv* env, jobject clazz, jint handle, jobject surface
code->setSurface(surface);
if (code->callbacks.onSurfaceCreated != NULL) {
code->callbacks.onSurfaceCreated(&code->activity,
- (android_surface_t*)code->surface);
+ (ASurfaceHolder*)code->surface);
}
}
}
@@ -232,7 +237,7 @@ onSurfaceChanged_native(JNIEnv* env, jobject clazz, jint handle, jobject surface
NativeCode* code = (NativeCode*)handle;
if (code->surface != NULL && code->callbacks.onSurfaceChanged != NULL) {
code->callbacks.onSurfaceChanged(&code->activity,
- (android_surface_t*)code->surface, format, width, height);
+ (ASurfaceHolder*)code->surface, format, width, height);
}
}
}
@@ -244,7 +249,7 @@ onSurfaceDestroyed_native(JNIEnv* env, jobject clazz, jint handle, jobject surfa
NativeCode* code = (NativeCode*)handle;
if (code->surface != NULL && code->callbacks.onSurfaceDestroyed != NULL) {
code->callbacks.onSurfaceDestroyed(&code->activity,
- (android_surface_t*)code->surface);
+ (ASurfaceHolder*)code->surface);
}
code->setSurface(NULL);
}