Render more Android functions safe to execute in a batch session
* src/androidfns.c (Fx_display_mm_width, Fx_display_mm_height) (Fandroid_display_monitor_attributes_list) (Fandroid_external_storage_available_p) (Fandroid_request_storage_access): Verify that a display connection or service object is available. * src/androidselect.c (Fandroid_get_clipboard) (Fandroid_browse_url_internal, Fandroid_get_clipboard_targets) (Fandroid_get_clipboard_data, Fandroid_notifications_notify): Moderate tone of error messages.
This commit is contained in:
parent
a5ef9e2568
commit
b22ab99f0a
2 changed files with 16 additions and 5 deletions
|
@ -1374,6 +1374,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width,
|
|||
error ("Android cross-compilation stub called!");
|
||||
return Qnil;
|
||||
#else
|
||||
check_android_display_info (terminal);
|
||||
return make_fixnum (android_get_mm_width ());
|
||||
#endif
|
||||
}
|
||||
|
@ -1386,6 +1387,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height,
|
|||
error ("Android cross-compilation stub called!");
|
||||
return Qnil;
|
||||
#else
|
||||
check_android_display_info (terminal);
|
||||
return make_fixnum (android_get_mm_height ());
|
||||
#endif
|
||||
}
|
||||
|
@ -1469,6 +1471,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
|
|||
#else
|
||||
struct MonitorInfo monitor;
|
||||
|
||||
check_android_display_info (terminal);
|
||||
memset (&monitor, 0, sizeof monitor);
|
||||
monitor.geom.width = android_get_screen_width ();
|
||||
monitor.geom.height = android_get_screen_height ();
|
||||
|
@ -3270,6 +3273,11 @@ External storage on Android encompasses the `/sdcard' and
|
|||
absent these permissions. */)
|
||||
(void)
|
||||
{
|
||||
/* Implement a rather undependable fallback when no GUI is
|
||||
available. */
|
||||
if (!android_init_gui)
|
||||
return Ffile_accessible_directory_p (build_string ("/sdcard"));
|
||||
|
||||
return android_external_storage_available_p () ? Qt : Qnil;
|
||||
}
|
||||
|
||||
|
@ -3284,6 +3292,9 @@ Use `android-external-storage-available-p' (which see) to verify
|
|||
whether Emacs has actually received such access permissions. */)
|
||||
(void)
|
||||
{
|
||||
if (!android_init_gui)
|
||||
return Qnil;
|
||||
|
||||
android_request_storage_access ();
|
||||
return Qnil;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ Alternatively, return nil if the clipboard is empty. */)
|
|||
const char *data;
|
||||
|
||||
if (!android_init_gui)
|
||||
error ("No Android display connection!");
|
||||
error ("No Android display connection");
|
||||
|
||||
method = clipboard_class.get_clipboard;
|
||||
text
|
||||
|
@ -258,7 +258,7 @@ for. Use `android-browse-url' instead. */)
|
|||
Lisp_Object value;
|
||||
|
||||
if (!android_init_gui)
|
||||
error ("No Android display connection!");
|
||||
error ("No Android display connection");
|
||||
|
||||
CHECK_STRING (url);
|
||||
value = android_browse_url (url, send);
|
||||
|
@ -290,7 +290,7 @@ data type available from the clipboard. */)
|
|||
Lisp_Object targets, tem;
|
||||
|
||||
if (!android_init_gui)
|
||||
error ("No Android display connection!");
|
||||
error ("No Android display connection");
|
||||
|
||||
targets = Qnil;
|
||||
block_input ();
|
||||
|
@ -544,7 +544,7 @@ does not have any corresponding data. In that case, use
|
|||
char *buffer, *start;
|
||||
|
||||
if (!android_init_gui)
|
||||
error ("No Android display connection!");
|
||||
error ("No Android display connection");
|
||||
|
||||
CHECK_STRING (type);
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ usage: (android-notifications-notify &rest ARGS) */)
|
|||
AUTO_STRING (default_icon, "ic_dialog_alert");
|
||||
|
||||
if (!android_init_gui)
|
||||
error ("No Android display connection!");
|
||||
error ("No Android display connection");
|
||||
|
||||
/* Clear each variable above. */
|
||||
title = body = replaces_id = group = icon = urgency = actions = Qnil;
|
||||
|
|
Loading…
Add table
Reference in a new issue