diff options
| -rw-r--r-- | api/current.xml | 90 | ||||
| -rw-r--r-- | core/java/android/hardware/Camera.java | 67 |
2 files changed, 153 insertions, 4 deletions
diff --git a/api/current.xml b/api/current.xml index efeecb6870ba..077b6ec5c372 100644 --- a/api/current.xml +++ b/api/current.xml @@ -67644,6 +67644,17 @@ visibility="public" > </method> +<method name="getFocusMode" + return="java.lang.String" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getInt" return="int" abstract="false" @@ -67789,6 +67800,17 @@ visibility="public" > </method> +<method name="getSupportedFocusModes" + return="java.util.List<java.lang.String>" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getSupportedPictureFormats" return="java.util.List<java.lang.Integer>" abstract="false" @@ -67970,6 +67992,19 @@ <parameter name="value" type="java.lang.String"> </parameter> </method> +<method name="setFocusMode" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="value" type="java.lang.String"> +</parameter> +</method> <method name="setGpsAltitude" return="void" abstract="false" @@ -68371,6 +68406,61 @@ visibility="public" > </field> +<field name="FLASH_MODE_VIDEO_LIGHT" + type="java.lang.String" + transient="false" + volatile="false" + value=""video-light"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="FOCUS_MODE_AUTO" + type="java.lang.String" + transient="false" + volatile="false" + value=""auto"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="FOCUS_MODE_FIXED" + type="java.lang.String" + transient="false" + volatile="false" + value=""fixed"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="FOCUS_MODE_INFINITY" + type="java.lang.String" + transient="false" + volatile="false" + value=""infinity"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="FOCUS_MODE_MACRO" + type="java.lang.String" + transient="false" + volatile="false" + value=""macro"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="SCENE_MODE_ACTION" type="java.lang.String" transient="false" diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index cc44400506b0..5f1a3c50e2dc 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -357,10 +357,12 @@ public class Camera { /** * Starts auto-focus function and registers a callback function to run when - * camera is focused. Only valid after startPreview() has been called. If - * the camera does not support auto-focus, it is a no-op and {@link - * AutoFocusCallback#onAutoFocus(boolean, Camera)} callback will be called - * immediately. + * camera is focused. Only valid after startPreview() has been called. + * Applications should call {@link + * android.hardware.Camera.Parameters#getFocusMode()} to determine if this + * method should be called. If the camera does not support auto-focus, it is + * a no-op and {@link AutoFocusCallback#onAutoFocus(boolean, Camera)} + * callback will be called immediately. * <p>If your application should not be installed * on devices without auto-focus, you must declare that your application * uses auto-focus with the @@ -598,6 +600,7 @@ public class Camera { private static final String KEY_ANTIBANDING = "antibanding"; private static final String KEY_SCENE_MODE = "scene-mode"; private static final String KEY_FLASH_MODE = "flash-mode"; + private static final String KEY_FOCUS_MODE = "focus-mode"; // Parameter key suffix for supported values. private static final String SUPPORTED_VALUES_SUFFIX = "-values"; @@ -646,6 +649,10 @@ public class Camera { * Flash will be fired in red-eye reduction mode. */ public static final String FLASH_MODE_RED_EYE = "red-eye"; + /** + * Constant emission of light. This can be used for video recording. + */ + public static final String FLASH_MODE_VIDEO_LIGHT = "video-light"; // Values for scene mode settings. public static final String SCENE_MODE_AUTO = "auto"; @@ -664,6 +671,25 @@ public class Camera { public static final String SCENE_MODE_PARTY = "party"; public static final String SCENE_MODE_CANDLELIGHT = "candlelight"; + // Values for focus mode settings. + /** + * Auto-focus mode. + */ + public static final String FOCUS_MODE_AUTO = "auto"; + /** + * Focus is set at infinity. Applications should not call + * {@link #autoFocus(AutoFocusCallback)} in this mode. + */ + public static final String FOCUS_MODE_INFINITY = "infinity"; + public static final String FOCUS_MODE_MACRO = "macro"; + /** + * Focus is fixed. The camera is always in this mode if the focus is not + * adjustable. If the camera has auto-focus, this mode can fix the + * focus, which is usually at hyperfocal distance. Applications should + * not call {@link #autoFocus(AutoFocusCallback)} in this mode. + */ + public static final String FOCUS_MODE_FIXED = "fixed"; + // Formats for setPreviewFormat and setPictureFormat. private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp"; private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp"; @@ -1295,6 +1321,39 @@ public class Camera { return split(str); } + /** + * Gets the current focus mode setting. + * + * @return one of FOCUS_MODE_XXX string constant. If the camera does not + * support auto-focus, this should return {@link + * #FOCUS_MODE_FIXED}. If the focus mode is not FOCUS_MODE_FIXED + * or {@link #FOCUS_MODE_INFINITY}, applications should call + * {@link #autoFocus(AutoFocusCallback)} to start the focus. + */ + public String getFocusMode() { + return get(KEY_FOCUS_MODE); + } + + /** + * Sets the focus mode. + * + * @param value FOCUS_MODE_XXX string constants. + */ + public void setFocusMode(String value) { + set(KEY_FOCUS_MODE, value); + } + + /** + * Gets the supported focus modes. + * + * @return a List of FOCUS_MODE_XXX string constants. null if focus mode + * setting is not supported. + */ + public List<String> getSupportedFocusModes() { + String str = get(KEY_FOCUS_MODE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + // Splits a comma delimited string to an ArrayList of String. // Return null if the passing string is null or the size is 0. private ArrayList<String> split(String str) { |