Merge pull request #15163 from lihanchen/AndroidTVUSBCamera

Fix problem with camera on Android TV
This commit is contained in:
Andrew Harp 2017-12-13 16:34:33 -05:00 committed by GitHub
commit 18c864cdae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -333,8 +333,12 @@ public abstract class CameraActivity extends Activity
continue;
}
useCamera2API = isHardwareLevelSupported(characteristics,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL);
// Fallback to camera1 API for internal cameras that don't have full support.
// This should help with legacy situations where using the camera2 API causes
// distorted or otherwise broken previews.
useCamera2API = (facing == CameraCharacteristics.LENS_FACING_EXTERNAL)
|| isHardwareLevelSupported(characteristics,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL);
LOGGER.i("Camera API lv2?: %s", useCamera2API);
return cameraId;
}