Merge pie-platform-release to aosp-master - DO NOT MERGE

Change-Id: Ib7c4eeace0e98f45c6dab1d6e0aea24b26ea917d
diff --git a/Android.bp b/Android.bp
index 4766b71..ce4214e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,7 +16,17 @@
     ],
 
     export_include_dirs: ["include"],
+    recovery_available: true,
     vendor_available: true,
+    target: {
+        recovery: {
+            exclude_header_libs: [
+                "libaudio_system_headers",
+                "libbluetooth-types-header",
+            ],
+        },
+    },
+
 }
 
 cc_library_shared {
@@ -38,9 +48,15 @@
     header_libs: ["libhardware_headers"],
     export_header_lib_headers: ["libhardware_headers"],
 
+    recovery_available: true,
     vendor_available: true,
     vndk: {
         enabled: true,
         support_system_process: true,
     },
+    target: {
+        recovery: {
+            exclude_shared_libs: ["libvndksupport"],
+        },
+    },
 }
diff --git a/hardware.c b/hardware.c
index 77cfd8d..40ae1d1 100644
--- a/hardware.c
+++ b/hardware.c
@@ -29,7 +29,9 @@
 #define LOG_TAG "HAL"
 #include <log/log.h>
 
+#if !defined(__ANDROID_RECOVERY__)
 #include <vndksupport/linker.h>
+#endif
 
 /** Base path of the hal modules */
 #if defined(__LP64__)
@@ -94,7 +96,11 @@
          */
         handle = dlopen(path, RTLD_NOW);
     } else {
+#if defined(__ANDROID_RECOVERY__)
+        handle = dlopen(path, RTLD_NOW);
+#else
         handle = android_load_sphal_library(path, RTLD_NOW);
+#endif
     }
     if (handle == NULL) {
         char const *err_str = dlerror();
@@ -133,7 +139,7 @@
         }
     } else {
         ALOGV("loaded HAL id=%s path=%s hmi=%p handle=%p",
-                id, path, *pHmi, handle);
+                id, path, hmi, handle);
     }
 
     *pHmi = hmi;
diff --git a/modules/camera/3_4/Android.mk b/modules/camera/3_4/Android.mk
index 6ecedac..3395b5b 100644
--- a/modules/camera/3_4/Android.mk
+++ b/modules/camera/3_4/Android.mk
@@ -36,7 +36,7 @@
   libyuv_static \
   libjpeg_static_ndk \
 
-v4l2_cflags := -fno-short-enums -Wall -Wno-error -Wextra -fvisibility=hidden -DHAVE_JPEG
+v4l2_cflags := -fno-short-enums -Wall -Wextra -Werror -fvisibility=hidden -DHAVE_JPEG
 
 v4l2_c_includes := $(call include-path-for, camera) \
   external/libyuv/files/include \
diff --git a/modules/camera/3_4/camera.cpp b/modules/camera/3_4/camera.cpp
index 79dca0b..387134f 100644
--- a/modules/camera/3_4/camera.cpp
+++ b/modules/camera/3_4/camera.cpp
@@ -16,6 +16,9 @@
 
 // Modified from hardware/libhardware/modules/camera/Camera.cpp
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera"
+
 #include <cstdlib>
 #include <memory>
 #include <vector>
@@ -28,8 +31,6 @@
 
 #include "metadata/metadata_common.h"
 
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Camera"
 #include <cutils/log.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
@@ -343,7 +344,7 @@
 
     // Pre-process output buffers.
     if (request->output_buffers.size() <= 0) {
-        ALOGE("%s:%d: Invalid number of output buffers: %d", __func__, mId,
+        ALOGE("%s:%d: Invalid number of output buffers: %zu", __func__, mId,
               request->output_buffers.size());
         return -EINVAL;
     }
@@ -433,7 +434,7 @@
         completeRequestWithError(request);
     }
 
-    ALOGV("%s:%d: Flushed %u requests.", __func__, mId, requests.size());
+    ALOGV("%s:%d: Flushed %zu requests.", __func__, mId, requests.size());
 
     // Call down into the device flushing.
     return flushBuffers();
@@ -503,7 +504,10 @@
         static_cast<uint32_t>(request->output_buffers.size()),
         request->output_buffers.data(),
         request->input_buffer.get(),
-        1  // Total result; only 1 part.
+        1,  // Total result; only 1 part.
+        0,  // Number of physical camera metadata.
+        nullptr,
+        nullptr
     };
     // Make the framework callback.
     mCallbackOps->process_capture_result(mCallbackOps, &result);
diff --git a/modules/camera/3_4/common.h b/modules/camera/3_4/common.h
index ca5151d..48cf2bd 100644
--- a/modules/camera/3_4/common.h
+++ b/modules/camera/3_4/common.h
@@ -17,11 +17,8 @@
 #ifndef V4L2_CAMERA_HAL_COMMON_H_
 #define V4L2_CAMERA_HAL_COMMON_H_
 
-// #define LOG_NDEBUG 0
 #include <cutils/log.h>
 
-#define LOG_TAG "V4L2CameraHAL"
-
 // Helpers of logging (showing function name and line number).
 #define HAL_LOGE(fmt, args...) do { \
     ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args);   \
@@ -59,11 +56,4 @@
 #define HAL_LOG_ENTER() HAL_LOGV("enter")
 #define HAL_LOG_EXIT() HAL_LOGV("exit")
 
-// Fix confliction in case it's defined elsewhere.
-#ifndef DISALLOW_COPY_AND_ASSIGN
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&);  \
-  void operator=(const TypeName&);
-#endif
-
 #endif  // V4L2_CAMERA_HAL_COMMON_H_
diff --git a/modules/camera/3_4/format_metadata_factory.cpp b/modules/camera/3_4/format_metadata_factory.cpp
index db03678..5eed134 100644
--- a/modules/camera/3_4/format_metadata_factory.cpp
+++ b/modules/camera/3_4/format_metadata_factory.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "FormatMetadataFactory"
+
 #include "format_metadata_factory.h"
 
 #include "arc/image_processor.h"
@@ -101,7 +104,7 @@
     return res;
   }
 
-  HAL_LOGI("Supports %d qualified formats.", qualified_formats.size());
+  HAL_LOGI("Supports %zu qualified formats.", qualified_formats.size());
 
   // Find sizes and frame/stall durations for all formats.
   // We also want to find the smallest max frame duration amongst all formats,
diff --git a/modules/camera/3_4/metadata/boottime_state_delegate.cpp b/modules/camera/3_4/metadata/boottime_state_delegate.cpp
index 5024cb2..3508e85 100644
--- a/modules/camera/3_4/metadata/boottime_state_delegate.cpp
+++ b/modules/camera/3_4/metadata/boottime_state_delegate.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "BoottimeStateDelegate"
+
 #include <errno.h>
 #include <string.h>
 
diff --git a/modules/camera/3_4/metadata/control.h b/modules/camera/3_4/metadata/control.h
index ad3f87b..902a60c 100644
--- a/modules/camera/3_4/metadata/control.h
+++ b/modules/camera/3_4/metadata/control.h
@@ -19,9 +19,9 @@
 
 #include <vector>
 
+#include <android-base/macros.h>
 #include <system/camera_metadata.h>
 
-#include "../common.h"
 #include "metadata_common.h"
 #include "partial_metadata_interface.h"
 #include "tagged_control_delegate.h"
diff --git a/modules/camera/3_4/metadata/enum_converter.cpp b/modules/camera/3_4/metadata/enum_converter.cpp
index d5e0a87..14da006 100644
--- a/modules/camera/3_4/metadata/enum_converter.cpp
+++ b/modules/camera/3_4/metadata/enum_converter.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "EnumConverter"
+
 #include "enum_converter.h"
 
 #include <errno.h>
diff --git a/modules/camera/3_4/metadata/enum_converter.h b/modules/camera/3_4/metadata/enum_converter.h
index df5cabb..83f4daa 100644
--- a/modules/camera/3_4/metadata/enum_converter.h
+++ b/modules/camera/3_4/metadata/enum_converter.h
@@ -19,7 +19,8 @@
 
 #include <map>
 
-#include "../common.h"
+#include <android-base/macros.h>
+
 #include "converter_interface.h"
 
 namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/ignored_control_delegate.h b/modules/camera/3_4/metadata/ignored_control_delegate.h
