History log of /frameworks/base/services/core/java/com/android/server/audio/AudioService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
db0da5637abb701eb290e41a369b5b696a94f225 14-Jun-2018 Eric Laurent <elaurent@google.com> audioservice: fix a2dp connection race condition

In case of fast (< 1 second) A2DP disconnect/connect sequence, there
is a potential race condition where the delayed disconnection message
(due to becoming noisy intent) is received after the not delayed
connection message.

- Make sure all messages related to device connection/disconnection
(including MSG_A2DP_DEVICE_CONFIG_CHANGE and MSG_BTA2DP_DOCK_TIMEOUT)
are handled by queueMsgUnderWakeLock().
- Make sure messages are processed in the same order as API calls.
- Add check for null address in makeA2dpDeviceUnavailableNow().

Bug: 109903807
Bug: 78837311
Test: repro steps in bugs. A2DP connection and playback

Change-Id: Ib81b3805f945f7206b1a60de74e9bbeeef89bdd0
(cherry picked from commit 3c4636c7127cd34728050d051ef3bd62829e877d)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
18424bb7a480883ac54d30303cbbe257e7edf712 07-Jun-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioService: fix deallock setBluetoothScoOn vs setMode

In AudioService:
setBluetoothScoOn()
> setBluetoothScoOnInt()
> synchronized(mSettingsLock)
> muteRingerModeStreams()
> synchronized (VolumeStreamState.class)
vs
setMode()
> setModeInt()
> synchronized (mSettingsLock)
> synchronized (VolumeStreamState.class)

The issue comes from setBluetoothScoOnInt() releasing the lock
on mSettingsLock before calling muteRingerModeStreams(). This
breaks the expected lock ordering in AudioService, where
mSettingsLock must be locked before VolumeStreamState.class.

Bug: 109746821
Test: see bug
Change-Id: I853ca60781efc506626b6345f27da701655ac359
(cherry picked from commit c106d9f958be76ab14a6724525f39bc3fec03fd2)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
69ed99856be479c3a721bb138bc15cb5d594fe42 31-May-2018 Hongwei Wang <hwwang@google.com> Merge "Master mute is valid when running fixed volume for automotive" into pi-dev
daba12467466b115fcbb50e609785591c24a6cbb 29-May-2018 Hongwei Wang <hwwang@google.com> Master mute is valid when running fixed volume for automotive

In Automotive case, we set fixed volume to suggest no volume control
inside AudioFlinger and master mute is a mapping to the physical mute
button in a car, which toggles the global mute state.

Bug: 80474559
Test: adb shell input keyevent 164
Change-Id: I1d4fd143a98ee96f11850811c90e6d9932cab948
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
cc4b8a4cda91e20d0d674e0212a95c1628ba6396 23-May-2018 Sungsoo Lim <sungsoo@google.com> Update mGlobalBluetoothA2dpOn when active device changed

Also do not setForceUse when a2dp config without change.

Bug: 79982460
Test: manual
Change-Id: I789b03c00366f9fd78fd3a0305fdf2c11dfc23d2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3e6fb6309033c50081c0789b5905d5cd539b38f6 21-May-2018 Eric Laurent <elaurent@google.com> Add field to set A2DP device volume on connect (1/2)

Add a field to setBluetoothA2dpDeviceConnectionStateInt() to allow
Bluetooth to set a volume for the new device when it connects.

Bug: 79529581
Test: Switch repeatedly between devices and see that the old volume isn't
used on the new device or the new volume isn't used on the old device.
Change-Id: I909fa3f40818c595fc977695fbfa1214f9a4de72
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
6db5f8640276b6b0eced5eb5ed81aac0d6a11b93 17-May-2018 jiabin <jiabin@google.com> Set enabledSurroundFormats as empty string when it is null.

When ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS doesn't exist in settings
DB, enabledSurroundFormats will be null. Set it as empty string to avoid
crash.

Bug: 79923672
Test: Delete ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS and select manual.
Change-Id: I8385bc05733ebd8ca0b64e756cf22fc8e3de09c8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1b43af094e5de196566762ca07e6f4207dc1c289 16-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove SCO devices if Bluetooth process is dead" into pi-dev
3994075a5b638ecffce5b8782521fce7631e7169 03-Apr-2018 jiabin <jiabin@google.com> Add support for manually set surround formats.

To make surround sound setting more clear to users, we are changing
surround setting from ALWAYS to MANUAL. With MANUAL, users could enable
surround formats according to their need.

Bug: 67479735
Test: Try creating AudioTrack with enable/disable surround formats.
Change-Id: I79e610f6c43d7003daf13da3bee4e03ba9b6ea87
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
8f8ee847b43815c56723792864336d250fa6593e 14-May-2018 Ugo Yu <ugoyu@google.com> Remove SCO devices if Bluetooth process is dead

Fix Bluetooth device stuck in device list forever if Bluetooth
crashed and any HFP device was connected at this moment.
Make sure all kind of device class of the BT address are removed
from the list.

Bug: 79509110
Test: kill com.android.bluetooth while HFP is connected.
Change-Id: I0d717bcc4c2182f1ac834d67b8227c9773639c7f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
33c3a17113ee93bfd4575241cc15e78afc300f0e 08-May-2018 Jack He <siyuanh@google.com> AudioService: Do not disconnect SCO started externally

* AudioService should not disconnect Bluetooth SCO if it is started
externally
* When SCO has already started externally, all SCO connection attempts
through AudioManager API will fail with SCO_AUDIO_STATE_DISCONNECTED
intent
* Remove SCO_STATE_DEACTIVATE_EXT_REQ state since AudioService could no
longer disconnect SCO audio that is started externally
* Change SCO_STATE_* values so that they are consecutive

Bug: 79407565
Test: With Bluetooth HFP device connected:
Test1: make a outgoing call
Test2: make VoIP call during cellular call
Test3: make a VoIP call during another VoIP call

Change-Id: I1e0a10aeb0eac59d4826f9defa595aebd85f534c
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
89f979849a5cf2fa4e16d4f24ab41409f16a9956 03-May-2018 Jack He <siyuanh@google.com> Bluetooth: Fix HFP SCO logic and documentation

AudioService:
* Call setBtScoActiveDevice and setBluetoothScoOn both in AudioService's
broadcast receiver so that these two methods must be triggerred in
the same sequence as ACTIVE_DEVICE_CHANGED and AUDIO_STATE_CHANGED
intents are sent and we no longer need to handle race condition by
synchronously checking active device in setBluetoothScoOn
* Default sco audio mode when no headset is active should be virtual
voice call, as many HFP devices do not accept SCO audio without an
ongoing call
* Synchronize checkScoAudioState() method with mScoClients
* Add helper functions connectBluetoothScoHelper and
disconnectBluetoothScoHelper to call various SCO setup and tear down
methods based on sco audio mode
* Try raw, virtual call, and voice recognition mode when disconnecting
externally started SCO
* Add new sco state SCO_STATE_DEACTIVATING to allow back to back calling
of startBluetoothSco and stopBluetoothSco

Audio Manager:
* Modified AudioManager logic so that removed devices callback is called
before newly added devices

BluetoothHeadset:
* Modified BluetoothHeadset so that start and stop SCO using virtual
voice call no longer need a parameter and will use active device by
default
* Modified documentation around various sco mangement APIs to match
their expected behaviors

Bug: 76114959
Test: VoIP calls sanity test cases
Change-Id: Id50db88f4ff36069b0f392c81dd9d90c24cd2206
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
eb0ce47980dbee1dbcecaec88e57eb7b0e9e10f5 04-May-2018 Julia Reynolds <juliacr@google.com> Suppress the first volume adjustment

Of the default volume stream

Test: manual
Change-Id: I829cea7080243ba204723a24c24e9158e30c12f4
Fixes: 78562363
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f5a7a28932563a6c63c849d4cd0fb2dfe74bd8d8 28-Apr-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Log audio recording and dynamic policy registration history" into pi-dev
929801a95d7987053691cc659708f7aaddfe9c70 27-Apr-2018 Ajay Panicker <apanicke@google.com> Don't set Bluetooth volume when the Bluetooth stream changes

Don't restore the remembered volume whenever an Bluetooth A2DP stream
comes up or whenever Bluetooth AVRCP reports absolute volume support.
All Bluetooth volume memory will now be handled by Bluetooth.

Bug: 30602783
Test: See that AudioService doesn't try to change the volume when a
Bluetooth device connects.

Change-Id: I683062c1a0565591ae33cbbb0381730b86ad17c2
(cherry picked from commit 085ecc32a40d4cf578d6c4379ff1045430ec72b0)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
12a8676b0bc7aa418211fed0abe6c098e20fdd45 25-Apr-2018 Jean-Michel Trivi <jmtrivi@google.com> Log audio recording and dynamic policy registration history

Bug: 78248310
Test: adb shell dumpsys audio, check under "recording activity"
Change-Id: I5d25d4728b7dea717e257c1d9a8efae9b002b437
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f05e516f1d669d4e3369b09ad4f5d0c1df158904 20-Apr-2018 Jack He <siyuanh@google.com> AudioService: Add warning log when handleDeviceConnection failed

Bug: 78284878
Test: make, no functional change
Change-Id: I3c0b90afe8f345fa63812a1f91350baccb59516e
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c274fb2d22da480cd48100bbfd13e19a5c0d78aa 04-Apr-2018 Jakub Pawlowski <jpawlowski@google.com> Persist volume level on reconnections for Hearing Aid

Devices in mFullVolumeDevices have volume level reset to maximum value
in checkFixedVolumeDevices.

Bug: 69623109
Test: change Hearing Aid volume, restart phone, verify volume persisted
Change-Id: Iba134c0b3dc959c19c59f89c3d4ac02eed1e216f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
e05eef8449e5314c1bd0278b1484130c170a379a 09-Mar-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioService: prevent muting of alarm / accessibility

STREAM_ACCESSIBILITY / ALARM min volume is index 1

Prevent a11y stream volume to be 0 when used separately from
media.
Prevent setting a volume index above min value.

Bug: 72403580
Bug: 74985293
Test: verify media vol can go to 0 ; enable Talkback verify
a11y volume can't be muted with vol keys or UI

Change-Id: Id46506d4c407f42fe3aca463055b0973e1a7c4dc
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
aa614fafc7278542419d5e4ad911b5c5ff05f854 27-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add lock when adjusting suggested stream volume." into pi-dev
8fd5d5e8e4546dacb83c55d0e3142f3e3c70c1ad 23-Mar-2018 jiabin <jiabin@google.com> Add lock when adjusting suggested stream volume.

When adjusting suggested stream volume, we may set the stream type
according to mVolumeControlStream, which could be changed by other
thread. To avoid getting stream type -1, which cause crash when checking
stream type, add a lock request in adjustSuggestedStreamVolume.

Bug: 71333271
Test: Manually test
Change-Id: If98f50f4f2389818b7ac3b0f33bdc7e27f3ad3f8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
85e7716a14674468f7cc27d8c5f4da69b010335f 23-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Trigger ACTION_AUDIO_BECOMING_NOISY when Hearing Aid is disconnected" into pi-dev
cbb8cd77d5bc67f058c8008e62badd129e93781e 23-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Bluetooth: Enable in-band ringing in vibration mode (1/4)" into pi-dev
6dd78c1759e8b1bc95fbae2ffe87eaecad5a2041 13-Feb-2018 Jack He <siyuanh@google.com> Bluetooth: Enable in-band ringing in vibration mode (1/4)

* Add AudioSystem.FOR_VIBRATE_RINGING mode to match the native layer
AUDIO_POLICY_FORCE_FOR_VIBRATE_RINGING force mode
* Switch to this mode when Bluetooth SCO is connected
* Modify AudioService.muteRingerModeStreams() method to not mute ringer
volume when Bluetooth SCO is ON. Also, when ringer is unmuted, mirror
speaker ringtone volume on Bluetooth SCO ringer

Bug: 72647074
Test: Call phone in vibration mode and hear ringtone on HFP enabled
headset, verify that ringtone is only played through headset.
Then disconnect headset and call again to verify that ringtone
does not play through phone speaker in vibration mode.

Change-Id: I7d642020710c085f0e1f27c750c74b0e2fb57398
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
21b7f49c34a11fc494f5692227bd041a7d89c66c 22-Mar-2018 Jakub Pawlowski <jpawlowski@google.com> Hearing Aid: pass proper stream type to getStreamVolumeDB

Bug: 69623109
Test: Connect to Hearing Aid, make phone call, adjust volume to maximum
value.

Change-Id: Ib615d8dee11c48bf8d6e954b84a40ab7a3f3a4ba
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
26fac4147c2477b7bfeeb4b1ba62ac856278356c 22-Mar-2018 Jakub Pawlowski <jpawlowski@google.com> Trigger ACTION_AUDIO_BECOMING_NOISY when Hearing Aid is disconnected

Bug: 69623109
Test: connect to HA, stream music, power off HA, verify music stopped
Change-Id: I07af4776153bd6f5dc9ba8082e4b24f01d525969
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
5527286e08f9ba26ef49ad9019bd3968bdaa69af 20-Feb-2018 Mike Digman <digman@google.com> Add vol up + power ringer toggle gesture

It only runs when the screen is on.

Test: manual, invoking gesture with different system settings
Bug: 75252670
Change-Id: I934d0bbb0a9fffecf34ebaadf77f3e1241d4faf7
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
09592d52be352e9da8c744cd78b5b9c30b2cb0ca 19-Mar-2018 Jakub Pawlowski <jpawlowski@google.com> Set Hearing Aid volume after connection

Hearing Aid don't remember last volume level, they must be reminded what
the volume was right after connection.

Bug: 69623109
Test: connect Hearing Aid, play music
Change-Id: Ifa0bd31a49950a14837a6d1a26d5eb6a8ec554f5
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
09b6c21593bb40fb81008d066949c2ba04a00ea2 04-Jan-2018 Chris Kuiper <ckuiper@google.com> audioservice: add more properties for volume steps and default volumes

This adds logic to properly handle:

1) ro.config.alarm_vol_steps and ro.config.system_vol_steps properties to
overwrite the max stream volumes for STREAM_ALARM and STREAM_SYSTEM.

2) ro.config.alarm_vol_default and ro.config.system_vol_default properties to
overwrite the default volume levels used after FDR.

Bug: b/71605702
Test: build image that sets the new properties and verified proper usage.

Change-Id: I8f423456c006596d87addd7156bcef2503e45486
(cherry picked from commit 49eba612207c677fbae9f99265fe59bbd1e3d57c)
(cherry picked from commit 5c31b1f3853d4391aef573369f56d292a7ad3e10)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f9570f3fe556d8407c6e3334495d61655aee86a4 22-Feb-2018 Jakub Pawlowski <jpawlowski@google.com> AudioService: Hearing Aid output management

This patch makes Hearing Aid output active/inactive when the connection
state, reported from Bluetooth stack is changed.

Bug: 64038649
Test: mm
Change-Id: Iaeee39febab3c340a77e02afe3e0a573fb9736f9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
21fb09f9261a8437840cb24626c579d592d8b594 28-Feb-2018 jianzhou <jianzhou@codeaurora.org> frameworks/base: Fix AudioService JNI leaks

