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
This commit is contained in:
Dan Minor 2020-02-20 16:19:55 +00:00
Родитель bcfc221e2a
Коммит 151570d408
1 изменённых файлов: 3 добавлений и 9 удалений

Просмотреть файл

@ -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());
}
}