index f1d5da1..dce457b 100644
--- a/modules/camera/3_4/metadata/ignored_control_delegate.h
+++ b/modules/camera/3_4/metadata/ignored_control_delegate.h
@@ -32,7 +32,7 @@
     *value = value_;
     return 0;
   };
-  int SetValue(const T& value) override { return 0; };
+  int SetValue(const T& /*value*/) override { return 0; };
 
  private:
   const T value_;
diff --git a/modules/camera/3_4/metadata/map_converter.h b/modules/camera/3_4/metadata/map_converter.h
index b1734b5..2324d74 100644
--- a/modules/camera/3_4/metadata/map_converter.h
+++ b/modules/camera/3_4/metadata/map_converter.h
@@ -22,7 +22,8 @@
 #include <map>
 #include <memory>
 
-#include "../common.h"
+#include <android-base/macros.h>
+
 #include "converter_interface.h"
 
 namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata.cpp b/modules/camera/3_4/metadata/metadata.cpp
index efc9959..c5106c7 100644
--- a/modules/camera/3_4/metadata/metadata.cpp
+++ b/modules/camera/3_4/metadata/metadata.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Metadata"
+
 #include "metadata.h"
 
 #include <camera/CameraMetadata.h>
diff --git a/modules/camera/3_4/metadata/metadata.h b/modules/camera/3_4/metadata/metadata.h
index e2232b5..615b589 100644
--- a/modules/camera/3_4/metadata/metadata.h
+++ b/modules/camera/3_4/metadata/metadata.h
@@ -19,10 +19,10 @@
 
 #include <set>
 
+#include <android-base/macros.h>
 #include <camera/CameraMetadata.h>
 #include <hardware/camera3.h>
 
-#include "../common.h"
 #include "metadata_common.h"
 
 namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata_common.h b/modules/camera/3_4/metadata/metadata_common.h
index 34b7777..52fb3ea 100644
--- a/modules/camera/3_4/metadata/metadata_common.h
+++ b/modules/camera/3_4/metadata/metadata_common.h
@@ -120,32 +120,41 @@
 // A helper for other methods in this file.
 // Gets the data pointer of a given metadata entry into |*val|.
 
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <typename T>
+inline void GetDataPointer(camera_metadata_ro_entry_t&, const T**);
+
+template <>
+inline void GetDataPointer<uint8_t>(camera_metadata_ro_entry_t& entry,
                            const uint8_t** val) {
   *val = entry.data.u8;
 }
 
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<int32_t>(camera_metadata_ro_entry_t& entry,
                            const int32_t** val) {
   *val = entry.data.i32;
 }
 
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<float>(camera_metadata_ro_entry_t& entry,
                            const float** val) {
   *val = entry.data.f;
 }
 
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<int64_t>(camera_metadata_ro_entry_t& entry,
                            const int64_t** val) {
   *val = entry.data.i64;
 }
 
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<double>(camera_metadata_ro_entry_t& entry,
                            const double** val) {
   *val = entry.data.d;
 }
 
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<camera_metadata_rational_t>(camera_metadata_ro_entry_t& entry,
                            const camera_metadata_rational_t** val) {
   *val = entry.data.r;
 }
@@ -180,7 +189,7 @@
   } else if (entry.count != 1) {
     HAL_LOGE(
         "Error: expected metadata tag %d to contain exactly 1 value "
-        "(had %d).",
+        "(had %zu).",
         tag,
         entry.count);
     return -EINVAL;
@@ -211,7 +220,7 @@
   } else if (entry.count != N) {
     HAL_LOGE(
         "Error: expected metadata tag %d to contain a single array of "
-        "exactly %d values (had %d).",
+        "exactly %zu values (had %zu).",
         tag,
         N,
         entry.count);
@@ -284,7 +293,7 @@
   if (entry.count % N != 0) {
     HAL_LOGE(
         "Error: expected metadata tag %d to contain a vector of arrays of "
-        "length %d (had %d entries, which is not divisible by %d).",
+        "length %zu (had %zu entries, which is not divisible by %zu).",
         tag,
         N,
         entry.count,
diff --git a/modules/camera/3_4/metadata/metadata_reader.cpp b/modules/camera/3_4/metadata/metadata_reader.cpp
index fe2ff85..6a25127 100644
--- a/modules/camera/3_4/metadata/metadata_reader.cpp
+++ b/modules/camera/3_4/metadata/metadata_reader.cpp
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
-#include "metadata_reader.h"
-
 // #define LOG_NDEBUG 0
 #define LOG_TAG "MetadataReader"
+
+#include "metadata_reader.h"
+
 #include <cutils/log.h>
 #include <system/camera.h>
 
@@ -200,9 +201,9 @@
     }
     // Must have a non-negative stall.
     if (stall.duration < 0) {
-      ALOGE("%s: Invalid stall duration: negative stall %d.",
+      ALOGE("%s: Invalid stall duration: negative stall %lld.",
             __func__,
-            stall.duration);
+            static_cast<long long>(stall.duration));
       return -EINVAL;
     }
     // TODO(b/31384253): YUV_420_888, RAW10, RAW12, RAW_OPAQUE,
diff --git a/modules/camera/3_4/metadata/metadata_reader.h b/modules/camera/3_4/metadata/metadata_reader.h
index 996bf8b..8e05079 100644
--- a/modules/camera/3_4/metadata/metadata_reader.h
+++ b/modules/camera/3_4/metadata/metadata_reader.h
@@ -22,9 +22,9 @@
 #include <set>
 #include <vector>
 
+#include <android-base/macros.h>
 #include <camera/CameraMetadata.h>
 
-#include "../common.h"
 #include "types.h"
 
 namespace default_camera_hal {
diff --git a/modules/camera/3_4/metadata/property.h b/modules/camera/3_4/metadata/property.h
index 6884c7d..6a542b2 100644
--- a/modules/camera/3_4/metadata/property.h
+++ b/modules/camera/3_4/metadata/property.h
@@ -41,22 +41,22 @@
   };
 
   virtual int PopulateDynamicFields(
-      android::CameraMetadata* metadata) const override {
+      android::CameraMetadata* /*metadata*/) const override {
     return 0;
   };
 
   virtual int PopulateTemplateRequest(
-      int template_type, android::CameraMetadata* metadata) const override {
+      int /*template_type*/, android::CameraMetadata* /*metadata*/) const override {
     return 0;
   };
 
   virtual bool SupportsRequestValues(
-      const android::CameraMetadata& metadata) const override {
+      const android::CameraMetadata& /*metadata*/) const override {
     return true;
   };
 
   virtual int SetRequestValues(
-      const android::CameraMetadata& metadata) override {
+      const android::CameraMetadata& /*metadata*/) override {
     return 0;
   };
 
diff --git a/modules/camera/3_4/metadata/ranged_converter.h b/modules/camera/3_4/metadata/ranged_converter.h
index 115ac2a..bc48767 100644
--- a/modules/camera/3_4/metadata/ranged_converter.h
+++ b/modules/camera/3_4/metadata/ranged_converter.h
@@ -19,7 +19,8 @@
 
 #include <memory>
 
-#include "../common.h"
+#include <android-base/macros.h>
+
 #include "converter_interface.h"
 
 namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/state.h b/modules/camera/3_4/metadata/state.h
index 54f66e4..13f2ea5 100644
--- a/modules/camera/3_4/metadata/state.h
+++ b/modules/camera/3_4/metadata/state.h
@@ -54,7 +54,7 @@
 // -----------------------------------------------------------------------------
 
 template <typename T>
-int State<T>::PopulateStaticFields(android::CameraMetadata* metadata) const {
+int State<T>::PopulateStaticFields(android::CameraMetadata* /*metadata*/) const {
   HAL_LOG_ENTER();
   return 0;
 }
@@ -72,21 +72,21 @@
 };
 
 template <typename T>
-int State<T>::PopulateTemplateRequest(int template_type,
-                                      android::CameraMetadata* metadata) const {
+int State<T>::PopulateTemplateRequest(int /*template_type*/,
+                                      android::CameraMetadata* /*metadata*/) const {
   HAL_LOG_ENTER();
   return 0;
 };
 
 template <typename T>
 bool State<T>::SupportsRequestValues(
-    const android::CameraMetadata& metadata) const {
+    const android::CameraMetadata& /*metadata*/) const {
   HAL_LOG_ENTER();
   return true;
 };
 
 template <typename T>
-int State<T>::SetRequestValues(const android::CameraMetadata& metadata) {
+int State<T>::SetRequestValues(const android::CameraMetadata& /*metadata*/) {
   HAL_LOG_ENTER();
   return 0;
 };
diff --git a/modules/camera/3_4/request_tracker.cpp b/modules/camera/3_4/request_tracker.cpp
index 09f634d..f92d254 100644
--- a/modules/camera/3_4/request_tracker.cpp
+++ b/modules/camera/3_4/request_tracker.cpp
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
-#include "request_tracker.h"
-
 // #define LOG_NDEBUG 0
 #define LOG_TAG "RequestTracker"
+
+#include "request_tracker.h"
+
 #include <cutils/log.h>
 
 namespace default_camera_hal {
@@ -50,7 +51,7 @@
   for (const auto& output_buffer : request.output_buffers) {
     result.insert(output_buffer.stream);
   }
-  return std::move(result);
+  return result;
 }
 
 bool RequestTracker::Add(std::shared_ptr<CaptureRequest> request) {
@@ -127,7 +128,6 @@
 
   // Check that each stream has space
   // (which implicitly checks if it is configured).
-  bool result = true;
   for (const auto stream : RequestStreams(request)) {
     if (StreamFull(stream)) {
       ALOGE("%s: Stream %p is full.", __func__, stream);
diff --git a/modules/camera/3_4/request_tracker.h b/modules/camera/3_4/request_tracker.h
index a632a61..e0bb4b5 100644
--- a/modules/camera/3_4/request_tracker.h
+++ b/modules/camera/3_4/request_tracker.h
@@ -22,9 +22,9 @@
 #include <set>
 
 #include <hardware/camera3.h>
+#include <android-base/macros.h>
 
 #include "capture_request.h"
-#include "common.h"
 
 namespace default_camera_hal {
 
diff --git a/modules/camera/3_4/request_tracker_test.cpp b/modules/camera/3_4/request_tracker_test.cpp
index 8b73bd8..001ba78 100644
--- a/modules/camera/3_4/request_tracker_test.cpp
+++ b/modules/camera/3_4/request_tracker_test.cpp
@@ -35,7 +35,11 @@
     stream2_.max_buffers = 3;
     dut_.reset(new RequestTracker());
     streams_ = {&stream1_, &stream2_};
-    camera3_stream_configuration_t config{static_cast<uint32_t>(streams_.size()), streams_.data(), 0};
+    camera3_stream_configuration_t config{
+        static_cast<uint32_t>(streams_.size()),
+        streams_.data(),
+        0,
+        nullptr};
     dut_->SetStreamConfiguration(config);
   }
 
diff --git a/modules/camera/3_4/static_properties.cpp b/modules/camera/3_4/static_properties.cpp
index 5be9dcd..0e8ba23 100644
--- a/modules/camera/3_4/static_properties.cpp
+++ b/modules/camera/3_4/static_properties.cpp
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
-#include "static_properties.h"
-
 // #define LOG_NDEBUG 0
 #define LOG_TAG "StaticProperties"
+
+#include "static_properties.h"
+
 #include <cutils/log.h>
 #include <hardware/camera3.h>
 #include <system/camera.h>
@@ -276,11 +277,11 @@
   for (size_t i = 0; i < stream_config->num_streams; ++i) {
     const camera3_stream_t* stream = stream_config->streams[i];
     if (stream == nullptr) {
-      ALOGE("%s: Stream %d is null", __func__, i);
+      ALOGE("%s: Stream %zu is null", __func__, i);
       return false;
     } else if (!IsInputType(stream->stream_type) &&
                !IsOutputType(stream->stream_type)) {
-      ALOGE("%s: Stream %d type %d is neither an input nor an output type",
+      ALOGE("%s: Stream %zu type %d is neither an input nor an output type",
             __func__,
             i,
             stream->stream_type);
@@ -294,7 +295,7 @@
 bool StaticProperties::InputStreamsSupported(
     const camera3_stream_configuration_t* stream_config) {
   // Find the input stream(s).
-  size_t num_input_streams = 0;
+  int32_t num_input_streams = 0;
   int input_format = -1;
   for (size_t i = 0; i < stream_config->num_streams; ++i) {
     const camera3_stream_t* stream = stream_config->streams[i];
@@ -370,10 +371,10 @@
 bool StaticProperties::OutputStreamsSupported(
     const camera3_stream_configuration_t* stream_config) {
   // Find and count output streams.
-  size_t num_raw = 0;
-  size_t num_stalling = 0;
-  size_t num_non_stalling = 0;
-  for (int i = 0; i < stream_config->num_streams; ++i) {
+  int32_t num_raw = 0;
+  int32_t num_stalling = 0;
+  int32_t num_non_stalling = 0;
+  for (size_t i = 0; i < stream_config->num_streams; ++i) {
     const camera3_stream_t* stream = stream_config->streams[i];
     if (IsOutputType(stream->stream_type)) {
       // Check that this stream is valid as an output.
@@ -413,7 +414,7 @@
   } else if (num_stalling > max_stalling_output_streams_) {
     ALOGE(
         "%s: Requested stream configuration exceeds maximum supported "
-        "stalling output streams %d (requested %d).",
+        "stalling output streams %d (requested %u).",
         __func__,
         max_stalling_output_streams_,
         num_stalling);
diff --git a/modules/camera/3_4/static_properties_test.cpp b/modules/camera/3_4/static_properties_test.cpp
index 2cdb9d4..13b9e96 100644
--- a/modules/camera/3_4/static_properties_test.cpp
+++ b/modules/camera/3_4/static_properties_test.cpp
@@ -94,10 +94,12 @@
     } else if (input) {
       type = CAMERA3_STREAM_INPUT;
     }
-    return {static_cast<int>(type),
-            static_cast<uint32_t>(width),
-            static_cast<uint32_t>(height),
-            static_cast<int>(format)};
+    camera3_stream_t stream;
+    stream.stream_type = type;
+    stream.width = width;
+    stream.height = height;
+    stream.format = format;
+    return stream;
   }
 
   void ExpectConfigurationSupported(std::vector<camera3_stream_t>& streams,
@@ -109,7 +111,8 @@
     camera3_stream_configuration_t config = {
         static_cast<uint32_t>(stream_addresses.size()),
         stream_addresses.data(),
-        CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+        CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
+        nullptr};
     PrepareDefaultDUT();
     EXPECT_EQ(dut_->StreamConfigurationSupported(&config), expected);
   }
@@ -435,7 +438,7 @@
 TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) {
   std::vector<camera3_stream_t*> streams(1);
   camera3_stream_configuration_t config = {
-      0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+      0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
   PrepareDefaultDUT();
   EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
 }
@@ -443,7 +446,10 @@
 TEST_F(StaticPropertiesTest, ConfigureNullStreams) {
   std::vector<camera3_stream_t*> streams(2, nullptr);
   camera3_stream_configuration_t config = {
-      static_cast<uint32_t>(streams.size()), streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+      static_cast<uint32_t>(streams.size()),
+      streams.data(),
+      CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
+      nullptr};
   PrepareDefaultDUT();
   EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
 }
@@ -451,7 +457,7 @@
 TEST_F(StaticPropertiesTest, ConfigureNullStreamVector) {
   // Even if the camera claims to have multiple streams, check for null.
   camera3_stream_configuration_t config = {
-      3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+      3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
   PrepareDefaultDUT();
   EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
 }
@@ -616,7 +622,8 @@
   camera3_stream_configuration_t config = {
       1,
       &stream_address,
-      99  // Not a valid operation mode.
+      99, // Not a valid operation mode.
+      nullptr
   };
   PrepareDefaultDUT();
   EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
diff --git a/modules/camera/3_4/stream_format.cpp b/modules/camera/3_4/stream_format.cpp
index 5f35e42..401a2f0 100644
--- a/modules/camera/3_4/stream_format.cpp
+++ b/modules/camera/3_4/stream_format.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "StreamFormat"
+
 #include "stream_format.h"
 
 #include <linux/videodev2.h>
@@ -41,8 +44,7 @@
       v4l2_pixel_format_(StreamFormat::HalToV4L2PixelFormat(format)),
       width_(width),
       height_(height),
-      bytes_per_line_(0),
-      min_buffer_size_(0) {}
+      bytes_per_line_(0) {}
 
 StreamFormat::StreamFormat(const v4l2_format& format)
     : type_(format.type),
@@ -50,16 +52,14 @@
       v4l2_pixel_format_(format.fmt.pix.pixelformat),
       width_(format.fmt.pix.width),
       height_(format.fmt.pix.height),
-      bytes_per_line_(format.fmt.pix.bytesperline),
-      min_buffer_size_(format.fmt.pix.sizeimage) {}
+      bytes_per_line_(format.fmt.pix.bytesperline) {}
 
 StreamFormat::StreamFormat(const arc::SupportedFormat& format)
     : type_(V4L2_BUF_TYPE_VIDEO_CAPTURE),
       v4l2_pixel_format_(format.fourcc),
       width_(format.width),
       height_(format.height),
-      bytes_per_line_(0),
-      min_buffer_size_(0) {}
+      bytes_per_line_(0) {}
 
 void StreamFormat::FillFormatRequest(v4l2_format* format) const {
   memset(format, 0, sizeof(*format));
diff --git a/modules/camera/3_4/stream_format.h b/modules/camera/3_4/stream_format.h
index 720e380..82ec440 100644
--- a/modules/camera/3_4/stream_format.h
+++ b/modules/camera/3_4/stream_format.h
@@ -78,7 +78,6 @@
   uint32_t width_;
   uint32_t height_;
   uint32_t bytes_per_line_;
-  uint32_t min_buffer_size_;
 };
 
 }  // namespace v4l2_camera_hal
diff --git a/modules/camera/3_4/v4l2_camera.cpp b/modules/camera/3_4/v4l2_camera.cpp
index 98b8062..558b453 100644
--- a/modules/camera/3_4/v4l2_camera.cpp
+++ b/modules/camera/3_4/v4l2_camera.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2Camera"
+
 #include "v4l2_camera.h"
 
 #include <fcntl.h>
@@ -36,18 +39,6 @@
 
 namespace v4l2_camera_hal {
 
-// Helper function for managing metadata.
-static std::vector<int32_t> getMetadataKeys(const camera_metadata_t* metadata) {
-  std::vector<int32_t> keys;
-  size_t num_entries = get_camera_metadata_entry_count(metadata);
-  for (size_t i = 0; i < num_entries; ++i) {
-    camera_metadata_ro_entry_t entry;
-    get_camera_metadata_ro_entry(metadata, i, &entry);
-    keys.push_back(entry.tag);
-  }
-  return keys;
-}
-
 V4L2Camera* V4L2Camera::NewV4L2Camera(int id, const std::string path) {
   HAL_LOG_ENTER();
 
@@ -73,12 +64,12 @@
     : default_camera_hal::Camera(id),
       device_(std::move(v4l2_wrapper)),
       metadata_(std::move(metadata)),
-      max_input_streams_(0),
-      max_output_streams_({{0, 0, 0}}),
       buffer_enqueuer_(new FunctionThread(
           std::bind(&V4L2Camera::enqueueRequestBuffers, this))),
       buffer_dequeuer_(new FunctionThread(
-          std::bind(&V4L2Camera::dequeueRequestBuffers, this))) {
+          std::bind(&V4L2Camera::dequeueRequestBuffers, this))),
+      max_input_streams_(0),
+      max_output_streams_({{0, 0, 0}}) {
   HAL_LOG_ENTER();
 }
 
diff --git a/modules/camera/3_4/v4l2_camera_hal.cpp b/modules/camera/3_4/v4l2_camera_hal.cpp
index 83746ce..386160f 100644
--- a/modules/camera/3_4/v4l2_camera_hal.cpp
+++ b/modules/camera/3_4/v4l2_camera_hal.cpp
@@ -16,6 +16,9 @@
 
 // Modified from hardware/libhardware/modules/camera/CameraHAL.cpp
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2CameraHAL"
+
 #include "v4l2_camera_hal.h"
 
 #include <dirent.h>
@@ -112,13 +115,13 @@
 }
 
 int V4L2CameraHAL::getNumberOfCameras() {
-  HAL_LOGV("returns %d", mCameras.size());
+  HAL_LOGV("returns %zu", mCameras.size());
   return mCameras.size();
 }
 
 int V4L2CameraHAL::getCameraInfo(int id, camera_info_t* info) {
   HAL_LOG_ENTER();
-  if (id < 0 || id >= mCameras.size()) {
+  if (id < 0 || static_cast<size_t>(id) >= mCameras.size()) {
     return -EINVAL;
   }
   // TODO(b/29185945): Hotplugging: return -EINVAL if unplugged.
@@ -131,22 +134,22 @@
   return 0;
 }
 
-void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* ops) {
+void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* /*ops*/) {
   HAL_LOG_ENTER();
   // No vendor ops for this HAL. From <hardware/camera_common.h>:
   // "leave ops unchanged if no vendor tags are defined."
 }
 
-int V4L2CameraHAL::openLegacy(const hw_module_t* module,
-                              const char* id,
-                              uint32_t halVersion,
-                              hw_device_t** device) {
+int V4L2CameraHAL::openLegacy(const hw_module_t* /*module*/,
+                              const char* /*id*/,
+                              uint32_t /*halVersion*/,
+                              hw_device_t** /*device*/) {
   HAL_LOG_ENTER();
   // Not supported.
   return -ENOSYS;
 }
 
-int V4L2CameraHAL::setTorchMode(const char* camera_id, bool enabled) {
+int V4L2CameraHAL::setTorchMode(const char* /*camera_id*/, bool /*enabled*/) {
   HAL_LOG_ENTER();
   // TODO(b/29158098): HAL is required to respond appropriately if
   // the desired camera actually does support flash.
diff --git a/modules/camera/3_4/v4l2_metadata_factory.cpp b/modules/camera/3_4/v4l2_metadata_factory.cpp
index bc8806f..535f562 100644
--- a/modules/camera/3_4/v4l2_metadata_factory.cpp
+++ b/modules/camera/3_4/v4l2_metadata_factory.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2MetadataFactory"
+
 #include "v4l2_metadata_factory.h"
 
 #include <camera/CameraMetadata.h>
diff --git a/modules/camera/3_4/v4l2_wrapper.cpp b/modules/camera/3_4/v4l2_wrapper.cpp
index d715e7e..bba826f 100644
--- a/modules/camera/3_4/v4l2_wrapper.cpp
+++ b/modules/camera/3_4/v4l2_wrapper.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2Wrapper"
+
 #include "v4l2_wrapper.h"
 
 #include <algorithm>
@@ -126,7 +129,7 @@
 
 // Helper function. Should be used instead of ioctl throughout this class.
 template <typename T>
-int V4L2Wrapper::IoctlLocked(int request, T data) {
+int V4L2Wrapper::IoctlLocked(unsigned long request, T data) {
   // Potentially called so many times logging entry is a bad idea.
   std::lock_guard<std::mutex> lock(device_lock_);
 
diff --git a/modules/camera/3_4/v4l2_wrapper.h b/modules/camera/3_4/v4l2_wrapper.h
index 4a8d517..dcb8afe 100644
--- a/modules/camera/3_4/v4l2_wrapper.h
+++ b/modules/camera/3_4/v4l2_wrapper.h
@@ -99,7 +99,7 @@
   void Disconnect();
   // Perform an ioctl call in a thread-safe fashion.
   template <typename T>
-  int IoctlLocked(int request, T data);
+  int IoctlLocked(unsigned long request, T data);
   // Request/release userspace buffer mode via VIDIOC_REQBUFS.
   int RequestBuffers(uint32_t num_buffers);
 
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp
index 214d97c..489cdf4 100644
--- a/modules/sensors/dynamic_sensor/Android.bp
+++ b/modules/sensors/dynamic_sensor/Android.bp
@@ -22,6 +22,8 @@
         "-Wall",
         "-Werror",
         "-Wextra",
+        // Allow implicit fallthroughs in HidRawSensor.cpp until they are fixed.
+        "-Wno-error=implicit-fallthrough",
     ],
     export_include_dirs: ["."],