Camera: Use capture result metadata to override EXIF

Use static and dynamic metadata to override Exif tags.

Also added back a missing ATRACE_ASYNC_ENDs statement.

Test: Camera CTS
Test: ERROR_BUFFER of internal streams is propagated to app
Test: ERROR_RESULT only results in EXIF not being overridden
Bug: 124066183
Change-Id: Id2c69c6bee04ae724ff5f190b2dd96d0159700c9
diff --git a/services/camera/libcameraservice/api2/HeicCompositeStream.h b/services/camera/libcameraservice/api2/HeicCompositeStream.h
index 0a76256..4cd9af0 100644
--- a/services/camera/libcameraservice/api2/HeicCompositeStream.h
+++ b/services/camera/libcameraservice/api2/HeicCompositeStream.h
@@ -77,7 +77,7 @@
 
     bool threadLoop() override;
     bool onStreamBufferError(const CaptureResultExtras& resultExtras) override;
-    void onResultError(const CaptureResultExtras& /*resultExtras*/) override {}
+    void onResultError(const CaptureResultExtras& resultExtras) override;
 
 private:
     //
@@ -145,12 +145,13 @@
         int32_t                   orientation;
         int32_t                   quality;
 
-        CpuConsumer::LockedBuffer     appSegmentBuffer;
+        CpuConsumer::LockedBuffer          appSegmentBuffer;
         std::vector<CodecOutputBufferInfo> codecOutputBuffers;
+        std::unique_ptr<CameraMetadata>    result;
 
         // Fields that are only applicable to HEVC tiling.
-        CpuConsumer::LockedBuffer     yuvBuffer;
-        std::vector<CodecInputBufferInfo> codecInputBuffers;
+        CpuConsumer::LockedBuffer          yuvBuffer;
+        std::vector<CodecInputBufferInfo>  codecInputBuffers;
 
         bool                      error;
         bool                      errorNotified;
@@ -209,6 +210,7 @@
     sp<Surface>       mAppSegmentSurface;
     bool              mAppSegmentBufferAcquired;
     size_t            mAppSegmentMaxSize;
+    CameraMetadata    mStaticInfo;
 
     int               mMainImageStreamId, mMainImageSurfaceId;
     sp<Surface>       mMainImageSurface;