Merge "Camera: Add trigger metadata entries." into jb-mr2-dev
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index 9f5ad50..080d34f 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -97,8 +97,10 @@
         <li><a href="#controls_android.control.aeMode">android.control.aeMode</a> (controls)</li>
         <li><a href="#controls_android.control.aeRegions">android.control.aeRegions</a> (controls)</li>
         <li><a href="#controls_android.control.aeTargetFpsRange">android.control.aeTargetFpsRange</a> (controls)</li>
+        <li><a href="#controls_android.control.aePrecaptureTrigger">android.control.aePrecaptureTrigger</a> (controls)</li>
         <li><a href="#controls_android.control.afMode">android.control.afMode</a> (controls)</li>
         <li><a href="#controls_android.control.afRegions">android.control.afRegions</a> (controls)</li>
+        <li><a href="#controls_android.control.afTrigger">android.control.afTrigger</a> (controls)</li>
         <li><a href="#controls_android.control.awbLock">android.control.awbLock</a> (controls)</li>
         <li><a href="#controls_android.control.awbMode">android.control.awbMode</a> (controls)</li>
         <li><a href="#controls_android.control.awbRegions">android.control.awbRegions</a> (controls)</li>
@@ -872,6 +874,58 @@
           </tr> <!-- end of entry -->
         
                 
+          <tr class="entry" id="controls_android.control.aePrecaptureTrigger">
+            <td class="entry_name">android.<wbr>control.<wbr>ae<wbr>Precapture<wbr>Trigger</td>
+            <td class="entry_type">
+                <span class="entry_type_name entry_type_name_enum">byte</span>
+
+
+
+                <ul class="entry_type_enum">
+                  <li>
+                    <span class="entry_type_enum_name">IDLE</span>
+                    <span class="entry_type_enum_notes">The trigger is idle.<wbr></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">START</span>
+                    <span class="entry_type_enum_notes">The precapture metering sequence
+              must be started.<wbr> The exact effect of the precapture
+              trigger depends on the current AE mode and
+              state.<wbr></span>
+                  </li>
+                </ul>
+
+            </td> <!-- entry_type -->
+
+            <td class="entry_description">
+              Whether the HAL must trigger precapture
+          metering.<wbr>
+            </td>
+
+            <td class="entry_units">
+            </td>
+
+            <td class="entry_range">
+            </td>
+
+            <td class="entry_notes">
+              This entry is normally set to IDLE,<wbr> or is not
+          included at all in the request settings.<wbr> When included and
+          set to START,<wbr> the HAL must trigger the autoexposure
+          precapture metering sequence.<wbr> The effect of AE precapture
+          trigger depends on the current AE mode and state; see the
+          camera HAL device v3 header for details.<wbr>
+            </td>
+
+            <td class="entry_tags">
+              <ul class="entry_tags">
+                  <li><a href="#tag_BC">BC</a></li>
+              </ul>
+            </td>
+
+          </tr> <!-- end of entry -->
+        
+                
           <tr class="entry" id="controls_android.control.afMode">
             <td class="entry_name">android.<wbr>control.<wbr>af<wbr>Mode</td>
             <td class="entry_type">
@@ -1030,6 +1084,60 @@
           </tr> <!-- end of entry -->
         
                 
+          <tr class="entry" id="controls_android.control.afTrigger">
+            <td class="entry_name">android.<wbr>control.<wbr>af<wbr>Trigger</td>
+            <td class="entry_type">
+                <span class="entry_type_name entry_type_name_enum">byte</span>
+
+
+
+                <ul class="entry_type_enum">
+                  <li>
+                    <span class="entry_type_enum_name">IDLE</span>
+                    <span class="entry_type_enum_notes">The trigger is idle.<wbr></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">START</span>
+                    <span class="entry_type_enum_notes">Autofocus must trigger now.<wbr></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">CANCEL</span>
+                    <span class="entry_type_enum_notes">Autofocus must return to initial
+              state,<wbr> and cancel any active trigger.<wbr></span>
+                  </li>
+                </ul>
+
+            </td> <!-- entry_type -->
+
+            <td class="entry_description">
+              Whether the HAL must trigger autofocus.<wbr>
+            </td>
+
+            <td class="entry_units">
+            </td>
+
+            <td class="entry_range">
+            </td>
+
+            <td class="entry_notes">
+              This entry is normally set to IDLE,<wbr> or is not
+          included at all in the request settings.<wbr> When included and
+          set to START,<wbr> the HAL must trigger the autofocus
+          algorithm.<wbr> The effect of AF trigger depends on the current
+          AF mode and state; see the camera HAL device v3 header for
+          details.<wbr> When set to CANCEL,<wbr> the HAL must cancel any active
+          trigger,<wbr> and return to initial AF state.<wbr>
+            </td>
+
+            <td class="entry_tags">
+              <ul class="entry_tags">
+                  <li><a href="#tag_BC">BC</a></li>
+              </ul>
+            </td>
+
+          </tr> <!-- end of entry -->
+        
+                
           <tr class="entry" id="controls_android.control.awbLock">
             <td class="entry_name">android.<wbr>control.<wbr>awb<wbr>Lock</td>
             <td class="entry_type">
@@ -9782,8 +9890,10 @@
           <li><a href="#controls_android.control.aeMode">android.control.aeMode</a> (controls)</li>
           <li><a href="#controls_android.control.aeRegions">android.control.aeRegions</a> (controls)</li>
           <li><a href="#controls_android.control.aeTargetFpsRange">android.control.aeTargetFpsRange</a> (controls)</li>
+          <li><a href="#controls_android.control.aePrecaptureTrigger">android.control.aePrecaptureTrigger</a> (controls)</li>
           <li><a href="#controls_android.control.afMode">android.control.afMode</a> (controls)</li>
           <li><a href="#controls_android.control.afRegions">android.control.afRegions</a> (controls)</li>
+          <li><a href="#controls_android.control.afTrigger">android.control.afTrigger</a> (controls)</li>
           <li><a href="#controls_android.control.awbLock">android.control.awbLock</a> (controls)</li>
           <li><a href="#controls_android.control.awbMode">android.control.awbMode</a> (controls)</li>
           <li><a href="#controls_android.control.awbRegions">android.control.awbRegions</a> (controls)</li>
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index d0a1d33..fe583f8 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -187,6 +187,28 @@
           of android.sensor.exposureTime</notes>
           <tag id="BC" />
         </entry>
+        <entry name="aePrecaptureTrigger" type="byte" enum="true">
+          <enum>
+            <value>IDLE
+              <notes>The trigger is idle.</notes>
+            </value>
+            <value>START
+              <notes>The precapture metering sequence
+              must be started. The exact effect of the precapture
+              trigger depends on the current AE mode and
+              state.</notes>
+            </value>
+          </enum>
+          <description>Whether the HAL must trigger precapture
+          metering.</description>
+          <notes>This entry is normally set to IDLE, or is not
+          included at all in the request settings. When included and
+          set to START, the HAL must trigger the autoexposure
+          precapture metering sequence. The effect of AE precapture
+          trigger depends on the current AE mode and state; see the
+          camera HAL device v3 header for details.</notes>
+          <tag id="BC" />
+        </entry>
         <entry name="afMode" type="byte" enum="true">
           <enum>
             <value>OFF
@@ -277,6 +299,29 @@
           in the frame metadata</notes>
           <tag id="BC" />
         </entry>
+        <entry name="afTrigger" type="byte" enum="true">
+          <enum>
+            <value>IDLE
+              <notes>The trigger is idle.</notes>
+            </value>
+            <value>START
+              <notes>Autofocus must trigger now.</notes>
+            </value>
+            <value>CANCEL
+              <notes>Autofocus must return to initial
+              state, and cancel any active trigger.</notes>
+            </value>
+          </enum>
+          <description>Whether the HAL must trigger autofocus.</description>
+          <notes>This entry is normally set to IDLE, or is not
+          included at all in the request settings. When included and
+          set to START, the HAL must trigger the autofocus
+          algorithm. The effect of AF trigger depends on the current
+          AF mode and state; see the camera HAL device v3 header for
+          details. When set to CANCEL, the HAL must cancel any active
+          trigger, and return to initial AF state.</notes>
+          <tag id="BC" />
+        </entry>
         <entry name="awbLock" type="byte" enum="true">
           <enum>
             <value>OFF
diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h
index 8d20ae8..8ae2ce1 100644
--- a/camera/include/system/camera_metadata_tags.h
+++ b/camera/include/system/camera_metadata_tags.h
@@ -110,8 +110,10 @@
     ANDROID_CONTROL_AE_MODE,
     ANDROID_CONTROL_AE_REGIONS,
     ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
+    ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,
     ANDROID_CONTROL_AF_MODE,
     ANDROID_CONTROL_AF_REGIONS,
