Update logic to set legacy remote submix rrid.

1. Only record legacy remote submix information when the recording event
is START or UPDATE.
2. The AudioDeviceInfo returned from AudioRecordingConfiguration may be
null. Check if the audio device info is null or not to avoid NPE.

Test: make
Test: volume adjustable on chromecast mirror mode when enabling LC
Bug: 152796386
Change-Id: Ibf9d5dd0d8a59339ca9c0c7547b84d033ed9bfd0
This commit is contained in:
jiabin
2020-03-31 15:19:31 -07:00
committed by Jiabin Huang
parent c068acb6ae
commit 3cbafbdb4f

View File

@@ -150,14 +150,14 @@ public final class RecordingActivityMonitor implements AudioSystem.AudioRecordin
final AudioRecordingConfiguration config = createRecordingConfiguration(
uid, session, source, recordingInfo,
portId, silenced, activeSource, clientEffects, effects);
if (source == MediaRecorder.AudioSource.REMOTE_SUBMIX) {
if (source == MediaRecorder.AudioSource.REMOTE_SUBMIX
&& (event == AudioManager.RECORD_CONFIG_EVENT_START
|| event == AudioManager.RECORD_CONFIG_EVENT_UPDATE)) {
final AudioDeviceInfo device = config.getAudioDevice();
if (AudioSystem.LEGACY_REMOTE_SUBMIX_ADDRESS.equals(device.getAddress())) {
if (device != null
&& AudioSystem.LEGACY_REMOTE_SUBMIX_ADDRESS.equals(device.getAddress())) {
mLegacyRemoteSubmixRiid.set(riid);
if (event == AudioManager.RECORD_CONFIG_EVENT_START
|| event == AudioManager.RECORD_CONFIG_EVENT_UPDATE) {
mLegacyRemoteSubmixActive.set(true);
}
mLegacyRemoteSubmixActive.set(true);
}
}
if (MediaRecorder.isSystemOnlyAudioSource(source)) {