1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Offer to grant storage permissions if absent

* java/org/gnu/emacs/EmacsService.java (externalStorageAvailable)
(requestStorageAccess23, requestStorageAccess30)
(requestStorageAccess): New functions.

* lisp/startup.el (fancy-startup-tail, normal-splash-screen):
Call android-win functions for inserting the new storage
permission notice.

* lisp/term/android-win.el
(android-display-storage-permission-popup)
(android-after-splash-screen): New functions.

* src/android.c (android_init_emacs_service): Link to new Java
functions.
(android_external_storage_available_p)
(android_request_storage_access): New functions.

* src/android.h: Update prototypes.

* src/androidfns.c (Fandroid_external_storage_available_p)
(Fandroid_request_storage_access): New functions.
(syms_of_androidfns): Register new subrs.
This commit is contained in:
Po Lu 2023-11-18 14:15:55 +08:00
parent 05213345c0
commit 669e754f5b
6 changed files with 314 additions and 1 deletions

View file

@ -3096,6 +3096,42 @@ within the directory `/content/storage'. */)
/* Functions concerning storage permissions. */
DEFUN ("android-external-storage-available-p",
Fandroid_external_storage_available_p,
Sandroid_external_storage_available_p, 0, 0, 0,
doc: /* Return whether Emacs is entitled to access external storage.
Return nil if the requisite permissions for external storage access
have not been granted to Emacs, t otherwise. Such permissions can be
requested by means of the `android-request-storage-access'
command.
External storage on Android encompasses the `/sdcard' and
`/storage/emulated' directories, access to which is denied to programs
absent these permissions. */)
(void)
{
return android_external_storage_available_p () ? Qt : Qnil;
}
DEFUN ("android-request-storage-access", Fandroid_request_storage_access,
Sandroid_request_storage_access, 0, 0, "",
doc: /* Request rights to access external storage.
Return nil whether access is accorded or not, immediately subsequent
to displaying the permissions request dialog.
`android-external-storage-available-p' (which see) ascertains if Emacs
has received such rights. */)
(void)
{
android_request_storage_access ();
return Qnil;
}
/* Miscellaneous input method related stuff. */
/* Report X, Y, by the phys cursor width and height as the cursor
@ -3302,6 +3338,8 @@ bell being rung. */);
#ifndef ANDROID_STUBIFY
defsubr (&Sandroid_query_battery);
defsubr (&Sandroid_request_directory_access);
defsubr (&Sandroid_external_storage_available_p);
defsubr (&Sandroid_request_storage_access);
tip_timer = Qnil;
staticpro (&tip_timer);