graphics: clang-format allocator default impl

Test: builds
Change-Id: I01cee2e7bc778f2e3e540a9856c25f1a0e390186
diff --git a/graphics/allocator/2.0/default/Gralloc.cpp b/graphics/allocator/2.0/default/Gralloc.cpp
index 273d3f5..af578e8 100644
--- a/graphics/allocator/2.0/default/Gralloc.cpp
+++ b/graphics/allocator/2.0/default/Gralloc.cpp
@@ -49,9 +49,9 @@
     }
 }
 
-} // namespace implementation
-} // namespace V2_0
-} // namespace allocator
-} // namespace graphics
-} // namespace hardware
-} // namespace android
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace allocator
+}  // namespace graphics
+}  // namespace hardware
+}  // namespace android
diff --git a/graphics/allocator/2.0/default/Gralloc.h b/graphics/allocator/2.0/default/Gralloc.h
index c79eeaa..18c5202 100644
--- a/graphics/allocator/2.0/default/Gralloc.h
+++ b/graphics/allocator/2.0/default/Gralloc.h
@@ -28,11 +28,11 @@
 
 extern "C" IAllocator* HIDL_FETCH_IAllocator(const char* name);
 
-} // namespace implementation
-} // namespace V2_0
-} // namespace allocator
-} // namespace graphics
-} // namespace hardware
-} // namespace android
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace allocator
+}  // namespace graphics
+}  // namespace hardware
+}  // namespace android
 
-#endif // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC_H
+#endif  // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC_H
diff --git a/graphics/allocator/2.0/default/service.cpp b/graphics/allocator/2.0/default/service.cpp
index 99f462c..bc0539a 100644
--- a/graphics/allocator/2.0/default/service.cpp
+++ b/graphics/allocator/2.0/default/service.cpp
@@ -20,8 +20,8 @@
 
 #include <hidl/LegacySupport.h>
 
