mozilla-mobile / fenix

⚠️ Fenix (Firefox for Android) moved to a new repository. It is now developed and maintained as part of: https://github.com/mozilla-mobile/firefox-android
https://github.com/mozilla-mobile/firefox-android
Mozilla Public License 2.0
6.47k stars 1.28k forks source link

Fenix asks for camera permissions just to make me upload files on some websites #27646

Closed Palloxin closed 1 year ago

Palloxin commented 1 year ago

Steps to reproduce

https://user-images.githubusercontent.com/75091899/199284887-4691fc17-b9fc-4bfa-a8ac-e31dd2771442.mp4

Expected behaviour

should not ask camera permissions, and just open the archive of my files since fenix has the storage permission

Actual behaviour

fenix asks camera permission to upload file despite it having already storage permissions

Device name

Huawei p8 lite 2017

Android version

Android 8 Miui 8

Firefox release type

Firefox Nightly

Firefox version

106.1.0

Device logs

No response

Additional information

No response

┆Issue is synchronized with this Jira Task

Mugurell commented 1 year ago

Thank you for the report! Can you please post the exact URL and complete steps for reproducing? Does the issue happens on other browsers also?

Palloxin commented 1 year ago

-https://yandex.com/images then follow the steps in the video, the touch of the finger is visible. -i don't know, this has been happening for a long time. i reported just because a was very tired of it. since i know about this issue for a long time i doubt this happens on other android browsers

Mugurell commented 1 year ago

Thank you for the details! Seems like the website does allow searching by image by tapping on this button

image

The image used for searching can be an existing one from the available storage or a new one taken from camera.

Testing on Chrome I see that the camera permission is asked only when the user chooses the camera as the image source:

https://user-images.githubusercontent.com/11428869/199288780-e6ae9067-e687-4ff0-b460-ec2625e9e202.mp4

Palloxin commented 1 year ago

i see, but i would like fenix to allow me to upload the image/files without asking for camera permission. there is no other way to do so without giving the permission of the camera (if there is, please show me)

Mugurell commented 1 year ago

Agree that we should try to avoid asking for the camera permission beforehand and only ask for this permission when it is actually needed, similar to how the website behaves on Chrome.

DreVla commented 1 year ago

I have investigated this bug and traced the problem all the way to the FilePicker in feature-prompts package in Android Components. The issue seems to be that when asked to handle a file request, the picker iterates through all of the MimeTypes and checks if there are any permissions required in order to display multiple choices in the chooser. It should ask for these permissions only if the user selects certain option from chooser (camera for example). Here is one solution I have tried but with no avail: https://stackoverflow.com/questions/44822840/request-permission-after-selected-optioneither-camera-or-gallery-from-intent-c

Some alternatives would be to implement a similar screen like chrome and some other browser do or use a different picker, similar to how duck duck go does it.

Chrome example (custom screen with possibility to take a picture with camera, browse more pictures or quickly select from most recent photos):

https://user-images.githubusercontent.com/32488956/200833508-40fe73fa-b6d9-4b33-b7ab-6a6af5a9802e.mp4

Duck Duck Go example, no permission required, going straight into android file picker, having recent images:

https://user-images.githubusercontent.com/32488956/200834363-c0a2da94-72da-4947-afc6-9899f694512a.mp4

Palloxin commented 1 year ago

implementing a similar screen to chrome will do, i guess

cpeterso commented 1 year ago

Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1813429

Change performed by the Move to Bugzilla add-on.