d4rken-org / sdmaid-se

SD Maid 2/SE is Android's most thorough cleaning tool.
https://play.google.com/store/apps/details?id=eu.darken.sdmse
GNU General Public License v3.0
2.51k stars 387 forks source link

AndroidTV: permission issue for debugging SDMaid-SE #908

Open MarkyMarkDE opened 7 months ago

MarkyMarkDE commented 7 months ago

When I will try to make a debug log, SDMaid SE shows follow

PXL_20240106_185750484

But this is wrong. SDMaid SE has not the permission to create any folders and files in /Android/data/ so we need here (AndroidTV) maybe a different path or I unfortunately can' t provide any debug logs. I'm not able grant the permission to access this path.

AndroidTV waipu.tv 4k Stick waipu_v11.7.6022 Android 11 sdmaid-se0.18.2beta0-foss

PXL_20240103_202137936

I know, AndroidTV isn't officially supported right now, but if possible it should work as well.

BTW: my filemanager+ stores it's data in /Android/media/com.alphainventor.filemanager/* maybe media is the right one too for SDMaid SE like /Android/media/eu.darken.sdmse/*

d4rken commented 7 months ago

Apps should be able to write in their own folder without extra permissions.

Does SD Maid fail to share it if you press "Teilen"?

Switching to media/ might be interesting though because it would allow other file managers to access that path though. :thinking:

MarkyMarkDE commented 7 months ago

Apps should be able to write in their own folder without extra permissions.

Does SD Maid fail to share it if you press "Teilen"?

Switching to media/ might be interesting though because it would allow other file managers to access that path though. 🤔

first of all: welcome back, hope you are doing well :wink:.

Yes, indeed media/ would be the best thing, I mean, then you don't have permission problems in any time. I fear that the restrictions in common will become even stricter in the future, and we will have to come up with solutions for that.

No it does simply not work, you "mean" that you create the log, but it doesn't. What should I "Share"? Nothing? The log doesn't exist but SD-Maid SE says that the log was successfully created, but that's wrong.

Yes, I did really get no access to the default path, no way for data/ and when I write the path in complete /Android/data/eu.darken.sdmse/ my file manager says that there is nothing found (folder don't exist). But you can also test with Dateimanager (best ever!) and the paid version, then you get also the "+" Version on Android TV. media/ would be the only possible path, other Apps (incl. Dateimanager+) use this also for their own stuff.

d4rken commented 7 months ago

Other filemanagers are NOT able to access the file, this is expected on newer Android versions.

The "Share" button for the log, inside SD Maid, should still work though!

Screenshot from 2024-01-25 12-01-19

Moving it to media means we can't clear it via system in case of storage issues or bugs. data/<pkg>/cache is covered by the system cache mechanism, while media/<pkg>/cache is not, :thinking: .

d4rken commented 2 months ago

I've further looked into this and SD Maid definitely writes the files correctly on Android TV:

emulator_x86_arm:/sdcard $ find Android/data                                                                                                                                                       
Android/data
Android/data/com.google.android.gms
Android/data/com.google.android.gms/files
Android/data/com.android.vending
Android/data/com.android.vending/files
Android/data/eu.darken.sdmse
Android/data/eu.darken.sdmse/cache
Android/data/eu.darken.sdmse/cache/debug
Android/data/eu.darken.sdmse/cache/debug/logs
Android/data/eu.darken.sdmse/cache/debug/logs/eu.darken.sdmse_logfile_1718712779847.log
Android/data/eu.darken.sdmse/cache/debug/logs/eu.darken.sdmse_logfile_1718712779847.zip
Android/data/eu.darken.sdmse/cache/debug/logs/eu.darken.sdmse_logfile_1718712867552.log
Android/data/eu.darken.sdmse/cache/debug/logs/eu.darken.sdmse_logfile_1718712867552.zip
Android/data/eu.darken.sdmse/files

The path does not really matter though if the share dialog works, as SD Maid will grant access to the path to the application that handles the share intent.

Android/data is not browsable for other apps, e.g. FileManagers without Root or ADB permission. This is not unique to Android TV though.

The issue comes down to needing an app that can handle ACTION_SEND with attachments, on Android TV, not sure this is an SD Maid problem :thinking: