summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2020-10-04 00:54:36 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2020-10-04 00:54:36 -0700
commit639a3bb213275df1250597f76e340b1a65bd5f89 (patch)
tree3fd9e6570cdcdb23ae33183655fa9312f3d18185
parent90cd7339bab12aa9dd12060a4b2f61ef08ea74ff (diff)
parentc3a9c814372a15d81a812c7152f699bcf048a4c3 (diff)
Merge "hal: handle null primary output scenario"
-rw-r--r--hal/audio_hw.c2
-rw-r--r--hal/voice.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index ee308c95..4516448a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -9110,7 +9110,7 @@ static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
ALOGD("%s: mode %d , prev_mode %d \n", __func__, mode , adev->mode);
adev->prev_mode = adev->mode; /* prev_mode is kept to handle voip concurrency*/
adev->mode = mode;
- if( mode == AUDIO_MODE_CALL_SCREEN ){
+ if (mode == AUDIO_MODE_CALL_SCREEN) {
adev->current_call_output = adev->primary_output;
voice_start_call(adev);
} else if (voice_is_in_call_or_call_screen(adev) &&
diff --git a/hal/voice.c b/hal/voice.c
index 72c3372b..586247ff 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -231,6 +231,11 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
return -EINVAL;
}
+ if (!adev->current_call_output) {
+ ALOGE("start_call: invalid current call output");
+ return -EINVAL;
+ }
+
uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
if (!uc_info) {
ALOGE("start_call: couldn't allocate mem for audio_usecase");