Android: Check whether camera supports auto-focus?

android, autofocus, camera

Solution

List<String> supportedFocusModes = camera.getParameters().getSupportedFocusModes();
boolean hasAutoFocus = supportedFocusModes != null && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)

Problem

For the Android API version 2.1 and higher, we can use context: ``` getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS) ``` But before version 2.1, how can we perform the same operation? Is there anything like this that does not involve invoking `Camera.open` and then `getParameters`?

Original source