Skip to content
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

Allow android/data access even without root #611

Closed
CodeCracker-oss opened this issue Oct 29, 2021 · 49 comments
Closed

Allow android/data access even without root #611

CodeCracker-oss opened this issue Oct 29, 2021 · 49 comments
Assignees
Labels
duplicate This issue or pull request already exists question Further information is requested
Milestone

Comments

@CodeCracker-oss
Copy link

Hello,

when I was messing with my new pixel 6 prior to rooting it, I realized MaterialFiles (unlike Amaze File Manager), doesn't have access to Apps External Storage, located (on pixel's at least): /storage/emulated/0/Android/data

this now either requires root, or to trigger it via SAF which would prompt a system dialog used to select that folder, to give MaterialFiles access to it, no root needed. It's the method amaze file manager uses.

Would you be open to implement SAF, to address this issue for non-root users?

@zhanghai
Copy link
Owner

Another duplicate - Please use Add storage -> External storage.

@zhanghai zhanghai self-assigned this Oct 29, 2021
@zhanghai zhanghai added duplicate This issue or pull request already exists question Further information is requested labels Oct 29, 2021
@CodeCracker-oss
Copy link
Author

@zhanghai

That has never worked for me. Once DocumentsProvider appears, browsing into Android folder, only shows 1 folder named media, with a message above saying Can't use this folder.

I was referring to using SAF to directly grant it access to Android/data, no need of manually going into different section of the app, even if above did work.

I've already seen an issue thread mentioning Add Storage -> External storage method.

@tp0
Copy link

tp0 commented Nov 1, 2021

That has never worked for me. Once DocumentsProvider appears, browsing into Android folder, only shows 1 folder named media, with a message above saying Can't use this folder.

Works for me. Only Android/media folder is visible, but I can select the parent Android folder.

@Hk-178
Copy link

Hk-178 commented Dec 10, 2021

How to acces SAF?. Pls help

That has never worked for me. Once DocumentsProvider appears, browsing into Android folder, only shows 1 folder named media, with a message above saying Can't use this folder.

Works for me. Only Android/media folder is visible, but I can select the parent Android folder.

@zhanghai
Copy link
Owner

How to acces SAF?. Pls help

That has never worked for me. Once DocumentsProvider appears, browsing into Android folder, only shows 1 folder named media, with a message above saying Can't use this folder.

Works for me. Only Android/media folder is visible, but I can select the parent Android folder.

Hamburger menu > Add storage > External storage > Navigate to Android folder and grant access.

@Hk-178
Copy link

Hk-178 commented Dec 10, 2021

How to acces SAF?. Pls help

That has never worked for me. Once DocumentsProvider appears, browsing into Android folder, only shows 1 folder named media, with a message above saying Can't use this folder.

Works for me. Only Android/media folder is visible, but I can select the parent Android folder.

Hamburger menu > Add storage > External storage > Navigate to Android folder and grant access.

A million thanks ❤️‍🔥

@widmannt
Copy link

widmannt commented Feb 2, 2022

How to acces SAF?. Pls help

That has never worked for me. Once DocumentsProvider appears, browsing into Android folder, only shows 1 folder named media, with a message above saying Can't use this folder.

Works for me. Only Android/media folder is visible, but I can select the parent Android folder.

Hamburger menu > Add storage > External storage > Navigate to Android folder and grant access.

Unfortunately, this doesn't work for me in Android 12. I can't grant access to the Android folder (and the data subfolder isn't shown either). Please see the screenshot below. The message is saying something along the lines of "This folder can't be used. In order to protect your data, please select another folder."

screenshot

@Hk-178
Copy link

Hk-178 commented Feb 2, 2022

You can use the folder "Android'
On the sidebar, when u open Android folder after giving access , inside it there will be the data sub folder.

@widmannt
Copy link

widmannt commented Feb 3, 2022

You can use the folder "Android' On the sidebar, when u open Android folder after giving access , inside it there will be the data sub folder.

I can't give access to the Android folder. It doesn't let me, the button at the bottom of the screen is grayed out.

If someone knows of another workaround, please let me know. However it seems that the method of using 'Add storage' -> 'External storage' doesn't work in Android 12 because of new security/privacy restrictions. Neither Android nor Android/data can be accessed this way on my device.

As @dhammel pointed out, Amaze file manager can access Android/data in Android 12 using the SAF, I tested on my device as well. Apparently they call the SAF directly to request access to the Android/data subfolder. Android seems to be forbidden, and Android/data is hidden in DocumentsProvider, but the user can grant access when the app directly asks for the subfolder.

(Additionally I noticed that Amaze file manager needs 'Special app access' -> 'Access to all files'. Maybe this is required to make it work in Android 12?)

I'd appreciate if @zhanghai could verify my findings and maybe reopen the issue if appropriate. Also I'm happy to provide more information and test things out if that would help in any way.

@zhanghai
Copy link
Owner

zhanghai commented Feb 5, 2022

Oh, so Amaze is already directly asking the folder. I'll do the same then.

@zhanghai zhanghai added this to the v1.4.0 milestone Feb 5, 2022
@zhanghai
Copy link
Owner

zhanghai commented Feb 5, 2022

Added into the codebase and will be available in the next release. Note that there are other issues to resolve in order to release a new version, including #384, so it will not come very quickly.

data

@Hk-178
Copy link

Hk-178 commented Feb 5, 2022

https://drive.google.com/file/d/1hFjDjUsJ6rjCv4tqyhUIthBEkVFagQTV/view?usp=drivesdk
Take a look at this vid. I added /android/data folder to the side bar and i can open it and access the data

@zhanghai
Copy link
Owner

zhanghai commented Feb 6, 2022

It is known that some version of DocumentsUI allows adding sdcard/Android, some later version disallowed it, and then some later version allowed all directories (when the app targets a lower SDK version) again. I'm adding this to help people who are having an unfortunate version of DocumentsUI.

@widmannt
Copy link

widmannt commented Feb 6, 2022

That's great news! Thank you for your awesome work!

@unilock
Copy link

unilock commented May 8, 2022

Doesn't seem to be working on Android 13 Beta 1. When trying to open /storage/emulated/0/Android/data, instead of opening DUI, Material Files simply gives a "permission denied" error.

Screenshot_20220508-101230

@zhanghai
Copy link
Owner

zhanghai commented May 8, 2022

@unilock You are opening the directory directly in your screenshot, which is expected to not work. You need to use "Add storage" in navigation drawer, and then select "Android/data".

Note that even this is expected to stop working on a future Android version or security update.

@unilock
Copy link

unilock commented May 9, 2022

@zhanghai Doing so opens DUI at /sdcard, and navigating to /sdcard/Android shows only media, as expected.

@zhanghai
Copy link
Owner

zhanghai commented May 9, 2022

Then you've got the security fix and there's no good way around it. You can still use DUI to manage those files though.

@VivekThummar52
Copy link

Add Storage ➝ /Android/data worked for me,

Now i can see all the nested folders inside data folder, Thank You @zhanghai !!

@ghost
Copy link

ghost commented Jul 2, 2022

Why can't I just grant access to the folders android/data and android/obb when I try to access them on android 11 Lineage OS for microg like other file explorers? Using add external storage option and navigating to android/data and android/obb and granting access works fine for internal storage but not SD card. Why is this the case? Hope I'm not a bother and thanks for all your hard work.

@Manu99it
Copy link

Manu99it commented Aug 27, 2022

FV file explorer manager (that with blue icon on Play store) implemented an awesome trick for Android 13: select the app before and then it request the subfolder access. It's annoying that you need to do it for every app, but without root seems the only possibility for now. If you could implement it, would be awesome

@zhanghai zhanghai reopened this Aug 27, 2022
@zhanghai
Copy link
Owner

The subdirectory hack is a known issue and has been reported, so it will be fixed in the future. I'm tired of playing such a cat & mouse game so if you want to access Android/data, please just use the built-in DocumentsUI for that.

@Manu99it
Copy link

The subdirectory hack is a known issue and has been reported, so it will be fixed in the future. I'm tired of playing such a cat & mouse game so if you want to access Android/data, please just use the built-in DocumentsUI for that.

I can understand. Documents UI however is just horrible for serious file management

@FastenM
Copy link

FastenM commented Sep 4, 2022

@zhanghai Ohh, I didn't know you could open DUI directly. Thanks! (For those wondering, I used Activity Launcher to create a shortcut on my home screen to com.android.documentsui.files.FilesActivity.)

Adding this shortcut doesn't launch the android data path for me but rather the download folder.

@DerGoogler
Copy link

If you above Android 13 there is no way to access Android/data or Android/obb. Is has a reason why the folders are restricted.

The only possible way is root.

@CodeCracker-oss
Copy link
Author

@DerGoogler There is a way to do it via SAF, developer of Material Files just hasn't implemented it. Amaze File Manager works well for this case. Tested on my Pixel 6 Android 13, January 2023 security update

You can access it via adb as well, if you don't have or want root.

@locuturus
Copy link

@zhanghai Ohh, I didn't know you could open DUI directly. Thanks! (For those wondering, I used Activity Launcher to create a shortcut on my home screen to com.android.documentsui.files.FilesActivity.)

Adding this shortcut doesn't launch the android data path for me but rather the download folder.

You can create shortcuts that open DUI directly to any folder you want. But it's a bit of a manual process because no app developer has come along to make it easy.

One app you can use is Shortcut Maker, by Rushikesh Kamewar, from the Play Store. Other apps that let you build an android intent will also work.

Screenshot_20230411-085840

The above will open the folder containing downloaded podcasts for AntennaPod (assuming it exists).

The key takeaways are you are sending an action.VIEW intent, and the filepath is in the Data section. It expects a URI format and externalstorage is the document provider. %3A is like / for root of sdcard, and %2F is like / for every folder after sdcard. Mime type makes sure DUI sees the intent and the flags I chose are important to create a fresh window every time you use the shortcut. If you didn't know it already DUI can have many many windows and if you don't create a fresh one the last one you interacted with might grab the intent but not follow the path you gave it. The package name and class are optional. They skip the open-with dialogue. Otherwise some apps, like Material Files, will offer to open this kind of intent but they always fail.

@locuturus
Copy link

The subdirectory hack is a known issue and has been reported, so it will be fixed in the future. I'm tired of playing such a cat & mouse game so if you want to access Android/data, please just use the built-in DocumentsUI for that.

I can understand. Documents UI however is just horrible for serious file management

I wonder if I can help in any way? I find DUI to be pretty good for 80% of file manager tasks I do. What are you wanting to do with it? There are non-obvious tricks and methods sometimes. But for sure it lacks some seemingly basic stuff.

@unOmni
Copy link

unOmni commented Nov 29, 2023

Need some help. I had android/data working when i used external storage and then it directed it me straight to data. But now that i reset my phone, i can't get it to work anymore. Zarchive redirects me to data and obb by itself when i tried just now but nothing here.

@Manu99it
Copy link

Manu99it commented Nov 30, 2023

Need some help. I had android/data working when i used external storage and then it directed it me straight to data. But now that i reset my phone, i can't get it to work anymore. Zarchive redirects me to data and obb by itself when i tried just now but nothing here.

Simply on Android 14 the method used before doesn't work anymore. If you updated from Android 13 to 14 then the app retain the permission to folders you previously permitted. If you install the app ex-novo, reset it, or you want to access a folder into android/data that you never permitted to, for now seems you can't. You can still access android/data with a PC or through ADB, or with the default file manager although lacking many features

@unOmni
Copy link

unOmni commented Nov 30, 2023

Need some help. I had android/data working when i used external storage and then it directed it me straight to data. But now that i reset my phone, i can't get it to work anymore. Zarchive redirects me to data and obb by itself when i tried just now but nothing here.

Simply on Android 14 the method used before doesn't work anymore. If you updated from Android 13 to 14 then the app retain the permission to folders you previously permitted. If you install the app ex-novo, reset it, or you want to access a folder into android/data that you never permitted to, for now seems you can't. You can still access android/data with a PC or through ADB, or with the default file manager although lacking many features

Forgot to say that I'm on Android 12 still.

@Manu99it
Copy link

Manu99it commented Nov 30, 2023

@unOmni then you can try MiXplorer, Solid Explorer, Xplore, they should be able to access android/data

Edit: I must correct myself because I found the solution. Simply uninstall the updates of the default Files app. Doing so the functionality is restored even in Android 14!

@unOmni
Copy link

unOmni commented Nov 30, 2023

@unOmni then you can try MiXplorer, Solid Explorer, Xplore, they should be able to access android/data

Edit: I must correct myself because I found the solution. Simply uninstall the updates of the default Files app. Doing so the functionality is restored even in Android 14!

I tried that before just some hours ago but nothing worked. It's actually the reason a reset my phone just so I don't have to see the default Files app that appeared after removing it's updates.

@Manu99it
Copy link

@unOmni then you can try MiXplorer, Solid Explorer, Xplore, they should be able to access android/data
Edit: I must correct myself because I found the solution. Simply uninstall the updates of the default Files app. Doing so the functionality is restored even in Android 14!

I tried that before just some hours ago but nothing worked. It's actually the reason a reset my phone just so I don't have to see the default Files app that appeared after removing it's updates.

So, just to be sure:

  1. You've uninstalled any update of "File" app by going to Settings->Apps->All Apps->File->3 dot menu->Uninstall Updates

  2. you used Solid Explorer/MiXplorer/Xplore to access android/data subfolders

  3. you got no results?

@unOmni
Copy link

unOmni commented Nov 30, 2023

@unOmni then you can try MiXplorer, Solid Explorer, Xplore, they should be able to access android/data
Edit: I must correct myself because I found the solution. Simply uninstall the updates of the default Files app. Doing so the functionality is restored even in Android 14!

I tried that before just some hours ago but nothing worked. It's actually the reason a reset my phone just so I don't have to see the default Files app that appeared after removing it's updates.

So, just to be sure:

  1. You've uninstalled any update of "File" app by going to Settings->Apps->All Apps->File->3 dot menu->Uninstall Updates
  2. you used Solid Explorer/MiXplorer/Xplore to access android/data subfolders
  3. you got no results?
  1. Yes
  2. I have just installed and started using Mixplorer, and it's working.

@Manu99it
Copy link

  1. Yes
  2. I have just installed and started using Mixplorer, and it's working.

Perfect! Unfortunately the Material Files dev hasn't implemented the workaround so you need to keep using MiXplorer. In case you want a more pleasant theme for MiXplorer I suggest you this: https://github.com/DerTyp7214/MixplorerThemeCreator

Or this one: https://github.com/jamal2362/MiX-Monet-Generator

@unOmni
Copy link

unOmni commented Nov 30, 2023

  1. Yes
  2. I have just installed and started using Mixplorer, and it's working.

Perfect! Unfortunately the Material Files dev hasn't implemented the workaround so you need to keep using MiXplorer. In case you want a more pleasant theme for MiXplorer I suggest you this: https://github.com/DerTyp7214/MixplorerThemeCreator

Or this one: https://github.com/jamal2362/MiX-Monet-Generator

Alright. I'll stick with MX for now.

@td-gamer-alt
Copy link

If the material files Devs listening right now then I have a way to do this Using Shizuki the root replacement

@7heMech
Copy link

7heMech commented Aug 17, 2024

Zarchiver also let's you use shizuku root mode would that be possible here?

@fvydjt
Copy link

fvydjt commented Sep 3, 2024

I have discovered an another method to view files and subfolders under Android/data directly within the MaterialFiles app. Here are the steps:

  1. Download MT Manager, which can access Android/data through various methods, such as Shizuku authorization.

  2. Start a local FTP server, a free and built-in function within MT Manager.

  3. Add this FTP server to MaterialFiles, and you can then view Android/data within MaterialFiles.


P.S.

I've noticed that some people, like @DerGoogler, aren't fans of MT Manager, possibly due to its reputation.

I don't particularly like MT Manager either, but it's the easiest way to achieve this.

As an alternative, you can use other apps that can access Android/data and start a local server simultaneously, such as Termux. The server must support at least one of the following protocols: FTP, SFTP, or WebDAV.

Other less recommended but possible solutions include running MT Manager in a virtual machine like VMOS or using a cracked version of MT Manager (Telegram: @SlxshMods, @Modder_Hub, @Unpack_Dex).

@DerGoogler
Copy link

DerGoogler commented Sep 3, 2024

  1. MT Manager

Biggest red-flag

@majiancy
Copy link

majiancy commented Nov 6, 2024

TCL的SmartTV里连DocumentsUI都没有,怎么搞?现在Material Files只能看到系统目录,无法增加外部存储;adb shell可以看到/sdcard ,但无法cp任何文件,也无法chmod。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests