Closed Bug 1489972 Opened 1 year ago Closed 1 year ago
An error is displayed if we deny and allow the permissions for camera
Environment: Device: Nokia 6(Android 7.1.1); Build: Nightly 64.0a1 (2018-09-09); Steps to reproduce: 1. Go to https://webrtc.github.io/samples/src/content/getusermedia/gum/; 2. Tap on "Open camera"; 3. From doorhanger, tap on "Deny"; 4. Tap again on "Open camera" and choose "Allow". Expected result: A video is displayed with my built-in camera active showing the content. Actual result: An error is displayed. Notes: - not reproducible on Google Pixel (Android 9), LG G4(Android 6.0.1); - not reproducible with audio only; - reloading the page has the same actual result. - Video: https://drive.google.com/open?id=0B_kDj8vLfC8IbHhEcXVaT05mX3oxZERGbU1zVThVbC1uS0w0
Summary: An error is displayed if we deny than allow the permissions for camera → An error is displayed if we deny and allow the permissions for camera
Possibly related - https://bugzilla.mozilla.org/show_bug.cgi?id=1507531
Let's investigate, since these two bugs may be related, it would be good to know if there's a deeper camera permissions issue.
Assignee: nobody → petru.lingurar
Status: NEW → ASSIGNED
The issue is happening because although the app has the `CAMERA` permission, when it tries to iterate over the available cameras to get their characteristics `Camera.open()` fails >E/WEBRTC-JC: Failed to open Camera 0, Facing back, Orientation 90, skipping due to: Fail to connect to camera service and so, with no available cameras the whole process fails.  https://searchfox.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java#110
Tested this more with Sorina (couldn't reproduce on our devices) and I see in logs > I/CameraService: Camera 0: Access for "org.mozilla.fennec_aurora" has been restricted This  happens when trying  to open the camera . This could only happen if app's uId or package name has been explicitly restricted. Interestingly enough, doing the same restrictions check, right above `Camera.open(i)` , > AppOpsManager#checkOp(AppOpsManager.OPSTR_CAMERA, Process.myUid(), getPackageName()) returns `AppOpsManager#MODE_ALLOWED` and then immediately after, Camera.open() says we are restricted.  https://android.googlesource.com/platform/frameworks/av/+/oreo-mr1-release/services/camera/libcameraservice/CameraService.cpp#2204  https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-mr1-release/core/java/android/app/AppOpsManager.java#L1903  https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-mr1-release/services/core/java/com/android/server/AppOpsService.java#L1150  https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-mr1-release/services/core/java/com/android/server/AppOpsService.java#L1376  https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-mr1-release/services/core/java/com/android/server/AppOpsService.java#L2588  https://searchfox.org/mozilla-central/rev/2edebf41a2b2e624859bf15ed5a98bdd002f73b4/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java#110
Tried to use camera2 APIs but the issue still exists. Since I cannot reproduce this locally on the devices I have I have asked Sorina to borrow me the Nokia 6 device to base my testing on.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.