CameraService: Implement SCALER_ROTATE_AND_CROP_AUTO, part 1

When an app sets SCALER_ROTATE_AND_CROP to AUTO, the camera service
needs to select the right ROTATE_AND_CROP mode given the application
UI state at the moment, received from the window manager.

In addition, some of the metadata in the active array coordinate
system needs to be converted to/from the cropped+rotated coordinate
system to ensure roundtripping UI information works as before.

Also ensure that the available rotate and crop metadata field is
always available, with a value of NONE if nothing else.

This commit adds support for doing the coordinate transforms and
overriding AUTO to a concrete value; it does not wire up a connection
to another system service to receive the correct override value, but
does add a command to set the override value for all current camera
clients.

Test: New CTS tests pass, unit tests for RotateAndCropMapper pass
Bug: 134631897
Change-Id: Icc45530e2cfbaf838a1e4d04e4fd2aef8122e8e1
diff --git a/services/camera/libcameraservice/device3/Camera3OfflineSession.h b/services/camera/libcameraservice/device3/Camera3OfflineSession.h
index b6b8a7d..969220f 100644
--- a/services/camera/libcameraservice/device3/Camera3OfflineSession.h
+++ b/services/camera/libcameraservice/device3/Camera3OfflineSession.h
@@ -33,6 +33,7 @@
 #include "device3/DistortionMapper.h"
 #include "device3/InFlightRequest.h"
 #include "device3/Camera3OutputUtils.h"
+#include "device3/RotateAndCropMapper.h"
 #include "device3/ZoomRatioMapper.h"
 #include "utils/TagMonitor.h"
 #include "utils/LatencyHistogram.h"
@@ -62,7 +63,9 @@
             const CameraMetadata& deviceInfo,
             const std::unordered_map<std::string, CameraMetadata>& physicalDeviceInfoMap,
             const std::unordered_map<std::string, camera3::DistortionMapper>& distortionMappers,
-            const std::unordered_map<std::string, camera3::ZoomRatioMapper>& zoomRatioMappers) :
+            const std::unordered_map<std::string, camera3::ZoomRatioMapper>& zoomRatioMappers,
+            const std::unordered_map<std::string, camera3::RotateAndCropMapper>&
+                rotateAndCropMappers) :
             mTagMonitor(tagMonitor), mVendorTagId(vendorTagId),
             mUseHalBufManager(useHalBufManager), mNeedFixupMonochromeTags(needFixupMonochromeTags),
             mUsePartialResult(usePartialResult), mNumPartialResults(numPartialResults),
@@ -75,7 +78,8 @@
             mDeviceInfo(deviceInfo),
             mPhysicalDeviceInfoMap(physicalDeviceInfoMap),
             mDistortionMappers(distortionMappers),
-            mZoomRatioMappers(zoomRatioMappers) {}
+            mZoomRatioMappers(zoomRatioMappers),
+            mRotateAndCropMappers(rotateAndCropMappers) {}
 
     const TagMonitor& mTagMonitor;
     const metadata_vendor_id_t mVendorTagId;
@@ -106,6 +110,8 @@
     const std::unordered_map<std::string, camera3::DistortionMapper>& mDistortionMappers;
 
     const std::unordered_map<std::string, camera3::ZoomRatioMapper>& mZoomRatioMappers;
+
+    const std::unordered_map<std::string, camera3::RotateAndCropMapper>& mRotateAndCropMappers;
 };
 
 /**
@@ -228,6 +234,8 @@
 
     std::unordered_map<std::string, camera3::ZoomRatioMapper> mZoomRatioMappers;
 
+    std::unordered_map<std::string, camera3::RotateAndCropMapper> mRotateAndCropMappers;
+
     mutable std::mutex mLock;
 
     enum Status {