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

Commit 58fa260d authored by Fei Zhang's avatar Fei Zhang Committed by Linux Build Service Account
Browse files

Camera: Add support for manual 3A

Add API for manual 3A (awb/af/aec).

Change-Id: Ia5240207ce7a6628e8fdfef79f56db01add14aef
parent f2898299
Loading
Loading
Loading
Loading
+165 −0
Original line number Diff line number Diff line
@@ -1929,6 +1929,27 @@ public class Camera {
        return p;
    }

    /** @hide
     * Returns the current cct value of white balance.
     *
     * If it's in AWB mode, cct is determined by stats/awb module.
     *
     * If it's in Manual WB mode, it actually returns cct value
     *     set by user via {@link #setParameters(Camera.Parameters)}.
     */
    public int getWBCurrentCCT() {
        Parameters p = new Parameters();
        String s = native_getParameters();
        p.unflatten(s);

        int cct = 0;
        if (p.getWBCurrentCCT() != null) {
            cct = Integer.parseInt(p.getWBCurrentCCT());
        }

        return cct;
    }

    /**
     * Returns an empty {@link Parameters} for testing purpose.
     *
@@ -2070,6 +2091,27 @@ public class Camera {
        /** y co-ordinate for the touch event */
        public int yCoordinate;
    };

    /** @hide
     * Returns the current focus position.
     *
     * If it's in AF mode, it's the lens position after af is done.
     *
     * If it's in Manual Focus mode, it actually returns the value
     *     set by user via {@link #setParameters(Camera.Parameters)}.
     */
    public int getCurrentFocusPosition() {
        Parameters p = new Parameters();
        String s = native_getParameters();
        p.unflatten(s);

        int focus_pos = -1;
        if (p.getCurrentFocusPosition() != null) {
            focus_pos = Integer.parseInt(p.getCurrentFocusPosition());
        }
        return focus_pos;
    }

    /* ### QC ADD-ONS: END */
    /**
     * Returns a copied {@link Parameters}; for shim use only.
@@ -2318,6 +2360,10 @@ public class Camera {
        public static final String WHITE_BALANCE_CLOUDY_DAYLIGHT = "cloudy-daylight";
        public static final String WHITE_BALANCE_TWILIGHT = "twilight";
        public static final String WHITE_BALANCE_SHADE = "shade";
        /** @hide
         * wb manual cct mode.
         */
        public static final String WHITE_BALANCE_MANUAL_CCT = "manual-cct";

        // Values for color effect settings.
        public static final String EFFECT_NONE = "none";
