We really need to fix this eventually, but it's not a ship blocker.
Change-Id: I35f66988e7adba13e47c2a86e13a7425cc5aada3
Signed-off-by: Dima Zavin <dima@android.com>
The problem comes from the fact that when a notification is played on both headsets + speaker,
the media strategy is muted. It is only unmuted when a new device is selected on hardwate output
(for instance headset only when music starts).
If an A2DP output is created while music is muted, AudioFlinger with use the last value received
for music volume to initialize the music stream volume on the newly created A2DP output, which in
this case is 0. The code in audio policy manager that applies stream volumes after the A2DP output
has been created is inefficient here, because as music stream is muted, the request to change the
volume is ignored.
As next time music starts it is now played over A2DP output and not on HW output,
no device modification is done on HW output and the music streams remains muted.
This is also applicatble to SYSTEM and TTS streams.
The fix consists in keeping a stream mute count on each output separately instead of a global stream mute count.
Thus when the music volume is re applied after A2DP output creation, the request is not ignored as the music stream is not
muted on A2DP output.
The GPU now correctly maps everything throug hthe MMU so physical addresses
are no longer needed.
Change-Id: Id16a690f63d7141c8ee6694b246b1955f450b8ed
Signed-off-by: Dima Zavin <dima@android.com>
* changes:
Patch from HTC: changes in libaudio - remove redundant ACDB updates for audio playback and recording. - remove redundant ACDB updates for audio route changes during playback or recording. Along with the matching audio driver change, this fixes b/2275992 and click before playback and AudioHardware is going to standby.
- remove redundant ACDB updates for audio playback and recording.
- remove redundant ACDB updates for audio route changes during playback or recording.
Along with the matching audio driver change, this fixes b/2275992
and click before playback and AudioHardware is going to standby.
- libaudio: incorrect ACDB setting was used when starting to record
with wired headset.
- libaudio: remove unnecessary audio path switch when camcorder is started
with wired headset.
Submitted on behalf of HK Chen <hk_chen@htc.com>
to fix issue 2229040. This workaround is considered no longer useful
by HTC since the changes in the A1026 configuration.
Removing workaround on behalf of HK Chen (HTC).
When the ringtone is not looped (non factory ringtone), a new AudioTrack is started every time the ringtone is repeated. The second time the track is started, the condition that triggers volume limitation is not true any more as music has been stopped for more than SONIFICATION_HEADSET_MUSIC_DELAY seconds and ringtone volume is not limited.
The fix consists in checking the condition (music playing or stopped for less than SONIFICATION_HEADSET_MUSIC_DELAY) when entering ringtone mode and latch it until we exit ringtone mode.
This change avoids the audio driver lockup when changing audio input path configuration. It does not solve the root cause in audio driver or dsp.
When applied lockups observed in the folling use cases are eliminated:
- use back mic for camcorder recording (issue 2194140)
- switch input device when headset is plugged in or out during record (issue 2226658).
Also removes warnings.
Submitted on behalf of H.K Chen <hk_chen@htc.com>
-- new a1026.h kernel header that contains just the user-space API and is
sanitized through bionic/libc/kernel/tools/clean_header.py
-- AudioHardware.cpp:
-- replace vr_mode with vr_mode_enabled, and use 0 and 1 instead of
A1026_VR_MODE_DISABLED/ENABLED, which is not defined in the kernel
header;
-- in doA1026_init(), replace a fread() of 1 byte with a read that as
much as possible from the firmware file in as few as possible passes
before we call into the kernel
-- Replace the size of the on-stack f/w buffer with A1026_MAX_FW_SIZE,
which now comes from the kernel header
-- Fix up some signed-unsigned comparison warnings on mBluetoothIdTx
Signed-off-by: Iliyan Malchev <malchev@google.com>
Modified AudioPolicyManager::setDeviceConnectionState() so that the device on active audio input is updated when a device is connected or disconnected.
The wrong key was used when removing the voice recognition mode from parameters list after handling it in AudioStreamInMSM72xx::setParameters() causing the set routing parameter to be removed and ignored.
The voice recognition mode is enabled when using the
AUDIO_SOURCE_VOICE_RECOGNITION audio recording source. The intended
behavior is to use the same microphone input as the default input,
but to configure the A1026 chip in the special mode tuned for
voice recognition, for the matching input. For testing purposes,
two settings will be available for each input, the choice of which
one is used will be dependent on the vr_uses_ns property.
The availability of the voice rec mode is dependent on the enable1026
system property.
Note that the final A1026 configuration modes are not used yet
(not available) but the ones to use are specified in the comments
of the AudioHardware::doAudience_A1026_Control() function at line
952 of AudioHardware.cpp for instance.
Upon availability of other presets, the enable1026 property could
be used to disable or enable even more of the 1026 features.
AudioHardware QSD8k:
- Add setParameters comment to control noise suppression states via new IOCTL A1026_SET_NS_STATE implemented in a1026 driver.
- Add support for new input device DEVICE_IN_BACK_MIC.
AudioPolicyManager:
- Add support for audio source AUDIO_SOURCE_CAMCORDER.
add a way to convert a mapped "pushbuffer" buffer to a gralloc handle
which then can be safely used by surfaceflinger
also make sure to not send empty rectangles to the MDP.
This is the combination of two issues:
- on QSD8K, the voice volume affects all streams, even when not in call.
This is fixed by setting the voice volume to unity gain whenever
exiting a call.
- another related issue was that when entering a call with no audio
playing, the in-call volume would be at its max. This is due to
the audio driver resetting the gain to unity when creating a new
output. AudioPolicyManager::setPhoneState() would sometimes fail
to force the reset of the audio volumes when entering a call, causing
the driver to use the unity gain, not the in-call volume set by the
user. This is fixed by testing whether is call is starting or ending
independently from the logic to determine the new ouput device.
Applications are supposed to hold a wakelock. However, since 1.0,
the audio driver and/or HAL has held a partial wakelock. That means
that many apps will be broken if we don't hold a wakelock while
audio is playing. This patch holds a wakelock while the audio
driver is open and releases it when it goes to standby mode.
Bluetooth A2DP suspend-resume improvements.
This change will reduce the occurence rate of A2DP sink suspend resume failures observed in issues 2184627, 2181005 and possibly 2189628.
Suspend A2DP output when phone state is not NORMAL and not only when it is RINGTONE.
Update A2DP suspend state when an A2DP or SCO device is connected or disconnected while phone state is not NORMAL.
Modified checkAndSetVolume() method to adjust VOICE_CALL, BLUETOOTH_SCO and DTMF stream volumes to match audio hardware behavior (never 0).
Also do the following adjustments on stream volumes:
- VOICE_CALL:
if in call, force software volume to max to avoid applying the volume twice (software mixer + audio hardware)
send setVoiceVolume() to set in call volume in audio hardware
- BLUETOOTH_SCO:
send setVoiceVolume() with max value because volume is applied by BT headset and should not be also applied by audio hardware.
- DTMF:
if in call and not using the BT SCO device, force software volume to max to avoid applying the volume twice (software mixer + audio hardware)
The fix consists in adding a parameter to handleIncallSonification() indicating that it is called from setPhoneState() in which case the stream mute or unmute is called as many times as there are active tracks on the output.
Also change the time when handleIncallSonification() is called in setPhoneState() to make sure that both mPhoneSate and the selected device are coherent with the IN_CALL state when the fucntion is called.
* changes:
Fix bug 2146274. Modify the Audio Policy Manager to support dynamic rerouting of STREAM_VOICE_CALL streams when using AudioManager.setSpeakerphoneOn(bool) even when not in call.
to support dynamic rerouting of STREAM_VOICE_CALL streams when using
AudioManager.setSpeakerphoneOn(bool) even when not in call.
The setSpeakerphoneOn() method is mapped in the AudioPolicyManager to
a call to setForceUse for the AudioSystem::FOR_COMMUNICATION usage.
This was only updating the output device when the current mode
was MODE_IN_CALL. The change consists in changing the routing
also when there is an active stream of type AudioSystem::VOICE_CALL
as we allow that stream type to be used not just for telephony streams,
but for communications in general.
The kernel will only do it for images with an alpha plane.
Change-Id: Idcba41945ed7d17daae0a5bcc48c64a82a49dded
Signed-off-by: Dima Zavin <dima@android.com>