Camera2: Separate AE/AWB locks from AE/AWB modes.

With AE/AWB modes including the LOCKED state, it was not possible for
the HAL to determine the current flash state, or to report fixed AWB
modes properly. Break out the locks into separate controls.

Bug: 6243944
Change-Id: I1b2d844420b8c4e06be32ea644e052f222ed825b
diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h
index 6ba6854..938144e 100644
--- a/camera/include/system/camera_metadata_tags.h
+++ b/camera/include/system/camera_metadata_tags.h
@@ -277,6 +277,7 @@
     ANDROID_CONTROL_SCENE_MODE,
     ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
     ANDROID_CONTROL_AE_MODE,
+    ANDROID_CONTROL_AE_LOCK,
     ANDROID_CONTROL_AE_REGIONS,
     ANDROID_CONTROL_AE_EXP_COMPENSATION,
     ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
@@ -284,6 +285,7 @@
     ANDROID_CONTROL_AE_STATE,
     ANDROID_CONTROL_AE_PRECAPTURE_ID,
     ANDROID_CONTROL_AWB_MODE,
+    ANDROID_CONTROL_AWB_LOCK,
     ANDROID_CONTROL_AWB_REGIONS,
     ANDROID_CONTROL_AWB_STATE,
     ANDROID_CONTROL_AF_MODE,
@@ -448,13 +450,18 @@
 // ANDROID_CONTROL_AE_MODE
 enum {
     ANDROID_CONTROL_AE_OFF = 0,
-    ANDROID_CONTROL_AE_LOCKED,
     ANDROID_CONTROL_AE_ON,
     ANDROID_CONTROL_AE_ON_AUTO_FLASH,
     ANDROID_CONTROL_AE_ON_ALWAYS_FLASH,
     ANDROID_CONTROL_AE_ON_AUTO_FLASH_REDEYE
 };
 
+// ANDROID_CONTROL_AE_LOCK
+enum {
+    ANDROID_CONTROL_AE_LOCK_OFF = 0,
+    ANDROID_CONTROL_AE_LOCK_ON
+};
+
 // ANDROID_CONTROL_AE_ANTIBANDING_MODE
 enum {
     ANDROID_CONTROL_AE_ANTIBANDING_OFF = 0,
@@ -476,7 +483,6 @@
 // ANDROID_CONTROL_AWB_MODE
 enum {
     ANDROID_CONTROL_AWB_OFF = 0,
-    ANDROID_CONTROL_AWB_LOCKED,
     ANDROID_CONTROL_AWB_AUTO,
     ANDROID_CONTROL_AWB_INCANDESCENT,
     ANDROID_CONTROL_AWB_FLUORESCENT,
@@ -487,6 +493,12 @@
     ANDROID_CONTROL_AWB_SHADE
 };
 
+// ANDROID_CONTROL_AWB_LOCK
+enum {
+    ANDROID_CONTROL_AWB_LOCK_OFF = 0,
+    ANDROID_CONTROL_AWB_LOCK_ON
+};
+
 // ANDROID_CONTROL_AWB_STATE
 enum {
     ANDROID_CONTROL_AWB_STATE_INACTIVE = 0,
diff --git a/camera/src/camera_metadata_tag_info.c b/camera/src/camera_metadata_tag_info.c
index ce0ccc3..c9a8f77 100644
--- a/camera/src/camera_metadata_tag_info.c
+++ b/camera/src/camera_metadata_tag_info.c
@@ -458,6 +458,8 @@
     { "videoStabilizationMode",      TYPE_BYTE },
     TIDX(CONTROL, AE_MODE) =
     { "aeMode",                      TYPE_BYTE },
+    TIDX(CONTROL, AE_LOCK) =
+    { "aeLock",                      TYPE_BYTE },
     TIDX(CONTROL, AE_REGIONS) =
     { "aeRegions",                   TYPE_INT32 },
     TIDX(CONTROL, AE_EXP_COMPENSATION) =
@@ -472,6 +474,8 @@
     { "aePrecaptureId",              TYPE_INT32},
     TIDX(CONTROL, AWB_MODE) =
     { "awbMode",                     TYPE_BYTE },
+    TIDX(CONTROL, AWB_LOCK) =
+    { "awbLock",                     TYPE_BYTE },
     TIDX(CONTROL, AWB_REGIONS) =
     { "awbRegions",                  TYPE_INT32 },
     TIDX(CONTROL, AWB_STATE) =