Skip to content
Snippets Groups Projects
Commit f8ed2f8b authored by Paul Adenot's avatar Paul Adenot
Browse files

Bug 1380795 - On Android, always put the front camera first in the list, as...

Bug 1380795 - On Android, always put the front camera first in the list, as it's more likely to be what users want by default. r=pehrsons,dminor

Differential Revision: https://phabricator.services.mozilla.com/D90380
parent b53748cd
No related branches found
No related tags found
No related merge requests found
......@@ -200,6 +200,17 @@ void DeviceInfoAndroid::DeInitialize() {
int32_t DeviceInfoAndroid::Refresh() {
if (!g_camera_info || g_camera_info->size() == 0) {
DeviceInfoAndroid::BuildDeviceList();
#ifdef DEBUG
int frontFacingIndex = -1;
for (uint32_t i = 0; i < g_camera_info->size(); i++) {
if (g_camera_info->at(i).front_facing) {
frontFacingIndex = i;
}
}
// Either there is a front-facing camera, and it's first in the list, or
// there is no front-facing camera.
MOZ_ASSERT(frontFacingIndex == 0 || frontFacingIndex == -1);
#endif
}
return 0;
}
......
......@@ -88,7 +88,11 @@ public class VideoCaptureDeviceInfoAndroid {
i++;
}
device.frontFacing = enumerator.isFrontFacing(camera);
allDevices.add(device);
if (device.frontFacing) {
allDevices.add(0, device);
} else {
allDevices.add(device);
}
}
return allDevices.toArray(new CaptureCapabilityAndroid[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment