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

Commit 83e50528 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Reimport Camera features and fixes from CM6" into gingerbread

parents d567805d 5a8a6f17
Loading
Loading
Loading
Loading
+445 −0
Original line number Diff line number Diff line
@@ -73573,6 +73573,28 @@
 visibility="public"
>
</method>
<method name="getAutoExposure"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getBrightness"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getColorEffect"
 return="java.lang.String"
 abstract="false"
@@ -73595,6 +73617,61 @@
 visibility="public"
>
</method>
<method name="getContrast"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getDefaultBrightness"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getDefaultContrast"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getDefaultSaturation"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getDefaultSharpness"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getExposureCompensation"
 return="int"
 abstract="false"
@@ -73674,6 +73751,17 @@
 visibility="public"
>
</method>
<method name="getISOValue"
 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"
@@ -73720,6 +73808,39 @@
 visibility="public"
>
</method>
<method name="getLensShade"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMaxBrightness"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMaxContrast"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMaxExposureCompensation"
 return="int"
 abstract="false"
@@ -73731,6 +73852,28 @@
 visibility="public"
>
</method>
<method name="getMaxSaturation"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMaxSharpness"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMaxZoom"
 return="int"
 abstract="false"
@@ -73821,6 +73964,17 @@
 visibility="public"
>
</method>
<method name="getSaturation"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSceneMode"
 return="java.lang.String"
 abstract="false"
@@ -73832,6 +73986,17 @@
 visibility="public"
>
</method>
<method name="getSharpness"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSupportedAntibanding"
 return="java.util.List&lt;java.lang.String&gt;"
 abstract="false"
@@ -73843,6 +74008,17 @@
 visibility="public"
>
</method>
<method name="getSupportedAutoexposure"
 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="getSupportedColorEffects"
 return="java.util.List&lt;java.lang.String&gt;"
 abstract="false"
@@ -73887,6 +74063,17 @@
 visibility="public"
>
</method>
<method name="getSupportedIsoValues"
 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="getSupportedJpegThumbnailSizes"
 return="java.util.List&lt;android.hardware.Camera.Size&gt;"
 abstract="false"
@@ -73898,6 +74085,17 @@
 visibility="public"
>
</method>
<method name="getSupportedLensShadeModes"
 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"
@@ -74030,6 +74228,17 @@
 visibility="public"
>
</method>
<method name="isSmartContrastEnabled"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="isSmoothZoomSupported"
 return="boolean"
 abstract="false"
@@ -74119,6 +74328,32 @@
<parameter name="antibanding" type="java.lang.String">
</parameter>
</method>
<method name="setAutoExposure"
 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="setBrightness"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="brightness" type="int">
</parameter>
</method>
<method name="setColorEffect"
 return="void"
 abstract="false"
@@ -74145,6 +74380,19 @@
<parameter name="value" type="java.lang.String">
</parameter>
</method>
<method name="setContrast"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="contrast" type="int">
</parameter>
</method>
<method name="setExposureCompensation"
 return="void"
 abstract="false"
@@ -74249,6 +74497,19 @@
<parameter name="timestamp" type="long">
</parameter>
</method>
<method name="setISOValue"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="iso" type="java.lang.String">
</parameter>
</method>
<method name="setJpegQuality"
 return="void"
 abstract="false"
@@ -74290,6 +74551,19 @@
<parameter name="height" type="int">
</parameter>
</method>
<method name="setLensShade"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="lensshade" type="java.lang.String">
</parameter>
</method>
<method name="setPictureFormat"
 return="void"
 abstract="false"
@@ -74387,6 +74661,19 @@
<parameter name="rotation" type="int">
</parameter>
</method>
<method name="setSaturation"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="saturation" type="int">
</parameter>
</method>
<method name="setSceneMode"
 return="void"
 abstract="false"
@@ -74400,6 +74687,32 @@
<parameter name="value" type="java.lang.String">
</parameter>
</method>
<method name="setSharpness"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="sharpness" type="int">
</parameter>
</method>
<method name="setSmartContrastEnabled"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="enabled" type="boolean">
</parameter>
</method>
<method name="setWhiteBalance"
 return="void"
 abstract="false"
@@ -74483,6 +74796,39 @@
 visibility="public"
>
</field>
<field name="AUTO_EXPOSURE_CENTER_WEIGHTED"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;meter-center&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="AUTO_EXPOSURE_FRAME_AVG"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;meter-average&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="AUTO_EXPOSURE_SPOT_METERING"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;meter-spot&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="CAF_OFF"
 type="java.lang.String"
 transient="false"
@@ -74758,6 +75104,105 @@
 visibility="public"
>
</field>
<field name="ISO_100"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;100&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ISO_1250"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;1250&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ISO_200"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;200&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ISO_400"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;400&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ISO_800"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;800&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ISO_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="ISO_HJR"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;deblur&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="LENSSHADE_DISABLE"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;disable&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="LENSSHADE_ENABLE"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;enable&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="PREVIEW_FPS_MAX_INDEX"
 type="int"
 transient="false"
+318 −3
Original line number Diff line number Diff line
@@ -910,7 +910,11 @@ public class Camera {
     * @see #getParameters()
     */
    public void setParameters(Parameters params) {
        try {
            native_setParameters(params.flatten());
        } catch (RuntimeException ex) {
            Log.e(TAG, "Failed to set all parameters");
        }
    }

    /**
@@ -1008,6 +1012,8 @@ public class Camera {
        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";
        private static final String KEY_ISO_MODE = "iso";
        private static final String KEY_LENSSHADE = "lensshade";
        private static final String KEY_FOCAL_LENGTH = "focal-length";
        private static final String KEY_HORIZONTAL_VIEW_ANGLE = "horizontal-view-angle";
        private static final String KEY_VERTICAL_VIEW_ANGLE = "vertical-view-angle";
@@ -1015,6 +1021,7 @@ public class Camera {
        private static final String KEY_MAX_EXPOSURE_COMPENSATION = "max-exposure-compensation";
        private static final String KEY_MIN_EXPOSURE_COMPENSATION = "min-exposure-compensation";
        private static final String KEY_EXPOSURE_COMPENSATION_STEP = "exposure-compensation-step";
        private static final String KEY_AUTO_EXPOSURE = "meter-mode";
        private static final String KEY_ZOOM = "zoom";
        private static final String KEY_MAX_ZOOM = "max-zoom";
        private static final String KEY_ZOOM_RATIOS = "zoom-ratios";
@@ -1022,6 +1029,19 @@ public class Camera {
        private static final String KEY_SMOOTH_ZOOM_SUPPORTED = "smooth-zoom-supported";
        private static final String KEY_FOCUS_DISTANCES = "focus-distances";
        private static final String KEY_CAF = "continuous-af";
        private static final String KEY_SHARPNESS = "sharpness";
        private static final String KEY_MAX_SHARPNESS = "sharpness-max";
        private static final String KEY_DEFAULT_SHARPNESS = "sharpness-def";
        private static final String KEY_CONTRAST = "contrast";
        private static final String KEY_MAX_CONTRAST = "contrast-max";
        private static final String KEY_DEFAULT_CONTRAST = "contrast-def";
        private static final String KEY_SATURATION = "saturation";
        private static final String KEY_MAX_SATURATION = "saturation-max";
        private static final String KEY_DEFAULT_SATURATION = "saturation-def";
        private static final String KEY_BRIGHTNESS = "brightness";
        private static final String KEY_MAX_BRIGHTNESS = "brightness-max";
        private static final String KEY_DEFAULT_BRIGHTNESS = "brightness-def";
        private static final String KEY_SMART_CONTRAST = "smart-contrast";
        
        // Parameter key suffix for supported values.
        private static final String SUPPORTED_VALUES_SUFFIX = "-values";
@@ -1049,12 +1069,34 @@ public class Camera {
        public static final String EFFECT_BLACKBOARD = "blackboard";
        public static final String EFFECT_AQUA = "aqua";

        // Values for auto exposure settings.
        public static final String AUTO_EXPOSURE_FRAME_AVG = "meter-average";
        public static final String AUTO_EXPOSURE_CENTER_WEIGHTED = "meter-center";
        public static final String AUTO_EXPOSURE_SPOT_METERING = "meter-spot";

        // Values for antibanding settings.
        public static final String ANTIBANDING_AUTO = "auto";
        public static final String ANTIBANDING_50HZ = "50hz";
        public static final String ANTIBANDING_60HZ = "60hz";
        public static final String ANTIBANDING_OFF = "off";

        //Values for ISO settings

        public static final String ISO_AUTO = "auto";
        public static final String ISO_HJR = "deblur";
        public static final String ISO_100 = "100";
        public static final String ISO_200 = "200";
        public static final String ISO_400 = "400";
        public static final String ISO_800 = "800";
        public static final String ISO_1250 = "1250";
        
        //Values for Lens Shading

        public static final String LENSSHADE_ENABLE = "enable";
        public static final String LENSSHADE_DISABLE= "disable";



        // Values for flash mode settings.
        /**
         * Flash will not be fired.
@@ -1372,7 +1414,8 @@ public class Camera {
         * @return the int value of the parameter
         */
        public int getInt(String key) {
            return Integer.parseInt(mMap.get(key));
            String value = mMap.get(key);
            return value == null ? 0 : Integer.parseInt(value);
        }

        /**
@@ -1969,6 +2012,166 @@ public class Camera {
        }


        /**
         * Get Sharpness level
         *
         * @return sharpness level
         */
        public int getSharpness(){
            return getInt(KEY_SHARPNESS, 0);
        }

        /**
         * Set Sharpness Level
         *
         * @param sharpness level
         */
        public void setSharpness(int sharpness){
            if((sharpness < 0) || (sharpness > getMaxSharpness()) )
                throw new IllegalArgumentException(
                        "Invalid Sharpness " + sharpness);

            set(KEY_SHARPNESS, String.valueOf(sharpness));
        }

        /**
         * Get Max Sharpness Level
         *
         * @return max sharpness level
         */
        public int getMaxSharpness(){
            return getInt(KEY_MAX_SHARPNESS, 0);
        }

        /**
         * Get default sharpness level
         * 
         * @return default sharpness level
         */
        public int getDefaultSharpness() {
            return getInt(KEY_DEFAULT_SHARPNESS, 0);
        }

        /**
         * Get Contrast level
         *
         * @return contrast level
         */
        public int getContrast(){
            return getInt(KEY_CONTRAST, 0);
        }

        /**
         * Set Contrast Level
         *
         * @param contrast level
         */
        public void setContrast(int contrast){
            if((contrast < 0 ) || (contrast > getMaxContrast()))
                throw new IllegalArgumentException(
                        "Invalid Contrast " + contrast);

            set(KEY_CONTRAST, String.valueOf(contrast));
        }

        /**
         * Get Max Contrast Level
         *
         * @return max contrast level
         */
        public int getMaxContrast(){
            return getInt(KEY_MAX_CONTRAST, 0);
        }

        /**
         * Get default contrast level
         * 
         * @return default contrast level
         */
        public int getDefaultContrast() {
            return getInt(KEY_DEFAULT_CONTRAST, 0);
        }

        /**
         * Get Saturation level
         *
         * @return saturation level
         */
        public int getSaturation(){
            return getInt(KEY_SATURATION, 0);
        }

        /**
         * Set Saturation Level
         *
         * @param saturation level
         */
        public void setSaturation(int saturation){
            if((saturation < 0 ) || (saturation > getMaxSaturation()))
                throw new IllegalArgumentException(
                        "Invalid Saturation " + saturation);

            set(KEY_SATURATION, String.valueOf(saturation));
        }

        /**
         * Get Max Saturation Level
         *
         * @return max contrast level
         */
        public int getMaxSaturation(){
            return getInt(KEY_MAX_SATURATION, 0);
        }

        /**
         * Get default saturation level
         * 
         * @return default saturation level
         */
        public int getDefaultSaturation() {
            return getInt(KEY_DEFAULT_SATURATION, 0);
        }

        /**
         * Get brightness level
         *
         * @return brightness level
         */
        public int getBrightness(){
            return getInt(KEY_BRIGHTNESS, 0);
        }

        /**
         * Set brightness level
         *
         * @param brightness level
         */
        public void setBrightness(int brightness){
            if((brightness < 0 ) || (brightness > getMaxBrightness()))
                throw new IllegalArgumentException(
                        "Invalid Brightness " + brightness);

            set(KEY_BRIGHTNESS, String.valueOf(brightness));
        }

        /**
         * Get Max Brightness Level
         *
         * @return max brightness level
         */
        public int getMaxBrightness(){
            return getInt(KEY_MAX_BRIGHTNESS, 0);
        }

        /**
         * Get default brightness level
         * 
         * @return default brightness level
         */
        public int getDefaultBrightness() {
            return getInt(KEY_DEFAULT_BRIGHTNESS, 0);
        }

        /**
         * Gets the current antibanding setting.
         *
@@ -2259,7 +2462,7 @@ public class Camera {
         */
        public boolean isZoomSupported() {
            String str = get(KEY_ZOOM_SUPPORTED);
            return TRUE.equals(str);
            return TRUE.equals(str) && getMaxZoom() > 0;
        }

        /**
@@ -2369,6 +2572,112 @@ public class Camera {
            return split(str);
        }

        /**
         * Gets the current ISO setting.
         *
         * @return one of ISO_XXX string constant. null if ISO
         *         setting is not supported.
         */
        public String getISOValue() {
            return get(KEY_ISO_MODE);
        }

        /**
         * Sets the ISO.
         *
         * @param iso ISO_XXX string constant.
         */
        public void setISOValue(String iso) {
            set(KEY_ISO_MODE, iso);
        }

         /**
         * Gets the supported ISO values.
         *
         * @return a List of FLASH_MODE_XXX string constants. null if flash mode
         *         setting is not supported.
         */
        public List<String> getSupportedIsoValues() {
            String str = get(KEY_ISO_MODE + SUPPORTED_VALUES_SUFFIX);
            return split(str);
        }

         /**
         * Gets the current LensShade Mode.
         *
         * @return LensShade Mode
         */
        public String getLensShade() {
            return get(KEY_LENSSHADE);
        }

        /**
         * Sets the current LensShade Mode.
         *
         * @return LensShade Mode
         */
        public void setLensShade(String lensshade) {
            set(KEY_LENSSHADE, lensshade);
        }

         /**
         * Gets the supported Lensshade modes.
         *
         * @return a List of LENS_MODE_XXX string constants. null if lens mode
         *         setting is not supported.
         */
        public List<String> getSupportedLensShadeModes() {
            String str = get(KEY_LENSSHADE + SUPPORTED_VALUES_SUFFIX);
            return split(str);
        }

         /**
         * Gets the current auto exposure setting.
         *
         * @return one of AUTO_EXPOSURE_XXX string constant. null if auto exposure
         *         setting is not supported.
         */
        public String getAutoExposure() {
            return get(KEY_AUTO_EXPOSURE);
        }

        /**
         * Sets the current auto exposure setting.
         *
         * @param value AUTO_EXPOSURE_XXX string constants.
         */
        public void setAutoExposure(String value) {
            set(KEY_AUTO_EXPOSURE, value);
        }

        /**
         * Gets the supported auto exposure setting.
         *
         * @return a List of AUTO_EXPOSURE_XXX string constants. null if auto exposure
         *         setting is not supported.
         */
        public List<String> getSupportedAutoexposure() {
            String str = get(KEY_AUTO_EXPOSURE + SUPPORTED_VALUES_SUFFIX);
            return split(str);
        }

        /**
         * Sets the smart-contrast feature
         * @param boolean
         */
        public void setSmartContrastEnabled(boolean enabled) {
            set(KEY_SMART_CONTRAST, enabled ? "on" : "off");
        }
        
        /**
         * Gets the value of smart-contrast
         *
         * @return if smart-contrast is enabled
         */
        public boolean isSmartContrastEnabled() {
            return "on".equals(get(KEY_SMART_CONTRAST));
        }
        
        // 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) {
@@ -2423,6 +2732,9 @@ public class Camera {

        // Returns the value of a float parameter.
        private float getFloat(String key, float defaultValue) {
            if (!mMap.containsKey(key)) {
                return defaultValue;
            }
            try {
                return Float.parseFloat(mMap.get(key));
            } catch (NumberFormatException ex) {
@@ -2432,6 +2744,9 @@ public class Camera {

        // Returns the value of a integer parameter.
        private int getInt(String key, int defaultValue) {
            if (!mMap.containsKey(key)) {
                return defaultValue;
            }
            try {
                return Integer.parseInt(mMap.get(key));
            } catch (NumberFormatException ex) {