diff options
author | 2017-02-15 19:48:58 -0800 | |
---|---|---|
committer | 2017-02-21 14:53:57 -0800 | |
commit | fe2f54fc8a9810708fe05d719721af19aea10a4a (patch) | |
tree | 73f4465492567a2f5630a107507c8912f2f4fc13 | |
parent | bc000a7729ca78a9c89df8768aad02b0dce008d0 (diff) |
cleanup libui’s includes
- remove unneeded includes
- include a cpp’s header first in all cpps
Test: compiled & booted
Bug: 35164655
Change-Id: I0890913fcc6614cce156aff19fccdef183145beb
-rw-r--r-- | include/ui/ANativeObjectBase.h | 2 | ||||
-rw-r--r-- | include/ui/DisplayInfo.h | 3 | ||||
-rw-r--r-- | include/ui/Gralloc1.h | 45 | ||||
-rw-r--r-- | include/ui/Gralloc1On0Adapter.h | 27 | ||||
-rw-r--r-- | include/ui/GrallocMapper.h | 2 | ||||
-rw-r--r-- | include/ui/GraphicBuffer.h | 4 | ||||
-rw-r--r-- | include/ui/GraphicBufferAllocator.h | 6 | ||||
-rw-r--r-- | include/ui/GraphicBufferMapper.h | 8 | ||||
-rw-r--r-- | libs/ui/Gralloc1.cpp | 1 | ||||
-rw-r--r-- | libs/ui/Gralloc1On0Adapter.cpp | 5 | ||||
-rw-r--r-- | libs/ui/GrallocAllocator.cpp | 3 | ||||
-rw-r--r-- | libs/ui/GrallocMapper.cpp | 4 | ||||
-rw-r--r-- | libs/ui/GraphicBuffer.cpp | 10 | ||||
-rw-r--r-- | libs/ui/GraphicBufferAllocator.cpp | 6 | ||||
-rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 6 |
15 files changed, 72 insertions, 60 deletions
diff --git a/include/ui/ANativeObjectBase.h b/include/ui/ANativeObjectBase.h index 76e850fa27..640e34b509 100644 --- a/include/ui/ANativeObjectBase.h +++ b/include/ui/ANativeObjectBase.h @@ -18,9 +18,7 @@ #define ANDROID_ANDROID_NATIVES_H #include <sys/types.h> -#include <string.h> -#include <hardware/gralloc.h> #include <system/window.h> // --------------------------------------------------------------------------- diff --git a/include/ui/DisplayInfo.h b/include/ui/DisplayInfo.h index 842806e018..94caf6b9d3 100644 --- a/include/ui/DisplayInfo.h +++ b/include/ui/DisplayInfo.h @@ -19,9 +19,8 @@ #include <stdint.h> #include <sys/types.h> -#include <utils/Timers.h> -#include <ui/PixelFormat.h> +#include <utils/Timers.h> namespace android { diff --git a/include/ui/Gralloc1.h b/include/ui/Gralloc1.h index 640e29c720..90713b3343 100644 --- a/include/ui/Gralloc1.h +++ b/include/ui/Gralloc1.h @@ -19,10 +19,17 @@ #define GRALLOC1_LOG_TAG "Gralloc1" -#include <ui/Gralloc1On0Adapter.h> - +#include <functional> +#include <memory> #include <unordered_set> +#include <log/log.h> + +#include <ui/Fence.h> + +#include <hardware/gralloc1.h> + + namespace std { template <> struct hash<gralloc1_capability_t> { @@ -33,10 +40,42 @@ namespace std { } namespace android { - +class GraphicBuffer; class Fence; class GraphicBuffer; +class Gralloc1On0Adapter; +} // namespace android + +// This is not an "official" capability (i.e., it is not found in gralloc1.h), +// but we will use it to detect that we are running through the adapter, which +// is capable of collaborating with GraphicBuffer such that queries on a +// buffer_handle_t succeed +static const auto GRALLOC1_CAPABILITY_ON_ADAPTER = + static_cast<gralloc1_capability_t>(GRALLOC1_LAST_CAPABILITY + 1); + +static const auto GRALLOC1_FUNCTION_RETAIN_GRAPHIC_BUFFER = + static_cast<gralloc1_function_descriptor_t>(GRALLOC1_LAST_FUNCTION + 1); +static const auto GRALLOC1_FUNCTION_ALLOCATE_WITH_ID = + static_cast<gralloc1_function_descriptor_t>(GRALLOC1_LAST_FUNCTION + 2); +static const auto GRALLOC1_FUNCTION_LOCK_YCBCR = + static_cast<gralloc1_function_descriptor_t>(GRALLOC1_LAST_FUNCTION + 3); +static const auto GRALLOC1_LAST_ADAPTER_FUNCTION = GRALLOC1_FUNCTION_LOCK_YCBCR; + +typedef gralloc1_error_t (*GRALLOC1_PFN_RETAIN_GRAPHIC_BUFFER)( + gralloc1_device_t* device, const android::GraphicBuffer* buffer); +typedef gralloc1_error_t (*GRALLOC1_PFN_ALLOCATE_WITH_ID)( + gralloc1_device_t* device, gralloc1_buffer_descriptor_t descriptor, + gralloc1_backing_store_t id, buffer_handle_t* outBuffer); +typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_LOCK_YCBCR)( + gralloc1_device_t* device, buffer_handle_t buffer, + uint64_t /*gralloc1_producer_usage_t*/ producerUsage, + uint64_t /*gralloc1_consumer_usage_t*/ consumerUsage, + const gralloc1_rect_t* accessRegion, struct android_ycbcr* outYCbCr, + int32_t acquireFence); + + +namespace android { namespace Gralloc1 { class Device; diff --git a/include/ui/Gralloc1On0Adapter.h b/include/ui/Gralloc1On0Adapter.h index b09fdc61a6..6379a08bf4 100644 --- a/include/ui/Gralloc1On0Adapter.h +++ b/include/ui/Gralloc1On0Adapter.h @@ -35,33 +35,6 @@ class GraphicBuffer; struct gralloc_module_t; -// This is not an "official" capability (i.e., it is not found in gralloc1.h), -// but we will use it to detect that we are running through the adapter, which -// is capable of collaborating with GraphicBuffer such that queries on a -// buffer_handle_t succeed -static const auto GRALLOC1_CAPABILITY_ON_ADAPTER = - static_cast<gralloc1_capability_t>(GRALLOC1_LAST_CAPABILITY + 1); - -static const auto GRALLOC1_FUNCTION_RETAIN_GRAPHIC_BUFFER = - static_cast<gralloc1_function_descriptor_t>(GRALLOC1_LAST_FUNCTION + 1); -static const auto GRALLOC1_FUNCTION_ALLOCATE_WITH_ID = - static_cast<gralloc1_function_descriptor_t>(GRALLOC1_LAST_FUNCTION + 2); -static const auto GRALLOC1_FUNCTION_LOCK_YCBCR = - static_cast<gralloc1_function_descriptor_t>(GRALLOC1_LAST_FUNCTION + 3); -static const auto GRALLOC1_LAST_ADAPTER_FUNCTION = GRALLOC1_FUNCTION_LOCK_YCBCR; - -typedef gralloc1_error_t (*GRALLOC1_PFN_RETAIN_GRAPHIC_BUFFER)( - gralloc1_device_t* device, const android::GraphicBuffer* buffer); -typedef gralloc1_error_t (*GRALLOC1_PFN_ALLOCATE_WITH_ID)( - gralloc1_device_t* device, gralloc1_buffer_descriptor_t descriptor, - gralloc1_backing_store_t id, buffer_handle_t* outBuffer); -typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_LOCK_YCBCR)( - gralloc1_device_t* device, buffer_handle_t buffer, - uint64_t /*gralloc1_producer_usage_t*/ producerUsage, - uint64_t /*gralloc1_consumer_usage_t*/ consumerUsage, - const gralloc1_rect_t* accessRegion, struct android_ycbcr* outYCbCr, - int32_t acquireFence); - namespace android { class Gralloc1On0Adapter : public gralloc1_device_t diff --git a/include/ui/GrallocMapper.h b/include/ui/GrallocMapper.h index 5a23b6844a..5a0d64ba8d 100644 --- a/include/ui/GrallocMapper.h +++ b/include/ui/GrallocMapper.h @@ -17,8 +17,6 @@ #ifndef ANDROID_UI_GRALLOC_MAPPER_H #define ANDROID_UI_GRALLOC_MAPPER_H -#include <memory> - #include <android/hardware/graphics/mapper/2.0/IMapper.h> #include <system/window.h> diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index 759c9ec647..040d1e7bac 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -20,13 +20,15 @@ #include <stdint.h> #include <sys/types.h> +#include <string> + #include <ui/ANativeObjectBase.h> #include <ui/PixelFormat.h> #include <ui/Rect.h> #include <utils/Flattenable.h> #include <utils/RefBase.h> -#include <string> +#include <hardware/gralloc.h> struct ANativeWindowBuffer; diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h index 2ccc44b783..e97122bbdf 100644 --- a/include/ui/GraphicBufferAllocator.h +++ b/include/ui/GraphicBufferAllocator.h @@ -20,11 +20,14 @@ #include <stdint.h> +#include <memory> +#include <string> + #include <cutils/native_handle.h> #include <utils/Errors.h> #include <utils/KeyedVector.h> -#include <utils/threads.h> +#include <utils/Mutex.h> #include <utils/Singleton.h> #include <ui/Gralloc1.h> @@ -36,7 +39,6 @@ namespace Gralloc2 { class Allocator; } -class Gralloc1Loader; class GraphicBufferMapper; class String8; diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h index 001769fddf..b6d4021c3f 100644 --- a/include/ui/GraphicBufferMapper.h +++ b/include/ui/GraphicBufferMapper.h @@ -20,10 +20,18 @@ #include <stdint.h> #include <sys/types.h> +#include <memory> + #include <ui/Gralloc1.h> #include <utils/Singleton.h> + +// Needed by code that still uses the GRALLOC_USAGE_* constants. +// when/if we get rid of gralloc, we should provide aliases or fix call sites. +#include <hardware/gralloc.h> + + namespace android { // --------------------------------------------------------------------------- diff --git a/libs/ui/Gralloc1.cpp b/libs/ui/Gralloc1.cpp index 7952ed6aa8..64a8b40441 100644 --- a/libs/ui/Gralloc1.cpp +++ b/libs/ui/Gralloc1.cpp @@ -18,6 +18,7 @@ #include <ui/Gralloc1.h> #include <ui/GraphicBuffer.h> +#include <ui/Gralloc1On0Adapter.h> #include <vector> diff --git a/libs/ui/Gralloc1On0Adapter.cpp b/libs/ui/Gralloc1On0Adapter.cpp index 4cc0e4b4d8..b8bc6c425a 100644 --- a/libs/ui/Gralloc1On0Adapter.cpp +++ b/libs/ui/Gralloc1On0Adapter.cpp @@ -18,10 +18,13 @@ #define LOG_TAG "Gralloc1On0Adapter" //#define LOG_NDEBUG 0 +#include <ui/Gralloc1On0Adapter.h> + + #include <hardware/gralloc.h> -#include <ui/Gralloc1On0Adapter.h> #include <ui/GraphicBuffer.h> +#include <ui/Gralloc1.h> #include <utils/Log.h> diff --git a/libs/ui/GrallocAllocator.cpp b/libs/ui/GrallocAllocator.cpp index ca67990532..5c5d5b382f 100644 --- a/libs/ui/GrallocAllocator.cpp +++ b/libs/ui/GrallocAllocator.cpp @@ -16,9 +16,10 @@ #define LOG_TAG "GrallocAllocator" -#include <log/log.h> #include <ui/GrallocAllocator.h> +#include <log/log.h> + namespace android { namespace Gralloc2 { diff --git a/libs/ui/GrallocMapper.cpp b/libs/ui/GrallocMapper.cpp index b9e9040e8e..6884dcb911 100644 --- a/libs/ui/GrallocMapper.cpp +++ b/libs/ui/GrallocMapper.cpp @@ -16,11 +16,9 @@ #define LOG_TAG "GrallocMapper" -#include <array> -#include <string> +#include <ui/GrallocMapper.h> #include <log/log.h> -#include <ui/GrallocMapper.h> namespace android { diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index b54442667f..37ebfb3cd4 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -16,18 +16,10 @@ #define LOG_TAG "GraphicBuffer" -#include <stdlib.h> -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/Log.h> - -#include <ui/GrallocMapper.h> #include <ui/GraphicBuffer.h> +#include <ui/GrallocMapper.h> #include <ui/GraphicBufferAllocator.h> #include <ui/GraphicBufferMapper.h> -#include <ui/PixelFormat.h> namespace android { diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index b14110e599..3f18bbc32c 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -18,13 +18,15 @@ #define LOG_TAG "GraphicBufferAllocator" #define ATRACE_TAG ATRACE_TAG_GRAPHICS +#include <ui/GraphicBufferAllocator.h> + +#include <stdio.h> + #include <log/log.h> #include <utils/Singleton.h> #include <utils/String8.h> #include <utils/Trace.h> -#include <ui/GraphicBufferAllocator.h> -#include <ui/Gralloc1On0Adapter.h> #include <ui/GrallocAllocator.h> #include <ui/GrallocMapper.h> #include <ui/GraphicBufferMapper.h> diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index f418f7f015..656472f1a1 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -18,8 +18,7 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 -#include <stdint.h> -#include <errno.h> +#include <ui/GraphicBufferMapper.h> // We would eliminate the non-conforming zero-length array, but we can't since // this is effectively included from the Linux kernel @@ -28,13 +27,10 @@ #include <sync/sync.h> #pragma clang diagnostic pop -#include <utils/Errors.h> #include <utils/Log.h> #include <utils/Trace.h> -#include <ui/Gralloc1On0Adapter.h> #include <ui/GrallocMapper.h> -#include <ui/GraphicBufferMapper.h> #include <ui/GraphicBuffer.h> #include <system/graphics.h> |