diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-05-04 11:40:40 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-05-05 15:17:26 -0700 |
commit | 69969e48f2bca9339662dddfacff0bbf6374ed7f (patch) | |
tree | 073be8188794a4542611e624a05fbbefaef98fc3 /native | |
parent | f24e66dbb99b52e3ef8e56b66c807ff1d5129fca (diff) | |
download | frameworks_base-69969e48f2bca9339662dddfacff0bbf6374ed7f.zip frameworks_base-69969e48f2bca9339662dddfacff0bbf6374ed7f.tar.gz frameworks_base-69969e48f2bca9339662dddfacff0bbf6374ed7f.tar.bz2 |
First pass at NativeActivity.
This is a rough sketch of the new pure-native API, which you can
use through a NativeActivity in your manifest (no Java code in
the .apk needed!).
Intentionally no docs yet, the API is still being seriously
messed with. But it works.
Change-Id: I0e916d58a0d159ecaf3689e41834eb8dc681c0c0
Diffstat (limited to 'native')
-rw-r--r-- | native/include/android/native_activity.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/native/include/android/native_activity.h b/native/include/android/native_activity.h new file mode 100644 index 0000000..8b09461 --- /dev/null +++ b/native/include/android/native_activity.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef ANDROID_NATIVE_ACTIVITY_H +#define ANDROID_NATIVE_ACTIVITY_H + +#include <stdint.h> +#include <sys/types.h> + +#include <jni.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct android_activity_callbacks_t; + +typedef struct android_activity_t { + struct android_activity_callbacks_t* callbacks; + + JNIEnv* env; + jobject clazz; + + void* instance; +} android_activity_t; + +typedef struct android_activity_callbacks_t { + void (*onStart)(android_activity_t* activity); + void (*onResume)(android_activity_t* activity); + void* (*onSaveInstanceState)(android_activity_t* activity, size_t* outSize); + void (*onPause)(android_activity_t* activity); + void (*onStop)(android_activity_t* activity); + void (*onDestroy)(android_activity_t* activity); + + void (*onLowMemory)(android_activity_t* activity); + void (*onWindowFocusChanged)(android_activity_t* activity, int hasFocus); +} android_activity_callbacks_t; + +typedef void android_activity_create_t(android_activity_t* activity, + void* savedState, size_t savedStateSize); + +extern android_activity_create_t android_onCreateActivity; + +#if 0 +extern android_onCreateActivity(android_activity_t activity, + void* savedState, size_t savedStateSize); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif // ANDROID_NATIVE_ACTIVITY_H + |