Android Camera2 example of judging whether the camera function is controllable
Android Camera2 adjustable function adaptation
First get the equipment level:
Float hardwareLevel = mCameracharacteristics.get(Cameracharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
LEGACY < LIMITED < FULL < LEVEL_ 3. The more on the right, the greater the authority
•INFO_ SUPPORTED_ HARDWARE_ LEVEL_ LEGACY = 2 •INFO_ SUPPORTED_ HARDWARE_ LEVEL_ LIMITED = 0 •INFO_ SUPPORTED_ HARDWARE_ LEVEL_ FULL = 1 •INFO_ SUPPORTED_ HARDWARE_ LEVEL_ 3 = 3
There will be functions supported under the corresponding level, and legacy is the minimum permission
In Limited
android.request.availableCapabilities
Introduction: list of capabilities that this camera device advertisements as fully supporting
int[] ints = mCameracharacteristics.get(Cameracharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
Possible values:
•BACKWARD_ COMPATIBLE •MANUAL_ SENSOR •MANUAL_ POST_ PROCESSING •RAW •PRIVATE_ REPROCESSING •READ_ SENSOR_ SETTINGS •BURST_ CAPTURE •YUV_ REPROCESSING •DEPTH_ OUTPUT •CONSTRAINED_ HIGH_ SPEED_ VIDEO
Examples of characteristic values corresponding to these values:
final String name3 = CaptureRequest.SENSOR_ FRAME_ DURATION.getName(); name3 -》android.sensor.frameDuration
Listing this means that if you want to know whether the device supports this function, you can get its package name through getname(), and then
mCameracharacteristics.getAvailableCaptureRequestKeys(); Find in the generated queue.
If there is a match, it is controllable;
CaptureRequest.LENS_ FOCUS_ DISTANCE; Adjust focus capturerequest.control_ AF_ MODE; Autofocus mode capturerequest.sensor_ Sensitivity adjustment ISO capturerequest.control_ AE_ Mode auto exposure mode
The above example of Android Camera2 judging whether the camera function is controllable is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.