Java Code Examples for android.hardware.Camera.Parameters#FOCUS_MODE_INFINITY
The following examples show how to use
android.hardware.Camera.Parameters#FOCUS_MODE_INFINITY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegacyResultMapper.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private static int convertLegacyAfMode(String mode) { if (mode == null) { Log.w(TAG, "convertLegacyAfMode - no AF mode, default to OFF"); return CONTROL_AF_MODE_OFF; } switch (mode) { case Parameters.FOCUS_MODE_AUTO: return CONTROL_AF_MODE_AUTO; case Parameters.FOCUS_MODE_CONTINUOUS_PICTURE: return CONTROL_AF_MODE_CONTINUOUS_PICTURE; case Parameters.FOCUS_MODE_CONTINUOUS_VIDEO: return CONTROL_AF_MODE_CONTINUOUS_VIDEO; case Parameters.FOCUS_MODE_EDOF: return CONTROL_AF_MODE_EDOF; case Parameters.FOCUS_MODE_MACRO: return CONTROL_AF_MODE_MACRO; case Parameters.FOCUS_MODE_FIXED: return CONTROL_AF_MODE_OFF; case Parameters.FOCUS_MODE_INFINITY: return CONTROL_AF_MODE_OFF; default: Log.w(TAG, "convertLegacyAfMode - unknown mode " + mode + " , ignoring"); return CONTROL_AF_MODE_OFF; } }
Example 2
Source File: LegacyMetadataMapper.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Convert the requested AF mode into its equivalent supported parameter. * * @param mode {@code CONTROL_AF_MODE} * @param supportedFocusModes list of camera1's supported focus modes * @return the stringified af mode, or {@code null} if its not supported */ static String convertAfModeToLegacy(int mode, List<String> supportedFocusModes) { if (supportedFocusModes == null || supportedFocusModes.isEmpty()) { Log.w(TAG, "No focus modes supported; API1 bug"); return null; } String param = null; switch (mode) { case CONTROL_AF_MODE_AUTO: param = Parameters.FOCUS_MODE_AUTO; break; case CONTROL_AF_MODE_CONTINUOUS_PICTURE: param = Parameters.FOCUS_MODE_CONTINUOUS_PICTURE; break; case CONTROL_AF_MODE_CONTINUOUS_VIDEO: param = Parameters.FOCUS_MODE_CONTINUOUS_VIDEO; break; case CONTROL_AF_MODE_EDOF: param = Parameters.FOCUS_MODE_EDOF; break; case CONTROL_AF_MODE_MACRO: param = Parameters.FOCUS_MODE_MACRO; break; case CONTROL_AF_MODE_OFF: if (supportedFocusModes.contains(Parameters.FOCUS_MODE_FIXED)) { param = Parameters.FOCUS_MODE_FIXED; } else { param = Parameters.FOCUS_MODE_INFINITY; } } if (!supportedFocusModes.contains(param)) { // Weed out bad user input by setting to the first arbitrary focus mode String defaultMode = supportedFocusModes.get(0); Log.w(TAG, String.format( "convertAfModeToLegacy - ignoring unsupported mode %d, " + "defaulting to %s", mode, defaultMode)); param = defaultMode; } return param; }