summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorjiabin <jiabin@google.com>2019-05-07 14:26:40 -0700
committerjiabin <jiabin@google.com>2019-05-08 15:19:13 -0700
commitc1de2dfe8602f10ed3086ab601b626bec632b198 (patch)
tree68241794ce067005b2770a31b232588ecb4c33fc /services/audioflinger
parenta8cc6d418bdf459a0c0f79326b09faa45645850c (diff)
downloadframeworks_av-c1de2dfe8602f10ed3086ab601b626bec632b198.tar.gz
frameworks_av-c1de2dfe8602f10ed3086ab601b626bec632b198.tar.bz2
frameworks_av-c1de2dfe8602f10ed3086ab601b626bec632b198.zip
Fix NPE when trying to get input device for attributes.
1. Return error when remote submix device is null. Remote submix device could be null in some case, such as device address error. Returning error to avoid native crash. 2. Unregister policy mix if set device connection fails. In that case, get input device could fail when policy mix is not found. Bug: 131906484 Test: Manually Change-Id: I03ab2bf217341b672c14adfba96d92ad9b453b01
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 5e5ea1120b..66466b218a 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1900,12 +1900,16 @@ sp<media::IAudioRecord> AudioFlinger::createRecord(const CreateRecordInput& inpu
input.opPackageName,
&input.config,
output.flags, &output.selectedDeviceId, &portId);
+ if (lStatus != NO_ERROR) {
+ ALOGE("createRecord() getInputForAttr return error %d", lStatus);
+ goto Exit;
+ }
{
Mutex::Autolock _l(mLock);
RecordThread *thread = checkRecordThread_l(output.inputId);
if (thread == NULL) {
- ALOGE("createRecord() checkRecordThread_l failed");
+ ALOGE("createRecord() checkRecordThread_l failed, input handle %d", output.inputId);
lStatus = BAD_VALUE;
goto Exit;
}