EmulatedCamera: Populate the active physical scaler crop

Add trivial support for the active physical scaler crop
and the lens intrinsic samples capture results.

Bug: 297083874
Test: atest VtsAidlHalCameraProvider_TargetTest
Change-Id: Iee9de2529fc2a245f78913da6f238f3c55a2a741
diff --git a/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp b/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp
index 9ed161a..ff6ed12 100644
--- a/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp
+++ b/devices/EmulatedCamera/hwl/EmulatedRequestState.cpp
@@ -1064,6 +1064,11 @@
                                  intrinsic_calibration_,
                                  ARRAY_SIZE(intrinsic_calibration_));
   }
+  if (report_lens_intrinsics_samples_) {
+    result->result_metadata->Set(ANDROID_STATISTICS_LENS_INTRINSIC_SAMPLES,
+                                 intrinsic_calibration_,
+                                 ARRAY_SIZE(intrinsic_calibration_));
+  }
   if (report_distortion_) {
     result->result_metadata->Set(ANDROID_LENS_DISTORTION, distortion_,
                                  ARRAY_SIZE(distortion_));
@@ -1084,6 +1089,11 @@
     }
     result->result_metadata->Set(ANDROID_SCALER_CROP_REGION, chosen_crop_region,
                                  ARRAY_SIZE(scaler_crop_region_default_));
+    if (report_active_sensor_crop_) {
+      result->result_metadata->Set(
+          ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION,
+          chosen_crop_region, ARRAY_SIZE(scaler_crop_region_default_));
+    }
   }
   if (report_extended_scene_mode_) {
     result->result_metadata->Set(ANDROID_CONTROL_EXTENDED_SCENE_MODE,
@@ -1340,6 +1350,11 @@
     return BAD_VALUE;
   }
 
+  report_lens_intrinsics_samples_ =
+      (available_results_.find(ANDROID_STATISTICS_LENS_INTRINSIC_SAMPLES) !=
+       available_results_.end()) &&
+      (available_results_.find(ANDROID_STATISTICS_LENS_INTRINSIC_TIMESTAMPS) !=
+       available_results_.end());
   report_scene_flicker_ =
       available_results_.find(ANDROID_STATISTICS_SCENE_FLICKER) !=
       available_results_.end();
@@ -2432,6 +2447,12 @@
             __FUNCTION__);
       return BAD_VALUE;
     }
+
+    if (available_requests_.find(
+            ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_SENSOR_CROP_REGION) !=
+        available_results_.end()) {
+      report_active_sensor_crop_ = true;
+    }
     ret = static_metadata_->Get(ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES,
                                 &entry);
     if ((ret == OK) && (entry.count > 0)) {
diff --git a/devices/EmulatedCamera/hwl/EmulatedRequestState.h b/devices/EmulatedCamera/hwl/EmulatedRequestState.h
index b9d9f31..79ad968 100644
--- a/devices/EmulatedCamera/hwl/EmulatedRequestState.h
+++ b/devices/EmulatedCamera/hwl/EmulatedRequestState.h
@@ -316,6 +316,8 @@
   bool report_pose_translation_ = false;
   bool report_distortion_ = false;
   bool report_intrinsic_calibration_ = false;
+  bool report_active_sensor_crop_ = false;
+  bool report_lens_intrinsics_samples_ = false;
   int32_t shading_map_size_[2] = {0};
 
   unsigned int rand_seed_ = 1;
diff --git a/devices/EmulatedCamera/hwl/EmulatedSensor.cpp b/devices/EmulatedCamera/hwl/EmulatedSensor.cpp
index 161561d..f96a565 100644
--- a/devices/EmulatedCamera/hwl/EmulatedSensor.cpp
+++ b/devices/EmulatedCamera/hwl/EmulatedSensor.cpp
@@ -1251,6 +1251,15 @@
     }
     result->result_metadata->Set(ANDROID_SENSOR_TIMESTAMP, &next_capture_time_,
                                  1);
+
+    camera_metadata_ro_entry_t lensEntry;
+    auto lensRet = result->result_metadata->Get(
+        ANDROID_STATISTICS_LENS_INTRINSIC_SAMPLES, &lensEntry);
+    if ((lensRet == OK) && (lensEntry.count > 0)) {
+      result->result_metadata->Set(ANDROID_STATISTICS_LENS_INTRINSIC_TIMESTAMPS,
+                                   &next_capture_time_, 1);
+    }
+
     uint8_t raw_binned_factor_used = false;
     if (sensor_binning_factor_info_.find(logical_camera_id_) !=
         sensor_binning_factor_info_.end()) {
diff --git a/devices/EmulatedCamera/hwl/configs/emu_camera_back.json b/devices/EmulatedCamera/hwl/configs/emu_camera_back.json
index 723f361..f9488dd 100644
--- a/devices/EmulatedCamera/hwl/configs/emu_camera_back.json
+++ b/devices/EmulatedCamera/hwl/configs/emu_camera_back.json
@@ -497,6 +497,8 @@
   "917523",
   "917526",
   "851985",
+  "1114133",
+  "1114134",
   "-2080374783",
   "-2080374782"
  ],
diff --git a/devices/EmulatedCamera/hwl/configs/emu_camera_front.json b/devices/EmulatedCamera/hwl/configs/emu_camera_front.json
index 7feca73..7b49648 100644
--- a/devices/EmulatedCamera/hwl/configs/emu_camera_front.json
+++ b/devices/EmulatedCamera/hwl/configs/emu_camera_front.json
@@ -642,7 +642,8 @@
    "1703938",
    "917530",
    "851985",
-   "917536"
+   "917536",
+   "1703939"
   ],
   "android.request.maxNumOutputStreams": [
    "1",