Camera: derive post RAW sensitivity boost range

Bug: 26625646
Change-Id: Ifbc49d744ac0dca201028aa414dae56febf28e4b
diff --git a/services/camera/libcameraservice/common/CameraModule.cpp b/services/camera/libcameraservice/common/CameraModule.cpp
index d1c79d0..f33d1ba 100644
--- a/services/camera/libcameraservice/common/CameraModule.cpp
+++ b/services/camera/libcameraservice/common/CameraModule.cpp
@@ -130,6 +130,7 @@
         // Check if HAL supports RAW_OPAQUE output
         camera_metadata_entry entry = chars.find(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
         bool supportRawOpaque = false;
+        bool supportAnyRaw = false;
         const int STREAM_CONFIGURATION_SIZE = 4;
         const int STREAM_FORMAT_OFFSET = 0;
         const int STREAM_WIDTH_OFFSET = 1;
@@ -151,6 +152,13 @@
                 // HAL does not fill in the opaque raw size
                 rawOpaqueSizes.push(width * height *2);
             }
+            if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
+                    (format == HAL_PIXEL_FORMAT_RAW16 ||
+                     format == HAL_PIXEL_FORMAT_RAW10 ||
+                     format == HAL_PIXEL_FORMAT_RAW12 ||
+                     format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) {
+                supportAnyRaw = true;
+            }
         }
 
         if (supportRawOpaque) {
@@ -161,6 +169,19 @@
                 derivedCharKeys.push(ANDROID_SENSOR_OPAQUE_RAW_SIZE);
             }
         }
+
+        // Check if HAL supports any RAW output, if so, fill in postRawSensitivityBoost range
+        if (supportAnyRaw) {
+            int32_t defaultRange[2] = {100, 100};
+            entry = chars.find(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE);
+            if (entry.count == 0) {
+                // Fill in default value (100, 100)
+                chars.update(
+                        ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE,
+                        defaultRange, 2);
+                derivedCharKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE);
+            }
+        }
     }
 
     // Always add a default for the pre-correction active array if the vendor chooses to omit this