Root cause: AudioService keeps creating new instance of
ForceControlStreamClient and linkToDeath with the same
callback which leads to global reference table overflow
Fix: don't create new instance if call back doesn't change;
release old instance before create new one.

Test: Monkey or directed (see bug)
Bug: 74056493

Change-Id: I90641ae08c9abd522e2e75c6db934235c8b803e6
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4e532f59dc950583503d3385a75ad89e126b3ba2 07-Mar-2018 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService: don't send BECOMING_NOISY when dyn policy affects media" into pi-dev
7db2d8f1cc19238f3bf627b081462e3e062686df 06-Mar-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioService: don't send BECOMING_NOISY when dyn policy affects media

Only send ACTION_AUDIO_BECOMING_NOISY when there is no dynamic
policy registered that affects media.

Bug: 67610473
Test: see bug
Change-Id: I0768718fbde35ea53c36c309086529567dfa82ac
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d696476fb31a203db38c7c31c347b27c8fda84ef 16-Feb-2018 Beverly <beverlyt@google.com> System sounds get its own dnd toggle

- Added logic for streams to be muted by dnd (unassociated with ringer)

Test: runtest -x frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
Bug: 73362490
Change-Id: I1101e67282f7331497e91eb510d2bf4f1ea6b4b1
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
af576a0e4fa9c9fe06a185007d5f201d80e4ebd1 14-Feb-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicy: support for add/remove AudioMix without unregistering

System API for a registered AudioPolicy to attach or detach
AudioMix without having to unregister, and then registering
the new mix configuration.

Bug: 63906162
Test: AudioPolicyTest

Change-Id: Ib2fea8aa034d3f7b498e76dc1fc51c1ea508d3a2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
eaf5a4a15a8d52a68b762a721c593b4b0650feb8 27-Feb-2018 Ajay Panicker <apanicke@google.com> Merge "AudioManager: Use setAvrcpAbsoluteVolume in adjustStreamVolume" am: affa54f01c am: b351b63c2d
am: 5e87e7c983

Change-Id: I23070fd7f15e25ef2006bb43a5c8bd5dadec545f
e3946c89454994983701cbcfb863439f9393b6fe 27-Feb-2018 Ajay Panicker <apanicke@google.com> AudioManager: Use setAvrcpAbsoluteVolume in adjustStreamVolume

Use setAvrcpAbsoluteVolume() instead of adjustAvrcpAbsoluteVolume in
adjust stream volume in order to better sync device volume and remote
Bluetooth device volume. This will allow Bluetooth to avoid calculating
its own volume step size.

Bug: 68812037
Test: Connect to device that supports Absolute Volume and see that
volume changed occur when changing volume on device.

Change-Id: I26d5812ee1a5953b6527561ce5ad1c5d944c244d
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
13956ba9abbcf8093bbaa6de7a1ae099765b8b88 23-Feb-2018 Andre Eisenbach <eisenbach@google.com> Merge "Add AudioManager.setHearingAidDeviceConnectionState" am: c3e842fde8 am: 670ecc2279
am: 54f104e84c

Change-Id: I145b732008e979b7c9762e366620f9fd6c15a97f
10c906121b64e474cf53a3e44d8e97d2da4121dd 21-Feb-2018 Jakub Pawlowski <jpawlowski@google.com> Add AudioManager.setHearingAidDeviceConnectionState

This will be used by Bluetooth to notify audio framework when Hearing
Aid is connected or disconnected.

Bug: 69623109
Test: mm
Change-Id: I5664d8bd20e36601eea815c0d6e55c3b1d49e4ea
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
8b8bdddae977793b384aeb1e93281e6ced581c49 16-Feb-2018 John Muir <muirj@google.com> AudioService: Allow specification of the USB safe volume.

Previously the USB safe volume was hard coded to -37.0 (see
explanation in AudioService.java). This volume is used to
determine the volume index for a safe level. The USB index can be
much lower than the similar volume index defined by
config_safe_media_volume_index, even though both may meet the EN
60950 specification (according to the test engineer).

Add a configuration property that allows the OEM to change the
USB safe volume for their device. The new property's name is
config_safe_media_volume_usb_mB. The safe volume is stored in
millibel to avoid using floating point numbers in the
configuration xml.

Bug: 73351887
Test: Default safe volume remains at -37.0dB.
Overlay can be used to modify the safe volume.
Change-Id: I2a2ecfbc4277fddaf724f38aef7c531c71ee5c3b
(cherry picked from commit b4b2da50c942151830643aff14d394597812cb29)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3fca44a9ee623eba9d08fd8353bfdc585aa6ea9a 15-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "AudioService: fix deadlock"
085346acffb81159eb21f79a95d98f3200b8af1f 14-Feb-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioService: fix deadlock

Source of deadlock:
Thread A:
readAudioSettings()
-> checkAllAliasStreamVolumes()
-> synchronized (VolumeStreamState.class)
-> mStreamStates[streamType].setAllIndexes()
-> synchronized (mSettingsLock)
Thread B:
updateStreamVolumeAlias()
-> mStreamStates[ACCESSIBILITY].setAllIndexes()
-> synchronized (mSettingsLock)
-> synchronized (VolumeStreamState.class)

Fix:
Ensure all calls to VSS.setAllIndexes() are synchronized
on mSettingsLock then on VolumeStreamState.class.

Bug: 72122435
Test: see bug for repro
Change-Id: I16ad1d1df88256291c36d8f5b8ebe830fe1b0b84
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4c7dd5ea3322ea35bef87d2f6816bcc0227b5190 14-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "AudioService: Remove orientation tracking"
b668bc611fd6d82c456386365ff3544b92dd6c29 13-Feb-2018 Mikhail Naganov <mnaganov@google.com> AudioService: Remove orientation tracking

Orientation is superseded with rotation, which provides
more useful information from the audio system perspective.

The ro.audio.monitorOrientation property doesn't seem to be set
in configuration of any device. The "orientation" property
is not analyzed by any available audio HAL.

Bug: 73168241
Test: make
Change-Id: Ie9dd04ea69976708ec807b64380206a7d0bf4691
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1d3cdce9b0a707bb3339e16ca2f7b344a9ba52af 20-Jan-2018 Eric Laurent <elaurent@google.com> Add audioserver state callback

Add system APIs for components (e.g rild) to monitor native audioserver
state and be able to reaply states after a native audioserver
crash and restart.

Bug: 67317552
Test: manual test.

Change-Id: I2afba9da5fc32b3768ca5ca0d5f97cc68707c408
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
97cd562c9536de092343b08184d879a4474a10e6 09-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "AudioService: makes some members accessible by a derived class"
6affe93c35335cf538543234323e05e524cbb0b4 24-Jan-2018 Chinyue Chen <chinyue@google.com> AudioService: makes some members accessible by a derived class

This allows ArcAudioService to inherit from AudioService and access the
required members.

Bug: 69927742
Test: make checkbuild
Change-Id: I0c561671f3e281ae19a9a76a7280bd7ca1175bbc
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ad87a1ca6d2bcf6203708c0788354a109987f8df 06-Feb-2018 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService: vol event for ext volume controller on volume thread"
7ed7147d99bf218551d023e1b12eab46d812d554 03-Feb-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioService: vol event for ext volume controller on volume thread

When dispatching a volume event to an external volume controller,
do it on AudioService's volume handler thread, not on the
input thread.

Bug: 63906162
Test: none
Change-Id: I4eeddd84caf630dca91a819ca1b4fcecc49d0048
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
e2d8aae2ccc51340cf4846ce28f635b825711368 31-Jan-2018 Jean-Michel Trivi <jmtrivi@google.com> Synchronous audio focus behavior with external focus policy

This patch preserves the synchronous nature of audio focus requests,
even when an external focus policy is installed.
When focus is requested, the request is blocked on
the client-side, while AudioService informs the external
policy of the request, and until the ext policy responds
with the focus request result for this client, or
it times out.
The new AudioPolicy API is the call for the external policy
to send the focus request result.

Bug: 63906162
Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t 'com.google.android.gts.audio.AudioHostTest#testFocusPolicy'

Change-Id: I4671517f7f00eaaed8748bd4013b7d20be3085fb
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f0ca5890ecb4d19e2228049688ab3376a6cf716c 31-Jan-2018 Eric Laurent <elaurent@google.com> Merge "AudioService: clear binder identity before calling AudioSystem"
975f900f22fb1e3f47f1edabcd36be55831d671d 29-Jan-2018 Jean-Michel Trivi <jmtrivi@google.com> Merge "Add support for external volume handler of volume adjustements"
610aa9b416f8db782a54b1c1c4115ed350a08e69 28-Jan-2018 Jean-Michel Trivi <jmtrivi@google.com> Add support for external volume handler of volume adjustements

For devices that use the config_handleVolumeKeysInWindowManager
configuration, add API to receive volume key-related events
directly, without them being processed by the framework
(already not received by apps).

Bug: b/63906162
Test: set config_handleVolumeKeysInWindowManager, use
"adb shell dumpsys audio" to verify adjustVolume methods aren't
logged

Change-Id: I432b14fa9980764d69077b9f1b23b8c95f30814d
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
431af2d3f6d0df1e3889e5f845cd7c6feaebe2d3 29-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Alarms and Media visibly muted in PriorityOnly dnd"
66b6967d5a92da04d1e744301d885641f703f9b5 27-Jan-2018 Eric Laurent <elaurent@google.com> AudioService: clear binder identity before calling AudioSystem

clear binder identity before calling AudioSystem methods reserved
for AudioService.

Bug: 72278478
Test: audio smoke test, CTS tests for AudioRecord and AudioTrack.
Change-Id: Ia8b934fdc39c70c9d359bd1cf02b2b3d917eec75
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
925cde8f745c4cf946d0e215d306d2b134ca44de 23-Jan-2018 Beverly <beverlyt@google.com> Alarms and Media visibly muted in PriorityOnly dnd

- if alarms and/or media cannot pass dnd and the phone is currently
in priority only dnd, then the alarm and/or media volume stream
will appear muted in the volume dialog and sound settings
(Settings > Sound)
- if all behavior for priority only dnd is not allowed to bypass dnd
(discluding alarms and media), then ringer is muted when priority-only
dnd mode is on. If a user clicks this ringer in the volume dialog, then
dnd ends
- Updated default zen config to version 3 (added alarms and media)
Test: manually toggle alarms + media in Settings > Sound > DND >
Behavior, toggle on/off dnd and then look at volume dialog and
volume bars in Settings > Sound
Test: runtest --path cts/tests/tests/media/src/android/media/cts/AudioManagerTest.java
Fixes: 72052742

Change-Id: Ia9e809ec2be93cb5a9ba6518dce04bf3ce45110b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c31033f43c85a07ebc6045c9b5af5408d0b306e9 15-Jan-2018 Jaekyun Seok <jaekyun@google.com> Read media files from /product/media/audio

Bug: 64195575
Test: tested reading media files from /product/media/audio after moving
files from /system/media/audio to /product/media/audio

Change-Id: Ic690965e2b5f0e237d21df1db0fd0354a76d7c90
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c4d2827c9686fafc9012f6362862b4c56f37101b 24-Jan-2018 Andy Hung <hunga@google.com> Merge "AudioSystem: Inform AudioFlinger of total memory"
a314014c450f421c0e8b317a67988306f5b29c1c 24-Jan-2018 Jack He <siyuanh@google.com> Merge "BT-HFP: Update Bluetooth headset state handler to Multi-HFP" am: 0aafefb113 am: a8505da2a6
am: 82a6cf1597

Change-Id: Ibb358a8270867752ce834429f914db21ec1c4c7d
8dd33941a455bab025beaa549b78c094e81226e2 18-Jan-2018 Jack He <siyuanh@google.com> BT-HFP: Update Bluetooth headset state handler to Multi-HFP

* When multiple headset devices are connected at the same time, at most one
device can be used for SCO audio at any time. This device is called
Active Device and is indicated by either
BluetoothHeadset.getActiveDevice() or
BluetoothHeadset.ACTIVE_DEVICE_CHANGED intent. It can also be set
through BluetoothHeadset.setActiveDevice(BluetoothDevice) internal API.
* This change let AudioService to listen to ACTIVE_DEVICE_CHANGED intent
instead of CONNECTION_STATE_CHANGED intent since it is the active
device that AudioService cares about, not the list of connected
devices.
* Everytime a new active device is set, AudioService will treat the old
one (if not null) as disconnected and call disconnection methods in
audio framework and the new active device is regarded as newly
connected and connection methods will be called by AudioService.
* When disconnectHeadset() is called, active device will be set to null

Bug: 71875419
Test: compile, connect multiple HFP devices and switch active device
among them
Change-Id: I148cca079d36a2dfc6a46b8d42ba69821c9c6de3
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7958358ddb34cebe4fdf99fef8d613c0c74ff17a 23-Jan-2018 Andy Hung <hunga@google.com> AudioSystem: Inform AudioFlinger of total memory

To better allocate per-client memory blocks.

Test: Debug logging
Bug: 64161002
Change-Id: I389bdea250a74322fab616f1009f51c6c73aef07
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
9228af6bc20c27b9949df36684f9c06ca9cdb27d 06-Jan-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioFocusRequest: add ability to force ducking for a11y

New API to specify an accessbility service wants to force ducking
in its focus request, regardless of the framework's evaluation
of whether or not it should duck the other players.
Use of this API is restricted to requests coming from services
bound to the A11y service, or root

Bug: 62194333
Test: play a podcast in GPM and "adb shell claf --gain 3 --usage 11 --forceDuck"

Change-Id: I85f26afa14fe233a3b870f86c9084613203494b8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
be4fb893a01e6e798e4be23666835424fb56b785 20-Jan-2018 Pavlin Radoslavov <pavlin@google.com> Multi-A2DP support - add a new internal API to suppress Audio Noisy intent

The new API setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent()
is similar to the existing setBluetoothA2dpDeviceConnectionState()
except that it takes one extra argument that indicates whether the
AudioManager.ACTION_AUDIO_BECOMING_NOISY intent will be sent:

setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
..., boolean suppressNoisyIntent)

This API is needed so the Active A2DP Sink device can be changed
while audio is streaming, and the audio continues playing on the new
Active Device.

Bug: 69269748
Test: Manual: multiple connected A2DP devices, and selecting each as
the Active Device.

Change-Id: I75766a58d9e6b42b3ce68bd9ad3a7a72ca5a1023
(cherry picked from commit 82e06463f2571a06286f9da0bf3ad5a0e58461a2)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
51a9a31ba58171c147b4c0c16c6acd54a97a5f65 20-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Multi-A2DP support - add a new internal API to suppress Audio Noisy intent"
82e06463f2571a06286f9da0bf3ad5a0e58461a2 20-Jan-2018 Pavlin Radoslavov <pavlin@google.com> Multi-A2DP support - add a new internal API to suppress Audio Noisy intent

The new API setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent()
is similar to the existing setBluetoothA2dpDeviceConnectionState()
except that it takes one extra argument that indicates whether the
AudioManager.ACTION_AUDIO_BECOMING_NOISY intent will be sent:

setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
..., boolean suppressNoisyIntent)

This API is needed so the Active A2DP Sink device can be changed
while audio is streaming, and the audio continues playing on the new
Active Device.

Bug: 69269748
Test: Manual: multiple connected A2DP devices, and selecting each as
the Active Device.

Change-Id: I75766a58d9e6b42b3ce68bd9ad3a7a72ca5a1023
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
5aff4813b0c5ef26d9b26624023b835092380336 20-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "AudioService: fix deadlock between readSettings() and VSS.setAllIndexes()"
4d7cc1a35a4803e0d7e1288968a8f352905199c4 19-Jan-2018 Nadav Bar <nadavbar@google.com> Merge "Enable phone apps to mute the VOICE_CALL stream"
ad37c2c40695793159df87aaf159f404105869c6 19-Jan-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioService: fix deadlock between readSettings() and VSS.setAllIndexes()

Locking order is mSettingsLock -> VolumeStreamState.class
Missing sync on mSettingsLock was causing deadlock between
VolumeStreamState.setAllIndexes() and readSettings().
Mark that setAllIndexesToMax() is properly sync'd on mSettingsLock.

Bug: 72122435
Test: chance
Change-Id: I4bd4037fec290dd6ba586c7090e1b377543041ab
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
6b7751d2b587f33d5f1bb19a4173456d51753c6f 24-Dec-2017 Nadav Bar <nadavbar@google.com> Enable phone apps to mute the VOICE_CALL stream

This change adds support for priveliged apps with the MODIFY_PHONE_STATE
permission to mute the voice call stream using the adjustStreamVolume method.
The change adds specific handling for VOICE_CALL as a mutable stream.

Bug: 71017199
Fixes: 7107199
Test: Tested manually
Change-Id: Ic6d0466992dcea4f37899eac80a0102c992bdd72
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7be17d26e0ba3167c55420e33817be74a6099dcb 22-Dec-2017 Jean-Michel Trivi <jmtrivi@google.com> New intent for microphone mute change notification

AudioManager: define ACTION_MICROPHONE_MUTE_CHANGED.
AudioService:
- broadcast intent when setMicrophoneMute() is called
with FLAG_RECEIVER_REGISTERED_ONLY.
- remove outdated (invalid) comments.

Bug: 70857126
Test: m -j ; make -j offline-sdk-docs ; make -j cts ; \
cts-tradefed run cts-dev -m CtsMediaTestCases -t android.media.cts.AudioManagerTest#testMicrophoneMuteIntent

Change-Id: I7391522f0195d06592e4f853e9b672fdec66d37a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
82b43303ee0a41b1e132e6077e630d0ffa3ca343 21-Dec-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioManager: add method to query stream attenuations in dB"
8e7aca38192f749b6e5fa44328d4827b4816cef5 29-Nov-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioManager: add method to query stream attenuations in dB

AudioManager: new methods in SDK for querying:
- the minimum volume index
- the volume in dB for a given index on a given device type

Bug: 64844598
Test: cts-tradefed run cts-dev -m CtsMediaTestCases -t android.media.cts.AudioManagerTest
Change-Id: Iac999e7676643272820a4f1f4a32cf3a781ab7cd
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
da1af765bb4fb5528acfeb6327ac5d2a45c7c07d 16-Dec-2017 Eric Laurent <elaurent@google.com> AudioService: fix isInCommunication()

Consider we are in call also when audio mode is MODE_IN_CALL.
This removes race conditions occuring when there is a delay between
audio mode being set to MODE_IN_CALL and the actual call state updated
in TelecomManager.

Bug: 70690373
Test: test DTMF level at various call volume on earpiece, speaker, USB
headset

Change-Id: I5e905a36e825211b6d780a285fc7b47cea3edf2b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
477982915abc666bc5fd5aae05cbb011c6b41124 30-Nov-2017 Zak Cohen <zakcohen@google.com> Make single volume devices more robust to ringer mode changes.

In single volume mode:
Make getNewRingerMode always return the existing one, as setRingerMode
does nothing when in single volume mode.
Check ringer mode change respects single volume mode.

Bug: 69814628
Test: flash to single volume mode device
Change-Id: I66ef173c97118fe471dec462d7a82ad2e62064b0
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d9e96e247bdf07caebfa39fbb64aaebc885d26e8 07-Nov-2017 Julia Reynolds <juliacr@google.com> Switch default stream from RING to MUSIC.

When changing volume.

Test: manual, cts
Bug: 63096355
Change-Id: I77296f91c58b1e5f0169fc1699e27b80b391408a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
8719a1d274aecc92f56ef8efc7541dec99ad9143 06-Nov-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: fix synchronization for camera sound enforcement

Synchronize read/write of non-final variable mCameraSoundForced
on mSettingsLock, and annotate accordingly.
The method updateRingerModeAffectedStreams() was synchronized
on mSettingsLock, except in setRingerModeDelegate().

Test: see bug
Bug: 63388421
Change-Id: Iee8f3c31fdb4bf93b08e7f0217c1d85d80cc9180
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
77ee4f2ff20ed2898e411b9337f3e183c3a855c7 04-Oct-2017 Eric Laurent <elaurent@google.com> Merge "Fix Cell broadcast sound in total silence" into oc-mr1-dev
0f6e9b5a79ffd82c3276b5e3e7723280884ddb5d 03-Oct-2017 Eric Laurent <elaurent@google.com> Merge "AudioService: do not unmute media on headset plug in total silence mode" into oc-mr1-dev
e5a351cb9213b59026efd602011a4d9e99c85649 28-Sep-2017 Eric Laurent <elaurent@google.com> Fix Cell broadcast sound in total silence

PlayerBase:
Update player volume when the audio attributes are updated in case
we need to unmute
PlaybackActivityMonitor:
Unmute alarm stream if needed when an alarm with flag
FLAG_BYPASS_INTERRUPTION_POLICY starts from an app with
privileged permission MODIFY_PHONE_STATE.

Bug: 63617557
Test: check sound with cell broadcast in total silence
Change-Id: Ifacb1d96a2d8d44047d9f9642d1e672fcf756cda
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
6afa65008d54ae790a0502fb6f4a08d9c92b5f2c 29-Sep-2017 Eric Laurent <elaurent@google.com> AudioService: more logs for audio mode changes

Added more logs to audio mode changes to track both the requested mode
and the actually selected mode.

Bug: 65513486
Test: Verify logs after various voice and VoIP scenarii
Change-Id: I486f091803ef7776ff325db908e8e462852ea3c1
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7fb83d920856884bf801d7d7c0c9755fde69cfbb 28-Sep-2017 Eric Laurent <elaurent@google.com> AudioService: do not unmute media on headset plug in total silence mode

Fix regression introduced by fix for issue 30440012.

Bug: 66893057
Test: play a video on Chrome in DnD total silence and plug a wired
headset

Change-Id: Iee11f06edda0749a15021a4682467c14289677c3
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1d1884405bf186828c46cba7581cd0d8963e8eb8 09-May-2017 Sharad Sangle <assangle@codeaurora.org> AudioService: Don't honour SCO ON request if SCO is not connected

Usecase:
1. Pair and connect BT headset supporting HFP.
2. Make VOIP calls using application that calls
setBluetoothScoOn(true) before SCO is actually connected.

Failure:
No audio / ANR are observed on connecting and disconnecting BT headset
during VOIP call.

Rootcause:
On BT connection during VOIP call, app is calling startBluetoothSco()
to setup BT SCO connection. Even before remote BT device SCO connection
establishment(which is taking around 4 secs in issue case), VOIP app
is calling force SCO routing using setBluetoothScoOn() API. This will
result audio modules to force route VOIP call to BT SCO, which results
audio failure/side effects as BT driver return failures. As SCO routing
retry continues several iterations (because of connection delays), this
results ADSP render buffer full followed by improper behavior.

Fix:
Check if SCO connection is establisted before honouring the
setBluetoothScoOn request, if SCO is not connected then
do not process SCO connection.
Only modify internal state when calls to setBluetoothScoOn() are from
system component
Inform audio HAL of SCO audio state via setParameters.

Test: 1. Pair and connect BT headset supporting HFP
2. Make VOIP calls using application that calls
setBluetoothScoOn(true) before SCO is actually connected.

Bug: 62051216
Bug: 63740200
Change-Id: Iab8e83613e21831abf5502a0268b1c4f89d6bba5
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
0e5deb3967398834c9d2321b31d3c56b380e98b5 02-Sep-2017 Eric Laurent <elaurent@google.com> AudioService: reduce EU volume warning thresdhold for USB headsets

Take into account additional gain due to simultaneous application of
EQ and bass boost by substracting 7dB from current warning message threshold.

Bug: 65225835
Test: check warning displayed when playing over USB headset after boot when
no SIM is present

Change-Id: I1bfcbf571d72122f4df6ff5e40be227c42d555e3
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d9d208a6d471228b6aea205600d5c429e3d19b6f 01-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix issue #63971747: Audio is not heard first time when played after a long pause" into oc-mr1-dev
3e3600e068b167f98ade98dae842c35843290681 31-Aug-2017 Dianne Hackborn <hackbod@google.com> Fix issue #63971747: Audio is not heard first time when played after a long pause

Audio banning is broken due to a race it has with the app. See
comment in the change for more details.

Test: manual
Bug: 63971747
Change-Id: I2a384a5b96c95ebf7e9476392fdc5a2d4f623061
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3120059d5bdc52fb5ef2c90d9662562e92cd4df9 28-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: log changes in OP_PLAY_AUDIO

Log changes to AppOpsManager.OP_PLAY_AUDIO in live player

Test: "adb shell dumpsys audio" after entering silence mode
Bug: 62258749
Bug: 64286665
Change-Id: Ia1c202c5b8b25e14f7c2e85060a256dc69433909
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
cf17036a21f0a2d83c22d0b24162422a77ff7564 25-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: log volume commands and origin

Add volume logger for volume events.
Move AudioService event definitions to separate file.

Test: change volume with volume buttons and dumpsys audio
Bug: 64470715

Change-Id: I25db849bffb4a41a737d226cfc40e2c6f7e0ecc0
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
011f39e7c7a16424260310fb9f580c727b72e8d8 20-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio event logging

New class AudioEventLogger to store a configurable number of the
last audio events. It hosts a circular buffer of lightweight
event objects, an abstract class whose implementations are
event-specific, and does the heavier string manipulations
at the time of the dump, not during normal operation.
Add logging for:
- phone state (a.k.a. audio mode) changes
- wired device connections
- playback activity monitor
- force use

Test: adb shell dumpsys audio
Bug: 64470715
Change-Id: I8dbd936e2ffec39134f1a8837191c74f5cb9fc56
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c164123cc3ca7a80e4466b46ff3526f6159f5016 16-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: device connection intent: never send null action
am: 87a264dfde

Change-Id: I1fd6f458bdc4a66a9d2a65d6f7d1bbdcf93b270a
87a264dfdeef1c638095bde254ac6659e440172e 16-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: device connection intent: never send null action

Change 145c95342c9c removed a test on the type of device for which
a ACTION_HEADSET_PLUG intent is broadcast. As a result, for some
devices (e.g. DEVICE_OUT_USB_DEVICE), there is a code path in
AudioService.sendDeviceConnectionIntent() where the intent's
action is not set, causing a WTF exception to be thrown for
the broadcast.
The fix consists in always checking that the intent will be sent
with a non-null action.

Test: connect a USB device recognized as DEVICE_OUT_USB_DEVICE
Bug: 64724117
Change-Id: Ib2a486d1fabbde58d6a8f8370d5803c694977ee1
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
e3d77e91ac73965d0099a7b4379cf108928c639d 15-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "Fix logic for Intent.ACTION_HEADSET_PLUG for USB headsets" into oc-dr1-dev
am: 21f3489653

Change-Id: I3352c141d9fe8b940e9d222c043a39376244b1cb
87d31ecdff739b423c99eeb0c860c743a5874a73 12-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> Fix logic for Intent.ACTION_HEADSET_PLUG for USB headsets

In the broadcast of Intent.ACTION_HEADSET_PLUG:
- restore setting "microphone" to 0 for line and headphone as
the input bit is never set for those devices
- for USB_HEADSET: there is no input bit for this device, so:
* when observing change for DEVICE_OUT, check status of DEVICE_IN
* when observing change for DEVICE_IN, only send the intent
if DEVICE_OUT is available.

Test: test broadcast and extras for Intent.ACTION_HEADSET_PLUG
Bug: 64250808
Change-Id: I0913933d03e21189bb552f60ae5dd35ffe28ddca
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
bca04acac57383df5d4a444028a21f028896eacd 10-Aug-2017 Paul Mclean <pmclean@google.com> Merge "Update isWiredHeadsetOn() to support USB headsets." into oc-dr1-dev
am: 75384f617d

Change-Id: I693a3cf37c55085eee470091edf5fff0bc62ece8
145c95342c9c976551156221e4185df7d1478866 04-Aug-2017 Paul McLean <pmclean@google.com> Update isWiredHeadsetOn() to support USB headsets.

Bug: 64250808
Test: Manual from an App (UsbDescriptors app)
Change-Id: Ic979636025e871d69853a7460befce4e1b1a6ed8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1e52eafae1298b2dc94de1a5fef6fcad0904cf45 12-Jul-2017 Eric Laurent <elaurent@google.com> Merge "audioservice: modify default music volume" into oc-dr1-dev am: b6f946c081
am: aebf79edb4

Change-Id: I9e5ee08c8320799dd53e604005c4be57142832fb
b6f946c081774152bcb5e2eac29051b0dc7a55f2 12-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "audioservice: modify default music volume" into oc-dr1-dev
a87f1941196f3b0d7b2a0ad3b76c5fd4d2c356e2 12-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ensure stream type valid in AudioService.isStreamMute"
b82e0abdc439f66d7dc596a8bf35268954a9ac76 12-Jul-2017 Eric Laurent <elaurent@google.com> Merge "audioservice: fix media volume reset at boot" into oc-dr1-dev am: 09a93b9739
am: 5dbd36d6c2

Change-Id: Id3cffa56e203092a720f2ec34a6304880b83020a
b378a13a2fe3a7a35f014f70ace611e5cae03d0e 11-Jul-2017 Eric Laurent <elaurent@google.com> audioservice: fix media volume reset at boot

mSafeUsbMediaVolumeIndex must be initialized after createStreamStates()
because it relies on audio policy having correct ranges for volum indexes.

Also change the safe volume threshold for USB headset from -15dBFs to
-30dBFs to account for max EQ gain.

Bug: 63462140
Bug: 63388412
Test: Verify USB headset media volume is unchanged after reboot
when no SIM is present.

Change-Id: I5252d97e3f3dcde7568681abb066752ef0d936d2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
403bd3429bff82e4926694d0c02d08bf4a6ca277 12-Jul-2017 Eric Laurent <elaurent@google.com> audioservice: modify default music volume

Default music volume is changed from 3/4 of max to 1/3 of max to
reduce initial volume over headphones percieved as too agressive.

Also add a property ro.config.media_vol_default to modify this
default value.

Bug: 62608451
Test: verify default music volume over headphones after factory reset.
Change-Id: Icadb99e1bafe88984d3a3a05014d4d4648830693
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
93d32ef11c34aef44f0c6ce16350cef1759ba769 11-Jul-2017 jiabin <jiabin@google.com> Ensure stream type valid in AudioService.isStreamMute

Bug: 37950108
Test: Test with the code in the bug on marlin.
Change-Id: If577c3d19ddbf1aff87dbf832af1a3ebbc7e5494
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3e99f654fbf56d3b7ef7130658b8ef83d2d0cdbd 06-Jul-2017 Dianne Hackborn <hackbod@google.com> Fix issue #34471029: Don't allow audio use from background apps.

This is becoming a common pattern (keeping track of which processes
are cached and not allowing them to do stuff in that state), so I
am turning this in to a general mechanism for monitoring this state
through the activity manager's IUidObserver. Now we can just have
AudoService implement its own IUidObserver to get this state and
update which uids it is blocking.

This required making some changes to uid change reports so that
the integer is now a bit mask instead of an enumerations, but that
is what it was already turning in to anyway. (This gets rid of
the crazy GONE_IDLE constant that we'd needed to add before because
it wasn't a bit mask).

Eventually the power manager should be changed to be told about
these changes to cached state instead of listening to every proc
state change, but we'll do that later, it is more disruption than
I want to take for now. However, while working on this, I noticed
that the power manager had regressed in the cached uids it would
actually block, because the activity manager was no longer telling
it about all uids that are idle. (I think this happened when I had
to change the default idle state of UidRecord to true.) So I am
adding a bit of new code to keep track of what idle state we last
reported to observers, to make sure we tell it about newly created
uids that are idle but have never actually become active.

Test: runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services

Change-Id: I7bfd46bacadd4cab2a69f40e6e52afb4e67b456a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b7772521395d080a4e3e055fc3397460d324d26e 28-Jun-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService: internal API for disabling audio playback for a UID" into oc-dr1-dev am: 8f81919093
am: 051285b648

Change-Id: Ib78281b6bc1b4ae37e0aba5e6a0b20cd81a29db2
92ed7bf41235c95b2c71648a631ce7aaa65f8943 27-Jun-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: internal API for disabling audio playback for a UID

Internal API, available through AudioManagerInternal, to flag
a UID as having lost the ability to play audio. When that
happens, all players associated with this UID are paused, and
future players are immediately paused when they report they
started.
Users of this API must "enable" a previously banned UID when
it is no longer in use.

Test: upcoming manual test with background apps
Bug: 34471029
Change-Id: Ic1c103aabe8f3897072b3ce938d84cb949540e23
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
66ffacf42a7dde6fac867605aaa47d555b960ee4 05-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Recording activity notification: client uid and package name

Add support for a system component to listen to recording activity
and know the uid and package name of the client app performing
the recording. This information is discarded for non-system
listeners on the server side.
Add log friendly dump for RecordActivityMonitor, AudioFormat and
audio source to dump recording activity in AudioService.

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest#testAudioManagerGetActiveRecordConfigurations
Test: during recording, run "adb shell dumpsys audio", check output under RecordActivityMonitor
Bug 62579636

Change-Id: I60a223da3a2b7f7080bd7346fe3edc1df039466a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
eab40d14a88574e4041504a68012c95a4a8f03c9 09-Jun-2017 Eric Laurent <elaurent@google.com> AudioService: implement safe volume warning for USB Headsets

Also fix MediaRoute update for USB devices

Bug: 62492975
Test: check warning with USB headset and property audio.safemedia.force.

Change-Id: If947beaf81b74b1e560402648042047cb23f1df6
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
949865b8a54b3e1d9000affbdc9444527f20cca0 25-May-2017 Yue Li <yuegoogle@google.com> Make sendVolumeUpdate method and VolumeAlias visible to ArcAudioService

- change mStreamVolumeAlias from private to protected
ArcAudioService will use it to revert rescaled volume
- change sendVolumeUpdate method from private to protected
ArcAudioService will override it to send request to the Host

Bug: 36129286
Test: Make such changes will allow ArcAudioService to successfully
handle volume update requests.

Change-Id: I1e294d20187c6aa6d158a981814aa9b9a87a336c
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4724ea7ef7bfe698cace7213772f866349bcc676 23-May-2017 Eric Laurent <elaurent@google.com> audio service: fix rapid succession of A2DP devices connections

commit dae476f7330 introduced a potential problem when a different BT A2DP
device is connected just after disconnecting one.

Bug: 37499793
Test: check connection to new BT A2DP device when one is already connected.
Change-Id: I8055844822fcc1640cca67fab2cba629c93f7cfa
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
bbe3e74457e7abeef4156380178ad1793ffe8c0e 29-Apr-2017 Eric Laurent <elaurent@google.com> AudioService: send AUDIO_BECOMING_NOISY intent when disconnecting USB

Bug: 37752052
Test: Verify music stops when removing USB headset
Change-Id: I6efd9e0532ea0569cfcab941a93e32395845201f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
cdae476f7330375e2f6a653a84082b9fc49280f8 29-Apr-2017 Eric Laurent <elaurent@google.com> AudioService: more AUDIO_BECOMING_NOISY intent fixes

Fix more race conditions
Ignore condition on removed device being actually used for
music when in call.

Bug: 37687852
Test: Verify AUDIO_BECOMING_NOISY intent is sent in more corner cases
Change-Id: I024aa3a4a68d84ac620289720caf3a32fb2985b1
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
5205a35f7805aec1285e1a17a8e6dcb0e49f7e33 28-Apr-2017 Eric Laurent <elaurent@google.com> AudioService: fix missing AUDIO_BECOMING_NOISY intent

If Bluetooth service calls onBluetoothA2dpDeviceConfigChange() before
setBluetoothA2dpDeviceConnectionState(), there is a chance that the
first method fails leaving the A2DP device state disconnected in audio
policy manager while it appears as connected in AudioService causing a
failure to send the AUDIO_BECOMING_NOISY intent.

Bug: 37687852
Test: Verify AUDIO_BECOMING_NOISY intent is sent even if race
condition occurs.

Change-Id: I014d145e7da5e7d267991ffb2ff50626e71247eb
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1ab43f6b03b8540b7867311a41d98e18ef033352 28-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: unmute media on connection of new audio accessory

When plugging in a new audio device:
- if the device is considered an external accessory
- and media volume is muted
- and the media volume is non-zero for this device
- and it is used for media playback
then unmute STREAM_MUSIC.
Log when AVRCP absolute volume is supported.

Test: mute media volume with icon, insert headset then play music, music should not be muted
Bug: 30440012

Change-Id: I102f26c435fa5cbd1e1bc4c14f51629d3cc51fb3
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c4a169cfb452ac4e8c7fb4ac153f66892ee0b16e 26-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "Audio focus enforcement: duck automatically apps for SDK O+" into oc-dev
461922fcfc8572415aa39c43c06afce685bd998d 26-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus enforcement: duck automatically apps for SDK O+

Enforce automatic ducking only for apps written for an SDK target
level above 25 (N-MR1)

Test: play notification while Podcast Addict is playing, verify it pauses instead of being ducked
Bug: 37506138
Change-Id: Id7e01a92a51308bd7a3f24abc417d2434b532c12
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
efb859f2af21bcc4844274663ce4bf6eddc09c57 25-Apr-2017 Phil Weaver <pweaver@google.com> Merge "Allow a11y listeners to specify handlers" into oc-dev
910311b35603a9132d8b986806ca13499d60240f 21-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "audio service: simplify becoming noisy intent logic" into oc-dev
26d709fdfa473f1722b1ee08562262cb4cfeaaac 21-Apr-2017 Phil Weaver <pweaver@google.com> Allow a11y listeners to specify handlers

This follows recommended practice for listeners, and also
allows ViewRootImpl to register for callbacks on its own
handler, which can prevent crashes in apps that have
different threads managing the UI at different times (for
example the system process).

Bug: 37542371
Test: Adding CTS tests for new APIs. A11y CTS still passes.
Change-Id: I65db025275e153c20b20567346246d5bc13bf418
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4cab9308fc73967f8085325b237d30978a7ba6da 31-Mar-2017 Phil Weaver <pweaver@google.com> Hide API to listen to a11y service state

Hiding and adding the requested return value, so if we
later decide to unhide it we'll be up to snuff for API
review.

Bug: 35764675
Test: Verified that the two features that listen, a11y
volume and the accessibility button on the nav bar, work
properly. Also ran accessibility CTS.
Merged-In: I47b62f2b4fd1ea4a7e697d20a3bb2c3201f6bcce
Change-Id: I4df6164772eb01b4f988c201f46c788eb7124511
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
9a5b262330191ada5a9724f58272a82e97ad4ccd 19-Apr-2017 Eric Laurent <elaurent@google.com> audio service: simplify becoming noisy intent logic

Simplify and fix the logic deciding if AudioManager.ACTION_AUDIO_BECOMING_NOISY
intent should be broadcast when a device is disconnected.

Bug: 37308922
Test: verify music stops when disconnecting a wired or BT A2DP headset
and it is the only device connected.
Verify music doesn't stop when disconnecting a wired or BT A2DP headset
and they are both connected.

Change-Id: Iba5885697d37a2f3d23dfc013623e2fbec173998
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
031cf1458244682ccb9192fb7f4a2f9a90de053b 18-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "Vol key presses: active stream has priority of set control stream" into oc-dev
a7880d4bb7784c1b72def92a6b7a7aaf489b3971 15-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Vol key presses: active stream has priority of set control stream

When deciding which volume stream is to be controlled by key
presses, give priority to the stream that is actually playing,
unless the user has selected a another volume to be controlled
by the key presses.

Test: play some music over headset, pause, go to home screen.
Press vol up, it changes ringer volume, immediately press play
and press vol up again, it should now change music volume
(and UI updates to indicate that).
Bug: 33355229

Change-Id: Ibad9b59a692e1c6375487b739c55fdbf07f107dd
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
170a0ee064580379b9810708615161af529323c1 15-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: fix updating of stream alias for A11y

VolumeStreamState.setAllIndexes():
- don't do anything if the target and source VSS have the same
stream type,
- javadoc of (old+new) behavior.
When STREAM_ACCESSIBILITY becomes independent of any other stream,
read the settings to restore the volumes previously set.

Test: see bug
Bug: 36286803
Change-Id: I2afcff3a93cc81f3958af252986ef1ac9c38899e
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
a53b7051a2d2d2ff9bddba0a12d2e8dcd0d5c620 13-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Fix A11y volume persisting/restore

When the accessibility volume is enabled, its value wasn't persisted
when changed because it was still using the persisting name from
its alias (music).
When enabled, notiify the volume controller that a11y volume has
changed so the UI also reflects the new value, now updated from
the persisted settings.
Do not persist volumes for streams that don't have a setting name.

Test: enable Talkback, set a11y volume at a different level than media \
then disable Talkback. Reboot and enable Talkback, verify a11y is \
restored.
Bug: 36286073

Change-Id: Ic6c30364e164b856fc10fbf6b22c09a7b5561be1
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4d52ae97070d91ed61c383aec17cf6bcf17767b0 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Audio focus: API for external audio focus policy" into oc-dev
126cf03f7c8e825a23e47dd133e77eb1b3b7633d 03-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus: API for external audio focus policy

System API for an external audio focus policy. Extends
the system focus listener with interception of
focus requests and abandons. Adds method for the focus
policy to dispatch focus grants and losses.

Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t 'com.google.android.gts.audio.AudioHostTest#testFocusPolicy'
Bug: 30258418
Change-Id: If408569a2dce07a774e0e2f1be9f1af8e426d2d3
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
fe9a53bc45fd0124a876dc0a49680aaf86641d3e 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking.

This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
668c34444d13b67949836baa4eac560afcc527c5 28-Mar-2017 Phil Weaver <pweaver@google.com> Merge "Fix permission checking for a11y volume."
f1a9aff96261a40d16c36dd3d47a8190c308d744 24-Mar-2017 Phil Weaver <pweaver@google.com> Fix permission checking for a11y volume.

Adding new permission for changing accessibility volume
to allow system UI to change it. Also providing audio
manager with a whitelist of bound accessibility service
uids so it can allow servics to change the volume.

Bug: 36569297
Test: Adding CTS test in linked CL.
Change-Id: I4f327e3a251fc3780c5957f41217c2ef5bb8b16e
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
92dea33bfebed04533264b06e036d04cc16b9608 02-Feb-2017 Jaewan Kim <jaewan@google.com> Simplify the media button handling logic

Here's the new media handling logic.

1. If the foreground app consumes the media key event
(Activity.onKeyDown/Up() or Activity.setMediaController()),
we stop here.
2. Find the media app whose AudioPlaybackConfiguration becomes
PLAYER_STATE_STARTED lastly across the boot. The media app is the app
with the media session.
- If its session is still alive, send the media key event
to the media session.
- If its session has been released but the session set the media
button receiver, send the media key event through the media button
receiver.
- If it has multiple media sessions, pick the media session whose
PlaybackState matches with the AudioPlaybackConfiguration's player
state.
3. Stop here. Don't try revive any other app.

This approach has two limitations.
1. If an app has multiple AudioPlaybackConfigurations and/or
media sessions, the MediaSessionService may pick the wrong media
session to send media key events.
2. If an app with a media session plays sound effects differently from
the SoundPool class, the MediaSessionService would consider the app
as the lastly played media app.

Bug: 33032080
Test: Manual tests as follows
1. Checked that the lastly played app receives the media key events
although the app's media session doesn't report its playback state.
2. Checked that the lastly played app receives the media key events
although the app's media session is released.
3. Checked that the lastly played app doesn't receive the media key
events if its playback is remote.
Change-Id: I1fd6f9eee0750da4dea9fcc7401fdb1c3f249a72
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ab2d9315d169a7129c5d1284e91393edd32650bd 13-Mar-2017 Jean-Michel Trivi <jmtrivi@google.com> Permission enforcement for A11y volume changes

Make modifying the STREAM_ACCESSIBILITY volume conditional
to have the BIND_ACCESSIBILITY_SERVICE permission.
Add BIND_ACCESSIBILITY_SERVICE permission to sysUI.

Test: cts-tradefed run cts -m CtsMediaTestCases -t android.media.cts.AudioManagerTest#testAccessibilityVolume
Bug: 34379420
Bug: 30448020
Change-Id: I9f26affccd953bd8473d06822857edf92fef4ba8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7af9a7443162d78ea6b1df5fc7a6362d7e6e72b5 20-Feb-2017 Robin Lee <rgl@google.com> Don't copy ringtones when profile sync goes off

Experimentally, it makes more sense to more people to have the parent
setting as an overlay not a concrete thing.

Test: make cts -j30 && cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.ManagedProfileTest#testRingtoneSyncAutoDisableRingtone' </dev/null 2>&1
Bug: 34730524
Change-Id: I5f804713def9e54921b90e4f5cea742ba8aaa685
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
fb6df0b969008fe65b0452764beda154dc8f9254 16-Feb-2017 Marco Nelissen <marcone@google.com> Make audio effects work

This makes the built-in audio effects work again.
3rd party effect panels can be made to work by disabling the built-in one
in Settings.
TODO: implement selection mechanism for third party effect panels.

Bug: 35316970
Test: manual
Change-Id: I6cd1cfba909bf74c31f37e9ecedcb28046f9109b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
33a119c94fbef9a185b82204fc58292e08c3d33d 13-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix typo on DISALLOW_UNMUTE_DEVICE"
492b4724fb42adf29f3978f01ebc5238f893d194 13-Feb-2017 Esteban Talavera <etalavera@google.com> Fix typo on DISALLOW_UNMUTE_DEVICE

Test: Builds sucessfully. Cannot find other usages in code search
Change-Id: I83f85b4715b11630b0ce0b471be536aef46a2936
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
03332ab6aa5461981acba74a63e5c96b379e9233 10-Feb-2017 Eric Laurent <elaurent@google.com> AudioService: check safe volume bypass early at boot

audio.safemedia.bypass property was sampled only after a 30 second
timeout after boot in case no MCC change config event is received.

If the property is true, skip the time out to speed up automated test
needing to disable the volume warning.

Bug: 31347265
Test: restart runtime with audio.safemedia.bypass true and check
no warning is displayed when raising volume to max

Change-Id: Ic31111200379e3cb4fddc651fa548a1bdff3384a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7592b986e13b1af76dc6c6a10f758ad2f371997a 02-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: query a11y manager at init for a11y volume active

When initializing accessibility state monitoring, query the
accessibility manager whether any service is enabling the
accessibility volume

Test: adb shell dumpsys audio, look for sIndependentA11yVolume
Bug: 30448020
Change-Id: Ie8c32e10a35f4eef5fdeadacccefaaec1cdfb022
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
6deaa4c8cf643ec28e2efb6741e26ee46bce592d 01-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "Notification playback synchronized with audio focus"
99489ccf740d369193a8ffc7eeb4bbde6919bd65 26-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> Notification playback synchronized with audio focus

PlayerProxy: more control options (pan, delayed start),
remove exceptions in method signatures.
Use delayed start on notification playback for better sync
between media apps and notifications
Disabled for now: support for AudioService (through
MediaFocusControl and PlaybackActivityMonitor) to enforce
audio ducking of focus owners losing audio focus with
AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK, and who don't
play audio that has a content labelled as CONTENT_TYPE_SPEECH.
This feature will be enabled when setting a VolumeShaper
on a player works.

Test: play music and play notification
Bug 30258418

Change-Id: I4e4d911645306bbde17f74288f3b61781fe0e3fe
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f6324a4b758d9251e68f3cc543a5b54c26867d91 19-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: remove compile time options for a11y volume

Remove test code path for the a11y volume and only rely on
AccessibilityServicesStateChangeListener. Query whether
any of the running a11y services expose
FLAG_ENABLE_ACCESSIBILITY_VOLUME

Test: enable a service that exposes FLAG_ENABLE_ACCESSIBILITY_VOLUME
(Talkback will do this in the future) and change volume
Bug 30448020

Change-Id: Ib5dff31313c0ec65b3e9982e35c00698adf5b7de
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
dbfb40f163f98a9aadba68e38222ee4734d17eba 23-Jan-2017 Julia Reynolds <juliacr@google.com> Optionally show accessibility stream volume row.

Bug: 30448020
Test: manual
Change-Id: I86a28c7a900d1fbc378f0ce4c113d59353bcb416
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
110dad7c782c4388906dccb1d1891d4b6fc3e49f 24-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "[SettingsProvider] Auto disable ringtone sync"
7bdc6d80efe0176d5c708a310ce756bc3c42b6f7 22-Sep-2016 Andre Lago <andrelago@google.com> [SettingsProvider] Auto disable ringtone sync

Disable the SYNC_PARENT_SOUNDS setting if a work profile ringtone is set

Test: cts-tradefed --test com.android.cts.devicepolicy.ManagedProfileTest
Bug: 30658854
Change-Id: I172f5396b47f03ac8afa365db0ec90f3a2dd0e29
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
cfa55535e866aade813f185d1893a3fef0826040 18-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: modify logic for independent a11y volume

Add support for enabling independent a11y volume based on
a11y services state change.
Add compile time constant USE_FLAG_ENABLE_ACCESSIBILITY_VOLUME
for testing a11y volume simply when TalkBack is enabled.

Test: change new USE_FLAG... constant to false and enable Talkback
Bug 30448020
Change-Id: I541481ed6ca24bc46872818bb5306c5662ab80e9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
bb983d20d2cacebdf81efe88f8ff4aa7304fbff7 06-Jan-2017 Julia Reynolds <juliacr@google.com> Use internal volume controller and status bar.

Remove code that let these components be replaced by external
processes.

Bug: 33006669
Bug: 34106436
Test: manual. reboot device, play music, change volume,
view notifications
Change-Id: I458f11537ab9db6f23735487513815553004613f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
46e310b34f73fe87a6dd1e7357b486f1cf7cacbc 05-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService playback activity notif: check origin of player updates

When receiving updates about players, check the validity of the call:
- the piid must be valid
- the uid of the caller and that of the player must match

Test: adb shell dumpsys audio
Bug: 30955183
Change-Id: Id15e2b69764ed7db0b93e2c0c96472c30b1d2070
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d61d501a06793d2914e087140bd1350acac1a16e 04-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Player activity notification: move some intialization server-side"
858ab9907152b2391063f11706e22d9308cb0454 04-Jan-2017 Pavlin Radoslavov <pavlin@google.com> Merge "Add a mechanism for configuring the A2DP Source codecs" am: 63270f2b96 am: 8b46f87e7e am: da3de76bdb
am: 62c5226e9c

Change-Id: I14d4cc2dc91cb1ab431eda32d5066ac8f471c3a6
62c5226e9c9d5a85689e40b00eacc41e5e90f671 04-Jan-2017 Pavlin Radoslavov <pavlin@google.com> Merge "Add a mechanism for configuring the A2DP Source codecs" am: 63270f2b96 am: 8b46f87e7e
am: da3de76bdb

Change-Id: If62a29812dad856d262c38804f3d88a5406ef79e
44a4ef0aa93ebb2912f36d65af42ffbb1bcdbc0f 21-Dec-2016 Pavlin Radoslavov <pavlin@google.com> Add a mechanism for configuring the A2DP Source codecs

* Added a new class BluetoothCodecConfig that contains codec-related
configuration or capabilities: codec type, priority, sample rate,
bits per sample, channel mode, and codec specific fields.

* Extended the Bluetooth A2DP AIDL interface to get/set the current
codec configuration

* Added new call handleBluetoothA2dpDeviceConfigChange() to the Media
Framework that is called when there are changes in the
Bluetooth A2DP device configuration - e.g., the A2DP codec is changed.

Test: A2DP streaming to headsets, TestPlans/71390
Bug: 30958229
Change-Id: I9a82716cbc2a5efbe77352a031ac80c88f6a2459
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
44a8f53f94808fdc5ac35a249d21ff2ba23e9419 02-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> Player activity notification: move some intialization server-side

Make beginning of player tracking synchronous, init uid/pid/piid
on the server side, and return the piid.
Anonymize configurations in the getter of active configurations
when the client isn't privileged.

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioPlaybackConfigurationTest
Bug: 30955183

Change-Id: I1610ae0067fd26d297057663352e679c8963a2d7
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
292a6a4e9934a94eea97b018befde3baed895f7d 01-Dec-2016 Jean-Michel Trivi <jmtrivi@google.com> Notification of playback activity

AudioService keeps track of status of implementations of PlayerBase.
AudioService's PlaybackActivityMonitor maintains a list of
playback configurations for each PlayerBase, and a list
of clients that want to receive updates about the playback.
Playback activity clients can query the playback configuration
of the system through AudioManager, or register a callback
for updates. For clients with MODIFY_AUDIO_ROUTING permission
(system), the playback configurations contain more information
about each player (player type, uid, pid, state), and can see
all players, not just the "active" ones. The act of stripping
off data about the players that is not supposed to be seen
by non-system clients, is referred to as "anonymization". It
is implemented in system server, so no system data is ever
sent to playback activity clients without system permission.
More information about the AudioPlaybackConfiguration is
available in the SystemApi (uid, pid, player type, player state).

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioPlaybackConfigurationTest
Bug: 30955183

Change-Id: I85997594c0378216419f5f0fdaa0714996fd3573
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c6729478b18bb40f2c3af65e98a667a8ff41695d 07-Dec-2016 Eric Laurent <elaurent@google.com> AudioService: fix mismatch in device volume index for alias streams
am: 825a5ea380

Change-Id: I44f3e0a603ddea097abca5af134615b53a5a9df8
825a5ea380d277d201a017d743cf10725266b64c 04-Nov-2016 Eric Laurent <elaurent@google.com> AudioService: fix mismatch in device volume index for alias streams

Fix VolumeStreamState.setIndex() to force device volume
index update on an alias stream when no specific device volume exists
on the VolumeStreamState of this alias stream.

This prevents asymetric behaviors of setDeviceVolume() and setAllVolumes()
causing some stream types to be muted and
not unmuted if no specific device volume index exist.

Test: make
Test: wipe device, setup wizard, place call and check nofication volume

Bug: 32626244
Change-Id: Idd170aa9f295b0a9533a589e1891a04c05ab2f2f
(cherry picked from commit 3fb608e4f38df2781461ee601156258c90b6c472)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ac48767f919e2a641e4ff5597f7bc24c6d481d41 11-Nov-2016 Jean-Michel Trivi <jmtrivi@google.com> Conditional behavior for a11y stream volume

VolumePolicy: define two a11y modes: 1/ legacy where
a11y volume aliases to media volume, 2/ a11y where
the a11y volume is independent from any other stream
type volume.
Refactor accessibility service listening to accomodate
communicating to the volume controller when the
a11y service is running.
Make accessibility stream alias conditional on a11y
service running. Reflect the behavior in the
volume controller.

Test: enable Talkback and verify logs in Vol controller
Bug 30448020

Change-Id: I80535ba259a22b6d93e62a7b3ca462a19d4c84b7
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3f0945a608197fa8919ebe909f6388d9d59e8c29 11-Nov-2016 Jean-Michel Trivi <jmtrivi@google.com> Define stream type for accessibility volume control

New stream type for accessibility volume.
Add related appOps.

Test: see added CTS tests in AudioManagerTest & Stub
Bug 30448020

Change-Id: I34f96713b22fedf75322b8ffe2b96a7c566f5009
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
dc589ac82b5fe2063f4cfd94c8ae26d43d5420a0 11-Nov-2016 Sudheer Shanka <sudheersai@google.com> Update usage of ActivityManagerNative.

- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
67b30fea3873555ddd3e8d0fec9e9d34ca9d867d 07-Nov-2016 Eric Laurent <elaurent@google.com> Merge "AudioService: fix mismatch in device volume index for alias streams"
fc46e9b643881b7b2ab76854f3a0ac077e9def8d 22-Oct-2016 Sudheer Shanka <sudheersai@google.com> Move IActivityManager to aidl.

Bug: 30977067
Test: Existing tests are passing, dump commands still working.
Change-Id: I9cf81c4d381ebce14a6c701e409cbb269f2ff1fb
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3fb608e4f38df2781461ee601156258c90b6c472 04-Nov-2016 Eric Laurent <elaurent@google.com> AudioService: fix mismatch in device volume index for alias streams

Fix VolumeStreamState.setIndex() to force device volume
index update on an alias stream when no specific device volume exists
on the VolumeStreamState of this alias stream.

This prevents asymetric behaviors of setDeviceVolume() and setAllVolumes()
causing some stream types to be muted and
not unmuted if no specific device volume index exist.

Test: make
Test: wipe device, setup wizard, place call and check nofication volume

Bug: 32626244
Change-Id: Idd170aa9f295b0a9533a589e1891a04c05ab2f2f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
da9d0ecb8390765ee7f3d8c7338e710f009f0f40 04-Nov-2016 Andre Eisenbach <eisenbach@google.com> Merge "BT: Don't switch devices when one of the connected BT headsets disconnects" am: 0bebfe76fc am: 2fe13541ad am: 51d7a455aa
am: 045226008c

Change-Id: Iacd5ae71b6338bcb461ae69cc09e5158fea502dc
2fe13541ad632c3484dd7b816672b6bf4cf3364f 04-Nov-2016 Andre Eisenbach <eisenbach@google.com> Merge "BT: Don't switch devices when one of the connected BT headsets disconnects"
am: 0bebfe76fc

Change-Id: Ibd4c4f9defec469bb14a282c53d64932123d4905
2980980a75a0066273683aed8b12a58b212a0487 18-Jan-2016 Satish Kodishala <skodisha@codeaurora.org> BT: Don't switch devices when one of the connected BT headsets disconnects

Usecase:
1. Enable multi-hf.
2. Connect to HS1.
3. Connect to HS2.
4. Make a call on AG. Here call audio is present on HS2.
5. Now disconnect HS1 from AG.

Failure:
When HS1 is disconnected, call audio is routed to handset/speaker.

Root cause:
When hs1 disconnection intent is received, SCO path is cleared
and audio is routed to handset/speaker.

Fix:
Check if the device being disconnected is same as the device
call audio is present before clearing SCO path.

Change-Id: If83325679b70b5893e44e8d844000ee028d0246c
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
909371b6f6a9d04abfb651b5cc57eee98955e398 29-Sep-2016 Sungsoo <sungsoo@google.com> Make dispatchAudioRoutesChanged be called when BT A2DP status changed am: 71f3563c39 am: 139f1e3742
am: 220f348fb3

Change-Id: I34ebeddffe313747008ed6f7d941097bd67d7b9b
b26960bf04117cf5d3ad57db5b6e72e6c80de7ef 29-Sep-2016 Sungsoo <sungsoo@google.com> Revert "AudioService: remove deprecated forcing of A2DP off" am: cf09fe6801 am: 8902c288b7
am: 38b5579261

Change-Id: Iea5ee66996db5d39b11cf3f278b1db5795db09d8
b2d12bb6562225e981ace94748a8301b107c216e 29-Sep-2016 Sungsoo <sungsoo@google.com> Revert "AudioService: restore A2DP/wired headset auto selection" am: 486f7d3fcd am: 3e6a30c07a
am: c6b31397a6

Change-Id: I38d170658c9cfd979b115ae12e8f727ffdafc175
71f3563c3960bd862dfa96844f646ea5b2f03de5 28-Sep-2016 Sungsoo <sungsoo@google.com> Make dispatchAudioRoutesChanged be called when BT A2DP status changed

Bug: 28517884, Bug: 31398128
Change-Id: Ic1e2f5e828a772c667caf1408ebfc9b0d7c3f7d4
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
cf09fe68015c042f3847b835f7f6bebe7f95107d 28-Sep-2016 Sungsoo <sungsoo@google.com> Revert "AudioService: remove deprecated forcing of A2DP off"

This reverts commit 0234587b1172a11929d17b05ef73ba14425edd65.

Bug: 28517884, Bug: 31398128
Change-Id: I8ca2871c4f956409d07dd90dcbe41d3e668568ba
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
486f7d3fcd34caea35179efd3886b9f5c31c9fd2 28-Sep-2016 Sungsoo <sungsoo@google.com> Revert "AudioService: restore A2DP/wired headset auto selection"

This reverts commit 383dc532f3c993ab6111d4fc55eba62ff0f926ec.

Bug: 28517884, Bug: 31398128
Change-Id: Ia633a1596298ae30384f8bcaa02a1b6d29344ba9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1022942a56472829c94f5708797d9d3136f40caf 15-Sep-2016 Eric Laurent <elaurent@google.com> AudioService: restore A2DP/wired headset auto selection am: 383dc532f3 am: 8097459f66
am: 4f2481ecaf

Change-Id: If58bc256b33d7fcdb68a1e26911950782ba40abe
21003f696fea9bd2796d2c446c53ade2927f7533 08-Dec-2015 Hank Freund <hanochf@google.com> Ignore TV platforms in checkForRingerModeChange

The checkForRingerModeChange function determines how to modify the
ringer mode based on the requested action and then calls setRingerMode
to carry out the change. For TV devices, setRingerMode exits
immediately, making the path through checkForRingerModeChange
unnecessary.

Removed all references to TV inside checkForRingerModeChange and
return immediately in that situation.

b/26016241

Change-Id: I15893d38c8b7b449e5a3f1d729f75505a08976a2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
383dc532f3c993ab6111d4fc55eba62ff0f926ec 13-Sep-2016 Eric Laurent <elaurent@google.com> AudioService: restore A2DP/wired headset auto selection

Restore automatic routing behavior when wired headset or BT headset
is connected.
This behavior was changed by commit 0234587b
This change mostly reverts 0234587b but keeps public methods
setBluetoothA2dpOn() and isBluetoothA2dpOn() deprecated with
stub implementations.

Bug: 30963785
Bug: 31424965
Change-Id: I90ea04584df595a778993595ad0076fef809ed98
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
0234587b1172a11929d17b05ef73ba14425edd65 29-Jul-2016 Eric Laurent <elaurent@google.com> AudioService: remove deprecated forcing of A2DP off

Forcing the policy to not use A2DP is not needed anymore now that
the cast icon does not expose A2DP choice anymore.
The corresponding AudioManager APIs have also been long deprecated.

Removing support for this feature which is replaced by newer routing
APIs.

Bug: 30963785

Change-Id: If98572742a8cf6388c1408d015c86dd445c5660b
(cherry picked from commit 0218f53108f578933c8d876364138d062b315a6b)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
0218f53108f578933c8d876364138d062b315a6b 29-Jul-2016 Eric Laurent <elaurent@google.com> AudioService: remove deprecated forcing of A2DP off

Forcing the policy to not use A2DP is not needed anymore now that
the cast icon does not expose A2DP choice anymore.
The corresponding AudioManager APIs have also been long deprecated.

Removing support for this feature which is replaced by newer routing
APIs.

Change-Id: If98572742a8cf6388c1408d015c86dd445c5660b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
73ea0ae15fafd66ab8a8e2679723715c189bbba3 11-Aug-2016 Jeff Sharkey <jsharkey@android.com> Fix bugs around manager fetching.

A recent patch started returning "null" when a Binder service
required to provide a manager wasn't yet registered.

This fixes four locations where that new logging was triggered: in
two cases by adjusting the fetching ordering, and in two other cases
by only fetching when the device supports the manager.

Bug: 28634953
Change-Id: I84dbccffa4ac760c10a2bbcb234f21272bfecb91
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
45926dcc1f5705a708648fedbb944422b1f3de4b 11-Dec-2015 Hank Freund <hanochf@google.com> Change default stream volume for TV to 1/4 max instead of 3/4

b/26048878

Change-Id: I423e9b8fb03d6875e7d0e4a4266943e950defefe
(cherry picked from commit db27de5da493b9d791321e8771ae59998dad8c28)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
fe84fe01d7415ea86e37824c0aff0d988089b6c2 25-Jul-2016 Tony Mak <tonymak@google.com> Persist master volume mute across reboot am: c1205111a9
am: c33b549af8

Change-Id: Id5e57ebdf81824af0f86854d8668a05f8109e0e1
c1205111a92b52283078f1a2e86c8d32c5928b92 22-Jul-2016 Tony Mak <tonymak@google.com> Persist master volume mute across reboot

Fix: 30133263

Change-Id: I53450a504e40e55516acc88550f369a74a244eaf
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1ed6df6bcf8f21a78a42bc9dc293812585eff121 18-Jun-2016 Muyuan Li <muyuanli@google.com> audio: add a flag to force tv-like audio stream.

Bug: 29446492
Change-Id: I5d7272d8735befe7fbed080cca1dd2b47e5f1b6e
(cherry picked from commit 77091ab14a1da2fe4e674edb8af275a3d1ed38ce)
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f04fab160a044e4e7d936c0457a156d7911f924c 19-May-2016 Jean-Michel Trivi <jmtrivi@google.com> Recording activity notification: return list of configuration

Use a list of configurations instead of an array

Bug 28819230

Change-Id: Ia4a3cdabf8337cfb98abe4d0055d497bcab8a5ee
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
39fb5670a8d863ec1ee9b3ece0d477a8b9dd44c2 09-Mar-2016 Liejun Tao <baibai@motorola.com> Bluetooth: Fine tune audio gain for Absolute Volume case

Fine tune the audio gain for Bluetooth Absolute Volume.
Use 50%, 70% and 85% for lowest volume steps 1, 2 and 3.
Thus the volume change sounds smoother, more linear.
When remote end tune volume out of mute, we should also
tune the audio gain for the lowest volume steps.

Bug: 26694114
Change-Id: I298a334a4b40ddb87495fda1935349bfce8b0537
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
02d01b7b0161df398b4d8d6e4015970a48bcf97d 11-Apr-2016 Julia Reynolds <juliacr@google.com> Merge "DND related restrictions" into nyc-dev
ed783798c3c541cd33bc8860f31928dda351d7ae 08-Apr-2016 Julia Reynolds <juliacr@google.com> DND related restrictions

- Apps without dnd access cannot call adjuststeamvolume if that will
change the ringer mode
- DND muted streams cannot be unmuted when DND total silence is enabled.

Bug: 27624414
Bug: 25395278
Change-Id: Id10988c42fc6cb6407aa2abcf66cc5c384fe533a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d9ac2be3e32472b042d1e977a86e2bad083cea16 07-Apr-2016 Eric Laurent <elaurent@google.com> audio service: fix volume burst on user switch

Change the convention on use of default device volume with
audio policy manager: Now setting the default device volume on a stream does not
reset all specific device volumes. The default volume is just used by audio policy
manager if no specific device volume is present for a given selected device.

Bug: 27557733

Change-Id: I1edd9530ccafc615d9353b9b06489c688e21f719
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d08da04cf2d52d62573459b82f0e7a1c02026b29 18-Mar-2016 Donghyun Cho <donghyun@google.com> Merge "Clear calling identity before calling sendKeyEvent" into nyc-dev
cdaa0b99eb81998c6b3f94aedb09f0e28dedca10 17-Mar-2016 Julia Reynolds <juliacr@google.com> Relax policy access restriction for adjust volume changes.

Otherwise users can't enter DND while using volume buttons in most
apps.

Bug: 27711587
Change-Id: Idb4976680d9bb88206928a7b623f17d07183ea28
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
5f6d404e0923498bed30595224d6e9b527156c07 17-Mar-2016 Donghyun Cho <donghyun@google.com> Clear calling identity before calling sendKeyEvent

When HdmiControlService#sendKeyEvent is called via AudioService,
permission check should be based on AudioService rather than the caller
of AudioService.

Bug: 27195998
Change-Id: I35f60813b3a48b2957f2bfd576a5f493d77691a7
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
495defd74f9a47dec33eb27ca25f5e390bd3fb4a 16-Mar-2016 Eric Laurent <elaurent@google.com> Merge "AudioService: do not persist mic mute and master mute" into nyc-dev
48034f89b75ecfa4871855afd7b4f701ff927d28 09-Mar-2016 Julia Reynolds <juliacr@google.com> Prevent apps without DND access from toggling DND via AudioService.

Bug: 25395278
Change-Id: Id72830607b01a43848d1261292e5835315ef70d0
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c02324864f3bab4baffb3ebbbd78ccee4b065e56 16-Mar-2016 Eric Laurent <elaurent@google.com> AudioService: do not persist mic mute and master mute

Master mute and mic mute are fully managed by user restrictions so there
is no need to persist their states.

Bug: 27486437
Change-Id: I7e58d1ddf409f6c80af371c7f5a5f305ee996386
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
598c0c9f659184971e974de6a0184a3000e7900c 07-Mar-2016 Jean-Michel Trivi <jmtrivi@google.com> Rename AudioRecordConfiguration to AudioRecordingConfiguration

In package android.media:
- rename AudioRecordConfiguration to
AudioRecordingConfiguration to avoid ambiguity with the
android.media.AudioRecord class
- rename AudioManager.getActiveRecordConfigurations() to
getActiveRecordingConfigurations.

Bug 27385560

Change-Id: I5ef404ff36522193990c9b563d4545893529b365
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
310355d28e73ff4192e597b99af202a9045fa7e2 07-Mar-2016 Jean-Michel Trivi <jmtrivi@google.com> Merge "Revert "Rename AudioRecordConfiguration to AudioRecordingConfiguration"" into nyc-dev
431ec6cdb9818ea6fb8b78e2589042ff09c40974 07-Mar-2016 Jean-Michel Trivi <jmtrivi@google.com> Revert "Rename AudioRecordConfiguration to AudioRecordingConfiguration"

This reverts commit 99278e1c724e01b792dd27031bc579e7d738edc1.

Change-Id: Ifcb3f17a26df8171cbc21dac093477b98a1333db
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
46f5429768045e0ba15229c7317429e3a1d15bac 07-Mar-2016 Jean-Michel Trivi <jmtrivi@google.com> Merge "Rename AudioRecordConfiguration to AudioRecordingConfiguration" into nyc-dev
99278e1c724e01b792dd27031bc579e7d738edc1 02-Mar-2016 Jean-Michel Trivi <jmtrivi@google.com> Rename AudioRecordConfiguration to AudioRecordingConfiguration

In package android.media: rename AudioRecordConfiguration to
AudioRecordingConfiguration to avoid ambiguity with the
android.media.AudioRecord class

Bug 27385560

Change-Id: Ia633ac30cbe151b8f0f903dc96a459a56737ace2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ed43bf5160d3170c3220a9c0cbab9b272acdfc6b 02-Mar-2016 Phil Burk <philburk@google.com> AudioService: update device info when ENCODED_SURROUND_OUTPUT changed

Fixes a bug with the ContentObserver not being registered.
Added code to also toggle the HDMI connection to force a broadcast.

Bug: 27434478
Bug: 24541671
Change-Id: If1644f4d08991ee27e3b6e10d244a704c25b5fa9
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ac0f704b1a77cb27dc0975206825098df6b211bb 24-Feb-2016 Phil Burk <philburk@google.com> AudioService: add support for ENCODED_SURROUND_OUTPUT

Preference allows override of AudioPolicyManager.
Lets user force or prevent use of AC3 and DTS regardless
of what the EDID says.

Bug: 26373761
Change-Id: I21440f2b90af9a369a36b7b07724e992501bce6d
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7b98e9a7e56213f90665c2c9aec213de8557021b 26-Feb-2016 Andy Hung <hunga@google.com> Make master mono controlled through settings

Bug: 15283594
Change-Id: I94a84a3ad3bbb0c1179726a4ecc68b7df033af58
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b09265df232f2f2e404604dce4b5e5a55fde0d1d 03-Feb-2016 Eric Laurent <elaurent@google.com> Merge "Bluetooth: Restrict gain for Absolute volume case" am: 81e7a58754
am: d24eb54b54

* commit 'd24eb54b5409997ece8e49ce2e57d27f8b41d778':
Bluetooth: Restrict gain for Absolute volume case
4565a47d916d3df37a31c1d3fadbd220f4b35c57 21-Jan-2016 Liejun Tao <baibai@motorola.com> Bluetooth: Restrict gain for Absolute volume case

For the lowest music volume steps 1 and 2, restrict the gain to 50% and
75%. This will avoid the lowest volume steps being too loud for some
accessories. For music volume 0, set phone gain to 0 as some
accessories won't mute on their end.

Change-Id: I24e0fa7be8c8635b428a11c91ea153aad7cec55f
Signed-off-by: Liejun Tao <baibai@motorola.com>
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b70b78a205f668a6529027008a144fa83ae2ed5a 14-Jan-2016 Eric Laurent <elaurent@google.com> audioservice: detect bluetooth adapter turning off.

Make sure that we disconnect all bluetooth devices when the
bluetooth adapter is turned off as the onServiceDisconnected()
is not systematically called for all profiles in this case.

Bug: 25488825.
Change-Id: Ia6f6d8611dc02acddb6f8ee09af528788c72d3cd
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
de41d3cd5a28cce3ba7f0fa23ba7c41ef93b223d 13-Jan-2016 Jean-Michel Trivi <jmtrivi@google.com> Merge changes from topic 'recordingcallback'

* changes:
Audio recording notification API
AudioManager event dispatcher: make more generic
d3c71f075b139024e2bea39bbd75e3b976bfb7cb 07-Dec-2015 Jean-Michel Trivi <jmtrivi@google.com> Audio recording notification API

AudioService can register a recording callback with AudioSystem.
Callbacks are handled in a new class, RecordingActivityMonitor.
This class notifies registered AudioManager instances
of updates, only if this AudioManager has client callbacks.
Each AudioManager dispatches updates to its registered
callbacks.

Bug 22876530

Change-Id: I95c6e5ec0631e53af53a490bcecca96089490089
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f04b84d4c66ea377ec6fe2b36f3a0994f3e94eba 19-Dec-2015 Andy Hung <hunga@google.com> Add setMasterMono and getMasterMono

Bug: 15283594
Bug: 22700363
Change-Id: I5d0552938ec2a54be4450512974d92ff8c77b1e9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ed0ea40a41aae8e65bc189efe6b631ca78259383 30-Oct-2015 Andy Hung <hunga@google.com> Add Android permissions for audioserver

audioserver has the same permissions as mediaserver.

TBD: Pare down permissions.

Bug: 24511453
Change-Id: Id7abddd79a730ad95b554a94207df3aa4b676f2a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d4de20df2a1e57d22db7c538b197e3db18eaaa7d 04-Nov-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioService: remove dead code

Remove dead code related to media button event receiver and
remote control display, now handled by MediaSession*

Change-Id: I4bd621240ddddf4df079df8d551c72b232c3301d
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ac65e1e1dba1cf0ea237a389220ec818ade07a16 21-Nov-2015 Makoto Onuki <omakoto@google.com> Remove UserManager.setSystemControlledUserRestriction()

Now that we don't have UM.setUserRestriction*s*() that could remove
all existing restrictions, there's almost no point handling
DISALLOW_RECORD_AUDIO differently.

Now DISALLOW_RECORD_AUDIO is handled just like other restrictions,
except we don't persist it.

Bug 24954662

Change-Id: I27875b4a74dd95a3ce6bb774081eeaf718eaec15
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1b434dac7f098227bbe0f346f7bb749e8b793a17 12-Nov-2015 Jae Seo <jaeseo@google.com> AudioService: add a missing call to setSystemAudioMute

Bug: 24946655
Change-Id: I0ff75135dbd05f1d99543cc0594656586a8ae7b5
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d45a4a2ecb18701b4cfadcb4a26663f2eab642fe 03-Nov-2015 Makoto Onuki <omakoto@google.com> Have AudioService listen to DISALLOW_UNMUTE_MICROPHONE and

... DISALLOW_ADJUST_VOLUME, instead of UserManager pushing
new settings to AudioService.

Also:
- Allow PO to set these two restrictions.

- Now AS.setMasterMuteInternal() respects mUseFixedVolume to make
it consistent with readPersistedSettings().

- When a user switches and restores the mute state in
AS.readPersistedSettings(), also check the current user restrictions
in addition to system settings. Because of the delay in AudioService
before persisting the mute settings in setMasterMuteInternal() and
setMicrophoneMute(), there's was an edge case
DISALLOW_UNMUTE_MICROPHONE and DISALLOW_ADJUST_VOLUME would be ignored
when the user switches right after they are set.

Bug 24981972

Change-Id: I4d9b709a0a0e6812319204568c6e44d6664bdeb4
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4f16073556f7978708fb71c87628cfe1692412d5 28-Oct-2015 Makoto Onuki <omakoto@google.com> Make UserManager enforce user restrictions, not DPM.

- Now even if a user restriction is set via UserManager, it'll be correctly
enforced.

- Changed the way AudioService enforces the OP_MUTE_MICROPHONE and
OP_AUDIO_MASTER_VOLUME app ops -- previously, when they're set, even a muting
call would be rejected. This was why DPMS.setUserRestriction() used different
calling orders for DISALLOW_UNMUTE_MICROPHONE/DISALLOW_ADJUST_VOLUME depending
on setting them or clearing them.
Now, even when the app ops are set, we still allow muting calls.

Bug 23902097
Bug 24981972

Change-Id: I865b5de43e15f5955f94006475a5ec6254904d31
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
e4381ec97c67fad16acfcc9933fde04f2260d796 30-Oct-2015 Eric Laurent <elaurent@google.com> AudioService: fix BT SCO min volume

Set minimum BT SCO stream volume back to 0 to comply to
Bluetooth audio gateway requirement.

Also fix minimum stream volume when initializing audio policy manager
after a mediaserver crash.

Bug: 24747886
Change-Id: I80c51114d5b10a132b7b10f216bce96323fdc166
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
e1aef85ff100c1beba215add2ff3238a4032c6ba 16-Oct-2015 Makoto Onuki <omakoto@google.com> Use the SystemService lifecycle mechanism for AudioService

This will be needed to refactor user restriction handling.

Change-Id: I4b77a020d631714e7f94bce5559190e3b78ec72c
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
58e47ca39a537c47c84a674eee392f9569d3e09e 02-Oct-2015 Jean-Michel Trivi <jmtrivi@google.com> am 182e6287: am 11568be8: am 5f48baef: am 24806db8: AudioService: alternative way of handling device rotation

* commit '182e628711a5859765479fd75066bbeac886c3f6':
AudioService: alternative way of handling device rotation
24806db8f6f523542510097ce0af4a32beeda83b 02-Oct-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioService: alternative way of handling device rotation

For devices that monitor orientation (primarily for channel assignment
to stereo speakers):
The com.android.server.policy.WindowOrientationListener API is more
power efficient than simply monitoring the device's orientation. When
supported, use it instead of android.view.OrientationEventListener.
When WindowOrientationListener reports an orientation change, start
a thread to poll the UI orientation, as its change may lag behind
the observed rotation. Gradually increasing delays between polls
are stored in a table.

Bug 24415763

Change-Id: I69bf68da6107af24cd02a48961dd17ceab557816
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
82418d110f24f45fe62731206083e478a44052ea 25-Sep-2015 Pankaj Kanwar <pkanwar@google.com> am 1e595bc2: am 52762ce8: am f99986ee: am 65bfe1ca: Merge "AudioService: cleanup sco audio mode upon disconnection." into mnc-dr-dev

* commit '1e595bc225a4d2f1a9c8e59a2047bee33dd79439':
AudioService: cleanup sco audio mode upon disconnection.
48221250ba8445b82dc9beaaf0853a37afffcdf6 25-Sep-2015 Eric Laurent <elaurent@google.com> AudioService: cleanup sco audio mode upon disconnection.

Clean up SCO forced usage and A2DP suspend state upon
SCO device or profile disconnection.
This is in case the Bluetooth Headset service does not
do it.

Bug: 24316765.
Change-Id: Ifc0305607c186be49b2eb42b7868647292e56137
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7c69636c9a406265e1da368f3edfd8fb9651132c 16-Sep-2015 Xiaohui Chen <xiaohuic@google.com> Cleanup USER_OWNER in various services

Bug: 19913735
Change-Id: I980370bab18e1b9ccf4043eed2b9fd721a940f72
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
598b03d1008fb416a597ae4b2e037c4492bf696d 07-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 9bf912c1: am 5ed03384: am 1f514608: am 5a624aad: am 38d30dc5: Merge "Immediately kill a shared user process on a permission revocation." into mnc-dev

* commit '9bf912c1cf6941402dc0f8ef449f34787796875e':
Immediately kill a shared user process on a permission revocation.
aa41add33b8d7d318387cc74c34e3d347d245211 07-Aug-2015 Svetoslav <svetoslavganov@google.com> Immediately kill a shared user process on a permission revocation.

1. When a permission is revoked we kill the app immediately but do
not do an immediate kill for shared uid processes. This fixes it.

2. Remove system APIs that are used only by the package installer.

bug:22984670

Change-Id: I3d4ae52ea8679f894aa7c5972941263903479183
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
0a01228c1e9a06e9454e732ea950fe6d8550db73 04-Aug-2015 Jean-Michel Trivi <jmtrivi@google.com> am 2cfe29e3: am cbda3dc7: am 0ca9e2df: am 4032c94d: am fc5a4bf0: Merge "AudioService: check for audio device connection success" into mnc-dev

* commit '2cfe29e34c7e95609e93cdbf57225145f242c8a2':
AudioService: check for audio device connection success
fc5a4bf0e1520bf3acd75226d760b8e1d7cdd59f 04-Aug-2015 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService: check for audio device connection success" into mnc-dev
6d00e41145a577de114f93985bf05d7eca99ccc3 04-Aug-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioService: check for audio device connection success

When connecting/disconnecting and audio device, AudioService
was assuming that the call was always successful through
AudioSystem.setDeviceConnectionState(). In the case of the
connection of a wired headset (mic + headphones), this also
causes A2DP to not be used for media playback.
The connection can fail if the audio device being connected
is not supported by the platform. But if this failure is
not taken into account for DEVICE_OUT_WIRED_HEADSET or
HEADPHONES, A2DP would still be avoided even when an A2DP
device reconnects at boot.
The fix consists in executing the connection logic only when
the connection was deemed successful. Nothing is altered
on the disconnection code path, or the direct connection
of A2DP.
The javadoc is updated in AudioSystem to indicate the return
codes to take into account in setDeviceConnectionState().

Bug 22511833

Change-Id: I22f0d2c7d4ab4fb9ee1be2f248907f721596a16f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c57692e30d6292ea40809acbd5e13f8e489baafe 01-Aug-2015 Jean-Michel Trivi <jmtrivi@google.com> am 209bf907: am aff9c638: am 4bdc3179: am de680550: am ffbdb8ad: Merge "Fix that shutter sound does not play after ringer mode changes to vibrator" into mnc-dev

* commit '209bf907dfcc4d79324828254be9ba994565d94d':
Fix that shutter sound does not play after ringer mode changes to vibrator
841ed0a0418162bab3ae63329a77e900fa840477 27-Jul-2015 Sungmin Choi <sungmin.choi@lge.com> Fix that shutter sound does not play after ringer mode changes to vibrator

Reproduce sequence:

1. Change ring volume to vibration in Settings > Sound & notification
> Ring volume using touch
2. Launch camera app
3. Capture, but cannot hear shutter sound
4. Even change ringtone to maximum, shutter sound is not played before reboot

Bug: 22589664
Change-Id: I90eb044eaf21f3b558bf050bf1d9f0b33ea4888b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f522848259047de88f6d43340ca62e2d09307f06 22-Jul-2015 Yasuhiro Matsuda <mazda@google.com> Merge "Do not broadcast ACTION_AUDIO_BECOMING_NOISY on first boot."
9ade08733fe0ffa6ac97e480facfe230dacfe53c 21-Jul-2015 Amith Yamasani <yamasani@google.com> am f8db3c64: am aef8716e: am b82c71a8: am 89d4131d: am 09ba7151: Merge "Don\'t kill apps that are multi-user aware..." into mnc-dev

* commit 'f8db3c64984de6c2220578d4c9c12570c3d752b8':
Don't kill apps that are multi-user aware...
c1cbaaba6c509a0e31cbed843f77af1eae1cb064 21-Jul-2015 Amith Yamasani <yamasani@google.com> Don't kill apps that are multi-user aware...

... when looking for background user apps that hold RECORD_AUDIO
permission.

On switching users, we kill any apps that might potentially be
recording audio. But we don't want to kill critical apps that need
to stay running because of multi-user aware services.

Bug: 22564430
Change-Id: I6d9a684d4e044cc3018f0f8181a44aa143a3baeb
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
4ced71932ad7094fd308df844434498604b539c2 10-Jul-2015 Yasuhiro Matsuda <mazda@google.com> Do not broadcast ACTION_AUDIO_BECOMING_NOISY on first boot.

This is for improving boot time by avoiding launch of
unnecessary processes (e.g com.google.android.apps.magazines)
during boot time.
Boot time is reduced by 100~200 ms on Nexus 9.

BUG: 22163689
Change-Id: Iaf373f6a5458c266100a5298b7096bbbd4ff42c2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
c70ee214e60a613ab6f931568de8816f549e603d 10-Jul-2015 Yasuhiro Matsuda <mazda@google.com> Remove an unused variable from AudioService.

mKeyguardManager became unnecessary after the following change
was submitted.
https://googleplex-android-review.git.corp.google.com/#/c/500013

Bug:16186697
Change-Id: I1fd65eb6f96ccbfa45634fd3578ad895576a0e41
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
70e0c58c2269cd29dfd6420d690da13dc03fd457 30-Jun-2015 Kenny Guy <kennyguy@google.com> Mute correct user from device policy manager.

Add per user versions of mute methods so
device policy manager can mute the correct
user.
Just persist change if the calling user
isn't the current user.
Treat calls to audio manager coming from uid
1000 as if they were coming from current user
rather than user 0 so that the correct user's
user restriction is checked.

Bug: 21782066
Bug: 21778905
Change-Id: I51469b741096d8a2ffdc520eaf5b3fd754f2c819
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
560877d498b3b142bb0d555bb2fe48ead3fa9b0f 26-Jun-2015 Jean-Michel Trivi <jmtrivi@google.com> Volume change intent carries stream alias

Define a new extra, AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS, to be
sent along with the volume change intent, VOLUME_CHANGED_ACTION.
When sending VOLUME_CHANGED_ACTION, attach the stream type alias.

Bug 17955277

Change-Id: I04fd279e223504e3ee1581086d7e9205344a6808
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3a30a76e8839d36c93c2620188238b84462b3dd2 24-Jun-2015 Ricardo Garcia <rago@google.com> Fix for SafeMedia logic and CTS tests

Added audio.safemedia.bypass system property to bypass SafeMedia logic on
CTS tests which require guaranteed access to full range of volume levels.

bug: 21779099
Change-Id: I76815a995f08d426218206af7aade491c5debd9e
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
72966d6d83413dc89d3051f30bdc0941cbfc7bb1 18-Jun-2015 John Spurlock <jspurlock@google.com> AudioService: Send the right stream to the volume UI on tablet changes.

Bug: 21798314
Change-Id: Idd49eb9e1253a94e567866a38b664035aea3715b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
98859b256ea32854e3af96d4bd6a705a6e00accf 12-Jun-2015 Eric Laurent <elaurent@google.com> audioservice: remove BT SCO device when service is disconnected

Bug: 21727956.
Change-Id: I9dd68ad83583cdbe7454724098c89daf70bee726
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
75ae23c09674bede6d3fe5ec05a6fba47142e2d5 02-Jun-2015 John Spurlock <jspurlock@google.com> Audio policy: setting explicit non-zero volume unmutes the stream.

And vice versa.

Bug: 21584884
Change-Id: I2cd6a84ab40edba4c6fc2b219693e0d4f0527d8d
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ccffda8359aaf11a6945650dfa39a8cd13604ed2 22-May-2015 Jean-Michel Trivi <jmtrivi@google.com> Remove the 5 sec timeout logic for setVolumeControlStream

Bug 16983918

Change-Id: I65174615d882ea433105862b1ecc50c512979ef9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
97de0c9a29f76f936e1d93f9031e178b56af514f 21-May-2015 Eric Laurent <elaurent@google.com> Merge "AudioService: indicate system ready to AudioFlinger" into mnc-dev
0867bed9ddb3bea3d7c252791f8b62ae21ad3de5 20-May-2015 Eric Laurent <elaurent@google.com> AudioService: indicate system ready to AudioFlinger

Indicate when JAVA services are ready to AudioFlinger so that
calls to power manager and scheduling service can be enabled.

Bug: 11520969.
Change-Id: Id977cab3208c34709011703d2dfdcf552e60371b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
cae346633321e237f824f3ca10d7e6fff2307b2f 20-May-2015 Eric Laurent <elaurent@google.com> AudioFormat: more compressed formats

Add MP3 and AAC as valid AudioFormat encodings.
Only @hide for now to allow system components to manage
audio patches with those formats.

Bug: 18649264.
Change-Id: I5ef5f151783308e31d8ac5b29454589077ef62ea
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d138e4e751b821ea6918faf870580f4f7a9b138a 16-May-2015 Eric Laurent <elaurent@google.com> AudioService: add missing audio becoming noisy intent

Add missing audio becoming noisy intent when the bluetooth
service is disconnected.

Bug: 21160886.
Change-Id: Idd96610a0ff824bd6337c37df60fa13f5bc6e54b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
20eec5bb794d0e1333ab3dca370f8b2ad2498416 09-May-2015 Paul McLean <pmclean@google.com> Add manufacturer-provided device name for AudioPort name field for BT devices.
Change "a2dp-device" to empty string for EnumAPI.

Bug: 20880296
Change-Id: If377735b6d552bb929e5881743bcc3c9a2afb9e3
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
50ced3f3231a26ddcafbc84600d7cf3f5a2a40d5 11-May-2015 John Spurlock <jspurlock@google.com> Zen: Ringer mode integration fixes.

- Properly mute media + alarm streams in total silence.
- Allow system components to update the "ringer mode affected"
streams dynamically.
- Improve dumpsys output for ringer mode streams (include names).
- Remember last ringer mode properly when entering dnd via a
volume down (so we can restore it properly when exiting).

Bug: 20854925
Bug: 20950463
Bug: 20756527
Change-Id: I80afc1f639ff802c541020e25ade1b23e9997ef9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
bcb6c1eb9e762455510645eb47579f7d597d6b78 11-May-2015 Fyodor Kupolov <fkupolov@google.com> Fix errors during user switching

Fix NPE in getHomeActivityForUser. Skip system processes in
killBackgroundUserProcessesWithRecordAudioPermission.

Bug: 21016983
Change-Id: I97f9ca362f4dbf0a659e3d5d7ae6cd8dbeb6404a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b501330a1b6ef14ff512a5727f7a01bc423d6fbb 18-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Disable multi-user background recording

On user switch, kill existing processes of the background user with
android.permission.RECORD_AUDIO permission. Home activity should not be
killed to avoid an expensive restart of the home launcher, when the
user switches back.

Introduced DISALLOW_RECORD_AUDIO user restriction, which is enabled for the
background user, and removed for the foreground user.

Introduced a concept of system controlled user restriction, which can only
be set by the system, rather than device administrator.

Bug: 20346194
Change-Id: Ic942fd565e80d14424230dae612965a8e229c4ef
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
f764d219f0faf82219600761c8d0562623b8f054 30-Apr-2015 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService receives callback for dynamic policy mix state changes" into mnc-dev
5a56109d1f5c00404c8f0e4281b9ac1392d72886 24-Apr-2015 Jean-Michel Trivi <jmtrivi@google.com> AudioService receives callback for dynamic policy mix state changes

AudioService registers a callback for dynamic policies from
AudioSystem.
AudioSystem keeps track of a single callback for dynamic policies.

Bug 20226914

Change-Id: I48899d20d1dbb47bb680e733a3bc9fd064b60f07
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
d9c75dba75ad4742dbaadc34db99d2b76cebca91 28-Apr-2015 John Spurlock <jspurlock@google.com> Volume: Simple dialog footer, DND in quick settings.

- Show DND tile by default, this is now the only
place to manage DND modes / end conditions.
- Remove super footer from volume dialog, replace with
a simplified version that displays the current mode
and allows ending DND.
- Remove obsolete text-only footer from codebase.
- Migrate remaining volume items into main resource files.
- Rename "No interruptions" to "Total silence".
- Add new user information banner for "Total silence"
- Crude media filtering for Total Silence.
(deeper muting changes will be done as a followup)
- Disable volume dialog sliders completely if muted due
to zen.
- Cleanup ZenModePanel: assume embedded mode, remove
expandable subhead
- Remember "favorite" DND mode inside the DND config panel.
- AudioService: consult ringer-mode-delegate before voluming
down into silent.
- Add new hour options to time-based exit conditions.
- Volume dialog visual updates to move closer to final visuals.
- Unify ringer=silent with DND.

Bug: 19260237
Change-Id: I05d7e001eca3b5125418ec3bc4087d0cb8866717
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
8c3dc85de5d6c2ab15a5d9a43feefe608df3cb35 24-Apr-2015 John Spurlock <jspurlock@google.com> AudioService: Fix mConnectedDevices iteration issues.

- Don't remove from the map while iterating.
- Use ArrayMap and tighten up all iterations to avoid unnecessary
allocations.

Bug: 20523001
Change-Id: I2587d0f9778b38d96afdfd0e61b00b06911837ae
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b02c744f05b0cca05b77fcbaad4a546ad86081eb 14-Apr-2015 John Spurlock <jspurlock@google.com> Zen: Enter alarms only on volume down from vibrate.

And vice versa (when dialog is showing).

Also make alarms only the default mode when DND is switched on
via the switch.

Bug: 19260237
Change-Id: I16e4a27944bc8245bb2beed84c0421d493b0b876
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
15427f80bb9632ec34f5491f0e9ac2c4f977074e 27-Mar-2015 John Spurlock <jspurlock@google.com> Merge "AudioService: Observe changes to output devices per-stream."
0a376af22411e3592441da1688d8b134133227ba 26-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Resolve stream before sending to volume UI.

- Don't send streams that the UI cannot display.
- Add an input validation check to adjustSuggestedStreamVolume.
- Remove unused validation method.

Bug: 19949071
Change-Id: Ib7a7c9bf386a8b2d7a0fb13928d103d764ec7aa9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
8a52c4491dfbb8354a92c0a1e6abc86848e187c6 26-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Observe changes to output devices per-stream.

- Keep track of calls to AudioSystem.getDevicesForStream.
- Report device changes for the base streams to the binary event log.
- Fire internal intent so volume UI can respond to changes.
- Update devices when new routes are reported.

Bug: 19618959
Change-Id: I7bbd497b178d9829accc19e6c951a711aef8590c
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1a7700793db3c7b60d5e090ee026a1bcfeff91d8 19-Mar-2015 Phil Burk <philburk@google.com> AudioService: fix String cast crash when mediaserver killed

Bug: 19847028
Change-Id: I45668fbd08e87df69fe3867473a09c387589ca8a
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
413d307c2c646bb2aa563f8167bfa78f0b59a654 19-Mar-2015 Phil Burk <philburk@google.com> AudioService: fix crash when mediaserver killed

Bug: 19847028
Change-Id: I4acacd8a6d20317d180a6994158abc0b2957280c
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
07e72432ac4a83f428d7f9ccf1e11594c67c1993 13-Mar-2015 John Spurlock <jspurlock@google.com> VolumePolicy: Debounce adjustments from vibrate->silent.

Disallows volume adjustments (lower) from vibrate to silent
until a small period of time after an adjustment from normal
to vibrate.

This provides for enough time for the user to see the state change
to vibrate and feel the associated haptic feedback before yet
another state change to silent.

Bug: 19260237
Change-Id: I5843a1c144d56146a83db194f352832c8d85159d
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b6e19e3e0f0170d058636101e23f964196f6f4b2 11-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Define minimum levels for volume streams.

- Set a floor of 1 for voice call + bluetooth sco, otherwise 0.
- All api calls validated to ensure a floor of the min level.
- Volume UI updated to shift the seekbar by the min value.
- Remove duplicate static max method in AudioService.
- Ensure streams with a min level > 0 are not considered muteable.

Bug: 19260237
Change-Id: I213180c9c277f51bd3897b7f777e5f88ed1db125
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
a48d779dad4c48aa2f97ad021ae3a5649c058312 03-Mar-2015 John Spurlock <jspurlock@google.com> Volume policy updates.

- Make volume policy settable by the volume UI instead
of hardcoded in AudioService.
- Add status bar icon for silent mode.
- Limit unmute-on-volume-adjust behavior to tvs.
- Ensure all changes to device volume are sent through
setIndex so no change events are missed.

Bug: 19260237
Change-Id: Iea070a7a6f90ff620e39629f2da3f33f87223d72
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
9087433753a5068819dcd3e86bdc2cce82bb8040 10-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Write base stream volume changes to the event log.

- Add a new volume_changed event, reported at the stream level.
- Only include changes to base streams (no aliases).
- Include the caller for each change. A caller is either:
- a pkg name (for external calls or known media sessions)
- a system server class's log tag (for internal calls,
disambiguates "android")

Bug: 19599935
Change-Id: Ia61b68ff1e7e2907a24972790ec052bfe099e665
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
394a8e1fa7d2aeeec3d750378c1cb5861a583eeb 03-Mar-2015 Paul McLean <pmclean@google.com> Handle simultaneous connect of devices with the same "type" (as in USB)

Change-Id: I163bf8e33ccf5aacc7ba21775916727430327f18
Bug: 19563570
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
1ff1e6edf133158351e793dd842bd0655ef6c199 09-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Fix device dump in dumpsys output.

Bug: 19653026
Change-Id: Id09a502f1507477403c49be32ee0ed0f00ab288f
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
b32fc97282aa95ceefa8601846d83fa6154163db 05-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Add current stream devices to dumpsys output.

Change-Id: I57ed785154d8d75ac0f189a479252a725e80bd5a
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
ee5ad729b90deff435f9875337cbc434be4f8fe7 03-Mar-2015 John Spurlock <jspurlock@google.com> Audio: Remove the concept of master volume.

- Remove two config resources (use master volume, and volume ramp).
- Remove master volume adjustments / getters / intents.
- Retain @hidden setMasterMute, needed for device admin
- Remove master volume logic in AudioService.
- Remove master volume logic in VolumePanel.
- Rename "getMasterStreamType" to "getUiSoundsStreamType" to avoid confusion.

