audio: enable necessary audio logs for debugging purpose

- Remove LOCAL_LOGD flag and enable audio necessary logs

Change-Id: Ia767ff8deaae4aa27252450eb94c64506cb8a495
diff --git a/alsa_sound/ALSAStreamOps.cpp b/alsa_sound/ALSAStreamOps.cpp
index 4c4a062..bb3dfe6 100644
--- a/alsa_sound/ALSAStreamOps.cpp
+++ b/alsa_sound/ALSAStreamOps.cpp
@@ -299,9 +299,7 @@
             break;
     }
 
-#if LOCAL_LOGD
-    ALOGD("ALSAFormat:0x%x,audioSystemFormat:0x%x",ALSAFormat,audioSystemFormat);
-#endif
+    ALOGV("ALSAFormat:0x%x,audioSystemFormat:0x%x",ALSAFormat,audioSystemFormat);
     return audioSystemFormat;
 }
 
diff --git a/alsa_sound/AudioHardwareALSA.cpp b/alsa_sound/AudioHardwareALSA.cpp
index 54f386a..7db7e63 100644
--- a/alsa_sound/AudioHardwareALSA.cpp
+++ b/alsa_sound/AudioHardwareALSA.cpp
@@ -201,9 +201,7 @@
 AudioHardwareALSA::~AudioHardwareALSA()
 {
     if (mUcMgr != NULL) {
-#if LOCAL_LOGD
-        ALOGD("closing ucm instance: %u", (unsigned)mUcMgr);
-#endif
+        ALOGV("closing ucm instance: %u", (unsigned)mUcMgr);
         snd_use_case_mgr_close(mUcMgr);
     }
     if (mALSADevice) {
@@ -295,10 +293,8 @@
     }
     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
+    ALOGV("setFmVolume(%f)\n", value);
+    ALOGV("Setting FM volume to %d (available range is 0 to 0x2000)\n", vol);
 
     mALSADevice->setFmVolume(vol);
 
@@ -337,9 +333,7 @@
     int device;
     int btRate;
     int state;
-#if LOCAL_LOGD
-    ALOGD("setParameters() %s", keyValuePairs.string());
-#endif
+    ALOGV("setParameters() %s", keyValuePairs.string());
 
     key = String8(TTY_MODE_KEY);
     if (param.get(key, value) == NO_ERROR) {
@@ -853,7 +847,7 @@
       snd_use_case_get(mUcMgr, "_verb", (const char **)&use_case);
 
       if (flag & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) {
-	  ALOGD("openOutputStream: DeepBuffer Output");
+      ALOGD("openOutputStream: DeepBuffer Output");
           alsa_handle.isDeepbufferOutput = true;
           if ((use_case == NULL) || (!strcmp(use_case, SND_USE_CASE_VERB_INACTIVE))) {
                strlcpy(alsa_handle.useCase, SND_USE_CASE_VERB_HIFI, sizeof(alsa_handle.useCase));
@@ -861,7 +855,7 @@
                strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_PLAY_MUSIC, sizeof(alsa_handle.useCase));
           }
       } else {
-	  ALOGD("openOutputStream: Lowlatency Output");
+      ALOGD("openOutputStream: Lowlatency Output");
           alsa_handle.bufferSize = PLAYBACK_LOW_LATENCY_BUFFER_SIZE;
           alsa_handle.latency = PLAYBACK_LOW_LATENCY;
           if ((use_case == NULL) || (!strcmp(use_case, SND_USE_CASE_VERB_INACTIVE))) {
@@ -1209,8 +1203,8 @@
                 strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_CAPTURE_A2DP_FM, sizeof(alsa_handle.useCase));
 #endif
             } else {
-		char value[128];
-		property_get("persist.audio.lowlatency.rec",value,"0");
+        char value[128];
+        property_get("persist.audio.lowlatency.rec",value,"0");
                 if (!strcmp("true", value)) {
                     strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_CAPTURE_LOWLATENCY_MUSIC, sizeof(alsa_handle.useCase));
                 } else {
diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp
index fdc89da..d44be17 100644
--- a/alsa_sound/alsa_default.cpp
+++ b/alsa_sound/alsa_default.cpp
@@ -176,9 +176,7 @@
     }
     strlcpy(curRxUCMDevice, "None", sizeof(curRxUCMDevice));
     strlcpy(curTxUCMDevice, "None", sizeof(curTxUCMDevice));
-#if LOCAL_LOGD
-    ALOGD("ALSA module opened");
-#endif
+    ALOGV("ALSA module opened");
 
     return 0;
 }
