History log of /frameworks/av/services/audioflinger/AudioPolicyService.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
21e5456821e3c107d09b0629adbf23c9e06e7c0b 23-Sep-2013 Eric Laurent <elaurent@google.com> fix incoming call audio start time.

commit cec4abb fixing issue 6720482 had a flaw that
would insert commmands at the wrong position in the
audio policy service command thread queue causing other
commands to be delayed more than expected.

A change in track stop timing introduced by commit bfb1b83
made this issue visible when answering a call.

Bug: 10860012.
Change-Id: Iec769112f14e13d13b64628b808e43663e33771c
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
9a54bc27876acd5d8be5b1fc3dc46701fe76fbb3 09-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: add HOTWORD audio source.

HOTWORD is a special capture audio source that uses
the same audio tuning as VOICE_RECOGNITION but allows an
active capture to be preempted.

Bug: 10640877.

Change-Id: Iea09a11cbcdbacc8d434e5230e7559dcd1b44ac0
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
bfb1b832079bbb9426f72f3863199a54aefd02da 07-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: offload playback, non-blocking write

- Added specialized playback thread class for offload playback,
derived from directoutput thread.
This thread type handles specific state transitions for offloaded
tracks and offloading commands (pause/resume/drain/flush..) to audio HAL.
As opposed to other threads, does not go to standby if the track is paused.

- Added support for asynchronous write and drain operations at audio HAL.
Use a thread to handle async callback events from HAL: this avoids locking
playback thread mutex when executing the callback and cause deadlocks when
calling audio HAL functions with the playback thread mutex locked.

- Better accouting for track activity: call start/stop and release Output
methods in audio policy manager when tracks are actually added and removed
from the active tracks list.
Added a command thread in audio policy service to handle stop/release commands
asynchronously and avoid deadlocks with playback thread.

- Track terminated status is not a state anymore. This condition is othogonal
to state to permitted state transitions while terminated.

Change-Id: Id157f4b3277620568d8eace7535d9186602564de
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
18cf609ca3f20a9da2c7e140088d7557e7479f49 22-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Fix compile warning"
1b8ae3d9f3605fab7d14c323f2118ba3c769a42a 19-Jul-2013 Glenn Kasten <gkasten@google.com> Fix compile warning

Change-Id: I80de4a013dc65eb7c532561438fd10e005354c03
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
153b9fe667e6e78e0218ff0159353097428c7657 15-Jul-2013 Glenn Kasten <gkasten@google.com> Make AudioFlinger::instantiate() more resilient when called from separate module

Bug: 8834855
Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
1ab85ec401801ef9a9184650d0f5a1639b45eeb9 31-May-2013 Glenn Kasten <gkasten@google.com> Include what is needed

Remove old includes.
Header files only include other header files that they directly need themselves.

Change-Id: Ic471386808d9f42ea19ccbd59cb50a5f83a89dd0
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
ad3af3305f024bcbbd55c894a4995e449498e1ba 25-Mar-2013 Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Public API changes for audio offload support.

NOTE: this does _not_ include all private member variables added
to classes as part of offload support. Only public/protected functions
and stubs functions/variables needed to make the changes buildable.

- isOffloadSupported() added to audio policy service
A stub implementation is required to build, this always returns false
- setParameters() added to IAudioTrack
A stub implementation is required to build, this always returns
INVALID_OPERATION

- CBlk flag for stream end

- Change AudioSystem::getRenderPosition() to take an audio_output_t
so caller can specify which output to query

- Add AudioSystem::isOffloadSupported()
This is fully implemented down to the AudioFlinger function
AudioPolicyServer::isOffloadSupported() which is just a stub
that always returns false.

- Add EVENT_STREAM_END to AudioTrack interface.
STREAM_END is used to signal when the hardware has actually finished
playing all the data it was sent.

- Add event type enumeration to media player interface AudioSink callbacks
so that the same callback can be used to handle multiple types of
event. For offloaded tracks we also have to handle STREAM_END and
TEAR_DOWN events

- Pass audio_offload_info_t to various functions used for opening outputs,
tracks and audio players. This passes additional information about the
compressed stream down to the HAL when using offload.
For publicly-available APIs this is an optional parameter (for some of
the internal and low-level APIs around the HAL interface it is mandatory)

- Add getParameters() and setParameters() API to AudioTrack
Currently dummy implementations.

- Change AudioPlayer contructor so that it takes a set of bitflags defining what
options are required. This replaces the original bool which only specified
whether to use deep buffering.

- Changes to StageFright class definition related to handling tearing-down of
an offloaded track when we need to switch back to software decode

- Define new StageFright utility functions used for offloaded tracks
Currently dummy implementations.

- AudioFlinger changes to use extended audio_config_t.
Fills in audio_offload_info_t member if this info is passed in when
opening an output.

- libvideoeditor changes required to add the new event type parameter
to AudioSink callback functions

- libmediaplayerservice changes required to add the new event type parameter
to AudioSink callback functions

Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
f3e21c301b8fef49eecf9c716373fcbfbaa47670 21-Jun-2013 Glenn Kasten <gkasten@android.com> am 60f3f102: Merge "Prevent AudioCommands being freed before read"

* commit '60f3f102ba2973cc31e5c7ea00d95bbf19968e8b':
Prevent AudioCommands being freed before read
5fa8c4bf81275d5e1f5ef71bc66fc22e3152eeb0 18-Jan-2013 Christer Fletcher <christer.fletcher@sonymobile.com> Prevent AudioCommands being freed before read

When AudioCommandThread::threadLoop process AudioCommands it was
possible for it to delete a command where the posting thread still
hadn't read that status from it.

If a second command signaled the thread loop to continue after it
had inserted a new command while the thread loop was actually waiting
for the first command to report that it had read the status the
thread loop would continue and delete the first command.

Changed the wait condition when waiting for the calling thread to
read status to use command->mCond instead of mWaitWorkCV. This way
it's guaranteed that the signal to continue comes from the correct
thread.

Change-Id: Ia69b48cb4fdfaf8b4c83b56a197fb9f2058a92d1
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
e336f9113bdd35119866a3c3f8008ca01c576660 05-Feb-2013 Jean-Michel Trivi <jmtrivi@google.com> Add support for querying if a stream is active remotely

Bug 7485803

Change-Id: I0744374f130fd2dd0714102354cffed2fa915361
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
411e447c4b90298f5ff635429c53f94fbce4fff9 02-Nov-2012 Glenn Kasten <gkasten@google.com> Don't explicitly log tid

If needed, it can be obtained with adb logcat -v threadtime

Change-Id: I91b3911d20f7bcfc3361db4052db21ff9181f1cf
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
8af901cdea0af7e536579dee6d56e69987035a01 01-Nov-2012 Glenn Kasten <gkasten@google.com> Line length 100

Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
d7086030fcf731e4bcef6c033cc6418cd04e6b91 10-Oct-2012 Jean-Michel Trivi <jmtrivi@google.com> Support querying active record sources

Add support for querying whether there is currently a recording
underway from the specified audio source.

Bug 7314859

Change-Id: I986b231a10ffd368b08ec2f9c7f348d28eaeb892
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
e3f641fd9348bf7f4c07f6cc707347fccea1439c 10-Oct-2012 Jean-Michel Trivi <jmtrivi@google.com> Support querying active record sources

Add support for querying whether there is currently a recording
underway from the specified audio source.

Bug 7314859

Change-Id: I986b231a10ffd368b08ec2f9c7f348d28eaeb892
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
bac4a4a9073a440bc6df7ca2306604819aa1c342 09-Oct-2012 Eric Laurent <elaurent@google.com> audio policy: deprecate ro.camera.sound.forced

The volume and routing policy of AUDIO_STREAM_ENFORCED_AUDIBLE is
now controlled by AudioService.

Do not read ro.camera.sound.forced is not needed anymore.

Bug 7032634.

Change-Id: Ic0a6396fc4b6efb91cdb4dffe0c8eb035d0440bd
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
116bc97164e0fa836744f31e54779b5a7a8c9db4 09-Oct-2012 Eric Laurent <elaurent@google.com> audio policy: deprecate ro.camera.sound.forced

The volume and routing policy of AUDIO_STREAM_ENFORCED_AUDIBLE is
now controlled by AudioService.

Do not read ro.camera.sound.forced is not needed anymore.

Bug 7032634.

Change-Id: Ic0a6396fc4b6efb91cdb4dffe0c8eb035d0440bd
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
58e5aa34f01d663654d8bafad65db1dda42161ff 20-Jun-2012 Glenn Kasten <gkasten@google.com> effect_descriptor_t const correctness

Change-Id: Iad008f20d35a18acf500f773900164552fd0c19e
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
a189a6883ee55cf62da1d7bf5bf5a8ab501938a4 20-Feb-2012 Glenn Kasten <gkasten@google.com> Use struct assignment instead of explicit memcpy

for POD structs effect_descriptor_t and effect_config_t

Change-Id: Ib2fc47f85fb65ed91b0abb1f87217c49b5eb571d
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
254af180475346b6186b49c297f340c9c4817511 03-Jul-2012 Glenn Kasten <gkasten@google.com> Use audio_channel_mask_t more places

Use it in AudioSystem::getOutput(), AudioSystem::getInput(),
IAudioPolicyService::getOutput(), IAudioPolicyService::getInput(),
and various other places in AudioFlinger.

Not done: AudioTrack and OutputDescriptor.

Change-Id: I70e83455820bd8f05dafd30c63d636c6a47cd172
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
cec4abb2a39eafa75cf6894170a200322aa7226e 03-Jul-2012 Eric Laurent <elaurent@google.com> audio policy: fix delayed command insertion

When inserting a delayed command in the audio policy service
command thread queue, later similar commands are filtered out.
In case of volume commands and delayed unmuting, this can cause
a problem where a new volume command can cause the timing of a
delayed unmuting command to not be honored.

This change makes that a volume command gets the time stamp of
any delayed command it replaces.

Bug 6720482.

Change-Id: I216f85ac0ea46e4a046d3483e9e9b7ffe6c34a08
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
20010053daabfa43fcfe781bbf004473b4c08538 22-Jun-2012 Glenn Kasten <gkasten@google.com> Remove acoustics from AudioSystem::getInput()

Change-Id: I29fb3ee5664c1f0ee0409c1bb2be087ecca637db
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
5f12136299918ea30555f3481668ec0dbb775e5f 15-Jun-2012 Eric Laurent <elaurent@google.com> audio policy: acquire lock for volume functions

Acquire the AudioPolicyService mutex when executing
setStreamVolumeIndex() and getStreamVolumeIndex().

These functions have become more complex and iterate on the
list of opened outputs and it is safer to acquire the
AudioPolicyService mutex to avoid concurrency with other
functions.

Bug 6626532.

Change-Id: Ifdcbbbf13338fd9a59f694d43faa7ade143f94bf
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
67c0a58e05f4c19d4a6f01fe6f06267d57b49305 02-May-2012 Eric Laurent <elaurent@google.com> audioflinger: various fixes on direct output

Various fixes in direct output playback thread implementation:
- threadLoop_write() was broken for playback threads that do not
use a pipe sink.
- output buffer size calculation was hard coded for stereo.
- removed software volume that was implemented for PCM stereo
format only: the audio HAL has to implement volume if needed
for direct outputs.

Change-Id: If211b4489be9af395435707b8cf0388cce1347b2
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
0ca3cf94c0dfc173ad7886ae162c4b67067539f6 18-Apr-2012 Eric Laurent <elaurent@google.com> rename audio policy output flags

Change-Id: I27c46bd1d1b2b5f96b87af7d05b951fef18a1312
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
a4c5a550e2a3bc237179b8684e51718e05894492 29-Mar-2012 Eric Laurent <elaurent@google.com> audio policy: load audio hw modules.

Audio HW modules are now loaded upon request from audio policy manager
according to the configuration in audio_policy.conf.
Removed hard coded HW module loading by AudioFlinger at init time.
Added methods to IAudioFlinger and AudioPolicyInterface
to control the loading of audio HW modules.
Added methods to open an output or input stream on a specific hw module.

Change-Id: I361b294ece1a9b56b2fb39cc64259dbb73b804f4
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
1a9ed11a472493cac7f6dfcbfac2064526a493ed 21-Mar-2012 Eric Laurent <elaurent@google.com> audio policy: add configuration file

removed outputs to stream mapping cache in audio system: the output for a
given stream type must always be queried from audio policy manager as the cache
is not always updated fast enough by audioflinger callback.

removed AudioFlinger::PlaybackThread::setStreamValid() not used anymore if
stream to output mapping is not cached.