Bug: 19582978
Change-Id: Id02c8fa4898cff3b913147f5ac1b4038e2e7cc24
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
6611bfdaa4dc7688d76d8ab70799c312d0c74446 03-Mar-2015 John Spurlock <jspurlock@google.com> Merge "AudioService: Fix typo/grammar in comment."
bc82b12eb74e5a218894e7ff361767303bf1f2c4 02-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Fix typo/grammar in comment.

Change-Id: I311fc5d7531464bbaeef5937c5ff2b757a8e675e
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7b91c55b3ff4857e904a11a0a67fcc86a32868b4 02-Mar-2015 John Spurlock <jspurlock@google.com> Merge "Remove unused imports in frameworks/base."
4b69ac70a1fa7a3bd4bb8b24efdaa6cf626c6853 02-Mar-2015 John Spurlock <jspurlock@google.com> Merge "AudioService: Migrate index map to SparseIntArray."
2bb02ec6a99a08366b4a357aac3683ec5c18c184 02-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Migrate index map to SparseIntArray.

- Use SparseIntArray instead of a generic hash map.
- Avoids unnecessary boxing/unboxing.
- Avoids unnecessary allocation for iterator temp objects.
- Provides deterministic dumping (by ascending device order).

Change-Id: If5ca5edd94af90cfed65ecbbbc1f4929f50ab6e9
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
59dc9c1d19e52bcbfb05ebe78e097496532062bc 02-Mar-2015 John Spurlock <jspurlock@google.com> AudioService: Fix typo in constant.

