From 151570d4082c338fd2f10c68fac23ea77ed8f561 Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Thu, 20 Feb 2020 16:19:55 +0000 Subject: [PATCH] Bug 1610939 - Remove unnecessary camera permissions check from VideoCaptureDeviceInfoAndroid; r=esawin This removes an unnecessary permissions check that is left over from the previous version of this code. If Camera2Enumerator is supported by the device, it can enumerate devices without the camera permission. If Camera1Enumerator is used, it will attempt to open the camera and fail, returning a default value. My local device uses Camera2Enumerator and the emulator uses Camera1Enumerator. I tested both code paths manually and enumeration is working as expected. I think enough devices support the newer camera API that it is not worth the trouble of reporting a dummy camera for devices that hit the Camera1Enumerator code path without having previously granted the camera permission. Differential Revision: https://phabricator.services.mozilla.com/D63492 --HG-- extra : moz-landing-system : lando --- .../videoengine/VideoCaptureDeviceInfoAndroid.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java b/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java index ca99f2098102..950e6e0c91c6 100644 --- a/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java +++ b/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java @@ -37,17 +37,11 @@ public class VideoCaptureDeviceInfoAndroid { @WebRTCJNITarget private static CaptureCapabilityAndroid[] getDeviceInfo() { final Context context = GeckoAppShell.getApplicationContext(); - final boolean hasPermissions = Permissions.has( - context, Manifest.permission.CAMERA); - if (hasPermissions) { - if (Camera2Enumerator.isSupported(context)) { - return createDeviceList(new Camera2Enumerator(context)); - } else { - return createDeviceList(new Camera1Enumerator()); - } + if (Camera2Enumerator.isSupported(context)) { + return createDeviceList(new Camera2Enumerator(context)); } else { - return new CaptureCapabilityAndroid[0]; + return createDeviceList(new Camera1Enumerator()); } }