Move LOG_TAG macro definitions to the top

of cc. files. Some platform library headers contain
log/log.h include-s which define default LOG_TAG if
not defined yet and this causes build warnings about
redefining a macro.

Bug: 301023410
Test: mm virtual_camera

Change-Id: I67c2b55f5b1d036e5020a929a32d5a9955b1a3c8
diff --git a/devices/VirtualCamera/VirtualCameraDevice.cc b/devices/VirtualCamera/VirtualCameraDevice.cc
index 92db675..9dbe094 100644
--- a/devices/VirtualCamera/VirtualCameraDevice.cc
+++ b/devices/VirtualCamera/VirtualCameraDevice.cc
@@ -14,10 +14,9 @@
  * limitations under the License.
  */
 
-#include "VirtualCameraDevice.h"
-
 // #define LOG_NDEBUG 0
 #define LOG_TAG "VirtualCameraDevice"
+#include "VirtualCameraDevice.h"
 
 #include <array>
 #include <chrono>
diff --git a/devices/VirtualCamera/VirtualCameraProvider.cc b/devices/VirtualCamera/VirtualCameraProvider.cc
index fa2e435..7f5db73 100644
--- a/devices/VirtualCamera/VirtualCameraProvider.cc
+++ b/devices/VirtualCamera/VirtualCameraProvider.cc
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "VirtualCameraProvider.h"
 
 // #define LOG_NDEBUG 0
 #define LOG_TAG "VirtualCameraProvider"
+#include "VirtualCameraProvider.h"
 
 #include <algorithm>
 #include <atomic>
diff --git a/devices/VirtualCamera/VirtualCameraSession.cc b/devices/VirtualCamera/VirtualCameraSession.cc
index 5d5b90f..ab34808 100644
--- a/devices/VirtualCamera/VirtualCameraSession.cc
+++ b/devices/VirtualCamera/VirtualCameraSession.cc
@@ -14,10 +14,9 @@
  * limitations under the License.
  */
 
-#include "VirtualCameraSession.h"
-
 // #define LOG_NDEBUG 0
 #define LOG_TAG "VirtualCameraSession"
+#include "VirtualCameraSession.h"
 
 #include <atomic>
 #include <chrono>
@@ -44,6 +43,7 @@
 #include "aidl/android/hardware/graphics/common/BufferUsage.h"
 #include "android/hardware_buffer.h"
 #include "fmq/AidlMessageQueue.h"
+#include "log/log.h"
 #include "system/camera_metadata.h"
 #include "system/graphics-sw.h"
 #include "util/EglDisplayContext.h"
diff --git a/devices/VirtualCamera/VirtualCameraStream.cc b/devices/VirtualCamera/VirtualCameraStream.cc
index 7a83719..8f23e4d 100644
--- a/devices/VirtualCamera/VirtualCameraStream.cc
+++ b/devices/VirtualCamera/VirtualCameraStream.cc
@@ -13,13 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "VirtualCameraStream.h"
-
-#include "EGL/egl.h"
-#include "util/EglFramebuffer.h"
 
 // #define LOG_NDEBUG 0
 #define LOG_TAG "VirtualCameraStream"
+#include "VirtualCameraStream.h"
 
 #include <cstdint>
 #include <memory>
@@ -27,6 +24,7 @@
 #include <tuple>
 #include <utility>
 
+#include "EGL/egl.h"
 #include "aidl/android/hardware/camera/device/Stream.h"
 #include "aidl/android/hardware/camera/device/StreamBuffer.h"
 #include "aidlcommonsupport/NativeHandle.h"
diff --git a/devices/VirtualCamera/util/EglDisplayContext.cc b/devices/VirtualCamera/util/EglDisplayContext.cc
index 9d11443..3f8ef39 100644
--- a/devices/VirtualCamera/util/EglDisplayContext.cc
+++ b/devices/VirtualCamera/util/EglDisplayContext.cc
@@ -14,12 +14,14 @@
  * limitations under the License.
  */
 
+// #define LOG_NDEBUG 0
+#define LOG_TAG "EglDisplayContext"
 #include "EglDisplayContext.h"
 
+#include "log/log.h"
+
 #define EGL_EGLEXT_PROTOTYPES
 #define GL_GLEXT_PROTOTYPES