Change-Id: I66dba8ffbbe59ab82f97c989163db04741c9a1d1
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
864908620eabc8594b178f0f970eea0066be4c83 25-Feb-2015 John Spurlock <jspurlock@google.com> AudioService: Use the foreground broadcast queue for fired intents.

Minimize delay for receivers, assume they are providing volume UI.

Change-Id: I054bac4292ad7c608cd46543409595dcea6a7731
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7a9ba420f440319ca6c31d554c2273f81f10b16f 16-Feb-2015 Jinsuk Kim <jinsukkim@google.com> Pass old and new volume to CEC without rounding up

Unnecessary rounding up was causing volume change requests
not to be converted to CEC commands occasionally. Removed
the operation.

Bug: 19332158
Change-Id: Ia074722058ada55d46f38aea7a2b915bb5fd2a00
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
0dfc90157d6fb9d773e59dfaab08a1722417a489 19-Feb-2015 John Spurlock <jspurlock@google.com> Merge "AudioService: Fire volume-changed intents for all streams."
c16442c515f136e1f014e57dabfa878ed2441552 19-Feb-2015 John Spurlock <jspurlock@google.com> Merge "AudioService: Fire the mute-changed intent for all changes."
f63860cd8072bc9a9e5178ff3b60d262999c78fc 19-Feb-2015 John Spurlock <jspurlock@google.com> AudioService: Fire volume-changed intents for all streams.

