Merge "Promotion of av-userspace.lnx.1.0-00048."
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 0526e9b..3698294 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -913,7 +913,9 @@
 
     if (is_offload_usecase(usecase->id) &&
         (usecase->stream.out) &&
-        (usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100)) {
+        (usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100) &&
+        (usecase->stream.out->devices == AUDIO_DEVICE_OUT_WIRED_HEADSET ||
+         usecase->stream.out->devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE)) {
         is_it_true_mode = (NATIVE_AUDIO_MODE_TRUE_44_1 == platform_get_native_support()? true : false);
          if ((is_it_true_mode && !adev->native_playback_enabled) ||
              (!is_it_true_mode && adev->native_playback_enabled)){
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index dee4e8b..f5fc3f2 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -656,7 +656,7 @@
     /// Opens: can these line be executed after the switch of volume curves???
     // if leaving call state, handle special case of active streams
     // pertaining to sonification strategy see handleIncallSonification()
-    if (isInCall()) {
+    if (isStateInCall(oldState)) {
         ALOGV("setPhoneState() in call state management: new state is %d", state);
         for (size_t j = 0; j < mOutputs.size(); j++) {
             audio_io_handle_t curOutput = mOutputs.keyAt(j);
@@ -668,7 +668,7 @@
             }
         }
 
-        // force reevaluating accessibility routing when call starts
+        // force reevaluating accessibility routing when call stops
         mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY);
     }
 
@@ -944,6 +944,9 @@
                 handleIncallSonification((audio_stream_type_t)stream, true, true, curOutput);
            }
         }
+
+       // force reevaluating accessibility routing when call starts
+       mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY);
     }
 
     // Flag that ringtone volume must be limited to music volume until we exit MODE_RINGTONE