CypherpunkArmory / UserLAnd

Main UserLAnd Repository
Other
3.62k stars 401 forks source link

Problem with importing and exporting files on Android 12 and 13 tablets. Only media file permissions can be given for Android 12, and none at all for Android 13. But ftp works. #1894

Open don-w-p opened 10 months ago

don-w-p commented 10 months ago

Describe the bug

There is a problem importing and exporting files in UserLAnd for Android 12 and 13. The Android 12 OS only lets one give the UserLAnd app permissions to media files, not to all files. And no permissions at all except for notifications can be given for Android 13. The Custom Document Provider does not show with the Files app or with other file browser apps even though a micro SD card is present for both tablets. Under "Other storage" in the "Browse" tab for the Files app, the unix emulator app Termux shows but UserLAnd does not. I can copy a file to Termux by choosing Share with the Files app and then choosing Termux. I expect UserLAnd would have behaved the same way had I been able to grant access permission to all files. I am using the Debian distribution in terminal mode.

Also, the documentation suggests using /storage/sdcard/ and then looking in SD Card > Android > data > tech.ula. There is no problem reading and writing to /storage/internal/ and /storage/sdcard/ in the UserLAnd Debian terminal, but the app "Files" hangs trying to open SD Card > Android > data > tech.ula and the app "Material Files" can't even open SD Card > Android > data, saying that the device must be rooted, which it isn't. There is no content in the internal Android > data folder even though I copied files to both /storage/internal/ and /storage/sdcard/.

The rest of this bug report describes ways to transfer files despite these problems. For the Android 12 tablet I can see and copy media files in the internal storage folder /DCIM/Camera. To copy other files that I put in that folder I must give them a .jpg extension. So if I have the file test.txt in /DCIM/Camera I rename it to test.jpg. Then I use the cp command and then use the mv command to change the extension back again.

For Android 13 this workaround fails. But the unix ftp command works if one has an internet connection. It must be installed using "apt install net-tools" and "apt install ftp". As a test in ftp, do "open test.rebex.net". For login, the name is "demo" and the password is "password". When done, do "close test.rebex.net" and "quit". The site is read-only. If there is no public ftp site that allows both upload and download that one can use, then one must set up one's own ftp server. I set up a working FTP server on a Raspberry Pi Model 4 and also on a Windows 11 desktop PC. This was extremely simple for the Raspberry Pi 4 but much had to be done exactly right for Windows 11 because of all its security and firewall. These FTP servers are on the local network only and no wifi router settings had to be changed.

To set up an FTP server on a Raspberry Pi model 4, open a terminal window, do "sudo raspi-config" and enable SSH, do "sudo apt-get install vsftpd" and then "reboot". That's it. The IPv4 address for a wifi network can be obtained by doing "ifconfig wlan0". In the UserLAnd Debian terminal, do "ftp" then "open 192.168.x.xxx" then "ls". Use get and put to transfer files Then "close 192.168.x.xxx" and "quit". The Name and Password will be that for the Raspberry Pi. That's the only security. There will be complete access to the Raspberry Pi file system. Access can be limited by making edits to the file /etc/vsftpd.conf as described in https://phoenixnap.com/kb/raspberry-pi-ftp-server, but I did not do so.

Setting up an FTP server on Windows 11 requires that the IIS Manager be added as a Windows feature together with all its sub-features, including "FTS Server". Once IIS is installed, type "IIS Manager" in the search bar. In the dialog box that comes up, one can "Add FTP Server". When setting up the FTP server, choose a name of the form ftp.xxxx.com and allow both Anonymous and Basic authentication, even though it seems that only authentication using the Windows login email address and password works. Also allow the IP address to be chosen. The port must be 21. Also choose "No SSH". The ftp command "open 192.168.x.xx" uses the public IPv4 address of the Windows computer. Several further things must be done. Under Firewall in Security and Maintenance in the Control Panel, one must add FTS Server as an app that can go through the firewall. For the ftp home directory, one must use a shared folder that is shared by everyone and also allow public access to shared folders. If the last isn't done, the ftp server will only work on the Windows computer that the FTP server is on.

Now that I have an always on Raspberry Pi FTP server that lets me easily transfer files, I recommend the UserLAnd Debian command line unix emulator. The only other satisfactory unix emulator I have found for an unrooted Android tablet is Termux, which should be installed with Andronix to get the latest supported version. It is not nearly as complete. For instance, neither gfortran nor ftp are in its repository.

Steps to reproduce the behavior:

In home screen, swipe down from the top twice and choose the gear Settings icon. Then choose Apps. Then either choose UserLAnd in the "Recently opened apps" if it appears there or choose "See all nnn apps" and choose UserLAnd. Then choose Permissions. Finally choose "Files and media" and for Android 12 you should get what I took a screen snapshot of.

Screenshots

Screenshot_20240123-144542

Device Information

Android 12 10.4 Inch tablet TECLAST Model T40S 16GB + 128 GB 2000 x 1200 IPS

Android 13 11 Inch tablet Oangcc Octa-Cores 16 GB + 256 GB + 1 TB Expand 2K 2000 x 1200

lindasdon commented 5 months ago

On Android 13 cellphone I have been able to transfer text files to Userland my mkdir /sdcard/Download/shr from userland and touch empty file there. I can open with text editor in Termux and copy contents in. As long as the file was originally created by userland it will be able to use it fully after text is copied in