Allow observing all stream changed events, including streams
that are bound to another stream via aliasing.

Change-Id: I2c1717ce632c4cb045c06785cb1ecc531a221ff8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
22b9ee129817f865f69bbcd3d95151c61d2d0ef0 19-Feb-2015 John Spurlock <jspurlock@google.com> AudioService: Fire the mute-changed intent for all changes.

Not merely those coming from explicit mute adjustments.

Change-Id: I79ad7e5800eb0602fd10d966441973800a1c318b
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
5e783732b672e7dc27d89cb9fe945bdf8364c39e 19-Feb-2015 John Spurlock <jspurlock@google.com> AudioService: easier forced camera sound debugging.

- Add mCameraSoundForced to the service state dumpsys output.
- Add a sysprop to opt-in to this behavior for testing. Does
not replace the configuration check.
- Centralize the configuration read in one place.

Change-Id: I83f84394b616f0788029412233ae1412b3cdedf2
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
3ce3725b289dae8ce01ee2e4b43a84424a7c5fbe 17-Feb-2015 John Spurlock <jspurlock@google.com> Use the unresolved stream type for mute checking.

Change-Id: I2eab68727f1d1e6846ad0536ee456daf26f6699e
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7d3cf59227a9bd8f0a5e29a4d82666d971280d92 17-Feb-2015 John Spurlock <jspurlock@google.com> Merge "Volume: Allow dialog to query "muteable" streams."
a9dfbe8b122d746cf8841fe1b13d31e7e0fc9c52 17-Feb-2015 John Spurlock <jspurlock@google.com> Volume: Allow dialog to query "muteable" streams.

Similar to the existing ability to query streams affected
by ringer mode.

Bug:19260237
Change-Id: I76eb5ab6b7c7e3a4d73ac1909289c560194d4fe8
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
7139fdc001ae78c684604419c7bb3669d2bcd839 13-Feb-2015 Eric Laurent <elaurent@google.com> Merge "AudioService: persist volume of ring stream when ringer mode changed"
cdb57aeb0e2c83a887c86da0ca2a890df7f02f41 12-Feb-2015 John Spurlock <jspurlock@google.com> Allow sysui-managed remote volume controllers.

- Relax restriction on audio service calls that assume the volume
ui is systemui, allow calls from a blessed component app.
- Blessed component app service saved in secure settings.
- SystemUI mediates requests to replace the volume dialog, prompts
the user on activation.
- Show a low pri ongoing notification when the volume dialog is
being replaced, to allow user restoration at any time.
- Replace the controller management code in VolumeUI to use a
ServiceMonitor, backed by the new blessed app component setting.
- Add proper zen-related noman client wrappers, make avail to the
registered volume controller.
- Everything is still @hidden, no api impact.

Bug: 19260237
Change-Id: Ie1383f57659090318a7eda737fdad5b8f88737d4
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
9e0d25fb875b436d9de577ecfdae50511b8aa289 13-Feb-2015 Eric Laurent <elaurent@google.com> AudioService: persist volume of ring stream when ringer mode changed

-Originally, when ringer mode changed from vibrate to normal by
adjusting volume from 0 to 1 , volume index will not be persisted.
After device rebooted, volume of ring stream will be restored to 0
-Persist volume index when ringer mode changed

Bug: 18762217

Change-Id: I75fbeaab01d80b8bcee623795f59a9e9f16b9634
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
6156017c2217d0fbbbb03434986250ec6bbd69d8 07-Feb-2015 John Spurlock <jspurlock@google.com> Move AudioService to services.

...and a few dependencies. Move remaining shared items to AudioSystem.

Change-Id: Ib9623ff867678d34977337856bb0156e8cdaeeb5
/frameworks/base/services/core/java/com/android/server/audio/AudioService.java