-using android::hardware::graphics::allocator::V2_0::IAllocator;
 using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::graphics::allocator::V2_0::IAllocator;
 
 int main() {
     return defaultPassthroughServiceImplementation<IAllocator>(4);
diff --git a/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.cpp b/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.cpp
index 3b62bb3..b49370a 100644
--- a/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.cpp
+++ b/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.cpp
@@ -32,14 +32,12 @@
 namespace V2_0 {
 namespace implementation {
 
-using android::hardware::graphics::mapper::V2_0::implementation::
-    grallocDecodeBufferDescriptor;
+using android::hardware::graphics::mapper::V2_0::implementation::grallocDecodeBufferDescriptor;
 
 Gralloc0Allocator::Gralloc0Allocator(const hw_module_t* module) {
     int result = gralloc_open(module, &mDevice);
     if (result) {
-        LOG_ALWAYS_FATAL("failed to open gralloc0 device: %s",
-                         strerror(-result));
+        LOG_ALWAYS_FATAL("failed to open gralloc0 device: %s", strerror(-result));
     }
 }
 
@@ -59,8 +57,8 @@
     return Void();
 }
 
-Return<void> Gralloc0Allocator::allocate(const BufferDescriptor& descriptor,
-                                         uint32_t count, allocate_cb hidl_cb) {
+Return<void> Gralloc0Allocator::allocate(const BufferDescriptor& descriptor, uint32_t count,
+                                         allocate_cb hidl_cb) {
     IMapper::BufferDescriptorInfo descriptorInfo;
     if (!grallocDecodeBufferDescriptor(descriptor, &descriptorInfo)) {
         hidl_cb(Error::BAD_DESCRIPTOR, 0, hidl_vec<hidl_handle>());
@@ -110,17 +108,15 @@
 }
 
 Error Gralloc0Allocator::allocateOne(const IMapper::BufferDescriptorInfo& info,
-                                     buffer_handle_t* outBuffer,
-                                     uint32_t* outStride) {
+                                     buffer_handle_t* outBuffer, uint32_t* outStride) {
     if (info.layerCount > 1 || (info.usage >> 32) != 0) {
         return Error::BAD_VALUE;
     }
 
     buffer_handle_t buffer = nullptr;
     int stride = 0;
-    int result = mDevice->alloc(mDevice, info.width, info.height,
-                                static_cast<int>(info.format), info.usage,
-                                &buffer, &stride);
+    int result = mDevice->alloc(mDevice, info.width, info.height, static_cast<int>(info.format),
+                                info.usage, &buffer, &stride);
     if (result) {
         switch (result) {
             case -EINVAL:
diff --git a/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.h b/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.h
index 0e90527..6052282 100644
--- a/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.h
+++ b/graphics/allocator/2.0/utils/passthrough/Gralloc0Allocator.h
@@ -28,9 +28,9 @@
 namespace V2_0 {
 namespace implementation {
 
-using android::hardware::graphics::mapper::V2_0::IMapper;
 using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
 using android::hardware::graphics::mapper::V2_0::Error;
+using android::hardware::graphics::mapper::V2_0::IMapper;
 
 class Gralloc0Allocator : public IAllocator {
    public:
@@ -43,8 +43,8 @@
                           allocate_cb hidl_cb) override;
 
    private:
-    Error allocateOne(const IMapper::BufferDescriptorInfo& info,
-                      buffer_handle_t* outBuffer, uint32_t* outStride);
+    Error allocateOne(const IMapper::BufferDescriptorInfo& info, buffer_handle_t* outBuffer,
+                      uint32_t* outStride);
 
     alloc_device_t* mDevice;
 };
diff --git a/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.cpp b/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.cpp
index 6cbb791..b7e27bb 100644
--- a/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.cpp
+++ b/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.cpp
@@ -33,15 +33,13 @@
 namespace implementation {
 
 using android::hardware::graphics::common::V1_0::BufferUsage;
-using android::hardware::graphics::mapper::V2_0::implementation::
-    grallocDecodeBufferDescriptor;
+using android::hardware::graphics::mapper::V2_0::implementation::grallocDecodeBufferDescriptor;
 
 Gralloc1Allocator::Gralloc1Allocator(const hw_module_t* module)
     : mDevice(nullptr), mCapabilities(), mDispatch() {
     int result = gralloc1_open(module, &mDevice);
     if (result) {
-        LOG_ALWAYS_FATAL("failed to open gralloc1 device: %s",
-                         strerror(-result));
+        LOG_ALWAYS_FATAL("failed to open gralloc1 device: %s", strerror(-result));
     }
 
     initCapabilities();
@@ -69,8 +67,7 @@
 }
 
 template <typename T>
-void Gralloc1Allocator::initDispatch(gralloc1_function_descriptor_t desc,
-                                     T* outPfn) {
+void Gralloc1Allocator::initDispatch(gralloc1_function_descriptor_t desc, T* outPfn) {
     auto pfn = mDevice->getFunction(mDevice, desc);
     if (!pfn) {
         LOG_ALWAYS_FATAL("failed to get gralloc1 function %d", desc);
@@ -81,20 +78,15 @@
 
 void Gralloc1Allocator::initDispatch() {
     initDispatch(GRALLOC1_FUNCTION_DUMP, &mDispatch.dump);
-    initDispatch(GRALLOC1_FUNCTION_CREATE_DESCRIPTOR,
-                 &mDispatch.createDescriptor);
-    initDispatch(GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR,
-                 &mDispatch.destroyDescriptor);
+    initDispatch(GRALLOC1_FUNCTION_CREATE_DESCRIPTOR, &mDispatch.createDescriptor);
+    initDispatch(GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR, &mDispatch.destroyDescriptor);
     initDispatch(GRALLOC1_FUNCTION_SET_DIMENSIONS, &mDispatch.setDimensions);
     initDispatch(GRALLOC1_FUNCTION_SET_FORMAT, &mDispatch.setFormat);
     if (mCapabilities.layeredBuffers) {
-        initDispatch(GRALLOC1_FUNCTION_SET_LAYER_COUNT,
-                     &mDispatch.setLayerCount);
+        initDispatch(GRALLOC1_FUNCTION_SET_LAYER_COUNT, &mDispatch.setLayerCount);
     }
-    initDispatch(GRALLOC1_FUNCTION_SET_CONSUMER_USAGE,
-                 &mDispatch.setConsumerUsage);
-    initDispatch(GRALLOC1_FUNCTION_SET_PRODUCER_USAGE,
-                 &mDispatch.setProducerUsage);
+    initDispatch(GRALLOC1_FUNCTION_SET_CONSUMER_USAGE, &mDispatch.setConsumerUsage);
+    initDispatch(GRALLOC1_FUNCTION_SET_PRODUCER_USAGE, &mDispatch.setProducerUsage);
     initDispatch(GRALLOC1_FUNCTION_GET_STRIDE, &mDispatch.getStride);
     initDispatch(GRALLOC1_FUNCTION_ALLOCATE, &mDispatch.allocate);
     initDispatch(GRALLOC1_FUNCTION_RELEASE, &mDispatch.release);
@@ -116,8 +108,8 @@
     return Void();
 }
 
-Return<void> Gralloc1Allocator::allocate(const BufferDescriptor& descriptor,
-                                         uint32_t count, allocate_cb hidl_cb) {
+Return<void> Gralloc1Allocator::allocate(const BufferDescriptor& descriptor, uint32_t count,
+                                         allocate_cb hidl_cb) {
     IMapper::BufferDescriptorInfo descriptorInfo;
     if (!grallocDecodeBufferDescriptor(descriptor, &descriptorInfo)) {
         hidl_cb(Error::BAD_DESCRIPTOR, 0, hidl_vec<hidl_handle>());
@@ -199,9 +191,8 @@
     // this is potentially broken as we have no idea which private flags
     // should be filtered out
     uint64_t producerUsage =
-        usage &
-        ~static_cast<uint64_t>(BufferUsage::CPU_READ_MASK | BufferUsage::CPU_WRITE_MASK |
-                               BufferUsage::GPU_DATA_BUFFER);
+        usage & ~static_cast<uint64_t>(BufferUsage::CPU_READ_MASK | BufferUsage::CPU_WRITE_MASK |
+                                       BufferUsage::GPU_DATA_BUFFER);
 
     switch (usage & BufferUsage::CPU_WRITE_MASK) {
         case static_cast<uint64_t>(BufferUsage::CPU_WRITE_RARELY):
@@ -258,36 +249,30 @@
     return consumerUsage;
 }
 
-Error Gralloc1Allocator::createDescriptor(
-    const IMapper::BufferDescriptorInfo& info,
-    gralloc1_buffer_descriptor_t* outDescriptor) {
+Error Gralloc1Allocator::createDescriptor(const IMapper::BufferDescriptorInfo& info,
+                                          gralloc1_buffer_descriptor_t* outDescriptor) {
     gralloc1_buffer_descriptor_t descriptor;
 
     int32_t error = mDispatch.createDescriptor(mDevice, &descriptor);
 
     if (error == GRALLOC1_ERROR_NONE) {
-        error = mDispatch.setDimensions(mDevice, descriptor, info.width,
-                                        info.height);
+        error = mDispatch.setDimensions(mDevice, descriptor, info.width, info.height);
     }
     if (error == GRALLOC1_ERROR_NONE) {
-        error = mDispatch.setFormat(mDevice, descriptor,
-                                    static_cast<int32_t>(info.format));
+        error = mDispatch.setFormat(mDevice, descriptor, static_cast<int32_t>(info.format));
     }
     if (error == GRALLOC1_ERROR_NONE) {
         if (mCapabilities.layeredBuffers) {
-            error =
-                mDispatch.setLayerCount(mDevice, descriptor, info.layerCount);
+            error = mDispatch.setLayerCount(mDevice, descriptor, info.layerCount);
         } else if (info.layerCount > 1) {
             error = GRALLOC1_ERROR_UNSUPPORTED;
         }
     }
     if (error == GRALLOC1_ERROR_NONE) {
-        error = mDispatch.setProducerUsage(mDevice, descriptor,
-                                           toProducerUsage(info.usage));
+        error = mDispatch.setProducerUsage(mDevice, descriptor, toProducerUsage(info.usage));
     }
     if (error == GRALLOC1_ERROR_NONE) {
-        error = mDispatch.setConsumerUsage(mDevice, descriptor,
-                                           toConsumerUsage(info.usage));
+        error = mDispatch.setConsumerUsage(mDevice, descriptor, toConsumerUsage(info.usage));
     }
 
     if (error == GRALLOC1_ERROR_NONE) {
@@ -300,8 +285,7 @@
 }
 
 Error Gralloc1Allocator::allocateOne(gralloc1_buffer_descriptor_t descriptor,
-                                     buffer_handle_t* outBuffer,
-                                     uint32_t* outStride) {
+                                     buffer_handle_t* outBuffer, uint32_t* outStride) {
     buffer_handle_t buffer = nullptr;
     int32_t error = mDispatch.allocate(mDevice, 1, &descriptor, &buffer);
     if (error != GRALLOC1_ERROR_NONE && error != GRALLOC1_ERROR_NOT_SHARED) {
diff --git a/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.h b/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.h
index 7b5a966..686e8b3 100644
--- a/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.h
+++ b/graphics/allocator/2.0/utils/passthrough/Gralloc1Allocator.h
@@ -28,9 +28,9 @@
 namespace V2_0 {
 namespace implementation {
 
-using android::hardware::graphics::mapper::V2_0::IMapper;
 using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
 using android::hardware::graphics::mapper::V2_0::Error;
+using android::hardware::graphics::mapper::V2_0::IMapper;
 
 class Gralloc1Allocator : public IAllocator {
    public:
@@ -55,8 +55,8 @@
 
     Error createDescriptor(const IMapper::BufferDescriptorInfo& info,
                            gralloc1_buffer_descriptor_t* outDescriptor);
-    Error allocateOne(gralloc1_buffer_descriptor_t descriptor,
-                      buffer_handle_t* outBuffer, uint32_t* outStride);
+    Error allocateOne(gralloc1_buffer_descriptor_t descriptor, buffer_handle_t* outBuffer,
+                      uint32_t* outStride);
 
     gralloc1_device_t* mDevice;