mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Update Android port
* doc/emacs/android.texi (Android Startup, Android File System) (Android Environment, Android Windowing, Android Troubleshooting): Improve documentation; fix typos. * doc/lispref/commands.texi (Misc Events): Likewise. * java/org/gnu/emacs/EmacsService.java (queryBattery): New function. * lisp/battery.el (battery-status-function): Set appropriately for Android. (battery-android): New function. * src/android.c (struct android_emacs_service): New method `query_battery'. (android_check_content_access): Improve exception checking. (android_init_emacs_service): Look up new method. (android_destroy_handle, android_create_window) (android_init_android_rect_class, android_init_emacs_gc_class) (android_set_clip_rectangles) (android_create_pixmap_from_bitmap_data, android_fill_polygon) (android_get_image, android_put_image, android_bell) (android_set_input_focus, android_raise_window) (android_lower_window, android_query_tree, android_get_geometry) (android_translate_coordinates, android_wc_lookup_string) (android_damage_window, android_build_string) (android_build_jstring, android_exception_check_1) (android_exception_check_2): New functions. (android_browse_url): Improve exception handling. Always use android_exception_check and don't leak local refs. (android_query_battery): New function. * src/android.h (struct android_battery_state): New struct. * src/androidfns.c (Fandroid_query_battery, syms_of_androidfns): New function. * src/androidfont.c (androidfont_from_lisp, DO_SYMBOL_FIELD) (DO_CARDINAL_FIELD, androidfont_list, androidfont_match) (androidfont_draw, androidfont_open_font) (androidfont_close_font): * src/androidselect.c (Fandroid_set_clipboard) (Fandroid_get_clipboard): * src/sfnt.c (sfnt_map_glyf_table): * src/sfntfont.c (sfntfont_free_outline_cache) (sfntfont_free_raster_cache, sfntfont_close): Allow font close functions to be called twice.
This commit is contained in:
parent
d5cccfdc56
commit
8e4c5db193
11 changed files with 414 additions and 166 deletions
|
|
@ -2783,6 +2783,46 @@ frame_parm_handler android_frame_parm_handlers[] =
|
|||
NULL,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Battery information support. */
|
||||
|
||||
DEFUN ("android-query-battery", Fandroid_query_battery,
|
||||
Sandroid_query_battery, 0, 0, 0,
|
||||
doc: /* Perform a query for battery information.
|
||||
This function will not work before Android 5.0.
|
||||
Value is nil upon failure, or a list of the form:
|
||||
|
||||
(CAPACITY CHARGE-COUNTER CURRENT-AVERAGE CURRENT-NOW STATUS
|
||||
REMAINING)
|
||||
|
||||
See the documentation at
|
||||
|
||||
https://developer.android.com/reference/android/os/BatteryManager
|
||||
|
||||
for more details about these values. */)
|
||||
(void)
|
||||
{
|
||||
struct android_battery_state state;
|
||||
|
||||
/* Make sure the Android libraries have been initialized. */
|
||||
|
||||
if (!android_init_gui)
|
||||
return Qnil;
|
||||
|
||||
/* Perform the query. */
|
||||
|
||||
if (android_query_battery (&state))
|
||||
return Qnil;
|
||||
|
||||
return listn (6, make_int (state.capacity),
|
||||
make_int (state.charge_counter),
|
||||
make_int (state.current_average),
|
||||
make_int (state.current_now),
|
||||
make_int (state.status),
|
||||
make_int (state.remaining));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -2837,8 +2877,9 @@ syms_of_androidfns (void)
|
|||
defsubr (&Sx_hide_tip);
|
||||
defsubr (&Sandroid_detect_mouse);
|
||||
defsubr (&Sandroid_toggle_on_screen_keyboard);
|
||||
|
||||
#ifndef ANDROID_STUBIFY
|
||||
defsubr (&Sandroid_query_battery);
|
||||
|
||||
tip_timer = Qnil;
|
||||
staticpro (&tip_timer);
|
||||
tip_frame = Qnil;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue