New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing "Default Write Disk" causes secondary storage setup to fail #312

Closed
bgiesing opened this Issue Feb 29, 2016 · 44 comments

Comments

4 participants
@bgiesing

bgiesing commented Feb 29, 2016

So I'm having a issue with my BLU Energy X Plus and the internal storage.

This device has a default write disk setting in Settings and (as far as I can tell) it makes the sd card visible to apps as internal and vice versa.
2016 feb 29 11-44-07

So my internal is shown as sdcard1 and when I go to grant access to it, it just says Invalid Input as it's expecting it to be an SD card while its actually internal. 
screenshot_2016-02-28-23-56-29
screenshot_2016-02-28-23-56-22

Device information

BLU Energy X Plus running Android 5.0.2 with a Mediatek processor.
SD Card is a 16 GB SanDisk Ultra Plus
Internal Storage is 8GB with about 1GB remaining.

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

Sadly none of my device have this option :(.
Currently i would need a debug run log to proceed.

Try to get into advanced settings and trigger one, maybe it will contain enough information.

@bgiesing

This comment has been minimized.

bgiesing commented Mar 2, 2016

@d4rken So I finally got the debug run file to make and cleared data to get a fresh run but now it's working with no issue. So I'm no longer having issues so I can't send a debug run to fix it if others do.

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

😕 Can you still do and attach a debug run of Overview loading and you selecting and giving sdcard permission?
I'd like to see how the config looks with this setup, maybe I spot something weird.

@bgiesing

This comment has been minimized.

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

Thanks for the log.
The issue should still exist.
SD Maid was not able to map the permission to the internal (now external) storage.

1456948302457 I/SDM:StorageManager: SDCARD | /storage/sdcard1 | -1 | [EXTSD] | null
1456948302457 I/SDM:StorageManager: SDCARD | /storage/sdcard0 | 0 | [PRIMARY] | content://com.android.externalstorage.documents/tree/3238-3231%3A/document/3238-3231%3A

It basically comes down to #231. I currently have no solution for this. An idea would be to try create files on different storages and then find those files to create the mapping, but I'm not yet ready to start on this.

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

In the above log the primary sdcard (actual external one) has a UriPermission, though it shouldn't need one, while the secondary storage (actual internal storage), has no UriPermission but should theoretically need one.

If you go into advanced settings and remove the uri permissions, can you still write to /storage/sdcard0 (external storage made internal) WITHOUT root?

Also can you write to /storage/sdcard1 without root? Because this doesn't seem to be a stock Android feature I'm unsure how this affects the sdcard permission restrictions.

Normally the default storage can be accessed by normal app permissions, while the external sdcards requires an UriPermission because access only works through androids storage framework (or root).

@bgiesing

This comment has been minimized.

bgiesing commented Mar 2, 2016

Well when I first posted on G+ (aka when I took the screenshots), I didn't have root and couldn't do anything. I am now rooted and that's when I did the log.

I'll temp unroot and try again.

(And this is the stock rom. Pretty messed up that what comes stock has this much issues.)

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

Ah well then it works because SD Maid has root. You don't need to unroot, denying SD Maid root is enough. What's messed up is Androids storage system in regards to external sdcards...

@bgiesing

This comment has been minimized.

bgiesing commented Mar 2, 2016

Well it doesn't take long to unroot anyway. Here's a new log without root.

sdmaid_logfile_1456953746160.log.txt

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

Ok, now go into advanced permissions, long press any permission listed under "Uri permission" until it's empty. Then try to create a new folder on each sdcard and do another log of that.

I expect it to work for the primary one and fail for the secondary card (actual internal one).

@bgiesing

This comment has been minimized.

bgiesing commented Mar 2, 2016

This was without root and I removed the permissions. Both folders were made successfully...

sdmaid_logfile_1456954794801.log.txt

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 2, 2016

If you switch the cards again such that the setup is normal, does it still work this way?
Then I would say your ROM has changed the permissions setup such that normal storage access permission also grant external storage access permission (like pre Android 4.3).
Only try it if it's not much trouble, only curiosity.

@bgiesing

This comment has been minimized.

bgiesing commented Mar 2, 2016

Yep as long as the SD card is even in the device it acts this way (no matter what the default write disk is set to)

@bgiesing

This comment has been minimized.

bgiesing commented Mar 2, 2016

And its happening with any app using the storage framework (so FX File Manager, SD Maid, Gmail, etc.). Apps that do work don't use the API (like RAR by WinRar, the stock File Manager, stock email client, etc.)

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 10, 2016

The initial granting of access via the SAF Api fails because the swapped internal storage has no UUID by which SD Maid can find it. A solution for that would also be a solution for #231

StorageVolumeX: uuid: 3238-3231 | state: mounted | path: /storage/sdcard0 | userlabel: M-^IPNG^M^J^Z^J
StorageVolumeX: uuid: null | state: mounted | path: /storage/sdcard1 | userlabel: null
StorageVolumeX: uuid: null | state: removed | path: /storage/usbotg | userlabel: null

But by your description it would not be necessary though?
So the issue is that SD Maid tries to use the storage framework, which fails, while if it would use normal file access (as <4.3) it would work?

Do you know any other devices with the same behavior? No one sells "BLU" devices in germany 😲

@bgiesing

This comment has been minimized.

bgiesing commented Mar 10, 2016

@d4rken yeah seems like that's the case

I don't but BLU devices are on Amazon for around $100 USD if they would import it.

Otherwise, BLU phones are a part of thing where multiple manufacturers buy the parts together and sell the same basic device to get price down. One of these other brands that sells the same phones as BLU is Gionee. (I haven't found a match for my specific Energy X Plus but the popular Studio Energy is the same as the Gionee Marathon M4.)

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 10, 2016

So currently the only issue is the setup screen as described in the original post?
You tested folder creation, does deletion, copy/move also work?

@bgiesing

This comment has been minimized.

bgiesing commented Mar 10, 2016

@d4rken Yep and Yep

@d4rken d4rken added the duplicate label Mar 10, 2016

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 10, 2016

Alright, I'm closing this with reference to #231 as it's the same fix for both.
If you find out anything new just add it. Thanks for detailed infos 👍

@d4rken

This comment has been minimized.

Owner

d4rken commented Mar 17, 2016

Let's treat this like an enhancement, as even without #231 I might be able to check for this.
Still need a test device though ...

@d4rken d4rken reopened this Mar 17, 2016

@bgiesing

This comment has been minimized.

bgiesing commented Mar 17, 2016

Well if there's anything I can do to help, I will try.

@d4rken d4rken removed the duplicate label Mar 29, 2016

@d4rken d4rken changed the title from Doesn't work with Default Write Disk on BLU devices to Changing "Default Write Disk" causes secondary storage setup to fail Apr 5, 2016

@d4rken d4rken added the bug label Apr 5, 2016

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 5, 2016

Different device, same issue:

Fingerprint: alps/full_n325bh/n325bh:5.1/LMY47D/1451268436:user/test-keys

sdmaid_logfile_1459859685120.zip

1459859786532 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard1, userHandle=-1, flags=[SECONDARY], safUri=null)
1459859786533 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard0, userHandle=0, flags=[PRIMARY], safUri=content://com.android.externalstorage.documents/tree/082A-8020%3A/document/082A-8020%3A)
1459859786248 D/SDM:StorageVolumeMapper: Updating mappings.
1459859786250 D/SDM:StorageVolumeMapper: Trying to map: UriPermission {uri=content://com.android.externalstorage.documents/tree/082A-8020%3A, modeFlags=3, persistedTime=1459859673397}
1459859786260 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=082A-8020,state=mounted,path=/storage/sdcard0,userlabel=null)
1459859786261 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=mounted,path=/storage/sdcard1,userlabel=null)
1459859786261 W/SDM:StorageVolumeMapper: Missing UUID for /storage/sdcard1
1459859786261 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=removed,path=/storage/usbotg,userlabel=null)
1459859786262 D/SDM:StorageVolumeMapper: Mapped VolumeRoot(treeUri=/tree/082A-8020:, rootId=082A-8020, title=primary, documentId=082A-8020:, storagePath=/storage/sdcard0) to UriPermission {uri=content://com.android.externalstorage.documents/tree/082A-8020%3A, modeFlags=3, persistedTime=1459859673397}
@bgiesing

This comment has been minimized.

bgiesing commented Apr 5, 2016

Another MediaTek device (UMI Rome). Maybe it's a MediaTek thing?

On Tue, Apr 5, 2016, 8:01 AM Matthias Urhahn notifications@github.com
wrote:

Different device, same issue:

Fingerprint: alps/full_n325bh/n325bh:5.1/LMY47D/1451268436:user/test-keys

sdmaid_logfile_1459859685120.zip
https://github.com/d4rken/sdmaid-public/files/204490/sdmaid_logfile_1459859685120.zip

1459859786532 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard1, userHandle=-1, flags=[SECONDARY], safUri=null)
1459859786533 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard0, userHandle=0, flags=[PRIMARY], safUri=content://com.android.externalstorage.documents/tree/082A-8020%3A/document/082A-8020%3A)

1459859786248 D/SDM:StorageVolumeMapper: Updating mappings.
1459859786250 D/SDM:StorageVolumeMapper: Trying to map: UriPermission {uri=content://com.android.externalstorage.documents/tree/082A-8020%3A, modeFlags=3, persistedTime=1459859673397}
1459859786260 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=082A-8020,state=mounted,path=/storage/sdcard0,userlabel=null)
1459859786261 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=mounted,path=/storage/sdcard1,userlabel=null)
1459859786261 W/SDM:StorageVolumeMapper: Missing UUID for /storage/sdcard1
1459859786261 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=removed,path=/storage/usbotg,userlabel=null)
1459859786262 D/SDM:StorageVolumeMapper: Mapped VolumeRoot(treeUri=/tree/082A-8020:, rootId=082A-8020, title=primary, documentId=082A-8020:, storagePath=/storage/sdcard0) to UriPermission {uri=content://com.android.externalstorage.documents/tree/082A-8020%3A, modeFlags=3, persistedTime=1459859673397}


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#312 (comment)

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 5, 2016

Possibly, though I doubt only MediaTek devices have the option to switch "Default write disk", or do they?

@bgiesing

This comment has been minimized.

bgiesing commented Apr 5, 2016

@d4rken I think it's a MediaTek only thing (they have a lot of those also including scheduled shut off/on)

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 6, 2016

Fingerprint: acer/T03_pa_ca/acer_t03:5.1/LMY47D/1450197656:user/release-keys

sdmaid_logfile_1459962610653.zip

@bgiesing Also a mediatek device?

@bgiesing

This comment has been minimized.

bgiesing commented Apr 6, 2016

@d4rken Yep, it's the Acer Liquid Z630 and has a Mediatek MT6735

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 7, 2016

Fingerprint: Micromax/AQ5001/AQ5001:5.0/LRX21M/1421661359:user/release-keys

1460059126294 D/SDM:StorageManager: Found 23 mounts.
1460059126296 D/SDM:StorageManager: Mountpoint:/storage/sdcard1 | BlockDevice:/dev/fuse | FileSystemType:FUSE | Options:[nodev, group_id=1023, relatime, rw, nosuid, default_permissions, allow_other, user_id=1023]
1460059126300 D/SDM:StorageManager: Mountpoint:/mnt/cd-rom | BlockDevice:/dev/block/loop0 | FileSystemType:UNKNOWN | Options:[ro, relatime]
1460059126301 D/SDM:StorageManager: Mountpoint:/mnt/obb | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, gid=1000, mode=755]
1460059126303 D/SDM:StorageManager: Mountpoint:/mnt/secure/asec | BlockDevice:/dev/block/vold/179:129 | FileSystemType:VFAT | Options:[nosuid, dirsync, shortname=mixed, gid=1023, allow_utime=0020, dmask=0007, utf8, nodev, relatime, rw, iocharset=iso8859-1, errors=remount-ro, codepage=437, noexec, fmask=0007, uid=1023]
1460059126305 D/SDM:StorageManager: Mountpoint:/mnt/asec | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, gid=1000, mode=755]
1460059126306 D/SDM:StorageManager: Mountpoint:/sys/fs/selinux | BlockDevice:selinuxfs | FileSystemType:UNKNOWN | Options:[relatime, rw]
1460059126306 D/SDM:StorageManager: Mountpoint:/storage/sdcard0 | BlockDevice:/dev/fuse | FileSystemType:FUSE | Options:[nodev, group_id=1023, relatime, rw, nosuid, default_permissions, allow_other, user_id=1023]
1460059126308 D/SDM:StorageManager: Mountpoint:/mnt/media_rw/sdcard0 | BlockDevice:/dev/block/vold/179:129 | FileSystemType:VFAT | Options:[nosuid, dirsync, shortname=mixed, gid=1023, allow_utime=0020, dmask=0007, utf8, nodev, relatime, rw, iocharset=iso8859-1, errors=remount-ro, codepage=437, noexec, fmask=0007, uid=1023]
1460059126308 D/SDM:StorageManager: Mountpoint:/ | BlockDevice:rootfs | FileSystemType:ROOTFS | Options:[seclabel, ro, relatime]
1460059126327 D/SDM:StorageManager: Mountpoint:/system | BlockDevice:/emmc@android | FileSystemType:EXT4 | Options:[data=ordered, seclabel, ro, relatime]
1460059126329 D/SDM:StorageManager: Mountpoint:/sys | BlockDevice:sysfs | FileSystemType:SYSFS | Options:[seclabel, relatime, rw]
1460059126330 D/SDM:StorageManager: Mountpoint:/dev/pts | BlockDevice:devpts | FileSystemType:DEVPTS | Options:[seclabel, relatime, rw, mode=600]
1460059126330 D/SDM:StorageManager: Mountpoint:/cache | BlockDevice:/emmc@cache | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, noatime, nosuid, noauto_da_alloc, discard]
1460059126332 D/SDM:StorageManager: Mountpoint:/sys/kernel/debug | BlockDevice:debugfs | FileSystemType:DEBUGFS | Options:[relatime, rw]
1460059126333 D/SDM:StorageManager: Mountpoint:/dev/cpuctl | BlockDevice:none | FileSystemType:CGROUP | Options:[relatime, rw, cpu]
1460059126336 D/SDM:StorageManager: Mountpoint:/protect_f | BlockDevice:/emmc@protect_f | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, nodelalloc, noatime, nosuid, noauto_da_alloc, commit=1]
1460059126337 D/SDM:StorageManager: Mountpoint:/acct | BlockDevice:none | FileSystemType:CGROUP | Options:[cpuacct, relatime, rw]
1460059126338 D/SDM:StorageManager: Mountpoint:/proc | BlockDevice:proc | FileSystemType:PROC | Options:[relatime, rw]
1460059126338 D/SDM:StorageManager: Mountpoint:/dev/usb-ffs/adb | BlockDevice:adb | FileSystemType:UNKNOWN | Options:[relatime, rw]
1460059126343 D/SDM:StorageManager: Mountpoint:/data | BlockDevice:/dev/block/dm-0 | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, noatime, nosuid, noauto_da_alloc, discard]
1460059126347 D/SDM:StorageManager: Mountpoint:/sys/fs/cgroup | BlockDevice:none | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, gid=1000, mode=750]
1460059126348 D/SDM:StorageManager: Mountpoint:/dev | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, nosuid, mode=755]
1460059126349 D/SDM:StorageManager: Mountpoint:/protect_s | BlockDevice:/emmc@protect_s | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, nodelalloc, noatime, nosuid, noauto_da_alloc, commit=1]
1460059131747 D/SDM:StorageVolumeMapper: Updating mappings.
1460059131752 D/SDM:StorageVolumeMapper: Trying to map: UriPermission {uri=content://com.android.externalstorage.documents/tree/primary%3A, modeFlags=3, persistedTime=1460059131747}
1460059131754 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=6B1C-0F09,state=mounted,path=/storage/sdcard0,userlabel=M->M-0M-:-M-nM-^JM- 2M-^AjM-^H)
1460059131755 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=mounted,path=/storage/sdcard1,userlabel=null)
1460059131756 W/SDM:StorageVolumeMapper: Missing UUID for /storage/sdcard1
1460059131756 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=removed,path=/storage/usbotg,userlabel=null)
1460059131759 W/SDM:StorageVolumeMapper: Failed to build VolumeRoot via StorageVolume.
1460059131763 D/SDM:StorageVolumeMapper: Trying to map: UriPermission {uri=content://com.android.externalstorage.documents/tree/6B1C-0F09%3A, modeFlags=3, persistedTime=1460034329969}
1460059131766 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=6B1C-0F09,state=mounted,path=/storage/sdcard0,userlabel=M->M-0M-:-M-nM-^JM- 2M-^AjM-^H)
1460059131768 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=mounted,path=/storage/sdcard1,userlabel=null)
1460059131768 W/SDM:StorageVolumeMapper: Missing UUID for /storage/sdcard1
1460059131769 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null,state=removed,path=/storage/usbotg,userlabel=null)
1460059131770 D/SDM:StorageVolumeMapper: Mapped VolumeRoot(treeUri=/tree/6B1C-0F09:, rootId=6B1C-0F09, title=SD-карта, documentId=6B1C-0F09:, storagePath=/storage/sdcard0) to UriPermission {uri=content://com.android.externalstorage.documents/tree/6B1C-0F09%3A, modeFlags=3, persistedTime=1460034329969}
1460059131791 E/SDM:UriAccessFragment: Invalid uri permission for Storage(location=SDCARD, path=/storage/sdcard1, userHandle=-1, flags=[SECONDARY], safUri=null), releasing: content://com.android.externalstorage.documents/tree/primary%3A
1460059126661 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard0, userHandle=0, flags=[PRIMARY], safUri=content://com.android.externalstorage.documents/tree/6B1C-0F09%3A/document/6B1C-0F09%3A)
1460059126662 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard1, userHandle=-1, flags=[SECONDARY], safUri=null)

