Merge "camera: remove redundant and unnecessary includes"
diff --git a/modules/camera/3_4/Android.mk b/modules/camera/3_4/Android.mk
index 3395b5b..ae408fa 100644
--- a/modules/camera/3_4/Android.mk
+++ b/modules/camera/3_4/Android.mk
@@ -97,6 +97,10 @@
 
 LOCAL_C_INCLUDES += $(v4l2_c_includes)
 LOCAL_SRC_FILES := $(v4l2_src_files)
+
+# Remove when libjpeg_static_ndk is XOM compatible
+LOCAL_XOM := false
+
 include $(BUILD_SHARED_LIBRARY)
 
 # Unit tests for V4L2 Camera HAL.
@@ -115,6 +119,9 @@
   $(v4l2_src_files) \
   $(v4l2_test_files) \
 
+# Remove when libjpeg_static_ndk is XOM compatible
+LOCAL_XOM := false
+
 include $(BUILD_NATIVE_TEST)
 
 endif # USE_CAMERA_V4L2_HAL
diff --git a/modules/camera/3_4/arc/cached_frame.cpp b/modules/camera/3_4/arc/cached_frame.cpp
index e7c6508..1c33d85 100644
--- a/modules/camera/3_4/arc/cached_frame.cpp
+++ b/modules/camera/3_4/arc/cached_frame.cpp
@@ -17,7 +17,8 @@
 CachedFrame::CachedFrame()
     : source_frame_(nullptr),
       cropped_buffer_capacity_(0),
-      yu12_frame_(new AllocatedFrameBuffer(0)) {}
+      yu12_frame_(new AllocatedFrameBuffer(0)),
+      scaled_frame_(new AllocatedFrameBuffer(0)) {}
 
 CachedFrame::~CachedFrame() { UnsetSource(); }
 
diff --git a/modules/camera/3_4/arc/image_processor.cpp b/modules/camera/3_4/arc/image_processor.cpp
index b2c7628..ee28c0b 100644
--- a/modules/camera/3_4/arc/image_processor.cpp
+++ b/modules/camera/3_4/arc/image_processor.cpp
@@ -85,6 +85,8 @@
     case V4L2_PIX_FMT_BGR32:
     case V4L2_PIX_FMT_RGB32:
       return width * height * 4;
+    case V4L2_PIX_FMT_JPEG:
+      return 0; // For JPEG real size will be calculated after conversion.
     default:
       LOGF(ERROR) << "Pixel format " << FormatToString(fourcc)
                   << " is unsupported.";
@@ -388,6 +390,9 @@
     return false;
   }
   size_t buffer_length = compressor.GetCompressedImageSize();
+  if (out_frame->SetDataSize(buffer_length)) {
+    return false;
+  }
   memcpy(out_frame->GetData(), compressor.GetCompressedImagePtr(),
          buffer_length);
   return true;
diff --git a/modules/input/evdev/InputHub.cpp b/modules/input/evdev/InputHub.cpp
index af7b28e..d22fc88 100644
--- a/modules/input/evdev/InputHub.cpp
+++ b/modules/input/evdev/InputHub.cpp
@@ -495,7 +495,7 @@
 
 status_t InputHub::unregisterDevicePath(const std::string& path) {
     int wd = -1;
-    for (auto pair : mWatchedPaths) {
+    for (const auto& pair : mWatchedPaths) {
         if (pair.second == path) {
             wd = pair.first;
             break;
@@ -781,7 +781,7 @@
 }
 
 status_t InputHub::closeNode(const InputDeviceNode* node) {
-    for (auto pair : mDeviceNodes) {
+    for (const auto& pair : mDeviceNodes) {
         if (pair.second.get() == node) {
             return closeNodeByFd(pair.first);
         }
@@ -801,7 +801,7 @@
 }
 
 std::shared_ptr<InputDeviceNode> InputHub::findNodeByPath(const std::string& path) {
-    for (auto pair : mDeviceNodes) {
+    for (const auto& pair : mDeviceNodes) {
         if (pair.second->getPath() == path) return pair.second;
     }
     return nullptr;
diff --git a/modules/sensors/OWNERS b/modules/sensors/OWNERS
index d4393d6..81099e8 100644
--- a/modules/sensors/OWNERS
+++ b/modules/sensors/OWNERS
@@ -1,2 +1,3 @@
 arthuri@google.com
 bduddie@google.com
+bstack@google.com
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: ["."],
 
diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.cpp b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
index a64d7a6..ae6ef47 100644
--- a/modules/sensors/dynamic_sensor/HidRawSensor.cpp
+++ b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
@@ -35,7 +35,7 @@
 HidRawSensor::HidRawSensor(
         SP(HidDevice) device, uint32_t usage, const std::vector<HidParser::ReportPacket> &packets)
         : mReportingStateId(-1), mPowerStateId(-1), mReportIntervalId(-1), mInputReportId(-1),
-        mEnabled(false), mSamplingPeriod(1000ll*1000*1000), mBatchingPeriod(0),
+        mEnabled(false), mSamplingPeriod(1000LL*1000*1000), mBatchingPeriod(0),
         mDevice(device), mValid(false) {
     if (device == nullptr) {
         return;