codec2: correct include order and add include dir

Include order (according to Android coding style):
1. local includes
2. ported Chromium vda includes
3. codec2 header includes
4. external includes (libchrome)
5. external includes (system, media, framework...)
6. c/c++ header includes

Bug: None
Test: run native tests
Change-Id: I7506cf4561a1df87a1bc8b6324d9419a01035b18
diff --git a/Android.mk b/Android.mk
index e8e6958..7d2a1a9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -8,7 +8,7 @@
 LOCAL_C_INCLUDES += \
         $(TOP)/external/libchrome \
         $(TOP)/external/gtest/include \
-        $(TOP)/external/v4l2_codec2 \
+        $(TOP)/external/v4l2_codec2/include \
         $(TOP)/external/v4l2_codec2/vda \
         $(TOP)/external/v4l2_codec2/vndk/include \
         $(TOP)/frameworks/av/media/libstagefright/codec2/include \
diff --git a/C2VDAAdaptor.cpp b/C2VDAAdaptor.cpp
index de0ac81..446a6b4 100644
--- a/C2VDAAdaptor.cpp
+++ b/C2VDAAdaptor.cpp
@@ -5,12 +5,13 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2VDAAdaptor"
 
-#include "C2VDAAdaptor.h"
-#include "bitstream_buffer.h"
-#include "native_pixmap_handle.h"
-#include "v4l2_device.h"
-#include "v4l2_slice_video_decode_accelerator.h"
-#include "videodev2.h"
+#include <C2VDAAdaptor.h>
+
+#include <bitstream_buffer.h>
+#include <native_pixmap_handle.h>
+#include <v4l2_device.h>
+#include <v4l2_slice_video_decode_accelerator.h>
+#include <videodev2.h>
 
 #include <system/graphics.h>
 #include <utils/Log.h>
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index 36e1598..0c05807 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -5,21 +5,23 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2VDAComponent"
 
-#include <inttypes.h>
-#include <algorithm>
-
-#include "C2VDAAdaptor.h"
+#include <C2VDAAdaptor.h>
 #define __C2_GENERATE_GLOBAL_VARS__
-#include "C2VDAComponent.h"
-#include "C2VDASupport.h"
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "videodev2.h"
+#include <C2VDAComponent.h>
+#include <C2VDASupport.h>
+
+#include <videodev2.h>
+
+#include <base/bind.h>
+#include <base/bind_helpers.h>
 
 #include <media/stagefright/MediaDefs.h>
 #include <utils/Log.h>
 #include <utils/misc.h>
 