@d4rken d4rken removed the help wanted label Apr 7, 2016

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 7, 2016

So I think we established the common theme, it's all MediaTek devices.
Sucks that I don't have access to such a device.

The key to the solution would be somehow detecting that this "default write disk" change has taken place, because then I could artifically give the previously primary storage, now secondary storage, a UUID.

@bgiesing

This comment has been minimized.

bgiesing commented Apr 8, 2016

Well and considering most MediaTek devices don't have custom ROMs/Root, even if you find one it might be hard to test and those few that have ROMs/Root are usually super buggy universal ports (most custom MediaTek ROMs are made for a specific MediaTek chip and then people use the zip file replace porting method).

The few exceptions are mostly devices shipped with Cyanogen and Android One.

@d4rken Maybe there's some way of having the user set the default to internal, launch the app and gather stats, tell them to switch to external SD or OTG, gather stats again, and then do something with that?

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 8, 2016

I need a real device so I can check some system values through the debugger, i might be able to solve it this through reflection then.

@bgiesing Care to help me find the cheapest rootable MediaTek device on these sites 😁 ?

http://www.tinydeal.com/de/cell-phones-c-54.html
http://www.banggood.com/de/Wholesale-Smartphones-c-1567.html

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 13, 2016

@bgiesing Tried to send you a mail with a test version. Got an mail delivery error. If you have time to provide me with a logfile use SD Maid v4.1.6+ to record a debug run log of the setup.