@@ -2555,6 +2601,11 @@ public class Camera {
         */
        public static final String FOCUS_MODE_CONTINUOUS_PICTURE = "continuous-picture";

        /** @hide
         *  manual focus mode
         */
        public static final String FOCUS_MODE_MANUAL_POSITION = "manual";

        // Indices for focus distance array.
        /**
         * The array index of near focus distance for use with
@@ -4429,8 +4480,14 @@ public class Camera {
        private static final String KEY_QC_TOUCH_AF_AEC = "touch-af-aec";
        private static final String KEY_QC_TOUCH_INDEX_AEC = "touch-index-aec";
        private static final String KEY_QC_TOUCH_INDEX_AF = "touch-index-af";
        private static final String KEY_QC_MANUAL_FOCUS_POSITION = "manual-focus-position";
        private static final String KEY_QC_MANUAL_FOCUS_POS_TYPE = "manual-focus-pos-type";
        private static final String KEY_QC_CURRENT_FOCUS_POSITION = "current-focus-position";
        private static final String KEY_QC_SCENE_DETECT = "scene-detect";
        private static final String KEY_QC_ISO_MODE = "iso";
        private static final String KEY_QC_EXPOSURE_TIME = "exposure-time";
        private static final String KEY_QC_MIN_EXPOSURE_TIME = "min-exposure-time";
        private static final String KEY_QC_MAX_EXPOSURE_TIME = "max-exposure-time";
        private static final String KEY_QC_LENSSHADE = "lensshade";
        private static final String KEY_QC_HISTOGRAM = "histogram";
        private static final String KEY_QC_SKIN_TONE_ENHANCEMENT = "skinToneEnhancement";
@@ -4453,6 +4510,11 @@ public class Camera {
        private static final String KEY_QC_VIDEO_HDR = "video-hdr";
        private static final String KEY_QC_POWER_MODE = "power-mode";
        private static final String KEY_QC_POWER_MODE_SUPPORTED = "power-mode-supported";
        private static final String KEY_QC_WB_MANUAL_CCT = "wb-manual-cct";
        private static final String KEY_QC_WB_CURRENT_CCT = "wb-current-cct";
        private static final String KEY_QC_MIN_WB_CCT = "min-wb-cct";
        private static final String KEY_QC_MAX_WB_CCT = "max-wb-cct";

        /** @hide
        * KEY_QC_AE_BRACKET_HDR
        **/
@@ -4514,6 +4576,11 @@ public class Camera {
        **/
        public static final String ISO_1600 = "ISO1600";

        /** @hide
        * ISO_3200
        **/
        public static final String ISO_3200 = "ISO3200";

        //Values for Lens Shading
        /** @hide
        * LENSSHADE_ENABLE
@@ -5231,6 +5298,42 @@ public class Camera {
            set(KEY_QC_ISO_MODE, iso);
         }

         /** @hide
         * Sets the exposure time.
         *
         * @param value exposure time.
         */
         public void setExposureTime(int value) {
            set(KEY_QC_EXPOSURE_TIME, Integer.toString(value));
         }

         /** @hide
         * Gets the current exposure time.
         *
         * @return exposure time.
         */
         public String getExposureTime() {
            return get(KEY_QC_EXPOSURE_TIME);
         }

         /** @hide
         * Gets the min supported exposure time.
         *
         * @return min supported exposure time.
         */
         public String getMinExposureTime() {
            return get(KEY_QC_MIN_EXPOSURE_TIME);
         }

         /** @hide
         * Gets the max supported exposure time.
         *
         * @return max supported exposure time.
         */
         public String getMaxExposureTime() {
            return get(KEY_QC_MAX_EXPOSURE_TIME);
         }

         /** @hide
         * Gets the current LensShade Mode.
         *
@@ -5286,6 +5389,46 @@ public class Camera {
            set(KEY_QC_MEMORY_COLOR_ENHANCEMENT, mce);
         }

         /** @hide
         * Set white balance manual cct value.
         *
         * @param cct user CCT setting.
         */
         public void setWBManualCCT(int cct) {
            set(KEY_QC_WB_MANUAL_CCT, Integer.toString(cct));
         }

         /** @hide
         * Gets the WB min supported CCT.
         *
         * @return min cct value.
         */
         public String getWBMinCCT() {
            return get(KEY_QC_MIN_WB_CCT);
         }

         /** @hide
         * Gets the WB max supported CCT.
         *
         * @return max cct value.
         */
         public String getMaxWBCCT() {
            return get(KEY_QC_MAX_WB_CCT);
         }

         /** @hide
         * Gets the current WB CCT.
         *
         * Pay attention to KEY_QC_WB_MANUAL_CCT and KEY_QC_WB_CURRENT_CCT.
         * The former is set by APK.
         * The latter is updated from HAL, usually in AWB mode.
         *
         * @return CCT value
         */
         public String getWBCurrentCCT() {
            return get(KEY_QC_WB_CURRENT_CCT);
         }

         /** @hide
         * Gets the current ZSL Mode.
         *
@@ -5324,6 +5467,28 @@ public class Camera {
           set(KEY_QC_CAMERA_MODE, cameraMode);
         }

         private static final int MANUAL_FOCUS_POS_TYPE_INDEX = 0;
         private static final int MANUAL_FOCUS_POS_TYPE_DAC = 1;
         /** @hide
         * Set focus position.
         *
         * @param pos user setting of focus position.
         */
         public void setFocusPosition(int type, int pos) {
           set(KEY_QC_MANUAL_FOCUS_POS_TYPE, Integer.toString(type));
           set(KEY_QC_MANUAL_FOCUS_POSITION, Integer.toString(pos));
         }

         /** @hide
         * Gets the current focus position.
         *
         * @return current focus position
         */
         public String getCurrentFocusPosition() {
            return get(KEY_QC_CURRENT_FOCUS_POSITION);
         }


         /** @hide
         * Gets the current HFR Mode.
         *