policy_hal: fix improper voice-playback concurrency handling

- setPhoneState checks call-state in audio hal to filter out
  unworthy usage of this API.
- With M upgrade, change to update call-state with audio hal is
  removed, instead permission checks are introduced to prevent
  random usage of such APIs. But setPhoneState is still checking
  for this call-state causing improper concurrency handling.
- Fix the issue by removing state check from setPhoneState.
- Remove set and get for parameter "in_call" from voice_extn.

Change-Id: I92fe10c617d6158976a0e07eed3275acb0aadd15
diff --git a/hal/voice.c b/hal/voice.c
index 4824d35..b10de17 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -131,8 +131,6 @@
     }
 
     session->state.current = CALL_INACTIVE;
-    if (adev->mode == AUDIO_MODE_NORMAL)
-        adev->voice.is_in_call = false;
 
     /* Disable sidetone only when no calls are active */
     if (!voice_is_call_state_active(adev))
diff --git a/hal/voice.h b/hal/voice.h
index 139a8c8..7cb9e1a 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -62,7 +62,6 @@
     int tty_mode;
     bool mic_mute;
     float volume;
-    bool is_in_call;
     bool in_call;
 };
 
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index 3cf370d..1717cba 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -41,7 +41,6 @@
 #define AUDIO_PARAMETER_KEY_ALL_CALL_STATES     "all_call_states"
 #define AUDIO_PARAMETER_KEY_DEVICE_MUTE         "device_mute"
 #define AUDIO_PARAMETER_KEY_DIRECTION           "direction"
-#define AUDIO_PARAMETER_KEY_IN_CALL             "in_call"
 #define AUDIO_PARAMETER_KEY_CALL_TYPE           "call_type"
 
 #define VOICE_EXTN_PARAMETER_VALUE_MAX_LEN 256
@@ -507,15 +506,6 @@
         }
     }
 
-    err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_IN_CALL, str_value,
-                            sizeof(str_value));
-    if (err >= 0) {
-          str_parms_del(parms, AUDIO_PARAMETER_KEY_IN_CALL);
-           if (!strncmp("true", str_value, sizeof("true"))) {
-           adev->voice.is_in_call = true;
-        }
-    }
-
     err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_CALL_TYPE, str_value,
                             sizeof(str_value));
     if (err >= 0) {
@@ -561,19 +551,10 @@
     int ret;
     char value[VOICE_EXTN_PARAMETER_VALUE_MAX_LEN] = {0};
     char *str = str_parms_to_str(query);
-    int val = 0;
 
     ALOGV_IF(str != NULL, "%s: enter %s", __func__, str);
     free(str);
 
-    ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_IN_CALL, value,
-                            sizeof(value));
-    if (ret >=0) {
-        if (adev->voice.is_in_call)
-            val = 1;
-        str_parms_add_int(reply, AUDIO_PARAMETER_KEY_IN_CALL, val);
-    }
-
     ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_AUDIO_MODE, value,
                             sizeof(value));
     if (ret >= 0) {
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index e48de6d..54efd0c 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -680,7 +680,6 @@
 
     sp<SwAudioOutputDescriptor> hwOutputDesc = mPrimaryOutput;
 #ifdef VOICE_CONCURRENCY
-    int voice_call_state = 0;
     char propValue[PROPERTY_VALUE_MAX];
     bool prop_playback_enabled = false, prop_rec_enabled=false, prop_voip_enabled = false;
 
@@ -696,19 +695,10 @@
         prop_voip_enabled = atoi(propValue) || !strncmp("true", propValue, 4);
     }
 
-    bool mode_in_call = (AUDIO_MODE_IN_CALL != oldState) && (AUDIO_MODE_IN_CALL == state);
-    //query if it is a actual voice call initiated by telephony
-    if (mode_in_call) {
-        String8 valueStr = mpClientInterface->getParameters((audio_io_handle_t)0, String8("in_call"));
-        AudioParameter result = AudioParameter(valueStr);
-        if (result.getInt(String8("in_call"), voice_call_state) == NO_ERROR)
-            ALOGD("voice_conc:SetPhoneState: Voice call state = %d", voice_call_state);
-    }
-
-    if (mode_in_call && voice_call_state && !mvoice_call_state) {
+    if ((AUDIO_MODE_IN_CALL != oldState) && (AUDIO_MODE_IN_CALL == state)) {
         ALOGD("voice_conc:Entering to call mode oldState :: %d state::%d ",
             oldState, state);
-        mvoice_call_state = voice_call_state;
+        mvoice_call_state = state;
         if (prop_rec_enabled) {
             //Close all active inputs
             audio_io_handle_t activeInput = mInputs.getActiveInput();