@siminhu

This comment has been minimized.

siminhu commented Apr 14, 2016

PLS find my logs:

sdmaid_logfiles.zip

Elphone P8000 MTK6753 64bit Octa Core, 1.3GHz, Android 5.1, RAM + ROM: 3GB RAM + 16GB ROM

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 14, 2016

@siminhu Those are taken with SD Maid v4.1.4. Need logs from 4.1.6 I added some extra logoutput for this issue.

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 14, 2016

@siminhu
I don't know why only one storage entry is visible, but it's nothing I can fix, the content of that window is supplied by the system.

The logfile did not have the info I need, record another log, while it is recording, go Advanced Settings-StorageAccess, then add just select any storage and add it, this should trigger the storage setup part i need to see in the log.

@siminhu

This comment has been minimized.

siminhu commented Apr 14, 2016

Elphone P8000 MTK6753 64bit Octa Core, 1.3GHz, Android 5.1, RAM + ROM: 3GB RAM + 16GB ROM

sdmaid_logfile_1460624142160.zip

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 14, 2016

@siminhu Thanks, the log is correct but due to the special circumstances on your device it does not bring me closer to a solution to this ticket. For some some reason your system does not recognize the internal storage after being swapped, your logs confirm that.

1460624164619 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=C257-80E6, state=mounted, path=/storage/sdcard0, primary=true, emulated=false, owner=null, userlabel=null)
1460624164619 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null, state=removed, path=/storage/usbotg, primary=false, emulated=false, owner=null, userlabel=null)

