History log of /frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f1047e87767be1acd2c32f4d36028d1d0014f4c0 17-Apr-2018 Eric Laurent <elaurent@google.com> audioflinger: filter out reserved keys from setParameters()

Only allow setParameters() for reserved keys when received from
audioserver UID. For instance, keys used to control routing or audio
stream configuration are reserved for use by audio policy manager.

Also use multiuser_get_app_id() instead of duplicated code to
extract application ID from UID.

Bug: 77869640
Test: manual audio smoke tests.
Change-Id: I88852e8fddf7f705e4a084fc02d9ced1f4b0de92
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
10b7123bd6ce29fe756422aeedc5cfe469c4309f 14-Apr-2018 Eric Laurent <elaurent@google.com> audiopolicy: clear caller identity before calling audio policy manager

Audio policy manager methods must always be executed with the
level of priviledge of audioserver process.
After checking calling permissions, audio policy service will
clear binder caller identity before calling into audio policy manager.

Also add restrictions for start source and stop source binder
transactions.

Bug: 77869640
Test: manual audio smoke tests
Change-Id: I993d4fddcea9bfa3f44093c38406b85d69ca8890
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
eba668adbdee1ecfcf00fa9f9fc066c022cfddba 05-Apr-2018 Mikhail Naganov <mnaganov@google.com> AudioPolicyService: Fix typo in UidPolicy::isUidActive

Copy-paste bug.

Bug: 77300296
Bug: 77624334
Test: make
Change-Id: Id5352dafe70003d7027a2ec71144570ac927ea73
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
eae73eb726c141056caf5a7ff95d45c3bcdd999f 04-Apr-2018 Mikhail Naganov <mnaganov@google.com> AudioPolicyService: Properly handle service restarts in UidPolicy

Add logic in UidPolicy for handling audioserver restarts as well
as ActivityManager (system server) restarts.

Also, refactor the UidPolicy logic to simplify reasoning about
active state lookup. As a result, 4 layers are considered:

1. Service UIDs--always active.
2. Overrides--controlled via 'adb shell cmd'.
3. Cached UIDs from ActivityManager--also updated via IUidObserver.
4. ActivityManager ground truth.

Bug: 73405145
Bug: 77300296
Test: android.media.cts.AudioRecordTest#testRecordNoDataForIdleUids
manual tests with SoloTester
Change-Id: I426dd5d4d9c9c2570c0e03dde390e18f672c1b1d
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
2af67733ac8616ccc763afaa6f6cfebeffc090a3 31-Mar-2018 Eric Laurent <elaurent@google.com> audio policy: disable silencing of background UID record

There is a problem when audioserver process restarts where we fail to
reload the list of active UIDs causing silent capture for all apps
until they are restarted.

Bug: 77300296
Bug: 63938985
Test: crash audioserver and check that capture still works.
Change-Id: Ie1a93c496516c1b7208780949054832a8a073044
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
96c7eed596077ff84e75b7b1c6f20c3a29219bd1 27-Mar-2018 Eric Laurent <elaurent@google.com> audioserver: fix UID checks for multi user

Fix UID checks in audioserver to take into account multi user UIDs
where the top part above AID_USER_OFFSET contains the user number.

Bug: 76439650
Test: manual audio smoke tests.
Change-Id: I6dbd616021bcb2639c7b7369000ce911c7e7e030
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
4980df29f61d5fad95e17ca1d1969f6ca4c1f296 27-Jan-2018 Eric Laurent <elaurent@google.com> audio: filter reserved binder calls

Block incoming binder calls to audio flinger and audio policy service
for sensitive functions if they are not coming from a system UID.

Bug: 72278478
Test: audio smoke tests. CTS tests for AudioTrack and AudioRecord
Change-Id: I78e02efffe135d5450ced125e51e2084719ca03d
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
f4ddfefc8ba59a8486d91826154cc9447821409e 16-Jan-2018 Svet Ganov <svetoslavganov@google.com> Don't record audio if UID is idle - media framework

To protect user's privacy if a UID is in an idle state we allow
recording but report silence (all zeros in the byte array) and once
the process goes in an active state we report the real mic data.
This avoids the race between the app being notified aboout its
lifecycle and the audio system being notified about the state
of a UID.

Test: Added - AudioRecordTest#testRecordNoDataForIdleUids
Passing - cts-tradefed run cts-dev -m CtsMediaTestCases
-t android.media.cts.AudioRecordTest

bug:63938985

Change-Id: I1442a9dda1553e9ea7a4a654c50555ac1ec06aa0
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
1b2a794a27caab3a1320d22b872b04ef73e96555 08-Dec-2017 Mikhail Naganov <mnaganov@google.com> audiopolicy: Remove ; after namespace bracket

Semicolons are not needed after the closing bracket of
a namespace, remove it.

Test: compiles
Change-Id: Ie82930365f738fd9c95a9163839a68b772e49d95
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
5ff158fd499f581bdc1c3e91bbc03ce15eeeb77c 30-Oct-2017 Ivan Lozano <ivanlozano@google.com> Fix integer sanitizer in audiopolicyservice.

A size_t was being converted to a ssize_t after an intended overflow
had already occurred. This makes the conversion explicit.

unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned
int'

Test: Compiled with the change and checked the sanitizer output.
Bug: 30969751
Change-Id: Ic15cc4b5d8295e14e3588ffa240830f7570dcaf3
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
ac4e42982d4537732b30e71c9a00ba0077944984 22-Dec-2016 Jean-Michel Trivi <jmtrivi@google.com> Monitoring of recording: uid of recording session

Pass uid of recording session along with other existing information
in the recording monitoring callback.
Define new structure, record_client_info, to group uid (new),
session id (existing) and source (existing) and simplify
method signatures and marshalling code.

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest#testAudioManagerGetActiveRecordConfigurations
Bug 62579636

Change-Id: I18f66d7e55640a21f31021416a12a3e8094c3690
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
8243fcd644bd4b4865c3977435bb758c981ccf65 29-Nov-2016 Eric Laurent <elaurent@google.com> remove support for legacy audio policy manager

Test: make

Change-Id: I7294a52674abadfdbc4da40a72c8fe1a229d0815
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
61a4fac2e3ec271241e3a4f405d7357b7f6ca4c2 13-Oct-2016 Mikhail Naganov <mnaganov@google.com> Remove dependencies on hardware/audio_policy.h

Most of the time it's not needed, may be needed when
USE_LEGACY_AUDIO_POLICY is enabled.

Test: make

Change-Id: Id25eafc05352f07614965913d367d484f2673fbd
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
00260b5e6996b0a4b12f71c5b84e44adea040534 13-Oct-2016 Mikhail Naganov <mnaganov@google.com> Remove dependencies on hardware/audio_effects.h and EffectsFactoryApi.h

Also remove some outstanding dependencies on hardware/audio.h.

Most of the time, only constants and structs from audio_effects.h
are used, and no actual calls into HAL are made. Move these
definitions into system/audio_effect.h, and generate constants
from TREBLE HAL definition.

For parameters, always use values from AudioParameter class.

There are still some outstanding includes of hardware/audio.h
in code that directly deals with audio modules. Need to extend
libaudiohal interfaces to support required functionality.

Test: make

Change-Id: I0bcdf8ae199485d4d65f3eeb7e7a3b9b5cdb6ab6
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
e964d4e421e2d1ca937227a580c0c837091a11e3 09-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy warnings in audio and playerservice.

* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: I265f3b094e08d5705b506b3fbba51439c134af84
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
baf35feefcd14c13a6bf5ff5b651d9f22c2c3de0 28-Jul-2016 Eric Laurent <elaurent@google.com> audio policy: fixed delayed voice volume commands

Apply same rule as for stream volume in case of delayed voice volume
command: this prevents a delayed command to cancel a non delayed
command sent after.

Bug: 30421096
Change-Id: I576db5eba9498c811c3a6493b3c17e1f02b1b1a1
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
fcddb0b73931d207b21bd281a7df3ba2f230a607 09-Jul-2016 Glenn Kasten <gkasten@google.com> Enable strict warning checks and fix

Change-Id: Id401a937911eb418e93314812f2f7c2b5ecff8d6
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
d848eb48c121c119e8ba7583efc75415fe102570 08-Mar-2016 Glenn Kasten <gkasten@google.com> Use audio_session_t consistently

Bug: 27562099
Change-Id: I328d8226191386b163f2ace41233607294c50dcd
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
8c7cf3b7d0d7bccb9affbc34ae2ab2d6b332f972 26-Feb-2016 Jean-Michel Trivi <jmtrivi@google.com> Send audio patch in recording callback

Remove direct access to patch handle in AudioInputDescriptor, replace with
set / get functions.
Add interface for AudioSession to query configuration from enclosing
input descriptor.
When input descriptor's patch handle changes during a recording, propagate
the change through the recording notification callback.

Bug 26798796

Change-Id: Ia1395d44da7ccfe69ca46877638d1eb49b3935ad
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
7281aa9810b33eff47b00104db26c97c77931611 18-Feb-2016 Jean-Michel Trivi <jmtrivi@google.com> Send client / device format in recording callback

Bug 26798796

Change-Id: Ib4f64159c8371d87da49a8f0cad9317a87d843c4
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
d7eda8d0127fabf2d63b0890043da40e2a9e366c 03-Feb-2016 Eric Laurent <elaurent@google.com> audio policy: fix overflow in condition wait timeout

Do not pass a large value to Condition::waitRelative() as this
can cause an overflow in pthread_cond_timedwait_relative_np() when
converting to absolute time.

Bug: 26891803
Change-Id: Ie2a00bca52d469aa08b2718089dc19cfb1f3475f
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
2f4fe9f7df8f22c6bc8745407d19df73128810ec 05-Dec-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicy: callback for recording configuration change

Each AudioSession tracks start / end of recording, and sends
a callback to AudioSystem.
AudioSystem tracks a single recording callback tracking
input source and audio session number.

Change-Id: Ic065751d9ba013e03f2a6ad8dde02542e5465ec0
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
57a34a5163fa995b5d4827d60d9ebdb1881b11df 27-Oct-2015 Zach Jang <zachjang@google.com> Merge "Revert "Revert "AudioPolicyService: fix race in AudioCommandThread""" into mnc-dev am: 6919fbe40d am: 8c5b71ce47 am: 2fb59515d4
am: 77249c550f

* commit '77249c550ffc97b5f92150d544e661e17d530332':
Revert "Revert "AudioPolicyService: fix race in AudioCommandThread""
7f5d179babc1dbd4a9859da92fa43a89f14ce853 27-Oct-2015 Zach Jang <zachjang@google.com> Merge "Revert "AudioPolicyService: fix race in AudioCommandThread"" into mnc-dev am: cda4871486 am: 1fcbd9b0e9 am: dee38ac0da
am: e44a9c0666

* commit 'e44a9c0666b3861eb2676ddf91cbeb5ecd5b23a5':
Revert "AudioPolicyService: fix race in AudioCommandThread"
a754b4fa874f97a51ed2bee9257f2a870effe619 27-Oct-2015 Zach Jang <zachjang@google.com> Revert "Revert "AudioPolicyService: fix race in AudioCommandThread""

This reverts commit 75c82b50951b21190f710a638c6a26ff7ee6d86d.

Change-Id: I1b1f147bedf205636ec20b84faf6ef597a781c0d
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
75c82b50951b21190f710a638c6a26ff7ee6d86d 27-Oct-2015 Zach Jang <zachjang@google.com> Revert "AudioPolicyService: fix race in AudioCommandThread"

This reverts commit 74ce88ff0f24a8c08fdab3a1140212183089c2b5.

Change-Id: I39114c8cdd3021951ba93716aaa0c1c03e68538d
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
74ce88ff0f24a8c08fdab3a1140212183089c2b5 23-Sep-2015 Eric Laurent <elaurent@google.com> AudioPolicyService: fix race in AudioCommandThread

Fixe race condition in AudioCommandThread::threadLoop() where a
command can be inserted in first position in the queue after the sleep
time has been calculated causing a longer delay than expected.

Also fix a failure to hold a wake lock while commands are still in the queue.

Bug: 22707905.
Change-Id: I813626986677bf00106acb37ee20d3dd75d5cf33
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
0a712e0c7f292821ac7a997a75dbe2388378bed4 24-Sep-2015 Eric Laurent <elaurent@google.com> am 1723a587: am 3d25b023: am 047d97b2: AudioPolicyService: fix race in AudioCommandThread

