Well, how can I check if an android device has Camera2 api features implemented or not? There are many new features in camera2 api such as manual controls. So how can I know
Camera API2
The Camera API2 framework exposes lower-level camera control to the app, including efficient zero-copy burst/streaming flows and per-frame controls of exposure, gain, white balance gains, color conversion, denoising, sharpening, and more. For details, watch the Google I/O video overview.
Android 5.0 and later includes Camera API2; however, devices running Android 5.0 and later may not support all Camera API2 features. The android.info.supportedHardwareLevel property that apps can query through the Camera API2 interfaces reports one of the following support levels:
LEGACY: These devices expose capabilities to apps through the Camera API2 interfaces that are approximately the same capabilities as those exposed to apps through the Camera API1 interfaces. The legacy frameworks code conceptually translates Camera API2 calls into Camera API1 calls; legacy devices do not support Camera API2 features such as per-frame controls.
LIMITED: These devices support some Camera API2 capabilities (but not all) and must use Camera HAL 3.2 or later.
FULL: These devices support all of major capabilities of Camera API2 and must use Camera HAL 3.2 or later and Android 5.0 or later.
LEVEL_3: These devices support YUV reprocessing and RAW image capture, along with additional output stream configurations.
EXTERNAL: These devices are similar to LIMITED devices with some exceptions; for example, some sensor or lens information may not be reported or have less stable frame rates. This level is used for external cameras such as USB webcams.
This What is Camera2 API? Check if your Smartphone supports it may help you to find it out!
Actually, checking for API version 21+ will work. The camera2 API, including CameraManager
is part of the system, not dependent on the hardware present. So you can always ask the CameraManager
for a list of CameraDevice
s, which you can then query individually.
However, I think what you actually mean is "how can I tell if I can set photographic parameters manually using the camera2 API?", which is dependent on the device you have. It depends on what control you need, but the information you need can be gleaned by getting the REQUEST_AVAILABLE_CAPABILITIES
metadata field. Hint: look for MANUAL_SENSOR
.
Install the app: Manual Camera Compatibility. It checks for Manual Focus, WB, ISO, Shutter speed and RAW support. All exposed via the camera2 HAL driver. I've installed the above in the AT&T store to check phones before buying. A great way to know if you're buying yesterday's model.
https://play.google.com/store/apps/details?id=pl.vipek.camera2_compatibility_test&hl=en
Install the App A Better Camera. You'll be able tout check if it is full, legacy, limited or mot supporter. That's how I found Samsung galaxy Tab 3 SMT820 iscamera2 api full.
Indeed, the camera2 api is only supported from API level 21. But only this check is not enough. There are devices with API level 21, but that support the camera 2 only partially. To check this, you should check the value of CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL. It can be FULL, LEGACY or LIMITED. Check here for details: https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html
Here is how to get it:
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
for (String cameraId : manager.getCameraIdList()) {
CameraCharacteristics characteristics
= manager.getCameraCharacteristics(cameraId);
Log.d("Img", "INFO_SUPPORTED_HARDWARE_LEVEL " + characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL));
}
I also needed this for another project, so I wrote a small app that probes all camera2 features and shows which ones are available on the phone: https://play.google.com/store/apps/details?id=de.weis.camera2probe
You can email this report in-app. I list all reports that I received here: https://github.com/TobiasWeis/android-camera2probe/wiki (The code of the app is also available there, in case someone needs to integrate into their own project)