The newer version tell me the state of the "emulated" flag per storage, I'm hoping that it will still say "true" for the previously internal storage. Will have to wait for logs from another device.

(I have cleaned up the comments a bit, in case you were wondering.)

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 22, 2016

Case with newer logging from v4.1.6:

alps/full_n325b/n325b:5.1/LMY47D/1456381072:user/test-keys

Mounts

1461304908513 D/SDM:StorageManager: Found 26 mounts.
1461304908513 D/SDM:StorageManager: Mountpoint:/protect_s | BlockDevice:/dev/block/platform/mtk-msdc.0/by-name/protect2 | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, nodelalloc, noatime, nosuid, noauto_da_alloc, commit=1]
1461304908514 D/SDM:StorageManager: Mountpoint:/storage/sdcard0 | BlockDevice:/dev/fuse | FileSystemType:FUSE | Options:[nodev, group_id=1023, relatime, rw, nosuid, default_permissions, allow_other, user_id=1023, noexec]
1461304908514 D/SDM:StorageManager: Mountpoint:/sys/kernel/debug | BlockDevice:debugfs | FileSystemType:DEBUGFS | Options:[seclabel, relatime, rw]
1461304908514 D/SDM:StorageManager: Mountpoint:/mnt/cd-rom | BlockDevice:/dev/block/loop0 | FileSystemType:UNKNOWN | Options:[ro, relatime]
1461304908514 D/SDM:StorageManager: Mountpoint:/system | BlockDevice:/dev/block/platform/mtk-msdc.0/by-name/system | FileSystemType:EXT4 | Options:[data=ordered, seclabel, ro, relatime]
1461304908515 D/SDM:StorageManager: Mountpoint:/mnt/asec | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, gid=1000, mode=755]
1461304908515 D/SDM:StorageManager: Mountpoint:/sys/fs/selinux | BlockDevice:selinuxfs | FileSystemType:UNKNOWN | Options:[relatime, rw]
1461304908515 D/SDM:StorageManager: Mountpoint:/mnt/media_rw/sdcard0 | BlockDevice:/dev/block/vold/179:129 | FileSystemType:VFAT | Options:[nosuid, dirsync, shortname=mixed, gid=1023, allow_utime=0020, dmask=0007, utf8, nodev, relatime, rw, iocharset=iso8859-1, errors=remount-ro, codepage=437, noexec, fmask=0007, uid=1023]
1461304908515 D/SDM:StorageManager: Mountpoint:/mnt/media_rw | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, uid=1000, gid=1000, mode=755]
1461304908515 D/SDM:StorageManager: Mountpoint:/ | BlockDevice:rootfs | FileSystemType:ROOTFS | Options:[seclabel, ro]
1461304908515 D/SDM:StorageManager: Mountpoint:/nvdata | BlockDevice:/dev/block/platform/mtk-msdc.0/by-name/nvdata | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, noatime, nosuid, noauto_da_alloc, discard]
1461304908516 D/SDM:StorageManager: Mountpoint:/storage/usbotg | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, uid=1000, gid=1000, mode=755]
1461304908516 D/SDM:StorageManager: Mountpoint:/proc | BlockDevice:proc | FileSystemType:PROC | Options:[relatime, rw]
1461304908516 D/SDM:StorageManager: Mountpoint:/dev/usb-ffs/adb | BlockDevice:adb | FileSystemType:UNKNOWN | Options:[relatime, rw]
1461304908516 D/SDM:StorageManager: Mountpoint:/dev | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, nosuid, mode=755]
1461304908516 D/SDM:StorageManager: Mountpoint:/mnt/obb | BlockDevice:tmpfs | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, gid=1000, mode=755]
1461304908517 D/SDM:StorageManager: Mountpoint:/mnt/secure/asec | BlockDevice:/dev/block/vold/179:129 | FileSystemType:VFAT | Options:[nosuid, dirsync, shortname=mixed, gid=1023, allow_utime=0020, dmask=0007, utf8, nodev, relatime, rw, iocharset=iso8859-1, errors=remount-ro, codepage=437, noexec, fmask=0007, uid=1023]
1461304908517 D/SDM:StorageManager: Mountpoint:/sys | BlockDevice:sysfs | FileSystemType:SYSFS | Options:[seclabel, relatime, rw]
1461304908517 D/SDM:StorageManager: Mountpoint:/dev/pts | BlockDevice:devpts | FileSystemType:DEVPTS | Options:[seclabel, relatime, rw, mode=600]
1461304908518 D/SDM:StorageManager: Mountpoint:/protect_f | BlockDevice:/dev/block/platform/mtk-msdc.0/by-name/protect1 | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, nodelalloc, noatime, nosuid, noauto_da_alloc, commit=1]
1461304908518 D/SDM:StorageManager: Mountpoint:/dev/cpuctl | BlockDevice:none | FileSystemType:CGROUP | Options:[relatime, rw, cpu]
1461304908518 D/SDM:StorageManager: Mountpoint:/data | BlockDevice:/dev/block/platform/mtk-msdc.0/by-name/userdata | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, noatime, nosuid, resuid=10010, noauto_da_alloc, discard]
1461304908518 D/SDM:StorageManager: Mountpoint:/acct | BlockDevice:none | FileSystemType:CGROUP | Options:[cpuacct, relatime, rw]
1461304908519 D/SDM:StorageManager: Mountpoint:/cache | BlockDevice:/dev/block/platform/mtk-msdc.0/by-name/cache | FileSystemType:EXT4 | Options:[data=ordered, nodev, seclabel, rw, noatime, nosuid, noauto_da_alloc, discard]
1461304908519 D/SDM:StorageManager: Mountpoint:/sys/fs/cgroup | BlockDevice:none | FileSystemType:TMPFS | Options:[seclabel, relatime, rw, gid=1000, mode=750]
1461304908519 D/SDM:StorageManager: Mountpoint:/storage/sdcard1 | BlockDevice:/dev/fuse | FileSystemType:FUSE | Options:[nodev, group_id=1023, relatime, rw, nosuid, default_permissions, allow_other, user_id=1023, noexec

Storages

1461304908904 I/SDM:StorageManager: Storage(location=DALVIK_DEX, path=/data/dalvik-cache/arm, userHandle=-1, flags=[], safUri=null)
1461304908904 I/SDM:StorageManager: Storage(location=DALVIK_DEX, path=/data/dalvik-cache/arm64, userHandle=-1, flags=[], safUri=null)
1461304908904 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard1, userHandle=-1, flags=[SECONDARY], safUri=null)
1461304908904 I/SDM:StorageManager: Storage(location=SDCARD, path=/storage/sdcard0, userHandle=0, flags=[PRIMARY], safUri=null)
1461304908905 I/SDM:StorageManager: Storage(location=PUBLIC_DATA, path=/storage/sdcard1/Android/data, userHandle=-1, flags=[SECONDARY], safUri=null)
1461304908905 I/SDM:StorageManager: Storage(location=PUBLIC_DATA, path=/storage/sdcard0/Android/data, userHandle=0, flags=[PRIMARY], safUri=null)
1461304908905 I/SDM:StorageManager: Storage(location=PUBLIC_OBB, path=/storage/sdcard0/Android/obb, userHandle=0, flags=[PRIMARY], safUri=null)
1461304908906 I/SDM:StorageManager: Storage(location=PUBLIC_OBB, path=/storage/sdcard1/Android/obb, userHandle=-1, flags=[SECONDARY], safUri=null)
1461304908906 I/SDM:StorageManager: Storage(location=APP_APP, path=/data/app, userHandle=-1, flags=[PRIMARY], safUri=null)
1461304908906 I/SDM:StorageManager: Storage(location=APP_APP_PRIVATE, path=/data/app-private, userHandle=-1, flags=[], safUri=null)
1461304908906 I/SDM:StorageManager: Storage(location=DOWNLOAD_CACHE, path=/cache, userHandle=-1, flags=[], safUri=null)
1461304908906 I/SDM:StorageManager: Storage(location=SYSTEM_APP, path=/system/app, userHandle=-1, flags=[], safUri=null)
1461304908907 I/SDM:StorageManager: Storage(location=DALVIK_PROFILE, path=/data/dalvik-cache/profiles, userHandle=-1, flags=[], safUri=null)
1461304908907 I/SDM:StorageManager: Storage(location=PUBLIC_MEDIA, path=/storage/sdcard1/Android/media, userHandle=-1, flags=[SECONDARY], safUri=null)
1461304908907 I/SDM:StorageManager: Storage(location=PUBLIC_MEDIA, path=/storage/sdcard0/Android/media, userHandle=0, flags=[PRIMARY], safUri=null)
1461304908908 I/SDM:StorageManager: Storage(location=SYSTEM, path=/system, userHandle=-1, flags=[], safUri=null)
1461304908908 I/SDM:StorageManager: Storage(location=DATA, path=/data, userHandle=-1, flags=[PRIMARY], safUri=null)
1461304908908 I/SDM:StorageManager: Storage(location=APP_LIB, path=/data/app-lib, userHandle=-1, flags=[], safUri=null)
1461304908908 I/SDM:StorageManager: Storage(location=PRIVATE_DATA, path=/data/user/0, userHandle=0, flags=[PRIMARY], safUri=null)
1461304908909 I/SDM:StorageManager: Storage(location=APP_ASEC, path=/data/app-asec, userHandle=-1, flags=[], safUri=null)
1461304908909 I/SDM:StorageManager: Storage(location=SYSTEM_PRIV_APP, path=/system/priv-app, userHandle=-1, flags=[], safUri=null)

Mapping attempt:

1461304917180 D/SDM:StorageVolumeMapper: Updating mappings.
1461304917183 D/SDM:StorageVolumeMapper: Trying to map: UriPermission {uri=content://com.android.externalstorage.documents/tree/primary%3A, modeFlags=3, persistedTime=1461304917179}
1461304917184 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=62A7-16FD, state=mounted, path=/storage/sdcard0, primary=true, emulated=false, owner=null, userlabel=null)
1461304917185 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null, state=mounted, path=/storage/sdcard1, primary=false, emulated=true, owner=UserHandle{0}, userlabel=null)
1461304917185 W/SDM:StorageVolumeMapper: Missing UUID for /storage/sdcard1
1461304917186 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null, state=removed, path=/storage/usbotg, primary=false, emulated=false, owner=null, userlabel=null)
1461304917187 W/SDM:StorageVolumeMapper: Failed to build VolumeRoot via StorageVolume.
@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 22, 2016

New logging shows that the swapped internal storage is still recognized as emulated and interestingly enough still has an owner. Although this is another WTF moment, we could actually use that to detect this and apply a workaround.

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 25, 2016

Got workaround ready, looking for someone to test it, mail me 😄 ?

@bgiesing

This comment has been minimized.

bgiesing commented Apr 25, 2016

