-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[Android] StorageProvider Fixes #19523
Conversation
@ksooo Makes sense. The fallback is to parse "/proc/mounts", so whatever it takes ;) |
@koying The call to getStorageVolumes is always throwing an exception. |
The real question is: Why does StorageManager.getStorageVolumes throw an exception? The answer most probably is the key for the actual fix. |
If you attach a log showing the exception, I might maybe point you in the right direction... |
Should I see the exception in logcat? |
Mmm... Not currently. The exception is just eaten away. You might add a
ExceptionClear() )
I think that will write the exception description to logcat ;) |
|
Yeah, |
Thanks, @koying
Which means that this code never worked since xbmc/libandroidjni@ee5cc10#diff-532e8e365b57f7770256c95b1c9f1e1d07d171295158dd4fa29b85e09ccbe889 Interesting. :-/ |
Very likely not. My original code was based on an unofficial API, iirc. |
@koying the libandroidjni fixes you suggested are here: xbmc/libandroidjni#22 |
…pport for SMB mounts.
…l signature for StorageManager.getStorageVolumes.
14d9ca4
to
90452f1
Compare
Time for a small reminder: https://developer.android.com/distribute/best-practices/develop/target-sdk |
Let's hope that a new Android maintainer arises soon, otherwise you could write as many reminders as you like or none at all, with the same result. |
@ksooo Do not ban from forums those who can and helped ;) BTW You merged way too fast getStorageVolumes is API 24 minimum (https://developer.android.com/reference/android/os/storage/StorageManager#getStorageVolumes()) , Kodi is api 21 minimum, this will crash on Android 5 5.1 and 6. |
Shouldn't crash. It will trap and fallback, as it was doing before... |
Don't know how it's called externally but the code previously checked if the function was present before call, now it blindly calls. (https://github.com/xbmc/libandroidjni/pull/22/files) Should have a version check here or at call site with doc on API limitation. Furthermore it probably now remove the function that worked on those API levels (assuming it was not broken for other reasons) |
No panic. Thanks for pointing this out. No idea whether it actually would crash, but it is absolutely no problem to add an API check before calling. I will add this. |
@koying could you please take a look at xbmc/libandroidjni#23 ? |
Fixes: #19023 #19307
DISCLAIMER: I’m not an Android dev, and it might be not the best fix or even nonsense, but for me it definitely fixes the problem of SMB shares mounted on the NVidia Shield TV at system level not appearing in the list of removable drives of Kodi.DISCLAIMER: I’m not an Android dev, but with the help of @koying I was able to track down and fix the problems
Some details I found out while debugging:
CAndroidStorageProvider::GetRemovableDrives
CJNIStorageManager::getStorageVolumes
eventually calls JavaStorageManager.getStorageVolumes
./proc/mounts
.First commit fixes the fallback to support SMB mounts.
Second commit fixes the non working primary code path, fixing both SMB mounts not appearing and volume labels.
I runtime-tested the changes on my Shields, with both SMB mounts and USB sticks.
@koying by any chance, if you are around, does this fix make any sense to you?