WindSekirun / NaraeImagePicker

MultiImagePicker for Android Application, written in Kotlin
Apache License 2.0
40 stars 14 forks source link

Android Pie hidden files issue #25

Open deepakkumardk opened 4 years ago

deepakkumardk commented 4 years ago

Image Picker also showing all the hidden files and it's child folders images in the folder list & all images list in case of Android 9.0 (Pie), which shouldn't be the intended behavior. But this case wasn't in there for Oreo.

WindSekirun commented 4 years ago

Currently, we use MediaStore api to retrieve media files and Android hides hidden images (actually, directory contains .nomedia file) in their MediaStorr api.

This problem can be solve by 'filtering directory which contains '.nomedia' file, but i think that issues doesn't occur in all of android pie device. (Maybe we can make options to filter nomedia file..)

deepakkumardk commented 4 years ago

What about the child of '.nomedia' file like this tree: .noMedia -> Myfiles

or a complex tree like this. In this case Myfiles is also being filtered in the folder list.

WindSekirun commented 4 years ago

In this stackchange, https://android.stackexchange.com/questions/187280/is-it-possible-to-have-a-media-folder-inside-a-nomedia-folder , .nomedia hides sub directories also. (Currently, i'm traveling without computer. Just mobile device)

deepakkumardk commented 4 years ago

I am not talking about just .nomedia file, what about manually created files with dot(.) extension like '.MyFiles' and it's child folders.

WindSekirun commented 4 years ago

Since .nomedia hides subdirectory also, we can apply same rule for Directory startsWith '.' .

  1. Query all folders from MediaStore
  2. If options.ignoreHiddenFiles is true, Filter directory which startsWith '.'
  3. Query listFiles() about each folders
  4. Filter directory which contains '.nomedia'
  5. Query all media files in filtered directories from MediaStore
  6. ...

For complex tree, There's no sufficient solution to solve it. Maybe user can have nested 60 directories in one hidden folders...

deepakkumardk commented 4 years ago

Ya, I have already filtered the '.hiddenfiles', but I am stuck with the complex tree.

WindSekirun commented 4 years ago

@deepakkumardk

I have an S10+ (G975N) with Android 10, and I've been doing some tests on my way back from travel.

Given that the software is beta software, the Gallery app and NaraeImagePicker guaranteed the same behavior.

The Complex tree seems to be irrelevant in that problem.

Case 1. Complex tree with .hideFolder

structure

sopme
 - .hides
   - somes
    - .hidefolder
      - test.jpg
    - test.jpg
   - test.jpg
 - test.jpg

Test Result

  1. Gallery (which samsung one) show 'sompe' folders only. Non-hiding folders will ignore when that folders inside of hiding folders.
  2. NaraeImagePicker show 'sompe' folders only.

Case 2. Complex tree with .nomedia

structure

2w
 - somes
  - .hidefolder
    - test.jpg
  - test.jpg
 - test.jpg
 - .nomedia

Test Result

  1. Gallery doesn't shows our 2w folders.
  2. NaraeImagePicker also doesn't show 2w folders.
WindSekirun commented 4 years ago

Also, nested folders are shown as their own rows, so it's easy to see if the folder name starts with a dot.

deepakkumardk commented 4 years ago

@WindSekirun, Actually this bug is everywhere I have checked WhatsApp, Telegram both were showing the hidden folders/Images as separate folders as in the folder view. Also I have look into the other ImagePicker library like Matisse, MediaPickerLib both were behaving the same for hidden file.

So, it's better to blame that it's a bug for OS of Android I am using or other way :-). Even that it's good to have to support for ignoreHiddenFiles

WindSekirun commented 4 years ago

@deepakkumardk At the discretion, we will proceed with Won't fix. If you still need to implement ignoreHiddenFiles, there is a need for further discussion.

deepakkumardk commented 4 years ago

As I mentioned it's good to have support for ignoreHiddenFiles as no one wants to show/see their hidden files when they are uploading pictures or accessing them from other galleries. And also it's a small but an effective change from the perspective of UX and for privacy too. So, I think we should go for the fix.