summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libjvm-android.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/libjvm-android.c b/src/libjvm-android.c
index b83f6b8..dda4dd7 100644
--- a/src/libjvm-android.c
+++ b/src/libjvm-android.c
@@ -5,6 +5,25 @@
#include "wrapper/verbose.h"
jstring
+android_os_Build_MANUFACTURER(JNIEnv *env, jobject object)
+{
+ assert(env && object);
+ return (*env)->NewStringUTF(env, "android2gnulinux");
+}
+
+jstring
+android_os_Build_MODEL(JNIEnv *env, jobject object)
+{
+ return android_os_Build_MANUFACTURER(env, object);
+}
+
+jstring
+android_os_Build_PRODUCT(JNIEnv *env, jobject object)
+{
+ return android_os_Build_MANUFACTURER(env, object);
+}
+
+jstring
android_content_Context_getPackageName(JNIEnv *env, jobject object, va_list args)
{
assert(env && object);
@@ -18,6 +37,56 @@ android_content_Context_getPackageCodePath(JNIEnv *env, jobject object, va_list
return (*env)->NewStringUTF(env, ".");
}
+jstring
+android_content_Context_POWER_SERVICE(JNIEnv *env, jobject object)
+{
+ assert(env && object);
+ return (*env)->NewStringUTF(env, "power");
+}
+
+jstring
+android_content_Context_WINDOW_SERVICE(JNIEnv *env, jobject object)
+{
+ assert(env && object);
+ return (*env)->NewStringUTF(env, "window");
+}
+
+jobject
+android_content_Context_getSystemService(JNIEnv *env, jobject object, va_list args)
+{
+ assert(env && object);
+ jstring str = va_arg(args, jstring);
+ (*env)->GetStringUTFChars(env, str, NULL);
+ return NULL;
+}
+
+jint
+android_content_Context_checkCallingOrSelfPermission(JNIEnv *env, jobject object, va_list args)
+{
+ assert(env && object);
+ jstring str = va_arg(args, jstring);
+ (*env)->GetStringUTFChars(env, str, NULL);
+ return -1; // PERMISSION_DENIED
+}
+
+jobject
+android_content_Context_getPackageManager(JNIEnv *env, jobject object, va_list args)
+{
+ assert(env && object);
+ static jobject sv;
+ return (sv ? sv : (sv = (*env)->AllocObject(env, (*env)->FindClass(env, "android/content/pm/PackageManager"))));
+}
+
+jobject
+android_content_pm_PackageManager_getApplicationInfo(JNIEnv *env, jobject object, va_list args)
+{
+ assert(env && object);
+ jstring str = va_arg(args, jstring);
+ verbose("%s::%d", (*env)->GetStringUTFChars(env, str, NULL), va_arg(args, jint));
+ static jobject sv;
+ return (sv ? sv : (sv = (*env)->AllocObject(env, (*env)->FindClass(env, "android/content/pm/ApplicationInfo"))));
+}
+
jobject
android_content_Context_getSharedPreferences(JNIEnv *env, jobject object, va_list args)
{
@@ -106,3 +175,19 @@ android_app_ApplicationErrorReport_getErrorReportReceiver(JNIEnv *env, jobject o
static jobject sv;
return (sv ? sv : (sv = (*env)->AllocObject(env, (*env)->FindClass(env, "android/content/ComponentName"))));
}
+
+jstring
+android_app_Activity_getPackageName(JNIEnv *env, jobject object, va_list args)
+{
+ // FIXME: Maybe we should be able to handle java inheritance somehow
+ // so we don't have to create these wrapper functions.
+ return android_content_Context_getPackageName(env, object, args);
+}
+
+jstring
+android_net_Uri_encode(JNIEnv *env, jobject object, va_list args)
+{
+ assert(env && object);
+ jstring str = va_arg(args, jstring);
+ return str;
+}