+    ANDROID_CONTROL_AF_TRIGGER,
     ANDROID_CONTROL_AWB_LOCK,
     ANDROID_CONTROL_AWB_MODE,
     ANDROID_CONTROL_AWB_REGIONS,
@@ -336,6 +338,12 @@
     ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE,
 } camera_metadata_enum_android_control_ae_mode_t;
 
+// ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER
+typedef enum camera_metadata_enum_android_control_ae_precapture_trigger {
+    ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE,
+    ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START,
+} camera_metadata_enum_android_control_ae_precapture_trigger_t;
+
 // ANDROID_CONTROL_AF_MODE
 typedef enum camera_metadata_enum_android_control_af_mode {
     ANDROID_CONTROL_AF_MODE_OFF,
@@ -346,6 +354,13 @@
     ANDROID_CONTROL_AF_MODE_EDOF,
 } camera_metadata_enum_android_control_af_mode_t;
 
+// ANDROID_CONTROL_AF_TRIGGER
+typedef enum camera_metadata_enum_android_control_af_trigger {
+    ANDROID_CONTROL_AF_TRIGGER_IDLE,
+    ANDROID_CONTROL_AF_TRIGGER_START,
+    ANDROID_CONTROL_AF_TRIGGER_CANCEL,
+} camera_metadata_enum_android_control_af_trigger_t;
+
 // ANDROID_CONTROL_AWB_LOCK
 typedef enum camera_metadata_enum_android_control_awb_lock {
     ANDROID_CONTROL_AWB_LOCK_OFF,
diff --git a/camera/src/camera_metadata_tag_info.c b/camera/src/camera_metadata_tag_info.c
index e8d340a..6a4e0e6 100644
--- a/camera/src/camera_metadata_tag_info.c
+++ b/camera/src/camera_metadata_tag_info.c
@@ -124,10 +124,14 @@
     { "aeRegions",                     TYPE_INT32  },
     [ ANDROID_CONTROL_AE_TARGET_FPS_RANGE - ANDROID_CONTROL_START ] =
     { "aeTargetFpsRange",              TYPE_INT32  },
+    [ ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER - ANDROID_CONTROL_START ] =
+    { "aePrecaptureTrigger",           TYPE_BYTE   },
     [ ANDROID_CONTROL_AF_MODE - ANDROID_CONTROL_START ] =
     { "afMode",                        TYPE_BYTE   },
     [ ANDROID_CONTROL_AF_REGIONS - ANDROID_CONTROL_START ] =
     { "afRegions",                     TYPE_INT32  },
+    [ ANDROID_CONTROL_AF_TRIGGER - ANDROID_CONTROL_START ] =
+    { "afTrigger",                     TYPE_BYTE   },
     [ ANDROID_CONTROL_AWB_LOCK - ANDROID_CONTROL_START ] =
     { "awbLock",                       TYPE_BYTE   },
     [ ANDROID_CONTROL_AWB_MODE - ANDROID_CONTROL_START ] =
@@ -631,6 +635,21 @@
         case ANDROID_CONTROL_AE_TARGET_FPS_RANGE: {
             break;
         }
+        case ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER: {
+            switch (value) {
+                case ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE:
+                    msg = "IDLE";
+                    ret = 0;
+                    break;
+                case ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START:
+                    msg = "START";
+                    ret = 0;
+                    break;
+                default:
+                    msg = "error: enum value out of range";
+            }
+            break;
+        }
         case ANDROID_CONTROL_AF_MODE: {
             switch (value) {
                 case ANDROID_CONTROL_AF_MODE_OFF:
@@ -665,6 +684,25 @@
         case ANDROID_CONTROL_AF_REGIONS: {
             break;
         }
+        case ANDROID_CONTROL_AF_TRIGGER: {
+            switch (value) {
+                case ANDROID_CONTROL_AF_TRIGGER_IDLE:
+                    msg = "IDLE";
+                    ret = 0;
+                    break;
+                case ANDROID_CONTROL_AF_TRIGGER_START:
+                    msg = "START";
+                    ret = 0;
+                    break;
+                case ANDROID_CONTROL_AF_TRIGGER_CANCEL:
+                    msg = "CANCEL";
+                    ret = 0;
+                    break;
+                default:
+                    msg = "error: enum value out of range";
+            }
+            break;
+        }
         case ANDROID_CONTROL_AWB_LOCK: {
             switch (value) {
                 case ANDROID_CONTROL_AWB_LOCK_OFF: