Merge "usb audio: check proxy_prepare() errors in opne_input_stream()" into oc-dev
am: 99d790b67a

Change-Id: I14d7412015b7c64dc6ffa94a1df0d0d26d622193
diff --git a/include/hardware/audio_alsaops.h b/include/hardware/audio_alsaops.h
index e994924..6a17a35 100644
--- a/include/hardware/audio_alsaops.h
+++ b/include/hardware/audio_alsaops.h
@@ -22,7 +22,8 @@
 #ifndef ANDROID_AUDIO_ALSAOPS_H
 #define ANDROID_AUDIO_ALSAOPS_H
 
-#include <cutils/log.h>
+#include <log/log.h>
+
 #include <system/audio.h>
 #include <tinyalsa/asoundlib.h>
 
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 5d69ab3..b706e8a 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -560,9 +560,6 @@
     /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
     int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
 
-    /* enable or disable bluetooth HCI snoop log */
-    int (*config_hci_snoop_log)(uint8_t enable);
-
     /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
       * This should be called immediately after a successful |init|.
       */
diff --git a/include/hardware/fingerprint.h b/include/hardware/fingerprint.h
index 6e08d6c..86ced9b 100644
--- a/include/hardware/fingerprint.h
+++ b/include/hardware/fingerprint.h
@@ -17,8 +17,8 @@
 #ifndef ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
 #define ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
 
-#include <hardware/hw_auth_token.h>
 #include <hardware/hardware.h>
+#include <hardware/hw_auth_token.h>
 
 #define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
 #define FINGERPRINT_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0)
diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c
index 43d13a9..8f73f11 100644
--- a/modules/audio/audio_hw.c
+++ b/modules/audio/audio_hw.c
@@ -21,13 +21,16 @@
 #include <malloc.h>
 #include <pthread.h>
 #include <stdint.h>
-#include <sys/time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
 
 #include <log/log.h>
 
+#include <hardware/audio.h>
 #include <hardware/hardware.h>
 #include <system/audio.h>
