diff options
author | Andreas Huber <andih@google.com> | 2014-02-13 16:35:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-02-13 16:35:03 +0000 |
commit | 04f0cab79d1499a5fe27330bb30dd94151b82880 (patch) | |
tree | f3d5102898d98059da36881bb9f6637cbde1f645 /include | |
parent | f6475c7204759a57bc730e2bbaefb3448a77c141 (diff) | |
parent | 7825334929b098b36e1144872200e75ba6d24b13 (diff) | |
download | frameworks_base-04f0cab79d1499a5fe27330bb30dd94151b82880.zip frameworks_base-04f0cab79d1499a5fe27330bb30dd94151b82880.tar.gz frameworks_base-04f0cab79d1499a5fe27330bb30dd94151b82880.tar.bz2 |
Merge "Split AndroidRuntime into AndroidRuntimeBase base-class and the rest."
Diffstat (limited to 'include')
-rw-r--r-- | include/android_runtime/AndroidRuntime.h | 19 | ||||
-rw-r--r-- | include/android_runtime/AndroidRuntimeBase.h | 50 |
2 files changed, 53 insertions, 16 deletions
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index 0b3ce9a..efd92bb 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -19,6 +19,8 @@ #ifndef _RUNTIME_ANDROID_RUNTIME_H #define _RUNTIME_ANDROID_RUNTIME_H +#include "AndroidRuntimeBase.h" + #include <utils/Errors.h> #include <binder/IBinder.h> #include <utils/String8.h> @@ -31,7 +33,7 @@ namespace android { -class AndroidRuntime +class AndroidRuntime : public AndroidRuntimeBase { public: AndroidRuntime(); @@ -45,12 +47,6 @@ public: }; /** - * Register a set of methods in the specified class. - */ - static int registerNativeMethods(JNIEnv* env, - const char* className, const JNINativeMethod* gMethods, int numMethods); - - /** * Call a class's static main method with the given arguments, */ status_t callMain(const char* className, jclass clazz, int argc, @@ -104,12 +100,6 @@ public: static android_thread_id_t createJavaThread(const char* name, void (*start)(void *), void* arg); - /** return a pointer to the VM running in this process */ - static JavaVM* getJavaVM() { return mJavaVM; } - - /** return a pointer to the JNIEnv pointer for this thread */ - static JNIEnv* getJNIEnv(); - /** return a new string corresponding to 'className' with all '.'s replaced by '/'s. */ static char* toSlashClassName(const char* className); @@ -121,9 +111,6 @@ private: Vector<JavaVMOption> mOptions; bool mExitWithoutCleanup; - /* JNI JavaVM pointer */ - static JavaVM* mJavaVM; - /* * Thread creation helpers. */ diff --git a/include/android_runtime/AndroidRuntimeBase.h b/include/android_runtime/AndroidRuntimeBase.h new file mode 100644 index 0000000..2b14987 --- /dev/null +++ b/include/android_runtime/AndroidRuntimeBase.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2014 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 _RUNTIME_ANDROID_RUNTIME_BASE_H +#define _RUNTIME_ANDROID_RUNTIME_BASE_H + +#include <nativehelper/jni.h> + +namespace android { + +struct AndroidRuntimeBase { + /** return a pointer to the VM running in this process */ + static JavaVM* getJavaVM() { return mJavaVM; } + + /** return a pointer to the JNIEnv pointer for this thread */ + static JNIEnv* getJNIEnv(); + + /** + * Register a set of methods in the specified class. + */ + static int registerNativeMethods(JNIEnv* env, + const char* className, const JNINativeMethod* gMethods, int numMethods); + +protected: + /* JNI JavaVM pointer */ + static JavaVM* mJavaVM; + + AndroidRuntimeBase() {} + virtual ~AndroidRuntimeBase() {} + + AndroidRuntimeBase(const AndroidRuntimeBase &); + AndroidRuntimeBase &operator=(const AndroidRuntimeBase &); +}; + +} // namespace android + +#endif // _RUNTIME_ANDROID_RUNTIME_BASE_H |