Reduce debug logs for some normal usecases

b/6984795

Change-Id: Ic5c53a458fc1f72cbe7269e58374412200fb6ff8
diff --git a/alsa_sound/AudioHardwareALSA.cpp b/alsa_sound/AudioHardwareALSA.cpp
index 7343c63..a0057de 100644
--- a/alsa_sound/AudioHardwareALSA.cpp
+++ b/alsa_sound/AudioHardwareALSA.cpp
@@ -166,7 +166,9 @@
 AudioHardwareALSA::~AudioHardwareALSA()
 {
     if (mUcMgr != NULL) {
+#if LOCAL_LOGD
         ALOGD("closing ucm instance: %u", (unsigned)mUcMgr);
+#endif
         snd_use_case_mgr_close(mUcMgr);
     }
     if (mALSADevice) {
@@ -195,7 +197,7 @@
 
 status_t AudioHardwareALSA::setVoiceVolume(float v)
 {
-    ALOGD("setVoiceVolume(%f)\n", v);
+    ALOGV("setVoiceVolume(%f)\n", v);
     if (v < 0.0) {
         ALOGW("setVoiceVolume(%f) under 0.0, assuming 0.0\n", v);
         v = 0.0;
@@ -205,7 +207,7 @@
     }
 
     int newMode = mode();
-    ALOGD("setVoiceVolume  newMode %d",newMode);
+    ALOGV("setVoiceVolume  newMode %d",newMode);
     int vol = lrint(v * 100.0);
 
     // Voice volume levels from android are mapped to driver volume levels as follows.
@@ -243,8 +245,10 @@
     }
     vol  = lrint((value * 0x2000) + 0.5);
 
+#if LOCAL_LOGD
     ALOGD("setFmVolume(%f)\n", value);
     ALOGD("Setting FM volume to %d (available range is 0 to 0x2000)\n", vol);
+#endif
 
     mALSADevice->setFmVolume(vol);
 
@@ -283,7 +287,9 @@
     int device;
     int btRate;
     int state;
+#if LOCAL_LOGD
     ALOGD("setParameters() %s", keyValuePairs.string());
+#endif
 
     key = String8(TTY_MODE_KEY);
     if (param.get(key, value) == NO_ERROR) {
@@ -586,13 +592,13 @@
                     for(it = mDeviceList.begin(); it != mDeviceList.end(); ++it) {
                          if((!strcmp(it->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||
                             (!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_LPA))) {
-                                 ALOGD("doRouting: LPA device switch to proxy");
+                                 ALOGV("doRouting: LPA device switch to proxy");
                                  startUsbPlaybackIfNotStarted();
                                  musbPlaybackState |= USBPLAYBACKBIT_LPA;
                                  break;
                          } else if((!strcmp(it->useCase, SND_USE_CASE_VERB_VOICECALL)) ||
                                    (!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_VOICE))) {
-                                    ALOGD("doRouting: VOICE device switch to proxy");
+                                    ALOGV("doRouting: VOICE device switch to proxy");
                                     startUsbRecordingIfNotStarted();
                                     startUsbPlaybackIfNotStarted();
                                     musbPlaybackState |= USBPLAYBACKBIT_VOICECALL;
@@ -600,7 +606,7 @@
                                     break;
                         }else if((!strcmp(it->useCase, SND_USE_CASE_VERB_DIGITAL_RADIO)) ||
                                  (!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_FM))) {
-                                    ALOGD("doRouting: FM device switch to proxy");
+                                    ALOGV("doRouting: FM device switch to proxy");
                                     startUsbPlaybackIfNotStarted();
                                     musbPlaybackState |= USBPLAYBACKBIT_FM;
                                     break;
@@ -676,7 +682,7 @@
                                     status_t *status)
 {
     Mutex::Autolock autoLock(mLock);
-    ALOGD("openOutputStream: devices 0x%x channels %d sampleRate %d",
+    ALOGV("openOutputStream: devices 0x%x channels %d sampleRate %d",
          devices, *channels, *sampleRate);
 
     status_t err = BAD_VALUE;
@@ -810,7 +816,7 @@
       mDeviceList.push_back(alsa_handle);
       ALSAHandleList::iterator it = mDeviceList.end();
       it--;
-      ALOGD("useCase %s", it->useCase);
+      ALOGV("useCase %s", it->useCase);
 #ifdef QCOM_USBAUDIO_ENABLED
       if((devices & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
          (devices & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
diff --git a/alsa_sound/AudioStreamOutALSA.cpp b/alsa_sound/AudioStreamOutALSA.cpp
index 88ac299..e8dc808 100644
--- a/alsa_sound/AudioStreamOutALSA.cpp
+++ b/alsa_sound/AudioStreamOutALSA.cpp
@@ -86,15 +86,15 @@
 
     if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER) ||
        !strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LPA)) {
-        ALOGD("setLpaVolume(%f)\n", volume);
-        ALOGD("Setting LPA volume to %d (available range is 0 to 100)\n", vol);
+        ALOGV("setLpaVolume(%f)\n", volume);
+        ALOGV("Setting LPA volume to %d (available range is 0 to 100)\n", vol);
         mHandle->module->setLpaVolume(vol);
         return status;
     }
     else if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_TUNNEL) ||
             !strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_TUNNEL)) {
-        ALOGD("setCompressedVolume(%f)\n", volume);
-        ALOGD("Setting Compressed volume to %d (available range is 0 to 100)\n", vol);
+        ALOGV("setCompressedVolume(%f)\n", volume);
+        ALOGV("Setting Compressed volume to %d (available range is 0 to 100)\n", vol);
         mHandle->module->setCompressedVolume(vol);
         return status;
     }
@@ -206,13 +206,13 @@
         (!mParent->musbPlaybackState)) {
         mParent->mLock.lock();
         mParent->startUsbPlaybackIfNotStarted();
-        ALOGD("Starting playback on USB");
+        ALOGV("Starting playback on USB");
         if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL) ||
            !strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP)) {
             ALOGE("Setting VOIPCALL bit here, musbPlaybackState %d", mParent->musbPlaybackState);
             mParent->musbPlaybackState |= USBPLAYBACKBIT_VOIPCALL;
         }else{
-            ALOGD("enabling music, musbPlaybackState: %d ", mParent->musbPlaybackState);
+            ALOGV("enabling music, musbPlaybackState: %d ", mParent->musbPlaybackState);
             mParent->musbPlaybackState |= USBPLAYBACKBIT_MUSIC;
         }
         mParent->mLock.unlock();
