Fix google-explicit-constructor warnings in surfaceflinger.
* Add explicit keyword to conversion constructors,
or use NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1
Change-Id: I94f511c3be31dc22022db6466ee9ed0c6be2bc8e
diff --git a/services/surfaceflinger/Client.h b/services/surfaceflinger/Client.h
index b6d7381..c77651f 100644
--- a/services/surfaceflinger/Client.h
+++ b/services/surfaceflinger/Client.h
@@ -38,7 +38,7 @@
class Client : public BnSurfaceComposerClient
{
public:
- Client(const sp<SurfaceFlinger>& flinger);
+ explicit Client(const sp<SurfaceFlinger>& flinger);
~Client();
status_t initCheck() const;
diff --git a/services/surfaceflinger/Colorizer.h b/services/surfaceflinger/Colorizer.h
index 6524481..f2e6491 100644
--- a/services/surfaceflinger/Colorizer.h
+++ b/services/surfaceflinger/Colorizer.h
@@ -34,7 +34,7 @@
WHITE = 37
};
- Colorizer(bool enabled)
+ explicit Colorizer(bool enabled)
: mEnabled(enabled) {
}
diff --git a/services/surfaceflinger/DispSync.h b/services/surfaceflinger/DispSync.h
index 537c81b..2763e59 100644
--- a/services/surfaceflinger/DispSync.h
+++ b/services/surfaceflinger/DispSync.h
@@ -61,7 +61,7 @@
virtual void onDispSyncEvent(nsecs_t when) = 0;
};
- DispSync(const char* name);
+ explicit DispSync(const char* name);
~DispSync();
// reset clears the resync samples and error value.
diff --git a/services/surfaceflinger/DisplayHardware/FloatRect.h b/services/surfaceflinger/DisplayHardware/FloatRect.h
index 9ad1040..151eaaa 100644
--- a/services/surfaceflinger/DisplayHardware/FloatRect.h
+++ b/services/surfaceflinger/DisplayHardware/FloatRect.h
@@ -32,7 +32,7 @@
inline FloatRect()
: left(0), top(0), right(0), bottom(0) { }
- inline FloatRect(const Rect& other)
+ inline FloatRect(const Rect& other) // NOLINT(implicit)
: left(other.left), top(other.top), right(other.right), bottom(other.bottom) { }
inline float getWidth() const { return right - left; }
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 8ab61e9..1aa4205 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -56,7 +56,7 @@
class Device
{
public:
- Device(hwc2_device_t* device);
+ explicit Device(hwc2_device_t* device);
~Device();
friend class HWC2::Display;
diff --git a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
index dc7c355..5debb9a 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
@@ -43,7 +43,7 @@
class HWC2On1Adapter : public hwc2_device_t
{
public:
- HWC2On1Adapter(struct hwc_composer_device_1* hwc1Device);
+ explicit HWC2On1Adapter(struct hwc_composer_device_1* hwc1Device);
~HWC2On1Adapter();
struct hwc_composer_device_1* getHwc1Device() const { return mHwc1Device; }
@@ -488,7 +488,7 @@
class Layer {
public:
- Layer(Display& display);
+ explicit Layer(Display& display);
bool operator==(const Layer& other) { return mId == other.mId; }
bool operator!=(const Layer& other) { return !(*this == other); }
diff --git a/services/surfaceflinger/EventControlThread.h b/services/surfaceflinger/EventControlThread.h
index be6c53a..9368db6 100644
--- a/services/surfaceflinger/EventControlThread.h
+++ b/services/surfaceflinger/EventControlThread.h
@@ -29,7 +29,7 @@
class EventControlThread: public Thread {
public:
- EventControlThread(const sp<SurfaceFlinger>& flinger);
+ explicit EventControlThread(const sp<SurfaceFlinger>& flinger);
virtual ~EventControlThread() {}
void setVsyncEnabled(bool enabled);
diff --git a/services/surfaceflinger/EventLog/EventLog.h b/services/surfaceflinger/EventLog/EventLog.h
index 5207514..efc5d70 100644
--- a/services/surfaceflinger/EventLog/EventLog.h
+++ b/services/surfaceflinger/EventLog/EventLog.h
@@ -52,7 +52,7 @@
bool mOverflow;
char mStorage[STORAGE_MAX_SIZE];
public:
- TagBuffer(int32_t tag);
+ explicit TagBuffer(int32_t tag);
// starts list of items
void startList(int8_t count);
diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h
index 34654fa..b635115 100644
--- a/services/surfaceflinger/EventThread.h
+++ b/services/surfaceflinger/EventThread.h
@@ -57,7 +57,7 @@
class EventThread : public Thread, private VSyncSource::Callback {
class Connection : public BnDisplayEventConnection {
public:
- Connection(const sp<EventThread>& eventThread);
+ explicit Connection(const sp<EventThread>& eventThread);
status_t postEvent(const DisplayEventReceiver::Event& event);
// count >= 1 : continuous event. count is the vsync rate
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index ba7184f..55e3b54 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -456,7 +456,7 @@
class SyncPoint
{
public:
- SyncPoint(uint64_t frameNumber) : mFrameNumber(frameNumber),
+ explicit SyncPoint(uint64_t frameNumber) : mFrameNumber(frameNumber),
mFrameIsAvailable(false), mTransactionIsApplied(false) {}
uint64_t getFrameNumber() const {
diff --git a/services/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h
index 1004f4c..aed0aa9 100644
--- a/services/surfaceflinger/MessageQueue.h
+++ b/services/surfaceflinger/MessageQueue.h
@@ -69,7 +69,7 @@
MessageQueue& mQueue;
int32_t mEventMask;
public:
- Handler(MessageQueue& queue) : mQueue(queue), mEventMask(0) { }
+ explicit Handler(MessageQueue& queue) : mQueue(queue), mEventMask(0) { }
virtual void handleMessage(const Message& message);
void dispatchRefresh();
void dispatchInvalidate();