Fix google-explicit-constructor warnings in audioflinger, audiopolicy.
* Add explicit keyword to conversion constructors.
Bug: 28341362
Test: build with WITH_TIDY=1
Change-Id: I3b73f0cd73f47be7735cc374306c02301c20588f
diff --git a/services/audioflinger/AutoPark.h b/services/audioflinger/AutoPark.h
index e539e47..9ac7b65 100644
--- a/services/audioflinger/AutoPark.h
+++ b/services/audioflinger/AutoPark.h
@@ -21,7 +21,7 @@
public:
// Park the specific FastThread, which can be nullptr, in hot idle if not currently idling
- AutoPark(const sp<T>& fastThread) : mFastThread(fastThread)
+ explicit AutoPark(const sp<T>& fastThread) : mFastThread(fastThread)
{
mPreviousCommand = FastThreadState::HOT_IDLE;
if (fastThread != nullptr) {
diff --git a/services/audioflinger/LinearMap.h b/services/audioflinger/LinearMap.h
index fca14dd..2220a0c 100644
--- a/services/audioflinger/LinearMap.h
+++ b/services/audioflinger/LinearMap.h
@@ -134,7 +134,7 @@
FIND_METHOD_START_VALUE, // No samples in history, using start value
};
- LinearMap(size_t size)
+ explicit LinearMap(size_t size)
: mSize(size),
mPos(0), // a circular buffer, so could start anywhere. the first sample is at 1.
mSamples(0),
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h b/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
index 67e197f..df54f48 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
@@ -36,7 +36,7 @@
class AudioRoute : public virtual RefBase
{
public:
- AudioRoute(audio_route_type_t type) : mType(type) {}
+ explicit AudioRoute(audio_route_type_t type) : mType(type) {}
void setSources(const AudioPortVector &sources) { mSources = sources; }
const AudioPortVector &getSources() const { return mSources; }
diff --git a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
index e3ad44d..ec04ef7 100644
--- a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
+++ b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
@@ -110,13 +110,13 @@
class InputProfile : public IOProfile
{
public:
- InputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SINK) {}
+ explicit InputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SINK) {}
};
class OutputProfile : public IOProfile
{
public:
- OutputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SOURCE) {}
+ explicit OutputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SOURCE) {}
};
}; // namespace android