-#include <hardware/audio.h>
 
 struct stub_audio_device {
     struct audio_hw_device device;
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index d47cfba..6c538ce 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -26,9 +26,10 @@
 #include <sys/limits.h>
 
 #include <cutils/compiler.h>
-#include <cutils/log.h>
 #include <cutils/properties.h>
 #include <cutils/str_parms.h>
+#include <log/log.h>
+#include <utils/String8.h>
 
 #include <hardware/audio.h>
 #include <hardware/hardware.h>
@@ -39,8 +40,6 @@
 #include <media/nbaio/MonoPipe.h>
 #include <media/nbaio/MonoPipeReader.h>
 
-#include <utils/String8.h>
-
 #define LOG_STREAMS_TO_FILES 0
 #if LOG_STREAMS_TO_FILES
 #include <fcntl.h>
diff --git a/modules/camera/3_0/Camera.cpp b/modules/camera/3_0/Camera.cpp
index de3ae78..dc7ffa5 100644
--- a/modules/camera/3_0/Camera.cpp
+++ b/modules/camera/3_0/Camera.cpp
@@ -13,25 +13,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera"
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
 
 #include <cstdlib>
-#include <stdio.h>
+
+#include <log/log.h>
+#include <utils/Mutex.h>
+
+#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
+#include <utils/Trace.h>
+
 #include <hardware/camera3.h>
 #include <sync/sync.h>
 #include <system/camera_metadata.h>
 #include <system/graphics.h>
-#include <utils/Mutex.h>
 #include "CameraHAL.h"
 #include "Metadata.h"
 #include "Stream.h"
 
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Camera"
-#include <cutils/log.h>
-
-#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
-#include <utils/Trace.h>
-
 #include "Camera.h"
 
 #define CAMERA_SYNC_TIMEOUT 5000 // in msecs
diff --git a/modules/camera/3_0/CameraHAL.cpp b/modules/camera/3_0/CameraHAL.cpp
index e395ce5..2d1d763 100644
--- a/modules/camera/3_0/CameraHAL.cpp
+++ b/modules/camera/3_0/CameraHAL.cpp
@@ -13,20 +13,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+//#define LOG_NDEBUG 0
+#define LOG_TAG "DefaultCameraHAL"
 
 #include <cstdlib>
+
+#include <log/log.h>
+#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
+#include <cutils/trace.h>
+
 #include <hardware/camera_common.h>
 #include <hardware/hardware.h>
 #include "ExampleCamera.h"
 #include "VendorTags.h"
 
-//#define LOG_NDEBUG 0
-#define LOG_TAG "DefaultCameraHAL"
-#include <cutils/log.h>
-
-#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
-#include <cutils/trace.h>
-
 #include "CameraHAL.h"
 
 /*
diff --git a/modules/camera/3_0/ExampleCamera.cpp b/modules/camera/3_0/ExampleCamera.cpp
index d060d35..473cb60 100644
--- a/modules/camera/3_0/ExampleCamera.cpp
+++ b/modules/camera/3_0/ExampleCamera.cpp
@@ -13,17 +13,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-#include <system/camera_metadata.h>
-#include "Camera.h"
-
 //#define LOG_NDEBUG 0
 #define LOG_TAG "ExampleCamera"
-#include <cutils/log.h>
+
+#include <stdint.h>
+
+#include <log/log.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <system/camera_metadata.h>
+#include "Camera.h"
 #include "ExampleCamera.h"
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
diff --git a/modules/camera/3_0/Metadata.cpp b/modules/camera/3_0/Metadata.cpp
index 18e5239..440da5f 100644
--- a/modules/camera/3_0/Metadata.cpp
+++ b/modules/camera/3_0/Metadata.cpp
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Metadata"
 
 #include <system/camera_metadata.h>
 
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Metadata"
-#include <cutils/log.h>
+#include <log/log.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
diff --git a/modules/camera/3_0/Stream.cpp b/modules/camera/3_0/Stream.cpp
index e0099b6..a38b590 100644
--- a/modules/camera/3_0/Stream.cpp
+++ b/modules/camera/3_0/Stream.cpp
@@ -13,20 +13,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-#include <stdio.h>
-#include <hardware/camera3.h>
-#include <hardware/gralloc.h>
-#include <system/graphics.h>
-#include <utils/Mutex.h>
-
 //#define LOG_NDEBUG 0
 #define LOG_TAG "Stream"
-#include <cutils/log.h>
+
+#include <stdio.h>
+
+#include <log/log.h>
+#include <utils/Mutex.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <hardware/camera3.h>
+#include <hardware/gralloc.h>
+#include <system/graphics.h>
+
 #include "Stream.h"
 
 namespace default_camera_hal {
diff --git a/modules/camera/3_0/VendorTags.cpp b/modules/camera/3_0/VendorTags.cpp
index 48c1a46..9a34dc9 100644
--- a/modules/camera/3_0/VendorTags.cpp
+++ b/modules/camera/3_0/VendorTags.cpp
@@ -13,17 +13,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-#include <system/camera_metadata.h>
-#include "Metadata.h"
-
 //#define LOG_NDEBUG 0
 #define LOG_TAG "VendorTags"
-#include <cutils/log.h>
+
+#include <stdint.h>
+
+#include <log/log.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <system/camera_metadata.h>
+#include "Metadata.h"
+
 #include "VendorTags.h"
 
 namespace default_camera_hal {
diff --git a/modules/consumerir/consumerir.c b/modules/consumerir/consumerir.c
index 2af6b89..f2cc623 100644
--- a/modules/consumerir/consumerir.c
+++ b/modules/consumerir/consumerir.c
@@ -17,10 +17,14 @@
 
 #include <errno.h>
 #include <malloc.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+
 #include <log/log.h>
-#include <hardware/hardware.h>
+
 #include <hardware/consumerir.h>
+#include <hardware/hardware.h>
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 
diff --git a/modules/fingerprint/fingerprint.c b/modules/fingerprint/fingerprint.c
index 08b112b..8f4bca6 100644
--- a/modules/fingerprint/fingerprint.c
+++ b/modules/fingerprint/fingerprint.c
@@ -17,10 +17,13 @@
 
 #include <errno.h>
 #include <malloc.h>
+#include <stdint.h>
 #include <string.h>
-#include <cutils/log.h>
-#include <hardware/hardware.h>
+
+#include <log/log.h>
+
 #include <hardware/fingerprint.h>
+#include <hardware/hardware.h>
 
 static int fingerprint_close(hw_device_t *dev)
 {
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index eadcdaa..7ef8098 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -14,24 +14,20 @@
  * limitations under the License.
  */
 
+#include <dlfcn.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
 #include <sys/mman.h>
 
-#include <dlfcn.h>
-
 #include <cutils/ashmem.h>
-#include <cutils/log.h>
-
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <cutils/log.h>
 #include <cutils/atomic.h>
+#include <log/log.h>
+
+#include <hardware/gralloc.h>
+#include <hardware/hardware.h>
 
 #ifdef __ANDROID__
 #include <linux/fb.h>
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index 84133fd..07bbfba 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -14,25 +14,24 @@
  * limitations under the License.
  */
 
-#include <limits.h>
-#include <unistd.h>
-#include <fcntl.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
-
+#include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/ioctl.h>
+#include <unistd.h>
 
 #include <cutils/ashmem.h>
-#include <cutils/log.h>
 #include <cutils/atomic.h>
+#include <log/log.h>
 
-#include <hardware/hardware.h>
 #include <hardware/gralloc.h>
+#include <hardware/hardware.h>
 
 #include "gralloc_priv.h"
 #include "gr.h"
diff --git a/modules/gralloc/mapper.cpp b/modules/gralloc/mapper.cpp
index 20d9841..ee3e40e 100644
--- a/modules/gralloc/mapper.cpp
+++ b/modules/gralloc/mapper.cpp
@@ -14,18 +14,17 @@
  * limitations under the License.
  */
 
-#include <limits.h>
 #include <errno.h>
+#include <limits.h>
 #include <pthread.h>
-#include <unistd.h>
 #include <string.h>
-
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
-#include <cutils/log.h>
 #include <cutils/atomic.h>
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <hardware/gralloc.h>
diff --git a/modules/hwcomposer/hwcomposer.cpp b/modules/hwcomposer/hwcomposer.cpp
index 7b2e278..fd4e90d 100644
--- a/modules/hwcomposer/hwcomposer.cpp
+++ b/modules/hwcomposer/hwcomposer.cpp
@@ -14,15 +14,14 @@
  * limitations under the License.
  */
 
-#include <hardware/hardware.h>
-
 #include <errno.h>
 #include <fcntl.h>
 #include <malloc.h>
 
-#include <cutils/log.h>
 #include <cutils/atomic.h>
+#include <log/log.h>
 
+#include <hardware/hardware.h>
 #include <hardware/hwcomposer.h>
 
 #include <EGL/egl.h>
diff --git a/modules/local_time/local_time_hw.c b/modules/local_time/local_time_hw.c
index 899c38a..b38d8a5 100644
--- a/modules/local_time/local_time_hw.c
+++ b/modules/local_time/local_time_hw.c
@@ -23,7 +23,7 @@
 #include <string.h>
 #include <sys/time.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <hardware/local_time_hal.h>
diff --git a/modules/nfc-nci/nfc_nci_example.c b/modules/nfc-nci/nfc_nci_example.c
index ea5eb47..f3f60f6 100644
--- a/modules/nfc-nci/nfc_nci_example.c
+++ b/modules/nfc-nci/nfc_nci_example.c
@@ -17,11 +17,11 @@
 #include <malloc.h>
 #include <string.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
+
 #include <hardware/hardware.h>
 #include <hardware/nfc.h>
 
-
 /*
  * We want to silence the "unused argument" that gcc and clang give.
  * Other compilers generating this warning will need to provide their
diff --git a/modules/radio/Android.bp b/modules/radio/Android.bp
new file mode 100644
index 0000000..01dc035
--- /dev/null
+++ b/modules/radio/Android.bp
@@ -0,0 +1,48 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Stub radio HAL module, used for tests
+cc_library_shared {
+    name: "radio.fm.default",
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: ["radio_hw.c"],
+    cflags: [
+        "-Wall",
+        "-Wno-unused-parameter",
+        "-Werror",
+    ],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libradio_metadata",
+    ],
+}
+
+// Stub radio tool that can be run in native.
+cc_binary {
+    name: "radio_hal_tool",
+    srcs: ["radio_hal_tool.c"],
+    cflags: [
+        "-Wall",
+        "-Wno-unused-parameter",
+        "-Werror",
+    ],
+    shared_libs: [
+        "libcutils",
+        "libhardware",
+        "liblog",
+        "libradio_metadata",
+    ],
+}
diff --git a/modules/radio/Android.mk b/modules/radio/Android.mk
deleted file mode 100644
index 6f11169..0000000
--- a/modules/radio/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-# Stub radio HAL module, used for tests
-include $(CLEAR_VARS)
-
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-
-LOCAL_MODULE := radio.fm.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := radio_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils libradio_metadata
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
-# Stub radio tool that can be run in native.
-include $(CLEAR_VARS)
-
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-
-LOCAL_MODULE := radio_hal_tool
-LOCAL_SRC_FILES := radio_hal_tool.c
-LOCAL_CFLAGS := -Wall -Wno-unused-parameter -Werror
-LOCAL_SHARED_LIBRARIES := libcutils libhardware liblog libradio_metadata
-
-include $(BUILD_EXECUTABLE)
diff --git a/modules/radio/radio_hal_tool.c b/modules/radio/radio_hal_tool.c
index 6c40739..0117f28 100644
--- a/modules/radio/radio_hal_tool.c
+++ b/modules/radio/radio_hal_tool.c
@@ -16,16 +16,18 @@
 
 #define LOG_TAG "radio_hal_tool"
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
+
 #include <hardware/hardware.h>
 #include <hardware/radio.h>
 #include <system/radio.h>
 #include <system/radio_metadata.h>
 
-
 // Global state variables.
 const struct radio_tuner *hal_tuner = NULL;
 
diff --git a/modules/radio/radio_hw.c b/modules/radio/radio_hw.c
index 4010507..964a8b6 100644
--- a/modules/radio/radio_hw.c
+++ b/modules/radio/radio_hw.c
@@ -17,22 +17,26 @@
 #define LOG_TAG "radio_hw_stub"
 #define LOG_NDEBUG 0
 
-#include <string.h>
-#include <stdlib.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/prctl.h>
+#include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+#include <time.h>
 #include <unistd.h>
-#include <cutils/log.h>
+
 #include <cutils/list.h>
-#include <system/radio.h>
-#include <system/radio_metadata.h>
+#include <log/log.h>
+
 #include <hardware/hardware.h>
 #include <hardware/radio.h>
+#include <system/radio.h>
+#include <system/radio_metadata.h>
 
 static const radio_hal_properties_t hw_properties = {
     .class_id = RADIO_CLASS_AM_FM,
@@ -633,8 +637,6 @@
 static int rdev_get_properties(const struct radio_hw_device *dev,
                                 radio_hal_properties_t *properties)
 {
-    struct stub_radio_device *rdev = (struct stub_radio_device *)dev;
-
     ALOGI("%s", __func__);
     if (properties == NULL)
         return -EINVAL;
@@ -749,7 +751,6 @@
                      hw_device_t** device)
 {
     struct stub_radio_device *rdev;
-    int ret;
 
     if (strcmp(name, RADIO_HARDWARE_DEVICE) != 0)
         return -EINVAL;
diff --git a/modules/sensors/SensorEventQueue.cpp b/modules/sensors/SensorEventQueue.cpp
index f6144f8..0d4d64a 100644
--- a/modules/sensors/SensorEventQueue.cpp
+++ b/modules/sensors/SensorEventQueue.cpp
@@ -14,11 +14,13 @@
  * limitations under the License.
  */
 
-#include <hardware/sensors.h>
-#include <algorithm>
 #include <pthread.h>
-#include <cutils/log.h>
 
+#include <algorithm>
+
+#include <log/log.h>
+
+#include <hardware/sensors.h>
 #include "SensorEventQueue.h"
 
 SensorEventQueue::SensorEventQueue(int capacity) {
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index 20d97f2..0089f98 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -51,21 +51,20 @@
 
 #define ERROR_BAD_COMMAND "Bad command"
 
+#include <arpa/inet.h>
 #include <errno.h>
+#include <pthread.h>
+#include <netinet/in.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#include <errno.h>
-#include <pthread.h>
 #include <sys/prctl.h>
-#include <cutils/log.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <system/sound_trigger.h>
diff --git a/modules/tv_input/tv_input.cpp b/modules/tv_input/tv_input.cpp
index ddace28..4c42518 100644
--- a/modules/tv_input/tv_input.cpp
+++ b/modules/tv_input/tv_input.cpp
@@ -18,8 +18,8 @@
 #include <fcntl.h>
 #include <malloc.h>
 
-#include <cutils/log.h>
 #include <cutils/native_handle.h>
+#include <log/log.h>
 
 #include <hardware/tv_input.h>
 
diff --git a/modules/usbcamera/Camera.cpp b/modules/usbcamera/Camera.cpp
index b396291..0324da8 100644
--- a/modules/usbcamera/Camera.cpp
+++ b/modules/usbcamera/Camera.cpp
@@ -16,21 +16,28 @@
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "Camera"
-#include <cutils/log.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
 
 #include <cstdlib>
-#include <stdio.h>
-#include <hardware/camera3.h>
-#include <system/camera_metadata.h>
-#include <system/graphics.h>
+
+#include <log/log.h>
 #include <utils/Mutex.h>
-#include "CameraHAL.h"
-#include "Metadata.h"
-#include "Stream.h"
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <hardware/camera3.h>
+#include <system/camera_metadata.h>
+#include <system/graphics.h>
+
+#include "CameraHAL.h"
+#include "Metadata.h"
+#include "Stream.h"
+
 #include "Camera.h"
 
 namespace usb_camera_hal {
diff --git a/modules/usbcamera/CameraHAL.cpp b/modules/usbcamera/CameraHAL.cpp
index c54283b..1a5eb3a 100644
--- a/modules/usbcamera/CameraHAL.cpp
+++ b/modules/usbcamera/CameraHAL.cpp
@@ -16,13 +16,17 @@
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "UsbCameraHAL"
-#include <cutils/log.h>
 
 #include <cstdlib>
+
+#include <log/log.h>
+#include <utils/Mutex.h>
+
 #include <hardware/camera_common.h>
 #include <hardware/hardware.h>
-#include "UsbCamera.h"
+
 #include "CameraHAL.h"
+#include "UsbCamera.h"
 
 /*
  * This file serves as the entry point to the HAL.  It contains the module
diff --git a/modules/usbcamera/HotplugThread.cpp b/modules/usbcamera/HotplugThread.cpp
index 02e7167..6188ede 100644
--- a/modules/usbcamera/HotplugThread.cpp
+++ b/modules/usbcamera/HotplugThread.cpp
@@ -16,7 +16,8 @@
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "HotplugThread"
-#include <cutils/log.h>
+
+#include <log/log.h>
 
 #include "HotplugThread.h"
 
diff --git a/modules/usbcamera/Metadata.cpp b/modules/usbcamera/Metadata.cpp
index f243834..78318f3 100644
--- a/modules/usbcamera/Metadata.cpp
+++ b/modules/usbcamera/Metadata.cpp
@@ -16,13 +16,14 @@
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "Metadata"
-#include <cutils/log.h>
 
-#include <system/camera_metadata.h>
+#include <log/log.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <system/camera_metadata.h>
+
 #include "Metadata.h"
 
 namespace usb_camera_hal {
diff --git a/modules/usbcamera/Stream.cpp b/modules/usbcamera/Stream.cpp
index 2b83421..d418798 100644
--- a/modules/usbcamera/Stream.cpp
+++ b/modules/usbcamera/Stream.cpp
@@ -16,17 +16,19 @@
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "Stream"
-#include <cutils/log.h>
 
 #include <stdio.h>
-#include <hardware/camera3.h>
-#include <hardware/gralloc.h>
-#include <system/graphics.h>
+
+#include <log/log.h>
 #include <utils/Mutex.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <hardware/camera3.h>
+#include <hardware/gralloc.h>
+#include <system/graphics.h>
+
 #include "Stream.h"
 
 namespace usb_camera_hal {
diff --git a/modules/usbcamera/UsbCamera.cpp b/modules/usbcamera/UsbCamera.cpp
index 9d53fc6..65cbec9 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -16,13 +16,16 @@
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "UsbCameraDevice"
-#include <cutils/log.h>
 
-#include <system/camera_metadata.h>
+#include <stdint.h>
+
+#include <log/log.h>
 
 #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
 #include <utils/Trace.h>
 
+#include <system/camera_metadata.h>
+
 #include "Camera.h"
 #include "UsbCamera.h"
 
diff --git a/modules/vehicle/vehicle.c b/modules/vehicle/vehicle.c
index 2d945fd..66e29c0 100644
--- a/modules/vehicle/vehicle.c
+++ b/modules/vehicle/vehicle.c
@@ -31,7 +31,7 @@
 #include <sys/time.h>
 #include <time.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <system/radio.h>
 #include <hardware/hardware.h>
 #include <hardware/vehicle.h>
diff --git a/modules/vibrator/vibrator.c b/modules/vibrator/vibrator.c
index 92c46e2..950bc59 100644
--- a/modules/vibrator/vibrator.c
+++ b/modules/vibrator/vibrator.c
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-#include <hardware/vibrator.h>
 #include <hardware/hardware.h>
+#include <hardware/vibrator.h>
 
-#include <cutils/log.h>
-
+#include <errno.h>
+#include <fcntl.h>
 #include <malloc.h>
-#include <stdio.h>
+#include <math.h>
 #include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
+
+#include <log/log.h>
 
 #define TIMEOUT_STR_LEN         20
 
diff --git a/tests/nusensors/nusensors.cpp b/tests/nusensors/nusensors.cpp
index 55b7785..a063959 100644
--- a/tests/nusensors/nusensors.cpp
+++ b/tests/nusensors/nusensors.cpp
@@ -17,14 +17,15 @@
 #include <inttypes.h>
 #include <string.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
+#include <utils/Timers.h>
 
 #include <hardware/sensors.h>
-#include <utils/Timers.h>
 
 char const* getSensorName(int type) {
     switch(type) {
diff --git a/tests/vehicle/vehicle-hal-tool.c b/tests/vehicle/vehicle-hal-tool.c
index e85df62..94624d3 100644
--- a/tests/vehicle/vehicle-hal-tool.c
+++ b/tests/vehicle/vehicle-hal-tool.c
@@ -17,13 +17,15 @@
 #define LOG_TAG "vehicle-hal-tool"
 
 #include <inttypes.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#include <log/log.h>
+
 #include <hardware/hardware.h>
 #include <hardware/vehicle.h>
 
-#include <cutils/log.h>
-
 void usage() {
     printf("Usage: "
             "./vehicle-hal-tool [-l] [-m -p -t [-v]]\n"