[Xiaomi Mi Max 3 Questions & Answers] meltwater:
Issue:

When using Open Camera, ES File Explorer or Amaze file explorer files are created with zero bytes. i.e. Copying a file will create a 0 byte file or if file storage location set to the SDCard, the Open Camera app will fail to record video or take pictures.

Initially write operations on the SDCard did seem to work for a while (recorded one video before fail using Open Camera and copied files across without errors).

All operations are fine on internal memory.

There is no issue using the built-in file manager and camera apps. Will update as I check though other apps affected by this.

Setup:

The phone was on MIUI 9, then updated to the MIUI 10 OTA update (from beginning of Oct2018):

GLOBAL Version 10.0.1.0 (OEDMIFH)

Android 8.1.0 OPMI.171019.019

Kernel 4.4.78-pref-ge3e6edb

I then performed a factory reset from the boot recovery before installing everything from my previous phone. I didn't try MIUI 9 with an SDCard.

System Apps and Apps up to date.

I then started with the SDCard (128GB Class 10) cleanly formatted on PC, FAT32, and then when inserted into the phone formatted again. Looked for option to mount as Internal Storage, but noted that this isn’t available on this device (probably for the best), and no obvious option for encryption???

Troubleshooting:

Initially I thought, OK failed SDCard (this was before I found built-in apps worked OK). So I removed the card formatted it and checked using a test program to write/verify the whole card and it checked out OK. Still same issues back in the phone.

Next I pulled SDCard from another phone and tried that, and I get the very same issues. Thinking less likely it is a failed SDCard now, perhaps it is a hardware issue with the phone. Although it did write some files before.

After reading a few places, mention of an issue on MIUI 9 but this was fixed in later update. The steps don't match with anything in MIUI 10.

There is also mention of a bug with Android Orio which is similar, where apps need Storage permissions. Checked and I'd given the apps this permission and I had.

Following this, I tried the standard apps (Camera and File Manager) and discovered that these wrote files without errors (using the very same files which fail before/after on the other apps). Right so looking less like a hardware issue (hopefully!).

For ES Explorer, first time you write to the SDCard you have to select the SDCard root (“Please choose the root directory (XXXX-XXXX) of ext-SDCard…”). In this step, the SDCARD is referred to as BOOT and ES Explorer mounts it with the ID of SDCARD. The internal memory is mounted as /storage/emulated/0 and the SDCard as /storage/XXXX-XXXX/.

Additional testing with the apps, has shown that the data is actually written by ES Explorer since the 0 byte file shown in ES Explorer after a copy, is the correct size and opens from the standard file manager. This is further confirmed when performing a reboot or remount of the SDCard, ES Explorer then reads the file as it should… Any file copied/moved by the standard file manager is shown and works correctly, even from ES Explorer.

I get just the same behaviour with alternative file explorers such as Amaze. Also I think many of the other apps suffer from the same issue since they can't open the 0byte photo or video until there is a remount/reboot.

With regards to Open Camera, this has the option to Use Storage Access Framework, which I think I had to enable for it to select the SDCard for storage (otherwise I think it returned a “serious error” when a few seconds into recording). I suspect something similar is happening on this app, but perhaps not consistently. As mentioned before, the first time I noticed a problem was after it had recorded a video (which was fine) and the next one I recorded was 0 bytes. The fact that it recorded without complaining, in retrospect, suggests to me that it was only reporting 0 bytes for the file (and if I’d remounted the card I would have the video OK) – since it’d have to been writing the data somewhere.

So it may be that the issue isn't writing to the SDCard, but correctly reading the data afterwards without remounting the SDCard (or reboot).

I've noticed there is a new version of MIUI 10 released yesterday, so may pick that up to see if it magically solves things (nothing mentioned on change log).

Questions:

Anyone else experienced anything similar? Ans: Apparently yes, it is a "feature", aren't we lucky.

Am I missing some special setting? Ans: No.

Any thoughts on what the issue could be or if there is a fix? Ans: It can be fixed using root magisk.

Are your mount points similar/different? Ans: Guessing not and isn't related to the problem.

Did you do a factory reset after update (one possibility is that whatever made it work in MIUI 9 remained for most people if they didn't factory reset)? Ans: Not the cause of the problem.

Thanks

meltwater.