Well since I reported it, you can send it my way! Email is
me@brandongiesing.com

On Sun, Apr 24, 2016 at 8:24 PM Matthias Urhahn notifications@github.com
wrote:

Got workaround ready, looking for someone to test it, mail me [image:
😄] ?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#312 (comment)

@d4rken

This comment has been minimized.

Owner

d4rken commented Apr 25, 2016

Workaround seems to work.

BIG2/i-mobile IQ BIG2/IQ BIG2:5.0.2/LRX22G/1431945074:user/release-keys

1461551414630 D/SDM:StorageVolumeMapper: Updating mappings.
1461551414712 D/SDM:StorageVolumeMapper: Trying to map: UriPermission {uri=content://com.android.externalstorage.documents/tree/primary%3A, modeFlags=3, persistedTime=1461551414629}
1461551414723 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=8A67-8AF2, state=mounted, path=/storage/sdcard0, primary=true, emulated=false, owner=null, userlabel=null)
1461551414725 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null, state=mounted, path=/storage/sdcard1, primary=false, emulated=true, owner=UserHandle{0}, userlabel=null)
1461551414729 W/SDM:StorageVolumeMapper: MediaTek device (issue #312), faking UUID: /storage/sdcard1
1461551414730 D/SDM:StorageVolumeMapper: StorageVolumeX: StorageVolumeX(uuid=null, state=removed, path=/storage/usbotg, primary=false, emulated=false, owner=null, userlabel=null)
1461551414735 D/SDM:StorageVolumeMapper: Mapped VolumeRoot(treeUri=/tree/primary:, rootId=primary, title=Phone storage, documentId=primary:, storagePath=/storage/sdcard1) to UriPermission {uri=content://com.android.externalstorage.documents/tree/primary%3A, modeFlags=3, persistedTime=1461551414629}
1461551414778 I/SDM:UriAccessFragment: SAF access granted for Storage(location=SDCARD, path=/storage/sdcard1, userHandle=-1, flags=[SECONDARY], safUri=content://com.android.externalstorage.documents/tree/primary%3A)
@GoogleAndroidUserHajimeFujimoto

This comment has been minimized.

GoogleAndroidUserHajimeFujimoto commented Sep 9, 2017

いかにすればSDメイド2017年4.7.7バージョンにアップデートできるか 今のところこのデバイスではAndroid7.1.1であります 可能であります

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment