Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36322db5 authored by Wu-cheng Li's avatar Wu-cheng Li
Browse files

Add focus API and FLASH_MODE_VIDEO_LIGHT.

parent dbe8bad1
Loading
Loading
Loading
Loading
+90 −0
Original line number Diff line number Diff line
@@ -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&lt;java.lang.String&gt;"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSupportedPictureFormats"
 return="java.util.List&lt;java.lang.Integer&gt;"
 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="&quot;video-light&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FOCUS_MODE_AUTO"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;auto&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FOCUS_MODE_FIXED"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;fixed&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FOCUS_MODE_INFINITY"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;infinity&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FOCUS_MODE_MACRO"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;macro&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="SCENE_MODE_ACTION"
 type="java.lang.String"
 transient="false"
+63 −4
Original line number Diff line number Diff line
@@ -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) {