Fix/suppress libs/vr google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters
Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I3631041531e3fb5cbcee246a7e7bb94fb06aa60b
diff --git a/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_frame.h b/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_frame.h
index b478bb5..a82df7f 100644
--- a/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_frame.h
+++ b/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_frame.h
@@ -10,7 +10,7 @@
class ParcelableComposerFrame : public Parcelable {
public:
ParcelableComposerFrame();
- ParcelableComposerFrame(const ComposerView::Frame& frame);
+ explicit ParcelableComposerFrame(const ComposerView::Frame& frame);
~ParcelableComposerFrame() override;
ComposerView::Frame frame() const { return frame_; }
diff --git a/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_layer.h b/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_layer.h
index 4cf48f1..6d2ac09 100644
--- a/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_layer.h
+++ b/services/vr/hardware_composer/aidl/android/dvr/parcelable_composer_layer.h
@@ -12,7 +12,7 @@
class ParcelableComposerLayer : public Parcelable {
public:
ParcelableComposerLayer();
- ParcelableComposerLayer(const ComposerView::ComposerLayer& layer);
+ explicit ParcelableComposerLayer(const ComposerView::ComposerLayer& layer);
~ParcelableComposerLayer() override;
ComposerView::ComposerLayer layer() const { return layer_; }
diff --git a/services/vr/hardware_composer/aidl/android/dvr/parcelable_unique_fd.h b/services/vr/hardware_composer/aidl/android/dvr/parcelable_unique_fd.h
index daf9e6d..c4216f6 100644
--- a/services/vr/hardware_composer/aidl/android/dvr/parcelable_unique_fd.h
+++ b/services/vr/hardware_composer/aidl/android/dvr/parcelable_unique_fd.h
@@ -13,7 +13,7 @@
class ParcelableUniqueFd : public Parcelable {
public:
ParcelableUniqueFd();
- ParcelableUniqueFd(const base::unique_fd& fence);
+ explicit ParcelableUniqueFd(const base::unique_fd& fence);
~ParcelableUniqueFd() override;
void set_fence(const base::unique_fd& fence) {
diff --git a/services/vr/hardware_composer/impl/vr_composer_client.h b/services/vr/hardware_composer/impl/vr_composer_client.h
index 76b1c4f..2ad95fc 100644
--- a/services/vr/hardware_composer/impl/vr_composer_client.h
+++ b/services/vr/hardware_composer/impl/vr_composer_client.h
@@ -35,13 +35,13 @@
class VrComposerClient : public ComposerClient {
public:
- VrComposerClient(android::dvr::VrHwc& hal);
+ explicit VrComposerClient(android::dvr::VrHwc& hal);
virtual ~VrComposerClient();
private:
class VrCommandEngine : public ComposerCommandEngine {
public:
- VrCommandEngine(VrComposerClient& client);
+ explicit VrCommandEngine(VrComposerClient& client);
~VrCommandEngine() override;
bool executeCommand(IComposerClient::Command command,
diff --git a/services/vr/hardware_composer/impl/vr_hwc.h b/services/vr/hardware_composer/impl/vr_hwc.h
index 85e587a..74c1699 100644
--- a/services/vr/hardware_composer/impl/vr_hwc.h
+++ b/services/vr/hardware_composer/impl/vr_hwc.h
@@ -112,9 +112,7 @@
using Composition =
hardware::graphics::composer::V2_1::IComposerClient::Composition;
- HwcLayer(Layer new_id) {
- info.id = new_id;
- }
+ explicit HwcLayer(Layer new_id) { info.id = new_id; }
void dumpDebugInfo(std::string* result) const;
diff --git a/services/vr/virtual_touchpad/VirtualTouchpadService.h b/services/vr/virtual_touchpad/VirtualTouchpadService.h
index 2c46209..2c88aec 100644
--- a/services/vr/virtual_touchpad/VirtualTouchpadService.h
+++ b/services/vr/virtual_touchpad/VirtualTouchpadService.h
@@ -13,7 +13,7 @@
//
class VirtualTouchpadService : public BnVirtualTouchpadService {
public:
- VirtualTouchpadService(std::unique_ptr<VirtualTouchpad> touchpad)
+ explicit VirtualTouchpadService(std::unique_ptr<VirtualTouchpad> touchpad)
: touchpad_(std::move(touchpad)), client_pid_(0) {}
~VirtualTouchpadService() override;