aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/jni.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/android/jni.cpp')
-rw-r--r--backends/platform/android/jni.cpp85
1 files changed, 39 insertions, 46 deletions
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index 764c84ce1c..256ae09ef8 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -76,10 +76,11 @@ bool JNI::_ready_for_events = 0;
jmethodID JNI::_MID_getDPI = 0;
jmethodID JNI::_MID_displayMessageOnOSD = 0;
+jmethodID JNI::_MID_openUrl = 0;
+jmethodID JNI::_MID_isConnectionLimited = 0;
jmethodID JNI::_MID_setWindowCaption = 0;
jmethodID JNI::_MID_showVirtualKeyboard = 0;
jmethodID JNI::_MID_getSysArchives = 0;
-jmethodID JNI::_MID_getPluginDirectories = 0;
jmethodID JNI::_MID_initSurface = 0;
jmethodID JNI::_MID_deinitSurface = 0;
@@ -233,6 +234,41 @@ void JNI::displayMessageOnOSD(const char *msg) {
env->DeleteLocalRef(java_msg);
}
+bool JNI::openUrl(const char *url) {
+ bool success = true;
+ JNIEnv *env = JNI::getEnv();
+ jstring javaUrl = env->NewStringUTF(url);
+
+ env->CallVoidMethod(_jobj, _MID_openUrl, javaUrl);
+
+ if (env->ExceptionCheck()) {
+ LOGE("Failed to open URL");
+
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ success = false;
+ }
+
+ env->DeleteLocalRef(javaUrl);
+ return success;
+}
+
+bool JNI::isConnectionLimited() {
+ bool limited = false;
+ JNIEnv *env = JNI::getEnv();
+ limited = env->CallBooleanMethod(_jobj, _MID_isConnectionLimited);
+
+ if (env->ExceptionCheck()) {
+ LOGE("Failed to check whether connection's limited");
+
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ limited = true;
+ }
+
+ return limited;
+}
+
void JNI::setWindowCaption(const char *caption) {
JNIEnv *env = JNI::getEnv();
jstring java_caption = env->NewStringUTF(caption);
@@ -293,46 +329,6 @@ void JNI::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
}
}
-void JNI::getPluginDirectories(Common::FSList &dirs) {
- JNIEnv *env = JNI::getEnv();
-
- jobjectArray array =
- (jobjectArray)env->CallObjectMethod(_jobj, _MID_getPluginDirectories);
-
- if (env->ExceptionCheck()) {
- LOGE("Error finding plugin directories");
-
- env->ExceptionDescribe();
- env->ExceptionClear();
-
- return;
- }
-
- jsize size = env->GetArrayLength(array);
- for (jsize i = 0; i < size; ++i) {
- jstring path_obj = (jstring)env->GetObjectArrayElement(array, i);
-
- if (path_obj == 0)
- continue;
-
- const char *path = env->GetStringUTFChars(path_obj, 0);
-
- if (path == 0) {
- LOGE("Error getting string characters from plugin directory");
-
- env->ExceptionClear();
- env->DeleteLocalRef(path_obj);
-
- continue;
- }
-
- dirs.push_back(Common::FSNode(path));
-
- env->ReleaseStringUTFChars(path_obj, path);
- env->DeleteLocalRef(path_obj);
- }
-}
-
bool JNI::initSurface() {
JNIEnv *env = JNI::getEnv();
@@ -452,9 +448,10 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
FIND_METHOD(, setWindowCaption, "(Ljava/lang/String;)V");
FIND_METHOD(, getDPI, "([F)V");
FIND_METHOD(, displayMessageOnOSD, "(Ljava/lang/String;)V");
+ FIND_METHOD(, openUrl, "(Ljava/lang/String;)V");
+ FIND_METHOD(, isConnectionLimited, "()Z");
FIND_METHOD(, showVirtualKeyboard, "(Z)V");
FIND_METHOD(, getSysArchives, "()[Ljava/lang/String;");
- FIND_METHOD(, getPluginDirectories, "()[Ljava/lang/String;");
FIND_METHOD(, initSurface, "()Ljavax/microedition/khronos/egl/EGLSurface;");
FIND_METHOD(, deinitSurface, "()V");
@@ -543,10 +540,6 @@ jint JNI::main(JNIEnv *env, jobject self, jobjectArray args) {
env->DeleteLocalRef(arg);
}
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new AndroidPluginProvider());
-#endif
-
LOGI("Entering scummvm_main with %d args", argc);
res = scummvm_main(argc, argv);