Fix clang-tidy warnings in audio_quality.

* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: I834788f335755d61881dbc48f8f6db670a219d65
diff --git a/suite/audio_quality/lib/include/Semaphore.h b/suite/audio_quality/lib/include/Semaphore.h
index 3fdcc75..c4c3e88 100644
--- a/suite/audio_quality/lib/include/Semaphore.h
+++ b/suite/audio_quality/lib/include/Semaphore.h
@@ -27,7 +27,7 @@
  */
 class Semaphore {
 public:
-    Semaphore(int count = 0);
+    explicit Semaphore(int count = 0);
 
     ~Semaphore();
 
diff --git a/suite/audio_quality/lib/include/Settings.h b/suite/audio_quality/lib/include/Settings.h
index a8cfea5..6404769 100644
--- a/suite/audio_quality/lib/include/Settings.h
+++ b/suite/audio_quality/lib/include/Settings.h
@@ -32,7 +32,7 @@
         ETEST_XML       = 4, // name of test description xml
         EMAX_SETTINGS   = 4  // not real setting
     };
-    void addSetting(SettingType type, const android::String8 setting);
+    void addSetting(SettingType type, const android::String8& setting);
     const android::String8& getSetting(SettingType type);
 private:
     static Settings* mInstance;
diff --git a/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h b/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h
index 94422af..fcfb270 100644
--- a/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h
+++ b/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h
@@ -27,7 +27,7 @@
 
 class AudioPlaybackLocal: public AudioLocal {
 public:
-    AudioPlaybackLocal(int hwId);
+    explicit AudioPlaybackLocal(int hwId);
     virtual ~AudioPlaybackLocal();
 protected:
     bool doPrepare(AudioHardware::SamplingRate, int samplesInOneGo);
diff --git a/suite/audio_quality/lib/include/audio/AudioProtocol.h b/suite/audio_quality/lib/include/audio/AudioProtocol.h
index 01e8507..eaf93a8 100644
--- a/suite/audio_quality/lib/include/audio/AudioProtocol.h
+++ b/suite/audio_quality/lib/include/audio/AudioProtocol.h
@@ -102,7 +102,7 @@
 
 class CmdDownload: public AudioProtocol {
 public:
-    CmdDownload(ClientSocket& socket)
+    explicit CmdDownload(ClientSocket& socket)
         : AudioProtocol(socket, ECmdDownload) {};
     virtual ~CmdDownload() {};
     virtual bool sendCommand(AudioParam& param);
@@ -111,7 +111,7 @@
 
 class CmdStartPlayback: public AudioProtocol {
 public:
-    CmdStartPlayback(ClientSocket& socket)
+    explicit CmdStartPlayback(ClientSocket& socket)
         : AudioProtocol(socket, ECmdStartPlayback) {};
     virtual ~CmdStartPlayback() {};
     virtual bool sendCommand(AudioParam& param);
@@ -119,14 +119,14 @@
 
 class CmdStopPlayback: public AudioProtocol {
 public:
-    CmdStopPlayback(ClientSocket& socket)
+    explicit CmdStopPlayback(ClientSocket& socket)
         : AudioProtocol(socket, ECmdStopPlayback) {};
     virtual ~CmdStopPlayback() {};
 };
 
 class CmdStartRecording: public AudioProtocol {
 public:
-    CmdStartRecording(ClientSocket& socket)
+    explicit CmdStartRecording(ClientSocket& socket)
         : AudioProtocol(socket, ECmdStartRecording) {};
     virtual ~CmdStartRecording() {};
 
@@ -137,14 +137,14 @@
 
 class CmdStopRecording: public AudioProtocol {
 public:
-    CmdStopRecording(ClientSocket& socket)
+    explicit CmdStopRecording(ClientSocket& socket)
         : AudioProtocol(socket, ECmdStopRecording) {};
     virtual ~CmdStopRecording() {};
 };
 
 class CmdGetDeviceInfo: public AudioProtocol {
 public:
-    CmdGetDeviceInfo(ClientSocket& socket)
+    explicit CmdGetDeviceInfo(ClientSocket& socket)
         : AudioProtocol(socket, ECmdGetDeviceInfo) {};
     virtual ~CmdGetDeviceInfo() {};
 
diff --git a/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h b/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h
index 614ed6d..e192812 100644
--- a/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h
+++ b/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h
@@ -27,7 +27,7 @@
 
 class AudioRecordingLocal: public AudioLocal {
 public:
-    AudioRecordingLocal(int hwId);
+    explicit AudioRecordingLocal(int hwId);
     virtual ~AudioRecordingLocal();
 protected:
     bool doPrepare(AudioHardware::SamplingRate, int samplesInOneGo);
diff --git a/suite/audio_quality/lib/include/audio/AudioRemote.h b/suite/audio_quality/lib/include/audio/AudioRemote.h
index 1268ee0..f5e6c2e 100644
--- a/suite/audio_quality/lib/include/audio/AudioRemote.h
+++ b/suite/audio_quality/lib/include/audio/AudioRemote.h
@@ -30,7 +30,7 @@
             int mode = AudioHardware::EModeVoice);
 
 protected:
-    AudioRemote(android::sp<RemoteAudio>& remote);
+    explicit AudioRemote(android::sp<RemoteAudio>& remote);
     virtual ~AudioRemote() {};
 
 protected:
@@ -42,7 +42,7 @@
 
 class AudioRemotePlayback: public AudioRemote {
 public:
-    AudioRemotePlayback(android::sp<RemoteAudio>& remote);
+    explicit AudioRemotePlayback(android::sp<RemoteAudio>& remote);
     virtual ~AudioRemotePlayback() {};
     virtual bool startPlaybackOrRecord(android::sp<Buffer>& buffer, int numberRepetition = 1);
     virtual bool waitForCompletion();
@@ -52,7 +52,7 @@
 
 class AudioRemoteRecording: public AudioRemote {
 public:
-    AudioRemoteRecording(android::sp<RemoteAudio>& remote);
+    explicit AudioRemoteRecording(android::sp<RemoteAudio>& remote);
     virtual ~AudioRemoteRecording() {};
     virtual bool startPlaybackOrRecord(android::sp<Buffer>& buffer, int numberRepetition = 1);
     virtual bool waitForCompletion();
diff --git a/suite/audio_quality/lib/include/audio/Buffer.h b/suite/audio_quality/lib/include/audio/Buffer.h
index 343c502..17c5679 100644
--- a/suite/audio_quality/lib/include/audio/Buffer.h
+++ b/suite/audio_quality/lib/include/audio/Buffer.h
@@ -32,7 +32,7 @@
  */
 class Buffer: public virtual android::RefBase {
 public:
-    Buffer(size_t capacity, size_t size = 0, bool stereo = true);
+    explicit Buffer(size_t capacity, size_t size = 0, bool stereo = true);
 
     virtual ~Buffer();
 
diff --git a/suite/audio_quality/lib/include/audio/RemoteAudio.h b/suite/audio_quality/lib/include/audio/RemoteAudio.h
index 26647c4..be977b2 100644
--- a/suite/audio_quality/lib/include/audio/RemoteAudio.h
+++ b/suite/audio_quality/lib/include/audio/RemoteAudio.h
@@ -40,12 +40,12 @@
 class RemoteAudio: public android::Thread {
 public:
 
-    RemoteAudio(ClientSocket& socket);
+    explicit RemoteAudio(ClientSocket& socket);
     virtual ~RemoteAudio();
 
     /** launch a thread, and connect to host */
     bool init(int port);
-    bool downloadData(const android::String8 name, android::sp<Buffer>& buffer, int& id);
+    bool downloadData(const android::String8& name, android::sp<Buffer>& buffer, int& id);
     // <0 : not found
     int getDataId(const android::String8& name);
     bool startPlayback(bool stereo, int samplingF, int mode, int volume,
diff --git a/suite/audio_quality/lib/include/task/ModelBuilder.h b/suite/audio_quality/lib/include/task/ModelBuilder.h
index c6102d7..d8d9e6b 100644
--- a/suite/audio_quality/lib/include/task/ModelBuilder.h
+++ b/suite/audio_quality/lib/include/task/ModelBuilder.h
@@ -33,7 +33,7 @@
 class ModelBuilder {
 public:
     ModelBuilder();
-    ModelBuilder(GenericFactory* factory);
+    explicit ModelBuilder(GenericFactory* factory);
     virtual ~ModelBuilder();
 
     /**
diff --git a/suite/audio_quality/lib/include/task/TaskAsync.h b/suite/audio_quality/lib/include/task/TaskAsync.h
index 4a8ed32..9651c90 100644
--- a/suite/audio_quality/lib/include/task/TaskAsync.h
+++ b/suite/audio_quality/lib/include/task/TaskAsync.h
@@ -27,7 +27,7 @@
  */
 class TaskAsync: public TaskGeneric {
 public:
-    TaskAsync(TaskType type);
+    explicit TaskAsync(TaskType type);
     virtual ~TaskAsync();
     virtual TaskGeneric::ExecutionResult run();
     virtual bool parseAttribute(const android::String8& name, const android::String8& value);
diff --git a/suite/audio_quality/lib/include/task/TaskCase.h b/suite/audio_quality/lib/include/task/TaskCase.h
index 4e20829..22d94e9 100644
--- a/suite/audio_quality/lib/include/task/TaskCase.h
+++ b/suite/audio_quality/lib/include/task/TaskCase.h
@@ -58,11 +58,11 @@
             ETypeI64
         };
         inline Value(): mType(ETypeDouble) {};
-        inline Value(Type type): mType(type) {};
-        inline Value(double val): mType(ETypeDouble) {
+        inline explicit Value(Type type): mType(type) {};
+        inline explicit Value(double val): mType(ETypeDouble) {
             setDouble(val);
         };
-        inline Value(int64_t val): mType(ETypeI64) {
+        inline explicit Value(int64_t val): mType(ETypeI64) {
             setInt64(val);
         };
         inline Type getType() {
@@ -123,7 +123,7 @@
      */
     bool translateVarName(const android::String8& orig, android::String8& translated);
 
-    void setDetails(android::String8 details);
+    void setDetails(const android::String8& details);
     const android::String8& getDetails() const;
 private:
     void releaseRemoteAudio();
diff --git a/suite/audio_quality/lib/include/task/TaskGeneric.h b/suite/audio_quality/lib/include/task/TaskGeneric.h
index 6f60bcf..af0a500 100644
--- a/suite/audio_quality/lib/include/task/TaskGeneric.h
+++ b/suite/audio_quality/lib/include/task/TaskGeneric.h
@@ -48,7 +48,7 @@
         //no ETaskInclude include does not involve any action.
     };
 
-    TaskGeneric(TaskType type);
+    explicit TaskGeneric(TaskType type);
 
     virtual ~TaskGeneric();
 
diff --git a/suite/audio_quality/lib/include/task/TaskProcess.h b/suite/audio_quality/lib/include/task/TaskProcess.h
index d043d98..8afc677 100644
--- a/suite/audio_quality/lib/include/task/TaskProcess.h
+++ b/suite/audio_quality/lib/include/task/TaskProcess.h
@@ -69,7 +69,7 @@
     class Param {
     public:
         Param(ParamType type, android::String8& string);
-        Param(TaskCase::Value& val);
+        explicit Param(TaskCase::Value& val);
         ParamType getType();
         android::String8& getParamString();
         TaskCase::Value& getValue();
diff --git a/suite/audio_quality/lib/src/Adb.h b/suite/audio_quality/lib/src/Adb.h
index 59d4b9b..c85b9f7 100644
--- a/suite/audio_quality/lib/src/Adb.h
+++ b/suite/audio_quality/lib/src/Adb.h
@@ -24,7 +24,7 @@
 public:
     /// device: device number typically passed in adb's -s argument.
     /// if device string is empty, adb command will be called without -s option.
-    Adb(const android::String8& device);
+    explicit Adb(const android::String8& device);
     ~Adb();
     bool setPortForwarding(int hostPort, int devicePort);
     /// install given clientBinary to DUT and launch given component.
diff --git a/suite/audio_quality/lib/src/RWBuffer.h b/suite/audio_quality/lib/src/RWBuffer.h
index 8b9d2a0..8065e3e 100644
--- a/suite/audio_quality/lib/src/RWBuffer.h
+++ b/suite/audio_quality/lib/src/RWBuffer.h
@@ -25,7 +25,7 @@
 /// utility for R/W buffer
 class RWBuffer {
 public:
-    RWBuffer(int capacity)
+    explicit RWBuffer(int capacity)
         : mCapacity(capacity),
           mWrPoint(0),
           mRdPoint(0) {
diff --git a/suite/audio_quality/lib/src/Settings.cpp b/suite/audio_quality/lib/src/Settings.cpp
index 42dd30e..7af4c08 100644
--- a/suite/audio_quality/lib/src/Settings.cpp
+++ b/suite/audio_quality/lib/src/Settings.cpp
@@ -34,7 +34,7 @@
 }
 
 
-void Settings::addSetting(SettingType type, const android::String8 setting)
+void Settings::addSetting(SettingType type, const android::String8& setting)
 {
     mSettings[type] = setting;
 }
diff --git a/suite/audio_quality/lib/src/audio/RemoteAudio.cpp b/suite/audio_quality/lib/src/audio/RemoteAudio.cpp
index ead04b9..56758fb 100644
--- a/suite/audio_quality/lib/src/audio/RemoteAudio.cpp
+++ b/suite/audio_quality/lib/src/audio/RemoteAudio.cpp
@@ -193,7 +193,7 @@
 }
 
 
-bool RemoteAudio::downloadData(const android::String8 name, android::sp<Buffer>& buffer, int& id)
+bool RemoteAudio::downloadData(const android::String8& name, android::sp<Buffer>& buffer, int& id)
 {
     CommandHandler* handler = reinterpret_cast<CommandHandler*>(mDownloadHandler.get());
     id = mDownloadId;
diff --git a/suite/audio_quality/lib/src/task/TaskCase.cpp b/suite/audio_quality/lib/src/task/TaskCase.cpp
index 5f9de97..861802d 100644
--- a/suite/audio_quality/lib/src/task/TaskCase.cpp
+++ b/suite/audio_quality/lib/src/task/TaskCase.cpp
@@ -292,7 +292,7 @@
     mClient = NULL;
 }
 
-void TaskCase::setDetails(android::String8 details)
+void TaskCase::setDetails(const android::String8& details)
 {
     mDetails = details;
 }
diff --git a/suite/audio_quality/test/TaskTest.cpp b/suite/audio_quality/test/TaskTest.cpp
index b003d99..3636f82 100644
--- a/suite/audio_quality/test/TaskTest.cpp
+++ b/suite/audio_quality/test/TaskTest.cpp
@@ -37,7 +37,7 @@
         static int mRunCounter;
         static int mLiveInstanceCounter;
 
-        TestTaskDummy(TaskGeneric::TaskType type)
+        explicit TestTaskDummy(TaskGeneric::TaskType type)
             : TaskGeneric(type) {
             mLiveInstanceCounter++;