Fix google-explicit-constructor warnings in gui and ui.
* Add explicit keyword to conversion constructors.
Bug: 28341362
Test: build with WITH_TIDY=1
Change-Id: I476ad1e9a4d47acb11bf4a87ad8baa855f441417
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 09300a2..a23ed57 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -60,7 +60,7 @@
// weak references.
class ProxyConsumerListener : public BnConsumerListener {
public:
- ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
+ explicit ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
virtual ~ProxyConsumerListener();
virtual void onFrameAvailable(const BufferItem& item) override;
virtual void onFrameReplaced(const BufferItem& item) override;
diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h
index 9307a26..c62e733 100644
--- a/include/gui/ConsumerBase.h
+++ b/include/gui/ConsumerBase.h
@@ -94,7 +94,7 @@
// buffers from the given IGraphicBufferConsumer.
// The controlledByApp flag indicates that this consumer is under the application's
// control.
- ConsumerBase(const sp<IGraphicBufferConsumer>& consumer, bool controlledByApp = false);
+ explicit ConsumerBase(const sp<IGraphicBufferConsumer>& consumer, bool controlledByApp = false);
// onLastStrongRef gets called by RefBase just before the dtor of the most
// derived class. It is used to clean up the buffers so that ConsumerBase
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 37ae6df..df2b781 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -292,7 +292,7 @@
struct QueueBufferInput : public Flattenable<QueueBufferInput> {
friend class Flattenable<QueueBufferInput>;
- inline QueueBufferInput(const Parcel& parcel);
+ explicit inline QueueBufferInput(const Parcel& parcel);
// timestamp - a monotonically increasing value in nanoseconds
// isAutoTimestamp - if the timestamp was synthesized at queue time
// dataSpace - description of the contents, interpretation depends on format
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index 646203b..592391f 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -66,7 +66,7 @@
* the controlledByApp flag indicates that this Surface (producer) is
* controlled by the application. This flag is used at connect time.
*/
- Surface(const sp<IGraphicBufferProducer>& bufferProducer, bool controlledByApp = false);
+ explicit Surface(const sp<IGraphicBufferProducer>& bufferProducer, bool controlledByApp = false);
/* getIGraphicBufferProducer() returns the IGraphicBufferProducer this
* Surface was created with. Usually it's an error to use the
diff --git a/include/ui/Fence.h b/include/ui/Fence.h
index b431bd5..a4c1df7 100644
--- a/include/ui/Fence.h
+++ b/include/ui/Fence.h
@@ -53,7 +53,7 @@
// Construct a new Fence object to manage a given fence file descriptor.
// When the new Fence object is destructed the file descriptor will be
// closed.
- Fence(int fenceFd);
+ explicit Fence(int fenceFd);
// Check whether the Fence has an open fence file descriptor. Most Fence
// methods treat an invalid file descriptor just like a valid fence that