* commit '1723a5879ff1295e6553730e2916e54a88b6222e':
AudioPolicyService: fix race in AudioCommandThread
047d97b2d046374e2a25c81a984d9cde23f5d781 23-Sep-2015 Eric Laurent <elaurent@google.com> AudioPolicyService: fix race in AudioCommandThread

Fixe race condition in AudioCommandThread::threadLoop() where a
command can be inserted in first position in the queue after the sleep
time has been calculated causing a longer delay than expected.

Also fix a failure to hold a wake lock while commands are still in the queue.

Bug: 22707905.
Change-Id: I813626986677bf00106acb37ee20d3dd75d5cf33
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
125902529aed131abc00210c36dc9ff03d9e8120 22-Aug-2015 Eric Laurent <elaurent@google.com> audio policy service: check registerClient() input parameter

Bug: 21523339.
Change-Id: I1d1ebd54fa7b20ae01d914bb216bf3dd24fc32cd
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
f60b6b6c776a762827874f6f635c0577359a7ee4 06-Jul-2015 Glenn Kasten <gkasten@google.com> Fix build warning

Change-Id: I876edc37fb2093ee13c876c2af5c46512763154d
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
e8726fea8a53bf3474aa3c6deaf2f6c1f565e694 26-Jun-2015 Eric Laurent <elaurent@google.com> reduce number of binder calls from mediaserver

Reduce the number of audio port, audio patch and
IO config changed binder calls from mediaserver to
client processes:
- Do not call IO config changed callback if selected
device is the same as previously selected one on a given
audio flinger playback or capture thread.
- Do not call the audio port or audo patch list update
callback on a client if this client as no listener registered.

Bug: 22045560.

Change-Id: If780e105404de79b7cb5c80c27b793ceb6b1c423
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
8c7e6dac6f5eb38cef627dab92eac8b38513450c 22-Apr-2015 Eric Laurent <elaurent@google.com> audio policy: session routes continued.

- Clear session routes when client process dies.
- Enforce the route only when the requesting session is active.
- Fix requested route not working if an output mix change is required
(e.g forcing to SPEAKER when the default route is USB or A2DP).
- Make sure all sessions sharing the strategy with a rerouted session
have the same route (needed for volume control consistency)

Change-Id: I0ab347a8fb97e73e2c5965374544c5f4fe509ef1
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
de80105c3f2db0eabd47640c49387ea3b44d4782 15-Apr-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicyManager: notification of dynamic policy mix activity

Implement non-stream type specific ref counting in output
descriptors to keep track of mix activity.
Notify audio policy client of mix activity changes.

Bug 20226914

Change-Id: Iec939cb640c58056f88947b611d23b4bb6d8a11b
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
884de21ca32e4a47f77e541a7284d02054ff3349 24-Mar-2015 Wally Yau <wyau@google.com> Make sure waitRelative is called when waitTime != INT64_MAX

b/19870971

(cherry picked from commit c600af1459c455583e071e653f0d998032aa423e)

Change-Id: Ic6bb54067d76c96ff6fc45431dc2d72db9f0a3a8
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp
56ec4ffcbae8aeac6c5245fc7b825d02e2e6cefd 24-Jan-2015 Jean-Michel Trivi <jmtrivi@google.com> Refactor AudioPolicyManager

AudioPolicyManager implementation is now split into the
following files:

files managerdefault/Gains.*
class AudioGain
class VolumeCurvePoint
class StreamDescriptor

files managerdefault/Devices.*
class DeviceDescriptor
class DeviceVector

files managerdefault/Ports.*
class AudioPort
class AudioPortConfig
class AudioPatch

files managerdefault/IOProfile.*
class IOProfile

files managerdefault/HwModule.*
class HwModule

files managerdefault/AudioInputDescriptor.*
class AudioInputDescriptor

files managerdefault/AudioOutputDescriptor.*
class AudioOutputDescriptor

All files for libaudiopolicyservice are moved under service/

All files for libaudiopolicymanager are moved under manager/

Change-Id: I43758be1894e37d34db194b51a19ae24461e066e
/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp