From d195e5ab401432ddac659791640a2927fc668699 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 13 Apr 2011 15:39:37 -0700 Subject: Replace a custom AndroidRuntime::findClass with a more targeted fix. This seems simpler and more contained, and I think the comment explaining why hoop-jumping is necessary is a bit clearer now. Change-Id: Ief4afd7cbb42188ed835fce23e497520bdb753a8 --- include/android_runtime/AndroidRuntime.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index de2d50b..b02a057 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -46,14 +46,10 @@ public: const char* className, const JNINativeMethod* gMethods, int numMethods); /** - * Call a static Java function that takes no arguments and returns void. - */ - status_t callStatic(const char* className, const char* methodName); - - /** * Call a class's static main method with the given arguments, */ - status_t callMain(const char* className, int argc, const char* const argv[]); + status_t callMain(const char* className, jclass clazz, int argc, + const char* const argv[]); /** * Find a class, with the input either of the form @@ -69,6 +65,13 @@ public: static AndroidRuntime* getRuntime(); /** + * This gets called after the VM has been created, but before we + * run any code. Override it to make any FindClass calls that need + * to use CLASSPATH. + */ + virtual void onVmCreated(JNIEnv* env); + + /** * This gets called after the JavaVM has initialized. Override it * with the system's native entry point. */ @@ -98,6 +101,9 @@ public: /** 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); + private: static int startReg(JNIEnv* env); void parseExtraOpts(char* extraOptsBuf); -- cgit v1.1