summaryrefslogtreecommitdiffstats
path: root/include/android_runtime
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:31:44 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:31:44 -0800
commit9066cfe9886ac131c34d59ed0e2d287b0e3c0087 (patch)
treed88beb88001f2482911e3d28e43833b50e4b4e97 /include/android_runtime
parentd83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (diff)
downloadframeworks_base-9066cfe9886ac131c34d59ed0e2d287b0e3c0087.zip
frameworks_base-9066cfe9886ac131c34d59ed0e2d287b0e3c0087.tar.gz
frameworks_base-9066cfe9886ac131c34d59ed0e2d287b0e3c0087.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'include/android_runtime')
-rw-r--r--include/android_runtime/ActivityManager.h31
-rw-r--r--include/android_runtime/AndroidRuntime.h125
-rw-r--r--include/android_runtime/android_util_AssetManager.h30
3 files changed, 186 insertions, 0 deletions
diff --git a/include/android_runtime/ActivityManager.h b/include/android_runtime/ActivityManager.h
new file mode 100644
index 0000000..451a004
--- /dev/null
+++ b/include/android_runtime/ActivityManager.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008 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 ActivityManager_H
+#define ActivityManager_H
+
+#include <utils/String16.h>
+
+namespace android {
+
+// Perform a ContentProvider.openFile() call for the given URI.
+//
+// Returns the native file descriptor for the opened stream, < 0 on error.
+extern int openContentProviderFile(const String16& uri);
+
+}
+
+#endif
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
new file mode 100644
index 0000000..78bef91
--- /dev/null
+++ b/include/android_runtime/AndroidRuntime.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2005 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_H
+#define _RUNTIME_ANDROID_RUNTIME_H
+
+#include <utils/Errors.h>
+#include <utils/IBinder.h>
+#include <utils/String8.h>
+#include <utils/String16.h>
+#include <utils/Vector.h>
+#include <utils/threads.h>
+#include <pthread.h>
+#include <nativehelper/jni.h>
+
+
+namespace android {
+
+class AndroidRuntime
+{
+public:
+ AndroidRuntime();
+ virtual ~AndroidRuntime();
+
+ /**
+ * Register a set of methods in the specified class.
+ */
+ static int registerNativeMethods(JNIEnv* env,
+ 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[]);
+
+ /**
+ * Find a class, with the input either of the form
+ * "package/class" or "package.class".
+ */
+ static jclass findClass(JNIEnv* env, const char* className);
+
+ int addVmArguments(int argc, const char* const argv[]);
+
+ void start(const char *classname, const bool startSystemServer);
+ void start(); // start in android.util.RuntimeInit
+
+ static AndroidRuntime* getRuntime();
+
+ /**
+ * This gets called after the JavaVM has initialized. Override it
+ * with the system's native entry point.
+ */
+ virtual void onStarted() = 0;
+
+ /**
+ * This gets called after the JavaVM has initialized after a Zygote
+ * fork. Override it to initialize threads, etc. Upon return, the
+ * correct static main will be invoked.
+ */
+ virtual void onZygoteInit() {};
+
+
+ /**
+ * Called when the Java application exits. The default
+ * implementation calls exit(code).
+ */
+ virtual void onExit(int code);
+
+ /** create a new thread that is visible from Java */
+ static void 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();
+
+private:
+ static int startReg(JNIEnv* env);
+
+ Vector<JavaVMOption> mOptions;
+
+ /* JNI JavaVM pointer */
+ static JavaVM* mJavaVM;
+
+ /*
+ * Thread creation helpers.
+ */
+ static int javaCreateThreadEtc(
+ android_thread_func_t entryFunction,
+ void* userData,
+ const char* threadName,
+ int32_t threadPriority,
+ size_t threadStackSize,
+ android_thread_id_t* threadId);
+ static int javaThreadShell(void* args);
+};
+
+// Returns the Unix file descriptor for a ParcelFileDescriptor object
+extern int getParcelFileDescriptorFD(JNIEnv* env, jobject object);
+
+}
+
+#endif
diff --git a/include/android_runtime/android_util_AssetManager.h b/include/android_runtime/android_util_AssetManager.h
new file mode 100644
index 0000000..b6dd9c9
--- /dev/null
+++ b/include/android_runtime/android_util_AssetManager.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2008 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_util_AssetManager_H
+#define android_util_AssetManager_H
+
+#include <utils/AssetManager.h>
+
+#include "jni.h"
+
+namespace android {
+
+extern AssetManager* assetManagerForJavaObject(JNIEnv* env, jobject assetMgr);
+
+}
+
+#endif