-// #define LOG_NDEBUG 0
-#define LOG_TAG "EglDisplayContext"
 
 #include <cstdint>
 
@@ -30,7 +32,6 @@
 #include "GLES/gl.h"
 #include "GLES2/gl2.h"
 #include "GLES2/gl2ext.h"
-#include "log/log.h"
 
 namespace android {
 namespace services {
diff --git a/devices/VirtualCamera/util/EglFramebuffer.cc b/devices/VirtualCamera/util/EglFramebuffer.cc
index 06e7933..0a1cab2 100644
--- a/devices/VirtualCamera/util/EglFramebuffer.cc
+++ b/devices/VirtualCamera/util/EglFramebuffer.cc
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-#include "EglFramebuffer.h"
-
+// #define LOG_NDEBUG 0
 #define LOG_TAG "EglFramebuffer"
+#include "EglFramebuffer.h"
 
 #include "EGL/eglext.h"
 #include "EglUtil.h"
diff --git a/devices/VirtualCamera/util/EglProgram.cc b/devices/VirtualCamera/util/EglProgram.cc
index 4e35a9b..fabd5fd 100644
--- a/devices/VirtualCamera/util/EglProgram.cc
+++ b/devices/VirtualCamera/util/EglProgram.cc
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "EglProgram.h"
 
+// #define LOG_NDEBUG 0
 #define LOG_TAG "EglProgram"
+#include "EglProgram.h"
 
 #include <array>
 
diff --git a/devices/VirtualCamera/util/EglUtil.cc b/devices/VirtualCamera/util/EglUtil.cc
index 5ccf35f..421d337 100644
--- a/devices/VirtualCamera/util/EglUtil.cc
+++ b/devices/VirtualCamera/util/EglUtil.cc
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-#include "EglUtil.h"
-
+// #define LOG_NDEBUG 0
 #define LOG_TAG "EglUtil"
+#include "EglUtil.h"
 
 #include "GLES/gl.h"
 #include "log/log.h"
diff --git a/devices/VirtualCamera/util/MetadataBuilder.cc b/devices/VirtualCamera/util/MetadataBuilder.cc
index 89657e0..7e2d741 100644
--- a/devices/VirtualCamera/util/MetadataBuilder.cc
+++ b/devices/VirtualCamera/util/MetadataBuilder.cc
@@ -14,16 +14,14 @@
  * limitations under the License.
  */
 
+// #define LOG_NDEBUG 0
+#define LOG_TAG "MetadataBuilder"
 #include "MetadataBuilder.h"
 
 #include <algorithm>
-#include <iterator>
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "MetadataBuilder"
-
 #include <cstddef>
 #include <cstdint>
+#include <iterator>
 #include <memory>
 #include <tuple>
 #include <utility>
@@ -32,6 +30,7 @@
 
 #include "CameraMetadata.h"
 #include "aidl/android/hardware/camera/device/CameraMetadata.h"
+#include "log/log.h"
 #include "system/camera_metadata.h"
 #include "utils/Errors.h"
 
diff --git a/devices/VirtualCamera/util/TestPatternHelper.cc b/devices/VirtualCamera/util/TestPatternHelper.cc
index f801f33..0e0d007 100644
--- a/devices/VirtualCamera/util/TestPatternHelper.cc
+++ b/devices/VirtualCamera/util/TestPatternHelper.cc
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-#include "TestPatternHelper.h"
-
+// #define LOG_NDEBUG 0
 #define LOG_TAG "TestPatternHelper"
+#include "TestPatternHelper.h"
 
 #include <complex>
 
diff --git a/devices/VirtualCamera/util/Util.cc b/devices/VirtualCamera/util/Util.cc
index 471d72b..1093fbe 100644
--- a/devices/VirtualCamera/util/Util.cc
+++ b/devices/VirtualCamera/util/Util.cc
@@ -1,10 +1,26 @@
-#include "Util.h"
+/*
+ * Copyright (C) 2023 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.
+ */
 
+// #define LOG_NDEBUG 0
 #define LOG_TAG "VirtualCameraUtil"
+#include "Util.h"
 
 #include <unistd.h>
 
-#include "log/log_main.h"
+#include "log/log.h"
 
 namespace android {
 namespace services {