Change-Id: Ieca720c0b292181f81247259c8a44359bc74c66b
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
e53b9ead781c36e96d6b6f012ddffc93a3d80f0d 13-Mar-2012 Glenn Kasten <gkasten@google.com> Whitespace and indentation

Fix indentation to be multiple of 4.
Make it easier to search:
sp< not sp < to
"switch (...)" instead of "switch(...)" (also "if" and "while")
Remove redundant blank line at start or EOF.
Remove whitespace at end of line.
Remove extra blank lines where they don't add value.

Use git diff -b or -w to verify.

Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
b3dfcf483a96816fe2e949dd86fed26e52ad7404 09-Mar-2012 Glenn Kasten <gkasten@google.com> Merge "AudioPolicyService InputDesc minor cleanup"
81872a2ce65653ae980621ba2907da56a83ba9a7 08-Mar-2012 Glenn Kasten <gkasten@google.com> AudioPolicyService InputDesc minor cleanup

Add a non-default constructor to set the mSessionId, and make mSessionId const.

Remove explicit clear on mEffects - it is automatically cleared by the destructor.

AudioPolicyService::setPreProcessorEnabled:
- parameter is const *
- use an alias instead of making a Vector copy

Destructor doesn't need to be virtual since there are no subclasses.

Change-Id: Ibc3c3bea8259839430b1cf5356186c7d96f1082f
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
6374252107fd6539397598195ea6defd5870fafb 08-Mar-2012 Eric Laurent <elaurent@google.com> audio policy: use audio_devices_t when appropriate

Change-Id: I1b3a5879e81c789fb53d356af3d3a1ee2dca955f
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
480b46802bef1371d5caa16ad5454fce04769c57 28-Feb-2012 Glenn Kasten <gkasten@google.com> Shorten thread names

prctl(PR_SET_NAME) limits to 15 characters. Before we had names like
"Binder Thread #" and the counter was cut off :-( Also remove redundant
"thread" at end of name; it's always a thread.

Change-Id: I1f99c2730ba0787ed9b59c15914356cddf698e2f
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
1b094ee8f7fe7eca65bf3d2f983ba95eef6db93d 17-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Simplify code"
a111792f1314479c649d1d44c30c2caf70c00c2a 26-Jan-2012 Glenn Kasten <gkasten@google.com> Simplify code

Use DefaultKeyedVector::valueFor to avoid extra test
Make local variables as local as possible
No double parentheses
No typedef for single use
No parentheses around indirect function call
No AudioFlinger:: prefix when not needed
Remove unnecessary casts
Remove block with only one line

Saves 128 bytes

Change-Id: I3a87430eeb01b81e7b81a1c38f6fdd3274ec48f3
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
9fda4b87441fe17d90d8144639c9de6d9022c3c0 02-Feb-2012 Glenn Kasten <gkasten@google.com> Fixed possible heap corruption in EffectDesc

"EffectDesc *effect = new EffectDesc(*effects[i]);" was relying on the
default copy constructor for EffectDesc, but the default copy constructor
does a member-by-member copy. This works OK for mUuid, but a member
copy of mName and mParams shares pointers. This could result in heap
corruption later on due to a double free. Changed to add an explicit
copy constructor that does a deep copy of both mName and mParams.

A malloc() and strdup() were being freed by delete, but the correct
matching API for these is free(). Fortunately our current memory runtime
implementation ignores the difference. Changed to use free().

EffectDesc and InputSourceDesc member fields were being torn down by
the code that does delete. Changed to do the tear-down in ~EffectDesc()
and ~InputSourceDesc().

Added constructor EffectDesc() with name and UUID parameters, rather
than having caller fill in the object after construction.

Made ~EffectDesc() and ~InputSourceDesc() non-virtual to save memory,
since they have no subclasses.

Change-Id: Ibb5cc2e6760d72e0c4cf537068ac4432c717bafd
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
8d6a2449a91f5116d7243ab039393195ebd663fe 08-Feb-2012 Glenn Kasten <gkasten@google.com> Use size_t and ssize_t with Vector

Use size_t with size() and ssize_t with indexOfKey(). Exception:
use ssize_t for backwards loops, and indices that are overloaded as a
marker or error code.

Change-Id: Ibf2a360af4539b72b09c818dda22ea2a0de92431
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
44deb053252a3bd2f57a007ab9560f4924f62394 06-Feb-2012 Glenn Kasten <gkasten@google.com> Factor out and speed up permission-checking code

Use the caching permission check for dump to save IPC.

Cache getpid() to save kernel call for other permission checks.

The C runtime library getpid() can't cache due to a fork
race condition, but we know that mediaserver doesn't fork.

Don't construct String16 on the stack.

Change-Id: I6be6161dae5155d39ba6ed6228e7683e67be34ed
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
9d1f02d74fd395ec4de6861147da289423f0ab6f 09-Feb-2012 Glenn Kasten <gkasten@google.com> Follow raw pointer and sp<> conventions

Unconditional delete for raw pointers.
Use "if (sp != 0)" not "if (sp.get() != 0)" or "if (sp != NULL)".
Use "if (raw != NULL)" not "if (raw)".

Change-Id: I531a8da7c37149261ed2f34b862ec4896a4b785b
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
23d82a9bc9a43b49ba684ba40875b91db310d3b9 03-Feb-2012 Glenn Kasten <gkasten@google.com> Fix typos in ALOG for pid vs tid

Change-Id: I6dc70f137d0ff8a86427ab8882a81886e1de0782
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
72ef00de10fa95bfcb948ed88ab9b7a177ed0b48 17-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_io_handle_t consistently instead of int

Other:
- add a comment to nextUniqueId
- made ThreadBase::mId const, since it is only assigned in constructor.

Change-Id: I4e8b7bec4e45badcde6274d574b8a9aabd046837
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
7378ca506e4e20c2b2d4e94a131cf1b95831adb5 20-Jan-2012 Glenn Kasten <gkasten@google.com> Use 0 not NULL for sp<> and wp<>

Change-Id: Id1f0c89acefaceed6cb9ca7c165fce895e46d85b
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
787bae0578fbaab6219ebf23494866b224d01438 03-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Use audio_in_acoustics_t consistently"
ff3c83e04ae459c4252b86dd4440b4e37ee92c16 03-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Use ToneGenerator::tone_type consistently"
a0d68338a88c2ddb4502f95017b546d603ef1ec7 28-Jan-2012 Glenn Kasten <gkasten@google.com> Use NULL not 0 for raw pointers

Use if (p != NULL) instead of if (ptr)

Change-Id: Iaec3413a59ccbf233c98fcd918cc7d70ac5da9fa
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
e9dd0176933d6233916c84e18f3e8c0d644ca05d 28-Jan-2012 Glenn Kasten <gkasten@google.com> Unconditional delete

Don't check that pointer is non-NULL before delete.

Don't leave deleted member fields non-NULL, except in a destructor,
since it could be misleading in a dump or debugger. (mRsmpOutBuffer)

Change-Id: Ic0492a6b752f74a67f4c96dfb89ca2de4e69eecf
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
3d2f877c1cb4e4ae4ddde7f57f4353de9341f11b 28-Jan-2012 Glenn Kasten <gkasten@google.com> Use ToneGenerator::tone_type consistently

Also remove defaults in startToneCommand(), they're not needed and the
default for tone type was nonsense.

Change-Id: I70fa8cee4f3dbb8c66ceb3719c8d3d2f447f05b9
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
de9719b3ec71472e6bf75117152176af51d1a515 27-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_in_acoustics_t consistently

Change-Id: I0a9dd668fb2e57b1c3ece3190588194974b99062
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
eba51fb3a361f67a6a64d5a16eba6084fe27d60e 23-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_source_t consistently

Was a mix of audio_source_t, uint8_t, and int.

Related fixes:
- fix comments in MediaRecorder.java
- AudioPolicyService server side was not checking source parameter at
all, so if the client wrapper was bypassed, invalid values could be
passed into audio HAL
- JNI android_media_AudioRecord_setup was checking source for positive
values, but not negative values. This test is redundant, since already
checked at Java and now checked by AudioPolicyService also, but might
as well make it correct.

Change-Id: Ie5e25d646dcd59a86d7985aa46cfcb4a1ba64a4a
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
58f30210ea540b6ce5aa6a46330cd3499483cb97 12-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_format_t consistently, continued

Was int or uint32_t.

When AudioFlinger::format can't determine the correct format,
return INVALID rather than DEFAULT.

Init mFormat to INVALID rather than DEFAULT in the constructor.
Subclass constructors will set mFormat to the correct value.

Change-Id: I9b62640aa107d24d2d27925f5563d0d7407d1b73
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
ea3cc3bca949139e401b77f2ac0cce7ac6e76f8f 20-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Remove dead setRingerMode(mode, mask)"
86905f445c96743b037eed6360afa956a85b019c 19-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Add units to time periods"
ca42b286a162f5cd6a4a916bfe429abe95780730 19-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use const const strings for arrays and pointers to strings"
22ecc912a87099cff8cadc424cd12f85c118673f 09-Jan-2012 Glenn Kasten <gkasten@google.com> Add units to time periods

Change-Id: Ib980e2676cecf5d9b0c2e388da6dc8e370df8abb
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
8dad0e31c2366c501bd1d600261d0af35a6ca786 09-Jan-2012 Glenn Kasten <gkasten@google.com> Use const const strings for arrays and pointers to strings

Change-Id: I0a073e17ebf6ad59e7edbedac104c6fa4bcaf9c9
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
f1d4592d4c3c99ebab55559e164ff102e825283e 14-Jan-2012 Glenn Kasten <gkasten@google.com> For booleans, use ! instead of == false

Change-Id: Ibc115936d2d0b0b7744ebe9b52839ea5b42c4edd
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
0b07b8085d7b837b4dd5f09e0c8c39408f6bdbf7 18-Jan-2012 Glenn Kasten <gkasten@google.com> Remove dead setRingerMode(mode, mask)

Change-Id: Ia4cc8be8424a40b3dcb7ebd0264fdff4e5247f7f
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
63ad6aacc6ce6b729bf25f41376cfea731a2c1eb 18-Jan-2012 Eric Laurent <elaurent@google.com> Merge "audio framework: manage stream volume per device"
83844cc2f95dc279015b47fd1e18c7cb4eabe9a1 19-Nov-2011 Eric Laurent <elaurent@google.com> audio framework: manage stream volume per device

Improve volume management by keeping track of volume for each type
of device independently.
Volume for each stream (MUSIC, RINGTONE, VOICE_CALL...) is now maintained
per device.

The main changes are:
- AudioService now keeps tracks of stream volumes per device:
volume indexes are kept in a HashMap < device , index>.
active device is queried from policy manager when a volume change request
is received
initalization, mute and unmute happen on all device simultaneously
- Settings: suffixes is added to volume keys to store each device
volume independently.
- AudioSystem/AudioPolicyService/AudioPolicyInterface: added a device argument
to setStreamVolumeIndex() and getStreamVolumeIndex() to address each
device independently.
- AudioPolicyManagerBase: keep track of stream volumes for each device
and apply volume according to current device selection.

Change-Id: I61ef1c45caadca04d16363bca4140e0f81901b3f
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
0696400a6bb9abbed62b3b9c6aa105495dc600a2 17-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use audio_mode_t consistently"
263709e7be37c7040aaef385bc5c9389a9b5f514 06-Jan-2012 Glenn Kasten <gkasten@google.com> Check stream type in AudioFlinger::createTrack

A bad parameter to AudioFlinger::createTrack could cause mediaserver to crash.

Other AudioFlinger stream type cleanup:
- Simplify range check for audio_stream_type_t
- Add comment about mStreamTypes array initialization.

Change-Id: Ia33aa1cce0fdd694b08d9288816ffc097a9543d0
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
fff6d715a8db0daf08a50634f242c40268de3d49 13-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_stream_type_t consistently

At native level it was a mixture of audio_stream_type_t, int, uint32_t,
and uint8_t. Java is still int. Also fixed a couple of hard-coded -1
instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0
instead of AUDIO_STREAM_VOICE_CALL.

Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
f78aee70d15daf4690de7e7b4983ee68b0d1381d 04-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_mode_t consistently

It was int or uint32_t.
Also make getMode() const.

Change-Id: Ibe45aadbf413b9158e4dd17f2b3bcc6355288d37
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
930f4caa1e311ef7ff538c421a324396157eb24f 07-Jan-2012 Glenn Kasten <gkasten@google.com> Simplify range check for audio_mode_t

AudioSystem::setMode previously allowed negative modes, but these were
then rejected by AudioFlinger.

Now negative modes (including AUDIO_MODE_INVALID and AUDIO_MODE_CURRENT)
are explicitly disallowed.

Change-Id: I0bac8fea737c8eb1f5b6afbb893e48739f88d745
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
29357bc2c0dd7c43ad3bd0c8e3efa4e6fd9bfd47 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
5ff1dd576bb93c45b44088a51544a18fc43ebf58 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
df64d15042bbd5e0e4933ac49bf3c177dd94752c 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
d1d8f23dde239289ba8c0de0944baaca3586c880 08-Jul-2011 Glenn Kasten <gkasten@google.com> Fix includes

Remove unused #include dlfcn.h

Add #include String8.h
Forward class declaration is only for references and pointers.
In this case, we need the full class declaration,
and were incorrectly depending on another header file to do it.

Change-Id: Iff65cceb3982698cc1ebaeec405695fc190c03ff
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
3856b090cd04ba5dd4a59a12430ed724d5995909 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
a5cc7cce9b8aee73b08f6532710e186c02fdd1c0 03-Aug-2011 Eric Laurent <elaurent@google.com> Issue 5081351: isWiredHeadsetOn() permission.

AudioManager.isWiredHeadsetOn() should not require permission MODIFY_AUDIO_SETTINGS.
Remove permission checks on all getters in audio policy manager as permission enforcement
is really usefull for setters.
Also deprecate AudioManager.isWiredHeadsetOn() which name and implementation are deceptive.

Change-Id: I38f8df7c26c0d417bf0e2b74e4c11c2d143f2ecd
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
db7c079f284f6e91266f6653ae0ec198b1c5006e 10-Aug-2011 Eric Laurent <elaurent@google.com> Audio effects: track CPU and memory use separately

Before this change, CPU and memory usage for an audio effect were
registered and checked against the limit by audio policy manager
upon effect instantiation. Even if an effect was not enabled
it would prevent another effect to be created if the CPU load budget
was exceeded, which was too restrictive.

This change adds a method to register/unregister CPU load only when
an effect is enabled or disabled.
It also adds a mechanism to place all effects on the global output mix
in suspend state (disabled) when an effect is enabled on a specific session.
This will allow applications using session effects to have the priority
over others using global effects.

Also fixes some issues with suspend/restore mechanism:
- avoid taking actions when an effect is disconnected and was not enabled.
- do not remove a session from the suspended sessions list when corresponding
effect chain is destroyed.

Change-Id: I5225278aba1ae13d0d0997bfe26a0c9fb46b17d3
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
57dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfc 24-Jul-2011 Eric Laurent <elaurent@google.com> Added APIs for audio preprocessing

Added APIs to control pre processes applied on captured audio.
Those APIs are still hidden until reviewed by API council.

Three types of standard pre processes are supported:
- Automatic Gain Control (AGC) by AutomaticGainControl class
- Acoustic Echo Cancellation (AEC) by AcousticEchoCanceler class
- Noise Suppression (NS) by NoiseSuppressor class

A method is added to AudioEffect class to query audio pre processings
applied by default by the platform on a given AudioRecord session ID.

Change-Id: I0b9fceeb8c704dd06319c3b52b85c96fe871d51d
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
7c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745 18-Jun-2011 Eric Laurent <elaurent@google.com> Audio framework: support for audio pre processing

Audio effect framework is extended to suport effects on
output and input audio path.

AudioFlinger: Support for audio effects and effect chains is
moved from PlaybackThread class to ThreadBase class so that
RecordThread can manage effects.
Effects of type pre processing are allowed on record thread
only. When a pre processing is enabled, the effect interface handle is
passed down to the input stream so that the audio HAL can call the
process function. The record thread loop calls the effect chain process
function that will only manage the effect state and commands and skip the
process function.

AudioRecord: The audio session is allocated before calling getInput() into
audio policy serice so that the session is known before the input theead is
created and pre processings can be created on the correct session.

AudioPolicyService: default pre processing for a given input source are
loaded from audio_effects.conf file.
When an input is created, corresponding effects are created and enabled.

Change-Id: Id17119e0979b4dcf189b5c7957fec30dc3478790
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
81eedd1746be590d5d506dfb9ff23619f9d9898f 13-Jul-2011 Mike Lockwood <lockwood@android.com> Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build

Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
7394a4f358fa9908a9f0a7c954b65c399f4268e6 14-Jun-2011 Dima Zavin <dima@android.com> audio: update for audio/audio_policy header names/locations

Change-Id: I36c49352eee57559403cd1597f56a8485a360289
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
0512ab559d4670c2204078470d7ef5d376811c57 05-May-2011 Glenn Kasten <gkasten@google.com> Remove dead code related to gettid

The gettid system call is always available now.

Change-Id: Ib78b41781eda182dc8605daf456bbea7ff7c2dc0
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
64760240f931714858a59c1579f07264d7182ba2 11-May-2011 Dima Zavin <dima@android.com> update for new audio.h header location

Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
fce7a473248381cc83a01855f92581077d3c9ee2 20-Apr-2011 Dima Zavin <dima@android.com> audio/media: convert to using the audio HAL and new audio defs

Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
6b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3 04-Feb-2011 Glenn Kasten <gkasten@google.com> Bug 3352047 Wrong message when adjusting volume

Add hidden AudioManager.getDevicesForStream and output device codes.

Change-Id: I4d1c1d3b6a077cd117720817d1f733dda557b947
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
802da7bc462f6f9df6e681cc75c51dc0a056a4a1 04-Feb-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 3366668 Use BinderService template"
d2dcb08808aed82218b258726fa66f8e095a3f9c 04-Feb-2011 Glenn Kasten <gkasten@google.com> Bug 3366668 Use BinderService template

Change-Id: I93d7f3fc9dc9b6a365723d8a51a73a5aabdb4f93
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
eda6c364c253ba97ee45a3adeb8c2b45db1f81db 02-Feb-2011 Eric Laurent <elaurent@google.com> Fix issue 3371080

Modified default volume control logic in AudioService:
1 IN_CALL volume if in video/audio chat
2 NOTIFICATION if notification is playing or was playing less than 5s ago.
3 MUSIC

Modified silent mode:
- now also affect MUSIC stream type
- entering silent mode when VOL- hard key is pressed once while selected
stream volume is already at 0 (except for VOICE_CALL stream).
- exiting silent mode when pressing VOL+ hard key while in silent mode

Play sound FX (audible selections, keyboard clicks) at a fixed volume.

Modified audio framework:
- isStreamActive() method now implemented in AudioPolicyManagerBase (previously AudioFlinger)
- iStreamActive() now specifies a time window during which the stream is considered
active after it actually stopped.

Change-Id: I7e5a0724099450b9fc90825224180ac97322785f
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
935752053ef2691dbb6d5a6d149e0e362c6e3c74 19-Jan-2011 Eric Laurent <elaurent@google.com> Tentative fix for issue 3362362.

The problem is likely that one method is called on the AudioPolicyManagerBase
instance while it is still being constructed by AudioPolicyService.

To avoid this, the AudioPolicyService mutex is held by the constructor until the
platform specific AudioPolicyManager is constructed and the member
mpPolicyManager initialized.

Also added an initCheck() method to AudioPolicyInterface to verify successful
initialization of AudioPolicyManager.

A similar change is done in AudioFlinger constructor.
Also added some missing protections in AudioFlinger methods where the
playback thread list is parsed.

Change-Id: I006b244ec057e1bb0aa5ebe426ef006e3b171056
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
de070137f11d346fba77605bd76a44c040a618fc 13-Jul-2010 Eric Laurent <elaurent@google.com> Audio policy manager changes for audio effects

Added methods for audio effects management by audio policy manager.
- control of total CPU load and memory used by effect engines
- selection of output stream for global effects
- added audio session id in parameter list for startOutput() and stopOutput().
this is not used in default audio policy manager implementation.

Modifications of audio effect framework in AudioFlinger to allow moving and reconfiguring
effect engines from one output mixer thread to another when audio tracks in the same session
are moved or when requested by audio policy manager.
Also fixed mutex deadlock problem with effect chains locks.

Change-Id: Ida43484b06e9b890d6b9e53c13958d042720ebdb
/frameworks/av/services/audioflinger/AudioPolicyService.cpp
65ab47156e1c7dfcd8cc4266253a5ff30219e7f0 15-Jul-2010 Mathias Agopian <mathias@google.com> move native services under services/

moved surfaceflinger, audioflinger, cameraservice

all native services should now reside in this location.

Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8
/frameworks/av/services/audioflinger/AudioPolicyService.cpp