Subject: bug#64445: 30.0.50; Android: Emacs cannot access /storage/emulated/0 although other apps can

From: Po Lu <[email-masked]>
Date: Tue, 04 Jul 2023 16:30:21 +0800

Milan Zamazal <[email-masked]> writes:

> The device is an e-ink reader with a highly customized environment.  It
> doesn’t have the standard settings manager, nor the standard file
> manager.  All I can say is that:
>
> - Emacs has the same storage permission as the other applications that
>   can access the storage without any problems (e.g. Termux or a
>   third-party file manager).

Termux targets Android 9.0, while Emacs targets Android 13.  On newer
systems, this means that Emacs needs additional permissions to access
the external directory.

> - I had to enable the permission manually, Emacs didn’t ask for it
>   itself (unlike e.g. the file manager does).  I also tried to reboot
>   the device, the permission is still there but Emacs cannot access the
>   storage.

Emacs does not ask for permissions upon startup like other Android
programs do; I think that is somewhat rude.

> - When I mount the device storage on my desktop computer via USB and run
>   ‘find -name "*emacs*"’ on it, the only thing found is the *.apk I
>   installed Emacs from.  Again, the directories of other applications
>   are visible.

Android unfortunately does not allow mounting application home
directories using USB.

> As no other application I use on the device (e.g. several applications I
> installed from F-Droid) suffers from the storage access problems nor
> requires anything unusual to access the storage, I believe it’s an Emacs
> bug.  Please tell me if there is anything I can do to help identifying
> the cause of the problem.

Would you please try to determine the precise version of Android that is
installed?  The Storage permission is not sufficient on Android 11 and
later, where you must also grant Emacs ``All Files Access'' through
Settings.

Thanks.