Commit graph

321 commits

Author SHA1 Message Date
Eric Laurent
4366b4a673 audio policy: fix volume upon A2DP connection
setForceUse() should not force new device selection on outputs
if the selected device is 0. If a device 0 (no device) selection
is forced on a duplicated output, this causes volumes to be reset to
their default on outputs the duplicated output is connected to.

Also force reapply volumes when a new output is created. It is safer and more
explicit than relying on the fact that the selected volume is different
from default volume and thus is actually sent to audioflinger.

Bug 6658021.

Change-Id: I0a14d5229847e001b0d44f60d41c241efdb9946a
2012-06-13 15:19:32 -07:00
Jean-Michel Trivi
e3ce4e9997 Merge "Increase system stream volume on speaker" into jb-dev 2012-06-07 15:29:10 -07:00
Eric Laurent
5568b826b6 Merge "audio policy: fix notification volume limitation" into jb-dev 2012-06-07 09:10:26 -07:00
Eric Laurent
ac3cf10ef6 audio policy: fix notification volume limitation
The limitation of notification volume when playing music over headphones
has been broken for devices where notifications and music are played over
separate output streams.

Fix computeVolume() to check music stream activity on all outputs.

Bug 6623707.

Change-Id: Ie25f9b428ea086efe0be5fea2d31551d2528b655
2012-06-06 17:39:16 -07:00
Eric Laurent
fa3697d716 audio policy: remove delay when enabling speaker
Do not force mute on a strategy when moving it from one output
stream to another if no stream is active.

Bug 6611972.

Change-Id: I21f72b0ef3600639de66e6b0a1c3ae44045fd81f
2012-06-06 16:58:35 -07:00
Jean-Michel Trivi
1238978744 Increase system stream volume on speaker
Increase the volume of the system stream for speaker output, so
 sounds played on this stream can be louder on devices that
 need it.
Additional changes in the rest of the framework will define properties
 to tune sound effect levels on a per-device basis.

Bug 6448481

Change-Id: Ia6c1ff314a321c6e271a682e3f4ff64c250b184e
2012-06-05 11:35:24 -07:00
Eric Laurent
3cdfddf1b2 audio policy: improve support for direct outputs
Add the capability to query supported parameters for
direct outputs after a device is connected. This allows
to dynamically update the output profile for devices like
HDMI where the capabilities depend on the connected sink.

Also added very verbose log mode for volume and mute.

Change-Id: I1d4ba8e7dbc3e1af883582857ce93240441e551c
2012-06-04 14:02:07 -07:00
Marco Nelissen
4660455366 Ensure global effects are on the correct output
Global effects such as the visualizer would sometimes not be on the
right output, for example when switching from a2dp to wired headset
or back, when there are both regular and deep buffer outputs available.
We now check which of the available outputs the global effect should
be on when more than one is available.
b/6528772

Change-Id: Ie268e32ef41e7888da67c24730dc93750a2cf579
2012-05-31 12:21:26 -07:00
Eric Laurent
1afd84f622 audio policy: allow disabling A2DP for media.
Added FORCE_NO_BT_A2DP forced use to allow applications to
override default policy to use A2DP whenever connected.

Bug 6485897.

Change-Id: I784271c062294fbe1aff7884965075b40c68dc24
2012-05-22 11:31:26 -07:00
Eric Laurent
01e6272f0a audio policy: fix in call volume problem.
When switching audio path, it is sometimes required
to temporarily mute certain streams to avoid glitches.
The unmute command is sent with a delay but the volume applied
when unmuting is computed according to the state at the time of mute.
If the device selection changes after the delayed unmute is programmed
the new volume will not correspond to the new device.

setStreamMute() now accepts a device selection as input parameter which is
used instead of current device for volume computation.

Bug 6497819.

Change-Id: I355ebf9e1afe814fa5c2723bda9c40e58f921b46
2012-05-15 19:26:46 -07:00
Jeff Brown
03f3747b2f Delete unused function.
set_last_user_activity_timeout() is no longer used or useful.
It opens a sysfs node that no longer exists that used to
be published by a daemon that is no longer even compiled
and that is about to be deleted.  It used to be called
by the power manager with a huge value whose purpose was
essentially to disable the timeout feature altogether.

Long live dead code!

Bug: 6435382
Change-Id: If8f97a66f4e963a11e1c6b67ad97b41b2613043e
2012-05-11 17:56:01 -07:00
Eric Laurent
7465678e0d Reduce system stream volume.
Reduce system stream volume by 6dB as
UI sounds are now perceived as being too loud.

Issue 6448481.

Change-Id: I0237eb94245014724dfdf55253049340e2162af8
2012-05-10 10:12:19 -07:00
Eric Laurent
ddfe26905e system and UI sounds volume policy
Added specific volume curves for AUDIO_STREAM_SYSTEM,
AUDIO_STREAM_ENFORCED_AUDIBLE and AUDIO_STREAM_DTMF.
Volume for these streams tracks AUDIO_STREAM_RING on phones
and AUDIO_STREAM_MUSIC on tablets but is contrained in the range
-24dB to -6dB on speaker and -24dB to -12dB on headset.

STRATEGY_ENFORCED_AUDIBLE routing policy is now the same as
STRATEGY_MEDIA in countries where not enforced.

Change-Id: If58d96559bfe2bbff4cd94c631d5933bd940778e
2012-04-26 10:17:13 -07:00
Dima Zavin
739022f26a audio_policy: set some reasonable defaults if audio_policy.conf is not found
Change-Id: I25f7407c34b3032d4e77a27a4ac47b648098d9b0
Signed-off-by: Dima Zavin <dima@android.com>
2012-04-24 12:55:06 -07:00
Dima Zavin
5ec145df77 audio_policy: look for config file in /vendor first
Change-Id: If10308f688437e1682e4104120772cfce16e9d89
Signed-off-by: Dima Zavin <dima@android.com>
2012-04-23 16:51:00 -07:00
Eric Laurent
9029a4fe8a audio policy: volume burst when switching device
The addition of the per device volume feature has introduced
a problem where a volume burst can be heard in the headphones
just after insertion if the speaker volume is much higher than the
headphones volume.

Added a temporary mute of the output when switching device to force
volume ramp to 0 and back up to new volume.

Issue 5984108.

Change-Id: I5c9ffbbcadd12d25c78cc2614d351346b8186c55
2012-04-23 10:25:13 -07:00
Eric Laurent
b2971bf2ae audio policy: add support for deep audio buffers
Added definitions for parsing deep buffer flags in output profiles.

Make sure that sound start is delayed enough to allow
duck/mute effect to apply before starting a notification on an output
with lower latency.

Change-Id: I1578e245da19d1a0f9ec62a2ea6dddaf82ea282b
2012-04-20 13:51:53 -07:00
Eric Laurent
0977cf534f rename audio policy flags
Change-Id: Ic42eba3432671f651c9703a07fe7b429a8ec0dff
2012-04-18 10:42:04 -07:00
Eric Laurent
0fa154b8d4 audio: update to new audio HAL device API.
Change-Id: I27c5e1e1041f62530884ec5d929e7d82f091912a
2012-04-16 19:05:21 -07:00
Eric Laurent
599a1fc115 audio policy: added rules for USB audio devices
Change-Id: If712b0c7fcf281d66d34614529f3433e56e058fb
2012-04-06 16:28:09 -07:00
Jean-Michel Trivi
9f1f9b509c Allow non-direct output of any channel mask
Because of the downmix capability of the mixer, do not prevent
 a non-direct output to be retrieved based on channel mask.

Change-Id: I911f95f4055c2134298c233d14f2f5d586091fd4
2012-04-05 12:17:01 -07:00
Eric Laurent
70c236c929 audio policy: load audio hw modules
Audio hw modules are now loaded according to configuration
data read from audio_policy.conf. They are not loaded anymore
from a hardcoded list in AudiFlinger.

Output and input streams are opened on the hw module by which
they are exposed.

Also removed obsolete "acoustics" flags for input streams.

Change-Id: I8dc658cc83890d3ac7d5e36c372a03732aa5b0c4
2012-04-03 20:49:35 -07:00
Eric Laurent
5ccdf14a85 audio policy: use configuration file
The audio policy manager implementation now reads a configuration file at
boot time that contains descriptors for available audio hardware
modules and for each module the profiles of available inputs and outputs streams.

The configuration file path on the target is: /system/etc/audio_policy.conf.
A default configuration file is given that defines a basic configuration
with one primary audio hw module capable of playback and capture.
Each platform or device should have its own audio_policy.conf file.

Also removed default value of fromCache argument of getDeviceForStrategy()
and getNewDevice() methods.

Change-Id: I0c773d2331508bbc787f89b123dd6a7b8c10d459
2012-04-03 15:56:30 -07:00
Jean-Michel Trivi
12bd6e4a5c Only duplicate notifications when no media is playing
Map the NOTIFICATION stream type to a new strategy,
 named STRATEGY_NOTIFICATION_RESPECTFUL, which differs
 from STRATEGY_NOTIFICATION in that, when media is
 playing, the notifications will use the same output
 as the MEDIA strategy. This will results in the
 notifications not being duplicated on the speaker
 when a headset is in use for media playback.

Change-Id: I032be0e2d383c69b5b6c912d7174753f5572c4b4
2012-04-02 09:31:09 -07:00
Mike Lockwood
48fa8d5b1c Merge remote-tracking branch 'goog/ics-aah-exp'
empty merge -s ours

Change-Id: I11a8a28ffccb4d28f2bbed4d55919443cae24e9f
2012-03-21 17:44:39 -07:00
Mike Lockwood
584c285492 Merge commit '5b71e6f'
Add an implementation of get_next_write_timestamp.

Change-Id: Ie8e19307bafdb057d06bf3c536380c5740f830a6
2012-03-21 17:44:01 -07:00
Mike Lockwood
0b934ade25 Merge commit '617c80a'
Add a bridge implementation of get_master_volume.

Conflicts:
	audio/audio_hw_hal.cpp

Change-Id: Icff9d8dce05d1d811fca815cc39cb38a1df293f9
2012-03-21 17:42:25 -07:00
Glenn Kasten
7c85ce8534 Remove obsolete references to libmedia
Change-Id: I65c10c2c6248a439d8ba6b3e9d540072fb25039f
2012-03-19 17:31:15 -07:00
Glenn Kasten
a881294ac8 Merge "Add libmedia_native" 2012-03-16 10:36:22 -07:00
Kenny Root
cf449e1408 Add support for EINTR to wifi.c
Some system calls can be interrupted. wifi.c in particular was getting
into error conditions during bugreport because it doesn't handle EINTR
at all.

Change-Id: I7bec432a0b3dca7dcc5c03c5e9f5e9ed73fa3c4b
2012-03-15 13:12:41 -07:00
Glenn Kasten
24a710aee7 Add libmedia_native
Change-Id: I1d66327828a5adb06911de1f72076bc0295255c1
2012-03-15 09:45:04 -07:00
Eric Laurent
f9a4e2eccf audio policy: use audio_devices_t when appropriate
Change-Id: I0b4e2ff705fce96b40fdda28b1bc4b514438bec6
2012-03-08 13:41:38 -08:00
Eric Laurent
f7db035626 audio policy: spaced comments in header file
Change-Id: Ie72dcb9e33afb217bb7e37081500a7fc53d7a047
2012-03-07 19:19:29 -08:00
Eric Laurent
08b014d9e5 audio policy: use common string for A2DP address
Use definition from audio.h for A2DP sink address parameter.

Change-Id: I2d7905b8e3dd71fab2efc68ae16682e09c3f872e
2012-03-07 19:04:55 -08:00
Eric Laurent
b4696fc22b audio policy manager: more generic A2DP impl.
This change makes support for A2DP related audio policy more generic:
-removed WITH_A2DP compilation switch
-use output profile descriptors listing the parameters
(sampling rate, format...) devices and attributes (low power, tunneling...)
for each available output.
All the behavior specific to A2DP is derived from the A2DP output profile
descriptor.
- removed obsolete a2dpUsedForSonification() method.

This is a first step towards a more generic support for different audio
hardware modules (USB, HDMI) and output streams supporting different
combinations of parameters (sampling rate, format...) and attributes
(low power, tunneling...).
Ultimately, the hw modules and output descriptors will loaded from a
configuration file.

Change-Id: Ife3e49e1afbcb72613bfc8ce38919bb087ca85ea
2012-03-07 17:53:49 -08:00
Todd Poynor
77d789de26 libhardware_legacy: Remove set_screen_state
The early-suspend/late-resume interface to /sys/power/state
is being moved to the default/legacy Power HAL.

The emulator interface is being moved to the emulator
Power HAL.

Change-Id: I66a1e611e6d907f20335f047001745f818dfc846
Signed-off-by: Todd Poynor <toddpoynor@google.com>
2012-02-18 00:23:46 -08:00
Eric Laurent
c5eb8b4a5d Fix volume not restored when exiting silent mode
The change for volume per device introduced a problem where if a headset
is plugged in while in silent mode, the sound will not be restored
at the first press on volume up key but only at the second press.

This is because when exiting silent mode, AudioService reapplies the
last known volume for all devices in any order and the last volume
applied prevails, even if it is for a device other than currently selected
by audio policy manager.

The fix consists in applying a new volume only if the device indicated
matches currently selected device on an output.

Change-Id: I778b90a9ec5a8b4a15e0333bd045f2dd327f388c
2012-02-15 18:40:31 -08:00
Irfan Sheriff
02243837e4 Merge "Fixes for concurrency support" 2012-02-14 15:37:17 -08:00
Glenn Kasten
1281e523b0 Merge "Use audio_in_acoustics_t consistently" 2012-02-03 08:31:19 -08:00
The Android Open Source Project
10d31fa204 am 7490f9bf: am b4ff7281: Reconcile with ics-mr1-release
* commit '7490f9bf37a1bfcad8e6c868d878dd56fd4c09ca':
2012-02-01 10:10:28 -08:00
The Android Open Source Project
7490f9bf37 am b4ff7281: Reconcile with ics-mr1-release
* commit 'b4ff728122f67ae9bf0f5afe4ff65b3ba3068b59':
2012-02-01 10:01:31 -08:00
The Android Open Source Project
b4ff728122 Reconcile with ics-mr1-release
Change-Id: Ibf33a69673d9acafb9199d331fc88a7d80dbeb20
2012-02-01 08:50:23 -08:00
Glenn Kasten
70eb9dec50 Use audio_in_acoustics_t consistently
Change-Id: I9875afdf21937c88a5decc9d94e89fddffc3519e
2012-01-27 13:04:19 -08:00
Glenn Kasten
f3b5a0736e Use audio_source_t consistently
Change-Id: I11de4e92254e128643d8f158c74dcfee97e51005
2012-01-26 16:46:31 -08:00
Irfan Sheriff
096e49c869 Fixes for concurrency support
Change-Id: Ia7251dc86184fff710234c70a8ad54a6b245809a
2012-01-20 15:33:52 -08:00
Glenn Kasten
c97d4bb2bd Merge "Use audio_format_t consistently" 2012-01-20 14:50:30 -08:00
Glenn Kasten
ba1e8cb245 Merge "Audio policy HAL set_ringer_mode is deprecated" 2012-01-20 10:07:13 -08:00
Glenn Kasten
902ec630b6 Fix typos
Change-Id: Ie0acd07861604e66f571e0c1f43cfdccf12ea691
2012-01-18 16:27:02 -08:00
Glenn Kasten
ca0657a1ca Audio policy HAL set_ringer_mode is deprecated
Change-Id: I66ef40ed381151ba61debe20edaa53bece0cc139
2012-01-18 15:24:50 -08:00
Eric Laurent
f6fc420a79 Merge "audio policy manager: stream volume per device" 2012-01-17 17:34:58 -08:00