A regression was introduced by commit 372b6255604d1c54d31e79f1ea31472fe5bc8956 fixing issue 2336461:
voice call volume still needs to be updated when entering IN_CALL mode.
This change reverts modifications made earlier on software voice volume control in audio policy manager.
These modifications are not needed anymore and are partly responsible of this issue now that voice volume is controlled by audio DSP.
Add new config values for usage AudioSystem::FOR_DOCK in setForceUse() to differenciate car and desk docks.
For the desk dock, the sonification strategy will use the phone speaker only as there is no guaranty that
a device is connected to the dock's output jack.
For the car dock, the sonification strategy will use the A2DP output as before.
dual microphone noise suppression should be used during a phone call
in handset mode. The disabling is performed by using the same A1026
settings as those used in Voice Recognition when not using the
Noise Suppression algorithm. This mode uses the exact same input
and gains as the incall receiver mode (A1026_PATH_INCALL_RECEIVER)
A new mode (A1026_PATH_INCALL_NO_NS_RECEIVER) is defined for code
clarity.
This correction in AudioPolicyManager does not directly fix the issue but a potential problem identified when working on the resolution.
The problem is that audio output path is not updated immediately when a headset is unplugged if music or notifications are active. This is however not observable because:
- music is paused by music app when the headset is unplugged, and correct path is re-established when music is resumed.
- ringtones and notifications are playing on both headset and speaker and are still audible on speaker when the headset is unplugged even if
the actual output path is not changed to speaker only.
There could be an impact on applications using MUSIC stream and not reacting to Intent AudioManager.ACTION_AUDIO_BECOMING_NOISY though.
Fixed AudioPolicyManager::getInput() broken in change ddb78e7753be03937ad57ce7c3c842c52bdad65e
so that an invalid IO handle (0) is returned in case of failure.
Applied the same correction to getOutput().
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.