@@ -276,13 +276,13 @@
 {
     Mutex::Autolock autoLock(mParent->mLock);
 
-    ALOGD("close");
+    ALOGV("close");
     if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
         (!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
          if((mParent->mVoipStreamCount)) {
 #ifdef QCOM_USBAUDIO_ENABLED
              if(mParent->mVoipStreamCount == 1) {
-                 ALOGD("Deregistering VOIP Call bit, musbPlaybackState:%d, musbRecordingState: %d",
+                 ALOGV("Deregistering VOIP Call bit, musbPlaybackState:%d, musbRecordingState: %d",
                        mParent->musbPlaybackState, mParent->musbRecordingState);
                  mParent->musbPlaybackState &= ~USBPLAYBACKBIT_VOIPCALL;
                  mParent->musbRecordingState &= ~USBRECBIT_VOIPCALL;
@@ -315,7 +315,7 @@
 {
     Mutex::Autolock autoLock(mParent->mLock);
 
-    ALOGD("standby");
+    ALOGV("standby");
 
     if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
       (!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
@@ -325,10 +325,10 @@
 #ifdef QCOM_USBAUDIO_ENABLED
     if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||
         (!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LPA))) {
-        ALOGD("Deregistering LPA bit");
+        ALOGV("Deregistering LPA bit");
         mParent->musbPlaybackState &= ~USBPLAYBACKBIT_LPA;
     } else {
-        ALOGD("Deregistering MUSIC bit, musbPlaybackState: %d", mParent->musbPlaybackState);
+        ALOGV("Deregistering MUSIC bit, musbPlaybackState: %d", mParent->musbPlaybackState);
         mParent->musbPlaybackState &= ~USBPLAYBACKBIT_MUSIC;
     }
 #endif
diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp
index 41aae71..c7d94f9 100644
--- a/alsa_sound/alsa_default.cpp
+++ b/alsa_sound/alsa_default.cpp
@@ -207,7 +207,9 @@
     }
     strlcat(ident, handle->useCase, sizeof(ident));
     ret = snd_use_case_get(handle->ucMgr, ident, (const char **)value);
+#if LOCAL_LOGD
     ALOGD("Device value returned is %s", (*value));
+#endif
     return ret;
 }
 
@@ -527,7 +529,9 @@
         free(use_case);
         use_case = NULL;
     }
+#if LOCAL_LOGD
     ALOGD("switchDevice: curTxUCMDevivce %s curRxDevDevice %s", curTxUCMDevice, curRxUCMDevice);
+#endif
 
     if (mode == AudioSystem::MODE_IN_CALL && platform_is_Fusion3() && (inCallDevSwitch == true)) {
         /* get tx acdb id */
@@ -603,7 +607,9 @@
     /* No need to call s_close for LPA as pcm device open and close is handled by LPAPlayer in stagefright */
     if((!strcmp(handle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) || (!strcmp(handle->useCase, SND_USE_CASE_MOD_PLAY_LPA))
     ||(!strcmp(handle->useCase, SND_USE_CASE_VERB_HIFI_TUNNEL)) || (!strcmp(handle->useCase, SND_USE_CASE_MOD_PLAY_TUNNEL))) {
+#if LOCAL_LOGD
         ALOGD("s_open: Opening LPA /Tunnel playback");
+#endif
         return NO_ERROR;
     }
 
@@ -1142,7 +1148,7 @@
 
 int getUseCaseType(const char *useCase)
 {
-    ALOGE("use case is %s\n", useCase);
+    ALOGV("use case is %s\n", useCase);
     if (!strncmp(useCase, SND_USE_CASE_VERB_HIFI,
            strlen(SND_USE_CASE_VERB_HIFI)) ||
         !strncmp(useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER,
@@ -1227,7 +1233,9 @@
 #endif
         if (mods_size) {
             for(i = 0; i < mods_size; i++) {
-                ALOGE("index %d modifier %s\n", i, mods_list[i]);
+#if LOCAL_LOGD
+                ALOGD("index %d modifier %s\n", i, mods_list[i]);
+#endif
                 usecase_type |= getUseCaseType(mods_list[i]);
             }
         }