diff options
| author | Po Lu | 2023-02-17 21:09:00 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-17 21:09:00 +0800 |
| commit | d70bb47aeb586bfa5feb29d6f3759604eb93829a (patch) | |
| tree | 38817755116a2ebfa1331cc633ff955eb8a2b4c7 /src/androidterm.c | |
| parent | 1f81186d67b2a86e6a555a7ad3323fcd13f5e257 (diff) | |
| download | emacs-d70bb47aeb586bfa5feb29d6f3759604eb93829a.tar.gz emacs-d70bb47aeb586bfa5feb29d6f3759604eb93829a.zip | |
Update emacsbug and version.el for the Android port
* java/Makefile.in (install_temp/assets/version): New generated
file.
* lisp/loadup.el: Set emacs versions appropriately prior to
dumping on Android.
* lisp/mail/emacsbug.el (emacs-build-description): Insert
Android build fingerprint.
* lisp/version.el (emacs-repository-version-android)
(emacs-repository-get-version, emacs-repository-get-branch):
Implement for Android.
* src/androidterm.c (android_set_build_fingerprint): New
function.
(syms_of_androidterm): New variable `android-build-fingerprint'.
Diffstat (limited to 'src/androidterm.c')
| -rw-r--r-- | src/androidterm.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index c6f75ec9219..8a07bfa7455 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -33,6 +33,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 33 | #include "window.h" | 33 | #include "window.h" |
| 34 | #include "textconv.h" | 34 | #include "textconv.h" |
| 35 | #include "coding.h" | 35 | #include "coding.h" |
| 36 | #include "pdumper.h" | ||
| 36 | 37 | ||
| 37 | /* This is a chain of structures for all the X displays currently in | 38 | /* This is a chain of structures for all the X displays currently in |
| 38 | use. */ | 39 | use. */ |
| @@ -5413,6 +5414,84 @@ android_term_init (void) | |||
| 5413 | 5414 | ||
| 5414 | 5415 | ||
| 5415 | 5416 | ||
| 5417 | /* Set Vandroid_build_fingerprint to a reasonable value. */ | ||
| 5418 | |||
| 5419 | static void | ||
| 5420 | android_set_build_fingerprint (void) | ||
| 5421 | { | ||
| 5422 | #ifdef ANDROID_STUBIFY | ||
| 5423 | Vandroid_build_fingerprint = Qnil; | ||
| 5424 | #else | ||
| 5425 | jclass class; | ||
| 5426 | jfieldID field; | ||
| 5427 | jobject string; | ||
| 5428 | const char *data; | ||
| 5429 | |||
| 5430 | /* Set class to NULL so freeing an uninitialized local ref can be | ||
| 5431 | avoided. */ | ||
| 5432 | class = NULL; | ||
| 5433 | |||
| 5434 | /* Likewise for string. */ | ||
| 5435 | string = NULL; | ||
| 5436 | |||
| 5437 | if (!android_init_gui) | ||
| 5438 | goto fail; | ||
| 5439 | else | ||
| 5440 | { | ||
| 5441 | /* Obtain Build.FINGERPRINT. Clear exceptions after each query; | ||
| 5442 | JNI can't find Build.FINGERPRIN on some systems. */ | ||
| 5443 | |||
| 5444 | class = (*android_java_env)->FindClass (android_java_env, | ||
| 5445 | "android/os/Build"); | ||
| 5446 | (*android_java_env)->ExceptionClear (android_java_env); | ||
| 5447 | |||
| 5448 | if (!class) | ||
| 5449 | goto fail; | ||
| 5450 | |||
| 5451 | field = (*android_java_env)->GetStaticFieldID (android_java_env, | ||
| 5452 | class, | ||
| 5453 | "FINGERPRINT", | ||
| 5454 | "Ljava/lang/String;"); | ||
| 5455 | (*android_java_env)->ExceptionClear (android_java_env); | ||
| 5456 | |||
| 5457 | if (!field) | ||
| 5458 | goto fail; | ||
| 5459 | |||
| 5460 | string | ||
| 5461 | = (*android_java_env)->GetStaticObjectField (android_java_env, | ||
| 5462 | class, field); | ||
| 5463 | (*android_java_env)->ExceptionClear (android_java_env); | ||
| 5464 | |||
| 5465 | if (!string) | ||
| 5466 | goto fail; | ||
| 5467 | |||
| 5468 | data = (*android_java_env)->GetStringUTFChars (android_java_env, | ||
| 5469 | string, NULL); | ||
| 5470 | (*android_java_env)->ExceptionClear (android_java_env); | ||
| 5471 | |||
| 5472 | if (!data) | ||
| 5473 | goto fail; | ||
| 5474 | |||
| 5475 | Vandroid_build_fingerprint = build_string_from_utf8 (data); | ||
| 5476 | (*android_java_env)->ReleaseStringUTFChars (android_java_env, | ||
| 5477 | string, data); | ||
| 5478 | } | ||
| 5479 | |||
| 5480 | if (string) | ||
| 5481 | ANDROID_DELETE_LOCAL_REF (string); | ||
| 5482 | |||
| 5483 | ANDROID_DELETE_LOCAL_REF (class); | ||
| 5484 | |||
| 5485 | return; | ||
| 5486 | |||
| 5487 | fail: | ||
| 5488 | if (class) | ||
| 5489 | ANDROID_DELETE_LOCAL_REF (class); | ||
| 5490 | |||
| 5491 | Vandroid_build_fingerprint = Qnil; | ||
| 5492 | #endif | ||
| 5493 | } | ||
| 5494 | |||
| 5416 | void | 5495 | void |
| 5417 | syms_of_androidterm (void) | 5496 | syms_of_androidterm (void) |
| 5418 | { | 5497 | { |
| @@ -5441,6 +5520,15 @@ If set to a non-float value, there will be no wait at all. */); | |||
| 5441 | x_underline_at_descent_line, | 5520 | x_underline_at_descent_line, |
| 5442 | doc: /* SKIP: real doc in xterm.c. */); | 5521 | doc: /* SKIP: real doc in xterm.c. */); |
| 5443 | x_underline_at_descent_line = false; | 5522 | x_underline_at_descent_line = false; |
| 5523 | |||
| 5524 | DEFVAR_LISP ("android-build-fingerprint", Vandroid_build_fingerprint, | ||
| 5525 | doc: /* String identifying the device's OS version. | ||
| 5526 | This is a string that uniquely identifies the version of Android | ||
| 5527 | Emacs is running on. */); | ||
| 5528 | |||
| 5529 | /* Avoid dumping Vandroid_build_fingerprint. */ | ||
| 5530 | pdumper_do_now_and_after_load (android_set_build_fingerprint); | ||
| 5531 | |||
| 5444 | DEFSYM (Qx_underline_at_descent_line, "x-underline-at-descent-line"); | 5532 | DEFSYM (Qx_underline_at_descent_line, "x-underline-at-descent-line"); |
| 5445 | } | 5533 | } |
| 5446 | 5534 | ||