+#include <inttypes.h>
+#include <algorithm>
+
 #define UNUSED(expr)  \
     do {              \
         (void)(expr); \
diff --git a/cmds/Android.mk b/cmds/Android.mk
index c5ae806..34d0a87 100644
--- a/cmds/Android.mk
+++ b/cmds/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_C_INCLUDES += \
         $(TOP)/external/libchrome \
         $(TOP)/external/gtest/include \
-        $(TOP)/external/v4l2_codec2 \
+        $(TOP)/external/v4l2_codec2/include \
         $(TOP)/external/v4l2_codec2/vda \
         $(TOP)/external/v4l2_codec2/vndk/include \
         $(TOP)/frameworks/av/media/libstagefright/codec2/include \
diff --git a/cmds/codec2.cpp b/cmds/codec2.cpp
index 17e27ac..62a1952 100644
--- a/cmds/codec2.cpp
+++ b/cmds/codec2.cpp
@@ -5,28 +5,22 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "codec2"
 
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include <thread>
-
-#include "C2VDAComponent.h"
-
 #include <C2AllocatorCrosGralloc.h>
 #include <C2AllocatorMemDealer.h>
+#include <C2VDAComponent.h>
+#include <C2VDASupport.h>
+
 #include <C2Buffer.h>
 #include <C2BufferPriv.h>
 #include <C2Component.h>
-#include <C2VDASupport.h>
 #include <C2Work.h>
 
 #include <binder/IServiceManager.h>
 #include <binder/ProcessState.h>
+#include <gui/GLConsumer.h>
+#include <gui/IProducerListener.h>
+#include <gui/Surface.h>
+#include <gui/SurfaceComposerClient.h>
 #include <media/ICrypto.h>
 #include <media/IMediaHTTPService.h>
 #include <media/stagefright/DataSource.h>
@@ -41,10 +35,14 @@
 #include <media/stagefright/foundation/AMessage.h>
 #include <media/stagefright/foundation/AUtils.h>
 
-#include <gui/GLConsumer.h>
-#include <gui/IProducerListener.h>
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <thread>
 
 using namespace android;
 using namespace std::chrono_literals;
diff --git a/C2VDAAdaptor.h b/include/C2VDAAdaptor.h
similarity index 91%
rename from C2VDAAdaptor.h
rename to include/C2VDAAdaptor.h
index 065fd0d..a59e1be 100644
--- a/C2VDAAdaptor.h
+++ b/include/C2VDAAdaptor.h
@@ -2,12 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef C2_VDA_ADAPTOR_H_
-#define C2_VDA_ADAPTOR_H_
+#ifndef ANDROID_C2_VDA_ADAPTOR_H
+#define ANDROID_C2_VDA_ADAPTOR_H
 
-#include "VideoDecodeAcceleratorAdaptor.h"
-#include "base/macros.h"
-#include "video_decode_accelerator.h"
+#include <VideoDecodeAcceleratorAdaptor.h>
+
+#include <video_decode_accelerator.h>
+
+#include <base/macros.h>
 
 namespace android {
 
@@ -62,4 +64,4 @@
 
 }  // namespace android
 
-#endif  // C2_VDA_ADAPTOR_H_
+#endif  // ANDROID_C2_VDA_ADAPTOR_H
diff --git a/C2VDAComponent.h b/include/C2VDAComponent.h
similarity index 96%
rename from C2VDAComponent.h
rename to include/C2VDAComponent.h
index 18c0f63..6daae45 100644
--- a/C2VDAComponent.h
+++ b/include/C2VDAComponent.h
@@ -2,28 +2,30 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef C2_VDA_COMPONENT_H_
-#define C2_VDA_COMPONENT_H_
+#ifndef ANDROID_C2_VDA_COMPONENT_H
+#define ANDROID_C2_VDA_COMPONENT_H
+
+#include <VideoDecodeAcceleratorAdaptor.h>
+
+#include <rect.h>
+#include <size.h>
+#include <video_codecs.h>
+#include <video_decode_accelerator.h>
+
+#include <C2Component.h>
+#include <C2Param.h>
+
+#include <base/macros.h>
+#include <base/memory/ref_counted.h>
+#include <base/single_thread_task_runner.h>
+#include <base/synchronization/waitable_event.h>
+#include <base/threading/thread.h>
 
 #include <deque>
 #include <map>
 #include <queue>
 #include <unordered_map>
 
-#include "VideoDecodeAcceleratorAdaptor.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread.h"
-#include "rect.h"
-#include "size.h"
-#include "video_codecs.h"
-#include "video_decode_accelerator.h"
-
-#include <C2Component.h>
-#include <C2Param.h>
-
 namespace android {
 
 C2ENUM(ColorFormat, uint32_t,  // enum for output color format
@@ -348,4 +350,4 @@
 
 }  // namespace android
 
-#endif  // C2_VDA_COMPONENT_H_
+#endif  // ANDROID_C2_VDA_COMPONENT_H
diff --git a/VideoDecodeAcceleratorAdaptor.h b/include/VideoDecodeAcceleratorAdaptor.h
similarity index 92%
rename from VideoDecodeAcceleratorAdaptor.h
rename to include/VideoDecodeAcceleratorAdaptor.h
index 506b95a..e2e65aa 100644
--- a/VideoDecodeAcceleratorAdaptor.h
+++ b/include/VideoDecodeAcceleratorAdaptor.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef VIDEO_DECODE_ACCELERATOR_ADAPTOR_H_
-#define VIDEO_DECODE_ACCELERATOR_ADAPTOR_H_
+#ifndef ANDROID_VIDEO_DECODE_ACCELERATOR_ADAPTOR_H
+#define ANDROID_VIDEO_DECODE_ACCELERATOR_ADAPTOR_H
+
+#include <rect.h>
+#include <size.h>
+#include <video_codecs.h>
+#include <video_pixel_format.h>
 
 #include <vector>
 
-#include "rect.h"
-#include "size.h"
-#include "video_codecs.h"
-#include "video_pixel_format.h"
-
 namespace android {
 
 // The offset and stride of a video frame plane.
@@ -99,4 +99,4 @@
 
 }  // namespace android
 
-#endif  // VIDEO_DECODE_ACCELERATOR_ADAPTOR_H_
+#endif  // ANDROID_VIDEO_DECODE_ACCELERATOR_ADAPTOR_H
diff --git a/tests/Android.mk b/tests/Android.mk
index 2da1043..20e00ca 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -19,7 +19,7 @@
   libv4l2_codec2_vda \
 
 LOCAL_C_INCLUDES += \
-  $(TOP)/external/v4l2_codec2 \
+  $(TOP)/external/v4l2_codec2/include \
   $(TOP)/external/v4l2_codec2/vda \
   $(TOP)/frameworks/av/media/libstagefright/codec2/include \
 
@@ -55,7 +55,7 @@
   libv4l2_codec2_vndk \
 
 LOCAL_C_INCLUDES += \
-  $(TOP)/external/v4l2_codec2 \
+  $(TOP)/external/v4l2_codec2/include \
   $(TOP)/external/v4l2_codec2/vda \
   $(TOP)/external/v4l2_codec2/vndk/include \
   $(TOP)/frameworks/av/media/libstagefright/codec2/include \
diff --git a/tests/C2VDACompIntf_test.cpp b/tests/C2VDACompIntf_test.cpp
index 542c35e..d538103 100644
--- a/tests/C2VDACompIntf_test.cpp
+++ b/tests/C2VDACompIntf_test.cpp
@@ -5,14 +5,14 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2VDACompIntf_test"
 
-#include <stdio.h>
-#include <limits>
-
 #include <C2VDAComponent.h>
 
 #include <gtest/gtest.h>
 #include <utils/Log.h>
 
+#include <stdio.h>
+#include <limits>
+
 #define UNUSED(expr)  \
     do {              \
         (void)(expr); \
diff --git a/tests/C2VDAComponent_test.cpp b/tests/C2VDAComponent_test.cpp
index c212ca8..9ffe377 100644
--- a/tests/C2VDAComponent_test.cpp
+++ b/tests/C2VDAComponent_test.cpp
@@ -5,29 +5,17 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2VDAComponent_test"
 
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include <algorithm>
-#include <chrono>
-#include <thread>
-
-#include <C2VDAComponent.h>
-
 #include <C2AllocatorCrosGralloc.h>
 #include <C2AllocatorMemDealer.h>
+#include <C2VDAComponent.h>
+#include <C2VDASupport.h>
+
 #include <C2Buffer.h>
 #include <C2BufferPriv.h>
 #include <C2Component.h>
-#include <C2VDASupport.h>
 #include <C2Work.h>
 
+#include <gtest/gtest.h>
 #include <media/IMediaHTTPService.h>
 #include <media/stagefright/DataSource.h>
 #include <media/stagefright/MediaDefs.h>
@@ -40,10 +28,20 @@
 #include <media/stagefright/foundation/ALooper.h>
 #include <media/stagefright/foundation/AMessage.h>
 #include <media/stagefright/foundation/AUtils.h>
-
-#include <gtest/gtest.h>
 #include <utils/Log.h>
 
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <algorithm>
+#include <chrono>
+#include <thread>
+
 using namespace std::chrono_literals;
 
 namespace android {
diff --git a/vndk/C2AllocatorCrosGralloc.cpp b/vndk/C2AllocatorCrosGralloc.cpp
index 93334b5..24bfba3 100644
--- a/vndk/C2AllocatorCrosGralloc.cpp
+++ b/vndk/C2AllocatorCrosGralloc.cpp
@@ -6,6 +6,7 @@
 #define LOG_TAG "C2AllocatorCrosGralloc"
 
 #include <C2AllocatorCrosGralloc.h>
+
 #include <C2Buffer.h>
 
 namespace android {
diff --git a/vndk/C2AllocatorCrosGrallocNyc.cpp b/vndk/C2AllocatorCrosGrallocNyc.cpp
index b1792ff..9ff26d3 100644
--- a/vndk/C2AllocatorCrosGrallocNyc.cpp
+++ b/vndk/C2AllocatorCrosGrallocNyc.cpp
@@ -5,15 +5,16 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2AllocatorCrosGralloc"
 
-#include <sys/mman.h>
+#include <C2AllocatorCrosGrallocNyc.h>
+
+#include <C2Buffer.h>
 
 #include <media/stagefright/MediaDefs.h>
 #include <ui/GraphicBuffer.h>
 #include <utils/Log.h>
 #include <utils/misc.h>
 
-#include <C2AllocatorCrosGrallocNyc.h>
-#include <C2Buffer.h>
+#include <sys/mman.h>
 
 namespace android {
 
diff --git a/vndk/C2AllocatorMemDealer.cpp b/vndk/C2AllocatorMemDealer.cpp
index ab5b363..a452628 100644
--- a/vndk/C2AllocatorMemDealer.cpp
+++ b/vndk/C2AllocatorMemDealer.cpp
@@ -5,7 +5,9 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2AllocatorMemDealer"
 
-#include <sys/mman.h>
+#include <C2AllocatorMemDealer.h>
+
+#include <C2Buffer.h>
 
 #include <binder/IMemory.h>
 #include <binder/MemoryDealer.h>
@@ -13,8 +15,7 @@
 #include <utils/Log.h>
 #include <utils/misc.h>
 
-#include <C2AllocatorMemDealer.h>
-#include <C2Buffer.h>
+#include <sys/mman.h>
 
 namespace android {
 
diff --git a/vndk/C2VDAStore.cpp b/vndk/C2VDAStore.cpp
index efbce44..9dd88a0 100644
--- a/vndk/C2VDAStore.cpp
+++ b/vndk/C2VDAStore.cpp
@@ -7,8 +7,8 @@
 #else
 #include <C2AllocatorCrosGralloc.h>
 #endif
-
 #include <C2AllocatorMemDealer.h>
+
 #include <C2BufferPriv.h>
 #include <C2Component.h>
 #include <C2VDASupport.h>
diff --git a/vndk/include/C2AllocatorCrosGralloc.h b/vndk/include/C2AllocatorCrosGralloc.h
index ac5ce64..58ac103 100644
--- a/vndk/include/C2AllocatorCrosGralloc.h
+++ b/vndk/include/C2AllocatorCrosGralloc.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef C2_ALLOCATOR_CROS_GRALLOC_H_
-#define C2_ALLOCATOR_CROS_GRALLOC_H_
+#ifndef ANDROID_C2_ALLOCATOR_CROS_GRALLOC_H
+#define ANDROID_C2_ALLOCATOR_CROS_GRALLOC_H
 
 #include <C2Buffer.h>
 
@@ -29,4 +29,4 @@
 
 }  // namespace android
 
-#endif  // C2_ALLOCATOR_CROS_GRALLOC_H_
+#endif  // ANDROID_C2_ALLOCATOR_CROS_GRALLOC_H
diff --git a/vndk/include/C2AllocatorCrosGrallocNyc.h b/vndk/include/C2AllocatorCrosGrallocNyc.h
index a2bd58a..670b4ab 100644
--- a/vndk/include/C2AllocatorCrosGrallocNyc.h
+++ b/vndk/include/C2AllocatorCrosGrallocNyc.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef C2_ALLOCATOR_CROS_GRALLOC_H_
-#define C2_ALLOCATOR_CROS_GRALLOC_H_
+#ifndef ANDROID_C2_ALLOCATOR_CROS_GRALLOC_NYC_H
+#define ANDROID_C2_ALLOCATOR_CROS_GRALLOC_NYC_H
 
 #include <C2Buffer.h>
 
@@ -37,4 +37,4 @@
 
 }  // namespace android
 
-#endif  // C2_ALLOCATOR_CROS_GRALLOC_H_
+#endif  // ANDROID_C2_ALLOCATOR_CROS_GRALLOC_NYC_H
diff --git a/vndk/include/C2AllocatorMemDealer.h b/vndk/include/C2AllocatorMemDealer.h
index 26da7dc..177e189 100644
--- a/vndk/include/C2AllocatorMemDealer.h
+++ b/vndk/include/C2AllocatorMemDealer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef C2_ALLOCATOR_MEM_DEALER_H_
-#define C2_ALLOCATOR_MEM_DEALER_H_
+#ifndef ANDROID_C2_ALLOCATOR_MEM_DEALER_H
+#define ANDROID_C2_ALLOCATOR_MEM_DEALER_H
 
 #include <C2Buffer.h>
 
@@ -29,4 +29,4 @@
 
 }  // namespace android
 
-#endif  // C2_ALLOCATOR_MEM_DEALER_H_
+#endif  // ANDROID_C2_ALLOCATOR_MEM_DEALER_H
diff --git a/vndk/include/C2VDASupport.h b/vndk/include/C2VDASupport.h
index aee2d4d..6ab3f44 100644
--- a/vndk/include/C2VDASupport.h
+++ b/vndk/include/C2VDASupport.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef C2_VDA_SUPPORT_H_
-#define C2_VDA_SUPPORT_H_
+#ifndef ANDROID_C2_VDA_SUPPORT_H
+#define ANDROID_C2_VDA_SUPPORT_H
 
 #include <C2Component.h>
 
@@ -40,4 +40,4 @@
 
 }  // namespace android
 
-#endif  // C2_VDA_SUPPORT_H_
+#endif  // ANDROID_C2_VDA_SUPPORT_H