camera: fix `-Wmacro-redefined` compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
hardware/libhardware/modules/camera/3_4/Android.mk and build
mmm hardware/libhardware/modules/camera/3_4
Change-Id: Ida00d842007e2a589907bc4fd1887076fd8b5b2a
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
diff --git a/modules/camera/3_4/camera.cpp b/modules/camera/3_4/camera.cpp
index 79dca0b..01236f3 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)
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..c6e739d 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"
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/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_reader.cpp b/modules/camera/3_4/metadata/metadata_reader.cpp
index fe2ff85..dfb3ade 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>
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/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/request_tracker.cpp b/modules/camera/3_4/request_tracker.cpp
index 09f634d..d4cbe47 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 {
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/static_properties.cpp b/modules/camera/3_4/static_properties.cpp
index 5be9dcd..e914567 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>
diff --git a/modules/camera/3_4/stream_format.cpp b/modules/camera/3_4/stream_format.cpp
index 5f35e42..89b58bd 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>
diff --git a/modules/camera/3_4/v4l2_camera.cpp b/modules/camera/3_4/v4l2_camera.cpp
index 98b8062..62d790e 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>
diff --git a/modules/camera/3_4/v4l2_camera_hal.cpp b/modules/camera/3_4/v4l2_camera_hal.cpp
index 83746ce..7ab96ac 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>
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..085683d 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>