diff options
Diffstat (limited to 'src/android.c')
| -rw-r--r-- | src/android.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/android.c b/src/android.c index d788c6f19b4..c186b462360 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -33,6 +33,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 33 | #include <sys/param.h> | 33 | #include <sys/param.h> |
| 34 | 34 | ||
| 35 | #include <assert.h> | 35 | #include <assert.h> |
| 36 | #include <fingerprint.h> | ||
| 36 | 37 | ||
| 37 | #include "android.h" | 38 | #include "android.h" |
| 38 | #include "androidgui.h" | 39 | #include "androidgui.h" |
| @@ -95,6 +96,7 @@ struct android_emacs_service | |||
| 95 | jmethodID detect_mouse; | 96 | jmethodID detect_mouse; |
| 96 | jmethodID name_keysym; | 97 | jmethodID name_keysym; |
| 97 | jmethodID sync; | 98 | jmethodID sync; |
| 99 | jmethodID browse_url; | ||
| 98 | }; | 100 | }; |
| 99 | 101 | ||
| 100 | struct android_emacs_pixmap | 102 | struct android_emacs_pixmap |
| @@ -1294,6 +1296,18 @@ android_get_home_directory (void) | |||
| 1294 | #pragma GCC diagnostic ignored "-Wmissing-prototypes" | 1296 | #pragma GCC diagnostic ignored "-Wmissing-prototypes" |
| 1295 | #endif | 1297 | #endif |
| 1296 | 1298 | ||
| 1299 | JNIEXPORT jstring JNICALL | ||
| 1300 | NATIVE_NAME (getFingerprint) (JNIEnv *env, jobject object) | ||
| 1301 | { | ||
| 1302 | char buffer[sizeof fingerprint * 2 + 1]; | ||
| 1303 | |||
| 1304 | memset (buffer, 0, sizeof buffer); | ||
| 1305 | hexbuf_digest (buffer, (char *) fingerprint, | ||
| 1306 | sizeof fingerprint); | ||
| 1307 | |||
| 1308 | return (*env)->NewStringUTF (env, buffer); | ||
| 1309 | } | ||
| 1310 | |||
| 1297 | JNIEXPORT void JNICALL | 1311 | JNIEXPORT void JNICALL |
| 1298 | NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object, | 1312 | NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object, |
| 1299 | jobject local_asset_manager, | 1313 | jobject local_asset_manager, |
| @@ -1514,6 +1528,8 @@ android_init_emacs_service (void) | |||
| 1514 | FIND_METHOD (detect_mouse, "detectMouse", "()Z"); | 1528 | FIND_METHOD (detect_mouse, "detectMouse", "()Z"); |
| 1515 | FIND_METHOD (name_keysym, "nameKeysym", "(I)Ljava/lang/String;"); | 1529 | FIND_METHOD (name_keysym, "nameKeysym", "(I)Ljava/lang/String;"); |
| 1516 | FIND_METHOD (sync, "sync", "()V"); | 1530 | FIND_METHOD (sync, "sync", "()V"); |
| 1531 | FIND_METHOD (browse_url, "browseUrl", "(Ljava/lang/String;)" | ||
| 1532 | "Ljava/lang/String;"); | ||
| 1517 | #undef FIND_METHOD | 1533 | #undef FIND_METHOD |
| 1518 | } | 1534 | } |
| 1519 | 1535 | ||
| @@ -4735,6 +4751,51 @@ android_project_image_nearest (struct android_image *image, | |||
| 4735 | 4751 | ||
| 4736 | 4752 | ||
| 4737 | 4753 | ||
| 4754 | /* Other miscellaneous functions. */ | ||
| 4755 | |||
| 4756 | /* Ask the system to start browsing the specified encoded URL. Upon | ||
| 4757 | failure, return a string describing the error. Else, value is | ||
| 4758 | nil. */ | ||
| 4759 | |||
| 4760 | Lisp_Object | ||
| 4761 | android_browse_url (Lisp_Object url) | ||
| 4762 | { | ||
| 4763 | jobject value, string; | ||
| 4764 | Lisp_Object tem; | ||
| 4765 | const char *buffer; | ||
| 4766 | |||
| 4767 | string = android_build_string (url); | ||
| 4768 | value = (*android_java_env)->CallObjectMethod (android_java_env, | ||
| 4769 | emacs_service, | ||
| 4770 | service_class.browse_url, | ||
| 4771 | string); | ||
| 4772 | android_exception_check (); | ||
| 4773 | |||
| 4774 | ANDROID_DELETE_LOCAL_REF (string); | ||
| 4775 | |||
| 4776 | /* If no string was returned, return Qnil. */ | ||
| 4777 | if (!value) | ||
| 4778 | return Qnil; | ||
| 4779 | |||
| 4780 | buffer = (*android_java_env)->GetStringUTFChars (android_java_env, | ||
| 4781 | (jstring) value, | ||
| 4782 | NULL); | ||
| 4783 | android_exception_check (); | ||
| 4784 | |||
| 4785 | /* Otherwise, build the string describing the error. */ | ||
| 4786 | tem = build_string_from_utf8 (buffer); | ||
| 4787 | |||
| 4788 | (*android_java_env)->ReleaseStringUTFChars (android_java_env, | ||
| 4789 | (jstring) value, | ||
| 4790 | buffer); | ||
| 4791 | |||
| 4792 | /* And return it. */ | ||
| 4793 | ANDROID_DELETE_LOCAL_REF (value); | ||
| 4794 | return tem; | ||
| 4795 | } | ||
| 4796 | |||
| 4797 | |||
| 4798 | |||
| 4738 | #else /* ANDROID_STUBIFY */ | 4799 | #else /* ANDROID_STUBIFY */ |
| 4739 | 4800 | ||
| 4740 | /* X emulation functions for Android. */ | 4801 | /* X emulation functions for Android. */ |