@@ -225,9 +223,7 @@
     }
     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;
 }
 
@@ -248,10 +244,8 @@
     }
 
     reqBuffSize = handle->bufferSize;
-#if LOCAL_LOGD
     ALOGD("setHardwareParams: reqBuffSize %d channels %d sampleRate %d",
          (int) reqBuffSize, handle->channels, handle->sampleRate);
-#endif
 
 #ifdef QCOM_SSR_ENABLED
     if (channels == 6) {
@@ -300,11 +294,9 @@
     handle->handle->buffer_size = pcm_buffer_size(params);
     handle->handle->period_size = pcm_period_size(params);
     handle->handle->period_cnt = handle->handle->buffer_size/handle->handle->period_size;
-#if LOCAL_LOGD
     ALOGD("setHardwareParams: buffer_size %d, period_size %d, period_cnt %d",
         handle->handle->buffer_size, handle->handle->period_size,
         handle->handle->period_cnt);
-#endif
     handle->handle->rate = handle->sampleRate;
     handle->handle->channels = handle->channels;
     handle->periodSize = handle->handle->period_size;
@@ -375,7 +367,7 @@
     char *rxDevice, *txDevice, ident[70], *use_case = NULL;
     int err = 0, index, mods_size;
     int rx_dev_id, tx_dev_id;
-    ALOGV("%s: device %d", __FUNCTION__, devices);
+    ALOGD("%s: device %d mode:%d", __FUNCTION__, devices, mode);
 
     if ((mode == AudioSystem::MODE_IN_CALL)  || (mode == AudioSystem::MODE_IN_COMMUNICATION)) {
         if ((devices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) ||
@@ -506,7 +498,7 @@
             snd_use_case_set(handle->ucMgr, "_disdev", curTxUCMDevice);
        }
     }
-    ALOGV("%s,rxDev:%s, txDev:%s, curRxDev:%s, curTxDev:%s\n", __FUNCTION__, rxDevice, txDevice, curRxUCMDevice, curTxUCMDevice);
+    ALOGD("%s,rxDev:%s, txDev:%s, curRxDev:%s, curTxDev:%s\n", __FUNCTION__, rxDevice, txDevice, curRxUCMDevice, curTxUCMDevice);
 
     if (rxDevice != NULL) {
         snd_use_case_set(handle->ucMgr, "_enadev", rxDevice);
@@ -535,9 +527,7 @@
         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 */
@@ -599,9 +589,7 @@
 
 static status_t s_init(alsa_device_t *module, ALSAHandleList &list)
 {
-#if LOCAL_LOGD
-    ALOGD("s_init: Initializing devices for ALSA module");
-#endif
+    ALOGV("s_init: Initializing devices for ALSA module");
 
     list.clear();
 
@@ -617,17 +605,13 @@
     /* 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
+        ALOGV("s_open: Opening LPA /Tunnel playback");
         return NO_ERROR;
     }
 
     s_close(handle);
 
-#if LOCAL_LOGD
-    ALOGD("s_open: handle %p", handle);
-#endif
+    ALOGV("s_open: handle %p", handle);
 
     // ASoC multicomponent requires a valid path (frontend/backend) for
     // the device to be opened
@@ -807,9 +791,7 @@
     unsigned flags = 0;
     int err = NO_ERROR;
 
-#if LOCAL_LOGD
-    ALOGD("s_start_voice_call: handle %p", handle);
-#endif
+    ALOGV("s_start_voice_call: handle %p", handle);
 
     // ASoC multicomponent requires a valid path (frontend/backend) for
     // the device to be opened
@@ -929,7 +911,7 @@
     unsigned flags = 0;
     int err = NO_ERROR;
 
-    ALOGD("s_start_fm: handle %p", handle);
+    ALOGV("s_start_fm: handle %p", handle);
 
     // ASoC multicomponent requires a valid path (frontend/backend) for
     // the device to be opened
@@ -1070,9 +1052,7 @@
      struct pcm *h = handle->rxHandle;
 
     handle->rxHandle = 0;
-#if LOCAL_LOGD
-    ALOGD("s_close: handle %p h %p", handle, h);
-#endif
+    ALOGV("s_close: handle %p h %p", handle, h);
     if (h) {
         ALOGV("s_close rxHandle\n");
         err = pcm_close(h);
@@ -1085,7 +1065,7 @@
     handle->handle = 0;
 
     if (h) {
-          ALOGV("s_close handle h %p\n", h);
+        ALOGV("s_close handle h %p\n", h);
         err = pcm_close(h);
         if(err != NO_ERROR) {
             ALOGE("s_close: pcm_close failed for handle with err %d", err);
@@ -1129,9 +1109,7 @@
     status_t err = NO_ERROR;
     struct pcm *h = handle->rxHandle;
     handle->rxHandle = 0;
-#if LOCAL_LOGD
-    ALOGD("s_standby: handle %p h %p", handle, h);
-#endif
+    ALOGV("s_standby: handle %p h %p", handle, h);
     if (h) {
         ALOGD("s_standby  rxHandle\n");
         err = pcm_close(h);
@@ -1144,9 +1122,7 @@
     handle->handle = 0;
 
     if (h) {
-#if LOCAL_LOGD
-          ALOGD("s_standby handle h %p\n", h);
-#endif
+          ALOGV("s_standby handle h %p\n", h);
         err = pcm_close(h);
         if(err != NO_ERROR) {
             ALOGE("s_standby: pcm_close failed for handle with err %d", err);
@@ -1166,9 +1142,7 @@
 {
     status_t status = NO_ERROR;
 
-#if LOCAL_LOGD
     ALOGD("s_route: devices 0x%x in mode %d", devices, mode);
-#endif
     callMode = mode;
     switchDevice(handle, devices, mode);
     return status;
@@ -1264,20 +1238,14 @@
                strlen(SND_USE_CASE_VERB_INACTIVE)))
             usecase_type |= getUseCaseType(useCase);
         mods_size = snd_use_case_get_list(handle->ucMgr, "_enamods", &mods_list);
-#if LOCAL_LOGD
-        ALOGD("Number of modifiers %d\n", mods_size);
-#endif
+        ALOGV("Number of modifiers %d\n", mods_size);
         if (mods_size) {
             for(i = 0; i < mods_size; i++) {
-#if LOCAL_LOGD
-                ALOGD("index %d modifier %s\n", i, mods_list[i]);
-#endif
+                ALOGV("index %d modifier %s\n", i, mods_list[i]);
                 usecase_type |= getUseCaseType(mods_list[i]);
             }
         }
-#if LOCAL_LOGD
-        ALOGD("usecase_type is %d\n", usecase_type);
-#endif
+        ALOGV("usecase_type is %d\n", usecase_type);
         if (!(usecase_type & USECASE_TYPE_TX) && (strncmp(curTxUCMDevice, "None", 4)))
             snd_use_case_set(handle->ucMgr, "_disdev", curTxUCMDevice);
         if (!(usecase_type & USECASE_TYPE_RX) && (strncmp(curRxUCMDevice, "None", 4)))
@@ -1502,9 +1470,7 @@
 void s_set_voice_volume(int vol)
 {
     int err = 0;
-#if LOCAL_LOGD
-    ALOGD("s_set_voice_volume: volume %d", vol);
-#endif
+    ALOGV("s_set_voice_volume: volume %d", vol);
     ALSAControl control("/dev/snd/controlC0");
     control.set("Voice Rx Volume", vol, 0);
 
@@ -1524,9 +1490,7 @@
 
 void s_set_volte_volume(int vol)
 {
-#if LOCAL_LOGD
-    ALOGD("s_set_volte_volume: volume %d", vol);
-#endif
+    ALOGV("s_set_volte_volume: volume %d", vol);
     ALSAControl control("/dev/snd/controlC0");
     control.set("VoLTE Rx Volume", vol, 0);
 }
@@ -1534,18 +1498,14 @@
 
 void s_set_voip_volume(int vol)
 {
-#if LOCAL_LOGD
-    ALOGD("s_set_voip_volume: volume %d", vol);
-#endif
+    ALOGV("s_set_voip_volume: volume %d", vol);
     ALSAControl control("/dev/snd/controlC0");
     control.set("Voip Rx Volume", vol, 0);
 }
 void s_set_mic_mute(int state)
 {
     int err = 0;
-#if LOCAL_LOGD
-    ALOGD("s_set_mic_mute: state %d", state);
-#endif
+    ALOGV("s_set_mic_mute: state %d", state);
     ALSAControl control("/dev/snd/controlC0");
     control.set("Voice Tx Mute", state, 0);
 
@@ -1564,27 +1524,21 @@
 }
 void s_set_volte_mic_mute(int state)
 {
-#if LOCAL_LOGD
-    ALOGD("s_set_volte_mic_mute: state %d", state);
-#endif
+    ALOGV("s_set_volte_mic_mute: state %d", state);
     ALSAControl control("/dev/snd/controlC0");
     control.set("VoLTE Tx Mute", state, 0);
 }
 
 void s_set_voip_mic_mute(int state)
 {
-#if LOCAL_LOGD
-    ALOGD("s_set_voip_mic_mute: state %d", state);
-#endif
+    ALOGV("s_set_voip_mic_mute: state %d", state);
     ALSAControl control("/dev/snd/controlC0");
     control.set("Voip Tx Mute", state, 0);
 }
 
 void s_set_voip_config(int mode, int rate)
 {
-#if LOCAL_LOGD
-    ALOGD("s_set_voip_config: mode %d,rate %d", mode, rate);
-#endif
+    ALOGV("s_set_voip_config: mode %d,rate %d", mode, rate);
     ALSAControl control("/dev/snd/controlC0");
     char** setValues;
     setValues = (char**)malloc(2*sizeof(char*));
@@ -1623,9 +1577,7 @@
 {
     int err = 0;
 
-#if LOCAL_LOGD
-    ALOGD("s_enable_wide_voice: flag %d", flag);
-#endif
+    ALOGV("s_enable_wide_voice: flag %d", flag);
     ALSAControl control("/dev/snd/controlC0");
     if(flag == true) {
         control.set("Widevoice Enable", 1, 0);
@@ -1649,9 +1601,7 @@
 
 void s_set_voc_rec_mode(uint8_t mode)
 {
-#if LOCAL_LOGD
-    ALOGD("s_set_voc_rec_mode: mode %d", mode);
-#endif
+    ALOGV("s_set_voc_rec_mode: mode %d", mode);
     ALSAControl control("/dev/snd/controlC0");
     control.set("Incall Rec Mode", mode, 0);
 }
@@ -1660,9 +1610,7 @@
 {
     int err = 0;
 
-#if LOCAL_LOGD
-    ALOGD("s_enable_fens: flag %d", flag);
-#endif
+    ALOGV("s_enable_fens: flag %d", flag);
     ALSAControl control("/dev/snd/controlC0");
     if(flag == true) {
         control.set("FENS Enable", 1, 0);
@@ -1688,9 +1636,7 @@
 {
     int err = 0;
 
-#if LOCAL_LOGD
-    ALOGD("s_enable_slow_talk: flag %d", flag);
-#endif
+    ALOGV("s_enable_slow_talk: flag %d", flag);
     ALSAControl control("/dev/snd/controlC0");
     if(flag == true) {
         control.set("Slowtalk Enable", 1, 0);
diff --git a/libalsa-intf/alsa_ucm.c b/libalsa-intf/alsa_ucm.c
index 72ce6c6..edddeb7 100644
--- a/libalsa-intf/alsa_ucm.c
+++ b/libalsa-intf/alsa_ucm.c
@@ -198,7 +198,7 @@
         list_size =
             snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->dev_list_head);
         uc_mgr->device_list_count = list_size;
-	if (list_size > 0) {
+    if (list_size > 0) {
             uc_mgr->current_device_list =
                 (char **)malloc(sizeof(char *)*list_size);
             if (uc_mgr->current_device_list == NULL) {
@@ -228,7 +228,7 @@
         list_size =
             snd_ucm_get_size_of_list(uc_mgr->card_ctxt_ptr->mod_list_head);
         uc_mgr->modifier_list_count = list_size;
-	if (list_size > 0) {
+    if (list_size > 0) {
             uc_mgr->current_modifier_list =
                 (char **)malloc(sizeof(char *) * list_size);
             if (uc_mgr->current_modifier_list == NULL) {
@@ -753,17 +753,13 @@
             ALOGE("Control device not initialized");
             ret = -ENODEV;
         } else {
-#if LOCAL_LOGD
             ALOGD("Set mixer controls for %s enable %d", use_case, enable);
-#endif
             if (ctrl_list[uc_index].acdb_id && ctrl_list[uc_index].capability) {
                 if (enable) {
                     if (snd_use_case_apply_voice_acdb(uc_mgr, uc_index)) {
-#if LOCAL_LOGD
-                        ALOGD("acdb_id %d cap %d enable %d",
+                        ALOGV("acdb_id %d cap %d enable %d",
                             ctrl_list[uc_index].acdb_id,
                             ctrl_list[uc_index].capability, enable);
-#endif
                         if (uc_mgr->acdb_handle) {
                             acdb_send_audio_cal = dlsym(uc_mgr->acdb_handle,"acdb_loader_send_audio_cal");
                             if (acdb_send_audio_cal == NULL) {
@@ -792,11 +788,9 @@
                           mixer_list[index].control_name, 0);
                 if (ctl) {
                     if (mixer_list[index].type == TYPE_INT) {
-#if LOCAL_LOGD
-                        ALOGD("Setting mixer control: %s, value: %d",
+                        ALOGV("Setting mixer control: %s, value: %d",
                              mixer_list[index].control_name,
                              mixer_list[index].value);
-#endif
                         ret = mixer_ctl_set(ctl, mixer_list[index].value);
                     } else if (mixer_list[index].type == TYPE_MULTI_VAL) {
                         ALOGD("Setting multi value: %s",
@@ -807,11 +801,9 @@
                             ALOGE("Failed to set multi value control %s\n",
                                 mixer_list[index].control_name);
                     } else {
-#if LOCAL_LOGD
-                        ALOGD("Setting mixer control: %s, value: %s",
+                        ALOGV("Setting mixer control: %s, value: %s",
                             mixer_list[index].control_name,
                             mixer_list[index].string);
-#endif
                         ret = mixer_ctl_select(ctl, mixer_list[index].string);
                     }
                     if ((ret != 0) && enable) {
@@ -1037,7 +1029,7 @@
         }
         strlcpy(use_case, ident, sizeof(use_case));
         strlcat(use_case, device, sizeof(use_case));
-	ALOGV("Applying mixer controls for use case: %s", use_case);
+    ALOGV("Applying mixer controls for use case: %s", use_case);
         if ((uc_index = get_use_case_index(uc_mgr, use_case, ctrl_list_type)) < 0) {
             ALOGV("No valid use case found: %s", use_case );
             uc_index = get_use_case_index(uc_mgr, ident, ctrl_list_type);
@@ -1343,10 +1335,8 @@
         return -EINVAL;
     }
 
-#if LOCAL_LOGD
     ALOGD("snd_use_case_set(): uc_mgr %p identifier %s value %s", uc_mgr,
          identifier, value);
-#endif
     strlcpy(ident, identifier, sizeof(ident));
     if(!(ident1 = strtok_r(ident, "/", &temp_ptr))) {
         ALOGV("No multiple identifiers found in identifier value");
@@ -1909,7 +1899,7 @@
                 SND_USE_CASE_VERB_INACTIVE, MAX_STR_LEN);
         /* Reset all mixer controls if any applied
          * previously for the same card */
-	snd_use_case_mgr_reset(uc_mgr_ptr);
+    snd_use_case_mgr_reset(uc_mgr_ptr);
         uc_mgr_ptr->card_ctxt_ptr->current_verb_index = -1;
         /* Parse config files and update mixer controls */
         ret = snd_ucm_parse(&uc_mgr_ptr);
@@ -2007,7 +1997,7 @@
                 ident_value);
             ret = set_controls_of_usecase_for_all_devices(uc_mgr,
                       ident_value, 0, CTRL_LIST_MODIFIER);
-	    if (ret != 0)
+        if (ret != 0)
                 ALOGE("Failed to disable mixer controls for %s", ident_value);
             free(ident_value);
         }
@@ -2043,10 +2033,10 @@
                 ident_value);
             ret = set_controls_of_device_for_all_usecases(uc_mgr,
                       ident_value, 0);
-	    if (ret != 0)
+        if (ret != 0)
                 ALOGE("Failed to disable or no mixer controls set for %s",
                     ident_value);
-	    free(ident_value);
+        free(ident_value);
         }
     }
     /* Clear the enabled devices list */