NaraeImagePicker icon indicating copy to clipboard operation
NaraeImagePicker copied to clipboard

Android Pie hidden files issue

Open deepakkumardk opened this issue 5 years ago • 11 comments

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.

deepakkumardk avatar Nov 08 '19 07:11 deepakkumardk

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..)

WindSekirun avatar Nov 08 '19 13:11 WindSekirun

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.

deepakkumardk avatar Nov 08 '19 13:11 deepakkumardk

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)

WindSekirun avatar Nov 08 '19 13:11 WindSekirun

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

deepakkumardk avatar Nov 08 '19 18:11 deepakkumardk

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...

WindSekirun avatar Nov 08 '19 22:11 WindSekirun

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

deepakkumardk avatar Nov 09 '19 03:11 deepakkumardk

@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 avatar Nov 09 '19 06:11 WindSekirun

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

WindSekirun avatar Nov 09 '19 06:11 WindSekirun

@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

deepakkumardk avatar Nov 17 '19 16:11 deepakkumardk

@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.

WindSekirun avatar Nov 18 '19 06:11 WindSekirun

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.

deepakkumardk avatar Nov 18 '19 06:11 deepakkumardk