History log of /frameworks/base/media/java/android/media/AudioService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
61ebf9cd8f0b7bfbad6840bb828f2300beef745d 29-Oct-2012 Eric Laurent <elaurent@google.com> Merge "audio service: make dock audio is off by default" into jb-mr1-dev
f4a8eb22112c534f436357b50f231778c5c15c25 29-Oct-2012 Jean-Michel Trivi <jmtrivi@google.com> No playback and music widget from other user on user switch

On user switch:
- make the current audio focus owner loose audio focus
- clear the remote control display

Bug 7205290
Bug 7307156

Change-Id: I6ebcb94d1d2bae8c57ab98dd7e795b239a981d28
/frameworks/base/media/java/android/media/AudioService.java
5ba0ffa0237a5c300545e4c72591613c6e5b2ed9 29-Oct-2012 Eric Laurent <elaurent@google.com> audio service: make dock audio is off by default

It is better to turn dock audio off by default if the user
has not yet explicitly turned it on from the settings menu.
There is a discoverability issue with current implementation
as we do not launch the settings menu at first dock insertion.
Having audio routed to the dock by default would make the tablet
silent for media content when docked and users will not be directed
to the settings menu.

As the dock audio enable setting is for low end docks only
(analog connection and no jack detection) disabling audio for low end docks
by default does not impact manta and prime docks.

Bug 7302106.

Change-Id: I571f361d41940cfb811f038442ae9ba9c6361d1d
/frameworks/base/media/java/android/media/AudioService.java
7ee1e4ff7346a278a6722108fbc1869240b3e866 27-Oct-2012 Eric Laurent <elaurent@google.com> add settings for dock audio enabled

Add settings dock_audio_media_enabled indicating if dock audio
is enabled for media for docks that do not implement jack detection.

Bug 7302106.

Change-Id: I75766b606ceb870b3f89979c4e3cca88ed197aaf
/frameworks/base/media/java/android/media/AudioService.java
d799db406b0bace285b7a82a468f75887f0308b6 24-Oct-2012 Eric Laurent <elaurent@google.com> AudioService: add fix for corrupted settings

Added correction of MODE_RINGER_STREAMS_AFFECTED setting in
case it is inconsistent when read from the database: ringtone,
notification and system streams are always affected by ringer mode.
A corruption of this setting persists accross reboots and propagates via
backup/restore causing devices to play notification and ringtones in silent mode.

Bug 7384750.

Change-Id: I23170413d01e6a8e34ef514f1516d7b9ab8bc656
/frameworks/base/media/java/android/media/AudioService.java
8d9a1f66d9d3dbbd45a56d441a746ec11dba7645 19-Oct-2012 Jeff Sharkey <jsharkey@android.com> More migration to Global settings.

Bug: 7375796
Change-Id: I3954ce141ad30073896090a28eee743ba15fd736
/frameworks/base/media/java/android/media/AudioService.java
c203ecfd9f6c356542fcb10bc85b27b98b170ddf 11-Oct-2012 Jean-Michel Trivi <jmtrivi@google.com> Use device availability to start WFD audio routing

Don't use the force_use mechanism to start WFD audio routing,
but rather only the availability of the remote submix audio
device. This is matched by a change in the audio policy
manager.

Bug 7318180

Change-Id: I756f032d8ca0375c3dbeddb7c321261c497539bc
/frameworks/base/media/java/android/media/AudioService.java
dd45d01128423a82652a3c9d77fa393631d95229 08-Oct-2012 Eric Laurent <elaurent@google.com> enforce camera sound according to country code

Use mcc config overlay mechanism to enforce camera shutter sounds
in countries where it is mandatory.
Property ro.camera.sound.forced is not needed anymore.
When camera sound is forced, STREAM_SYSTEM_ENFORCED is removed from
streams affected by ringer mode and its volume is
maxed out. AudioSystem.FORCE_SYSTEM_ENFORCED is sent to audio
policy manager to alter the routing policy for STREAM_SYSTEM_ENFORCED.

Also fix streams being unmuted when settings are reloaded
upon user switch while in silent mode.

Add ringer mode to audio service dump.

Bug 7032634.

Change-Id: Iceea5bba3b8d3aabf8e42b222deb33a893dc8f38
/frameworks/base/media/java/android/media/AudioService.java
33902db75011d863009585682bd08560c5b89a75 08-Oct-2012 Eric Laurent <elaurent@google.com> AudioService: fix settings for fixed volume device

Force max volume for devices with fixed volume policy (HDMI, dock...)
when reading the settings from DB. Otherwise, these devices would
get the default volume which is not what we want.

Also fix a problem related to ringer mode management when reloading the
volume settings upon user switch that would cause a muted stream to be
unmuted.

Bug 7301563;

Change-Id: I81cdb97125b845da584ed680181b93c7c1e5903f
/frameworks/base/media/java/android/media/AudioService.java
31fed73701041cd5455942abe2dacfc7639c5370 04-Oct-2012 Eric Laurent <elaurent@google.com> Merge "AudioService: filter flags in volume methods" into jb-mr1-dev
799448bee167c046ed715c7c4e3fe3486bf80d43 25-Sep-2012 Eric Laurent <elaurent@google.com> AudioService: filter flags in volume methods

Strip FIXED_VOLUME flag in setStreamVolume() and
adjustStreamVolume() as this flag is reserved for
framework use.

Bug 4335692.

Change-Id: I507582270f4c4cd631ee81fe50dca895bb6352b3
/frameworks/base/media/java/android/media/AudioService.java
002e9d382d2daa7ed41636463ecdbddbd4897aba 02-Oct-2012 Eric Laurent <elaurent@google.com> audio service: fix system volume settings

STREAM_SYSTEM stream volume is never persisted to settings as
it is always derived from another stream volume (STREAM_RING on phones
and STREAM_MUSIC on tablets). Therefore values stored in settings
are stale from previous releases and should be ignored.

Also fix a problem where a muted stream can be unmuted by
readAudioSettings() even if it is muted by ringer mode.

Bug 7216630.

Change-Id: If23561ddfbc704f89fd0a997faf1b50299a50c2e
/frameworks/base/media/java/android/media/AudioService.java
d640bd325c3be9a350058c835b880a7e0b40dc60 29-Sep-2012 Eric Laurent <elaurent@google.com> enable safe media volume according to country

Enable safe headphone volume feature for all countries that
do not opt otherwise in their mmc configuration.
Opt out for US.

Bug 7231029.

Change-Id: I2619d627508eb2cd1f73db9242e0cb5efa839a2a
/frameworks/base/media/java/android/media/AudioService.java
4bbcc6549738f3d69831b2bd9eb4accec3e9920e 24-Sep-2012 Eric Laurent <elaurent@google.com> Display a fixed volume silder when docked.

Align UI indication to volume policy when docked: the music volume
cannot be adjusted when docked or connected to HDMI. Display
a disabled slider at max volume in this case to be consistent.

Bug 4335692.

Change-Id: I6f8db143b0e2ecf54e4bdacd88afdeb661a98a18
/frameworks/base/media/java/android/media/AudioService.java
bf2e088b008cdc80059b943c3b144ec982963f4e 25-Sep-2012 Jean-Baptiste Queru <jbq@google.com> Merge into jb-mr1-dev

Change-Id: Iba23d16643b8754f6e0a7288b2ca242f722f1bdd
5bfaeaef3fc348d66f48b86be08655e91dff910a 22-Sep-2012 Eric Laurent <elaurent@google.com> pause music playback when switching user.

AudioService sends AudioManager.ACTION_AUDIO_BECOMING_NOISY
intent when notified of a user switch to pause music playback
for all background users.

Bug 7128886.

Change-Id: I6a24409533bf40c517c43da25b9baeceb3379cb8
/frameworks/base/media/java/android/media/AudioService.java
9903e2638a6c502d96413680d3ebae4fb77fc412 22-Sep-2012 Eric Laurent <elaurent@google.com> Volume keys control music volume after music stops

On phones, add a short delay during which volume keys still
control music volume after music has stopped. This is similar
to the tablet behavior for notifications volume.
It allows users to control the prompt volume for talk back,
voice search or navigation even after the prompt has stopped.

Bug 7162364.

Change-Id: Iffbca9ec30ebcbe5846f783ddd260b6e736caf2b
/frameworks/base/media/java/android/media/AudioService.java
f1a457d06c53a901ea08d2d3fb6e766bc06c4d4f 21-Sep-2012 Eric Laurent <elaurent@google.com> Do not turn safe volume on upon headset connection

It is not a requirement to force headphone volume limitation
back on when a headset is plugged in. Only turn it back on
when the device is power off or after 20 hours of cumulative
music listening.

Bug 7064975.

Change-Id: Idabd417a9a9b8096552119c0ff528ba193cfdb5d
/frameworks/base/media/java/android/media/AudioService.java
f9fac2c5fe3f304ee866b1afc3191d36835e96bd 20-Sep-2012 Eric Laurent <elaurent@google.com> Merge "Add multi user volume management" into jb-mr1-dev
bc0fab1fc2db832ef86d8a33466ec4d68b103ca0 19-Sep-2012 Eric Laurent <elaurent@google.com> Add multi user volume management

Notification and Alarm volumes are per user: they are saved and restored
when the foreground user changes.
Media volume is global: it is still saved and restored per user for
implentation reasons but is copied from one user to the next to ensure
media playback volume continuity when switching users.

Ringer mode (silent, vibrate...) is now a global setting.

Bug 7128886.

Change-Id: I9f4f5a0a3985552bca61c2cc3bbe5a144db755a6
/frameworks/base/media/java/android/media/AudioService.java
db45484e4b5858d14da93d3a06311b93bf0cf320 18-Sep-2012 Mike Lockwood <lockwood@google.com> AudioService: Send "becoming noisy" intent when USB accessory audio is disconnected

Bug: 7051259

Change-Id: I5b5fb3ad7c7e38dbf49700d893fd49354eaecf51
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
c34dcc1e1ebf152bb400abbb8bc25f7dc0c3ba97 10-Sep-2012 Eric Laurent <elaurent@google.com> headphone volume limitation

Limit music volume when headphones or headset are inserted.
Display warning message when user wants to increase the volume
above a platform specific volume and request user acknowledgement
before proceeding.

TODO: exact wording of the warning message must be defined by UX.

Change-Id: I00f429f602534c6d8783126b929371c4d432e6e2
/frameworks/base/media/java/android/media/AudioService.java
2ac2afeac989ea1dc326b0db996d6c6c8e00cc29 21-Aug-2012 Jean-Michel Trivi <jmtrivi@google.com> Add support for controlling remote submix audio routing

Add method in AudioManager to control remote submix through
AudioService.
AudioService controls remote submxi: enabling/disabling
remote submix will:
- make the sink audio device available/unavailable
- make the audio source available/unavailable
- force/unforce media streams to be routed to WFD

Change-Id: I05d9cc7c3e8a720318ec1385737cbd46a21a3207
/frameworks/base/media/java/android/media/AudioService.java
73365695e4d169126c6932df8e8e932aefe6aaca 30-Aug-2012 Dianne Hackborn <hackbod@google.com> Merge "Improve multi-user broadcasts." into jb-mr1-dev
5ac72a29593ab9a20337a2225df52bdf4754be02 30-Aug-2012 Dianne Hackborn <hackbod@google.com> Improve multi-user broadcasts.

You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.

Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.

New Context APIs for more kinds of sending broadcasts as users.

Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.

Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.

Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
/frameworks/base/media/java/android/media/AudioService.java
794da7a0543cbecffefb73794aa68d1a93e41adf 30-Aug-2012 Eric Laurent <elaurent@google.com> AudioService: pause music when undocked

Send becomming noisy event also when disconnecting a dock
(analog, digital or USB) or HDMI.

Bug 6760590.

Change-Id: I497df35a3c6817d2b300f532d4cc3f12e3ce9ace
/frameworks/base/media/java/android/media/AudioService.java
1f9196a8e5de9b004e61afabc70b18caf7cf9c7e 27-Jul-2012 Jean-Michel Trivi <jmtrivi@google.com> Relax rules for media apps to stay on RemoteControlDisplay

The playback of notification would make the display of the
RemoteControlClient disappear from the lockscreen.

Fixed by modifying which AudioFocus owner to consider when
reevaluating how the RemoteControlDisplay needs to be updated:
use the first (starting from the top of the AudioFocus stack) that
uses STREAM_MUSIC, or that uses any other stream type for a short
period.

Change-Id: Id7cef00c5eed1f6ebfa59634eea8e2c9b2f3f5eb
/frameworks/base/media/java/android/media/AudioService.java
f2b0c11f4e797e183131261724d8de310dac5431 09-Jul-2012 Jean-Michel Trivi <jmtrivi@google.com> Fix sound effect attenuation calculation

The sound effect volume attenuation calculation is wrong: the
division by 20 was always returning 1 or 0.
In AudioService, rename the sound effect attenuation value to
follow the naming conventions for static variables.

Change-Id: I3c36d50f4470ff09ca98cb944aefb5ad0f968782
/frameworks/base/media/java/android/media/AudioService.java
c390bed06b4a572e273ead1254da9a932e04dce3 03-Jul-2012 Eric Laurent <elaurent@google.com> AudioService: fix a2dp force use delay

Fixed setBluetoothA2dpOnInt() so that AudioSystem.setForceUse()
is called synchronously and not via a message.

This is because the order in which setForceUse() and setDeviceConnectionState()
are executed is important to avoid audio glitches when called from
onSetWiredDeviceConnectionState().

Bug 6720482.

Change-Id: I09c975d1108fd38f31b047c082acdf944ab790a7
/frameworks/base/media/java/android/media/AudioService.java
f98de1e8dd6dcbd191921b4aa07a1d41b0b9db91 20-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Asynchronous handling of remote volume updates

Remote playback information updates will be posted from the
application thread, and sent to AudioService. Because they
require locking the stack containing the remote playback
information, the update should happen on AudioService's handler
thread to avoid lock contention.

Change-Id: Ie04898295e08c16dd8ab5985fd825301e9cf1981
/frameworks/base/media/java/android/media/AudioService.java
1357012968f9066ea3051d83995e9bac69526c3c 19-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Remote volume handling in MediaRouter

Extend MediaRouter.UserRouteInfo to enable setting playback
information, which includes volume. When the user route instance
has a RemoteControlClient, forward any playback information to it.
Enable specifying a callback to be notified of volume events
on the route.
Extend MediaRouter.RouteInfo to enable retrieving playback
information.

Update RemoteControlClient javadoc to reflect which parts of the
API are not intended to be made public.

Change-Id: I59d728eb61747af6c8c89d53f0faeb07940594c3
/frameworks/base/media/java/android/media/AudioService.java
2f4423043ffeaf232ec984be03743326f08cdc8a 19-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Merge "Remote volume handling" into jb-dev
dd0a19266d5c837069da1ea188744d54c8d723a8 19-Jun-2012 Adam Powell <adamp@google.com> MediaRouter bluetooth a2dp selection

Remove bluetooth permission check from internal AudioService method
setBluetoothA2dpOn

Manage BT A2DP state in MediaRouter. A2DP is only enabled or disabled
when either the system built-in audio route or the A2DP audio route is
selected; when selecting any other route the current state is left
alone.

Change-Id: Ib14274e206e79bd8762edca1205ecfa87b7a94cf
/frameworks/base/media/java/android/media/AudioService.java
3114ce3861f20f9a5c2c59dd2629197a1f4874a8 12-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Remote volume handling

Extend RemoteControlClient class to enable an applicaton to
specify more information about how it's playing media, now covering
usecases where media playback happens "remotely". This playback
information can be used to set the volume and maximum volume
used remotely.
Declare a new intent and associated extras in Intent,
ACTION_VOLUME_UPDATE, so an application can be notified that
the volume it handles should be updated. It can then use
the new RemoteControlClient.setPlaybackInformation() method
to notify AudioService what the volume is.
Extend AudioService to maintain playback information associated
with the RemoteControlClient information in the stack of
media button event receivers (mRCStack). The information
about the active remote is cached so the stack doesn't have
to be iterated over in order to retrieve remote playback info.
Events to "adjust" the remote volume based on hardware key
presses cause the client application to be notified of
volume updates, and the volume panel to display the volume
set by the app.
Revise which stream type is controlled when none is specified
according to latest guidelines for remote playback.
Update VolumePanel class to support a new pseudo stream type,
AudioService.STREAM_REMOTE_MUSIC, that corresponds to the
remote playback volume, and uses the new "media route" icon.
Enable it to receive asynchronously new volume values for
the remote that will be displayed if the UI is still up,
and ignored otherwise.
Now supports hiding/showing sliders dynamically so remote
volume only appears when AudioService has a remote control
client handling remote volume.
Define new java symbols for the two media route icons.
Modify lockscreen behavior: don't automatically control music
volume when music is active, consider also remote playback.

Still to do:
- playback information set by RemoteControlClient should post
a message for AudioService to update playback information
instead of updating it synchronously

Change-Id: I557aa687239f9acfe33a609f05876c67fa7eb967
/frameworks/base/media/java/android/media/AudioService.java
632ca417f0a33e3fa9ccece531afa2db3f0d4a30 15-Jun-2012 Dianne Hackborn <hackbod@google.com> Add new callback for MediaRouter to found out about device changes.

The AudioService now has an API to call to get the currently
connected devices, and later reports of changes in connection
state. The information includes the name of the bluetooth
device if one is connected for display to the user, and states
for all of the pluggable devices. No longer requires a Bluetooth
permission to keep the routes updated.

Change-Id: I81ca421c60592fbc1592477d59bf1c9d1b64954a
/frameworks/base/media/java/android/media/AudioService.java
6a5f9f6ddbfcb97a25436ad34be39fc7b3b45168 08-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Merge "Configuration for lock and UI sound levels" into jb-dev
e12c39bb9cedb8b363658979872694eb55b1386e 06-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Always queue A2DP connection state message with wakelock held

Messages for changes to A2DP connection state are intended to be
queued in AudioService after acquiring a wake lock, which is
released after the message has been handled.
This was correctly done for connection messages when the system
is up and running, but wasn't when the BluetoothProfile service
listener gets an onServiceConnected() event, which is the case
the the device boots.
This change correctly uses the queueMsgUnderWakeLock() method
whenever a MSG_SET_A2DP_CONNECTION_STATE is to be sent.

Bug 6616292

Change-Id: Ie337a4641a89c522e2d233bccaac4e08ce324117
/frameworks/base/media/java/android/media/AudioService.java
c55b393efd462490cd5e27fc373bceafdd25662e 05-Jun-2012 Jean-Michel Trivi <jmtrivi@google.com> Configuration for lock and UI sound levels

Define two integers in the platform configuration to
define the sound level for lock/unlock sounds, and
UI sound effects.
Use the corresponding value in KeyguardViewMediator for the lock sounds.
Use the corresponding value in AudioService when playing sound effects.

Bug 6448481

Change-Id: Ie238f5eb1645e395412864d93447ac4049f7e54b
/frameworks/base/media/java/android/media/AudioService.java
2d8dab5a549b25b6f36df4614d7c0166d4d099e2 31-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Handle wakelocks for device connection intents from AudioService

Now that AudioService handles the device connection intents itself,
those need to be sent under wakelock.
The wake lock is acquired when AudioService is notified of the
device connection, and released when the corresponding message
has been handled.
This change only covers the device connection messages, and doesn't
affect the handling of the other AudioService messages.

Bug 6485897

Change-Id: I2d35f5404f097b5adde8af21fd81347bdd5576a6
/frameworks/base/media/java/android/media/AudioService.java
b1fbaaccb656ef09a8770c28df15e3e91a452e64 29-May-2012 Eric Laurent <elaurent@google.com> Send device connection intents from AudioService

AudioService is currently notified of wired headset and A2DP
sink connection states via broadcast intents from WiredAccessoryObserver
and BluetoothA2dpService. This is a problem as there is no guaranty that
AudioService can take actions upon the change before other apps are notified.
For instance, the Play On feature requires the UI to be refreshed when a device
is inserted/removed and we must guaranty that the UI component can read
new A2DP enable state from AudioManager after it receives a device connection state
change intent.

- Added hidden methods to AudioManager so that WiredAccessoryObserver
and BluetoothA2dpService can notify AudioService of device connection directly.
- The wired accessories connection intents are now sent by AudioService.
- The A2DP state change intent is delayed by BluetoothA2DPService when
ACTION_AUDIO_BECOMING_NOISY is sent by AudioService
- ACTION_AUDIO_BECOMING_NOISY intent is not sent when disconnecting A2DP
while a wired headset is present and vice versa.

Bug 6485897.

Change-Id: Ie160b3ee5f451132065530772b868593c90afd94
/frameworks/base/media/java/android/media/AudioService.java
7847211fb4699bf6018e29d214a918ed6657319b 21-May-2012 Eric Laurent <elaurent@google.com> AudioManager: restore setBluetoothA2dpOn() method

Remove deprecation on setBluetoothA2dpOn() method so that applications
can override the default audio policy which is to use A2DP
for media whenever connected.

The request is not persistent and the default policy is restored when a
new A2DP i ro wired headset connection occurs.

Bug 6485897.

Change-Id: I2a4b6b6bdba55f7b133e64f86d27c03eb86acfa4
/frameworks/base/media/java/android/media/AudioService.java
3c2711fc2853394324b044632b79ca67388df8f4 20-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Type of search on headset key long press must depend on device state

When the user long presses on the headset key, the type of search
that will launched must depend on the state of the device. The
following logic is implemented:
- screen on and device unlocked: action is ACTION_WEB_SEARCH,
- device locked or screen off: action is ACTION_VOICE_SEARCH_HANDS_FREE
with EXTRA_SECURE set to true if the device is securely locked.

Bug 6518222

Change-Id: I318770346b8d83e44dfcd4154bcdb517ea7098b5
/frameworks/base/media/java/android/media/AudioService.java
ab624c2fd4f0fad6ba7f422a960942e5a7035cea 17-May-2012 Jeff Brown <jeffbrown@google.com> Use FLAG_LONG_PRESS for headset long press interactions.

Handle canceled key events correctly and don't synthesize
key events in that case.

Unfortunately, the state machine was confused by some sequences
of key events that it might receive from the input dispatcher
when new activities take focus during a long-press on the headset key.
The audio service may receive a cancel event intended for the old
window, followed by a repeated down and finally an up for the new window.
Simplified this down to just two booleans.

Bug: 6484717
Change-Id: I9587d0a5e282419ef4d7c17665940682aacea96a
/frameworks/base/media/java/android/media/AudioService.java
722b808662eb20fa91151f1e3aa05fd911d1d226 16-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Handle media button events during phone calls and when ringing

Add functionality in AudioManager/AudioService to register a
media button receiver for telephony that, when registered, gets
priority for media button key events during a phone call or
when ringing.

Bug 6484717

Change-Id: I0835fc02cb24d06ca59af5a32c3ba0ae93e54442
/frameworks/base/media/java/android/media/AudioService.java
8c78752f2bf786ca3e6f45b9dc6955d3b4bba59c 14-May-2012 Eric Laurent <elaurent@google.com> Implement new volume display policy.

Whenever a stream type is muted, the progress bar in volume panel
is at 0.
If a stream is muted by ringer mode and does not control ringer mode,
the progress bar is disabled.
Pressing VOL- when in vibrate or silent mode resets the last audible
volume of ringtone stream (music strem on tablets) to 0.

VolumePanel implementation:
- Always prefer AudioManager APIs over AudioService APIs when available on both.
- Do not use AudioManager.shouldVibrate() (deprecated).

Change-Id: I57fcb19ada4e8d729b6b41d668496562ebe340c3
/frameworks/base/media/java/android/media/AudioService.java
2d97a70ff8bbac5ea807003d65b64e3b255e82bc 12-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Merge "Start voice-based interactions from headsethook key" into jb-dev
4294b83927f51e5c115ebaafd2e185ba5de91436 01-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Start voice-based interactions from headsethook key

Implement the interception of long-press on keys that
can be used to trigger voice-based interactions (here
only HEADSETHOOK) only if the long-press hasn't been
trapped by the foreground application:
- if the key is not one that is used for voice input, handle
the event as before.
- if the key press wasn't long enough, simulate a delayed
key press.
- if long press is detected, send
RecognizerIntent.ACTION_WEB_SEARCH. Long press duration
is set to 300ms (a typical key press is under 100ms).

Bug 3225090

Change-Id: I5b3adeb91d3c41ccd54d23fdb93d7eaec496eee7
/frameworks/base/media/java/android/media/AudioService.java
8d8176d41b8b8f08435e727f03e43e27a542dcc2 11-May-2012 Mike Lockwood <lockwood@google.com> Merge "AudioService: Fix problem handling USB audio disconnect" into jb-dev
9841818b9a0280abf59343c9e00a2976dbc084fa 11-May-2012 Mike Lockwood <lockwood@google.com> AudioService: Fix problem handling USB audio disconnect

Also broadcast ACTION_AUDIO_BECOMING_NOISY on USB audio disconnect

Change-Id: I46dfcc744df880066aea6bf651334a081c14af0f
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
244820185269991186d07068b92985624cede4a5 10-May-2012 Eric Laurent <elaurent@google.com> AudioService: fix various volume issues.

Fix various issues in adjustStreamVolume() related to stream type aliases
using different ranges.

Always Update last audible index on all streams sharing the same alias.

Add check on setRingerMode() to prevent setting mode to VIBRATE when no
vibrator is present.

Issue 6455831.

Change-Id: Id110e05d2f16e208e1e398922617bf31967b62db
/frameworks/base/media/java/android/media/AudioService.java
3172d5e3e7520a745fa37b71fc1c7bf244b57085 09-May-2012 Eric Laurent <elaurent@google.com> AudioService: synchronized access to volume index

Add synchronization to prevent concurrent accesses to
volume indexes HashMap in VolumeStreamState.

Use ConcurrentHashMap for VolumeStreamState mIndex and
mLastAudibleIndex.

Issue 6421841.

Change-Id: I6dee805a79aa5e2cd0ba4072014a2fcdda4ed507
/frameworks/base/media/java/android/media/AudioService.java
bffc3d1bd33eb2d8e00a9f8b6261d815db503311 08-May-2012 Eric Laurent <elaurent@google.com> Silent and Vibrate mode clean up

Clean up related to new Vibration policy.
The vibrate behavior is now only derived from:
- presence of a vibrator on the device
- current ringer mode selected: NORMAL, VIBRATE or SILENT
If no vibrator is present the ringer mode can only be NORMAL or SILENT.

The control of ringer mode via volume keys when volume keys control the "master"
stream type (RING on phones, MUSIC on tablets) is as follows:
If a vibrator is present:
VOL- and volume equals 1: NORMAL => VIBRATE
VOL- and volume equals 0 and not continuous press: VIBRATE => SILENT
VOL+ and in SILENT mode: SILENT => VIBRATE
VOL+ and in VIBRATE mode: VIBRATE => NORMAL, volume = 1
If no vibrator is present:
VOL- and volume equals 0 and not continuous press: NORMAL => SILENT
VOL+ and in SILENT mode: SILENT => NORMAL, volume = 0

VIBRATE_ON and VIBRATE_IN_SILENT settings are not stored/retreived any more.

AudioService checks and corrects ringer mode and stream volumes if necessary when reading from
DB at boot time.

Also:
Added dump for stream volumes in AudioService.
Added device names missing in AudioSystem for USB accessory and USB device.

Issue: 6036529
Issue: 6414950
Issue: 6448163

Change-Id: I77fb821ec63e4e566320cac2701b4ac466e86aef
/frameworks/base/media/java/android/media/AudioService.java
f26f01784e1c733c53cad3ed31918e73448ce369 26-Apr-2012 Jean-Michel Trivi <jmtrivi@google.com> Make AudioService aware of device orientation changes

If the "ro.audio.monitorOrientation" system property is
defined and true, monitor device configuration changes
and see if the device orientation changed. If it did,
set the "orientation" audio system parameter to one
of "landscape", "portrait", "square" or "undefined".
Set orientation when starting AudioService, and
when media server restarts.

Change-Id: Idce548f93abf3aab30149e5952daaa7051630232
/frameworks/base/media/java/android/media/AudioService.java
94affdd80e20c334dd5bfff170aee878992195ad 01-May-2012 Eric Laurent <elaurent@google.com> Merge "fix unmute from volume panel on tablets" into jb-dev
f740664cd808bebfc35ded46da6002bdc97a1a16 01-May-2012 Eric Laurent <elaurent@google.com> fix unmute from volume panel on tablets

Changing STREAM_MUSIC from volume panel on tablets should exit silent
mode as does changing STREAM_RING on phones.

Issue 5970208.

Change-Id: Ia8ed62033da07a5d4dfcfa84b0b47b27414bdd9a
/frameworks/base/media/java/android/media/AudioService.java
c68022258ebd3dd97a5079ba99f4f3cd12b223b0 30-Apr-2012 Jean-Michel Trivi <jmtrivi@google.com> Optimize how AudioService receives media button events

AudioService maintains a stack of registered media button event
receivers.
This change modifies the broadcasters of ACTION_MEDIA_BUTTON intents
let AudioService directly handle the corresponding key event instead
of trapping the intent sent by PhoneWindowManager, KeyguardViewBase
and PhoneFallbackEventHandler.
Because the key event may be sent through a PendingIntent,
AudioService now also implements the OnFinished interface to be
notified when the event was consumed so it can release the wake
lock held if it was held when the key event needed to be sent
(see where PassHeadsetKey was instanciated in PhoneWindowManager).

Change-Id: I2e8614df94af9d54edbf714ef443cc372d21827a
/frameworks/base/media/java/android/media/AudioService.java
098d580cc2bb6c0891c756a4e5230c6c6b0d2376 27-Apr-2012 Jeff Sharkey <jsharkey@android.com> Migrate ringtone playback to SystemUI.

Introduce IRingtonePlayer, which handles playback for both Ringtone
objects and Notifications. SystemUI now hosts this player, which it
registers with AudioService. It also keeps MediaPlayer instances
warm, and cleans them up after stop() or Binder death.

Move both Ringtone and NotificationManagerService to play back audio
through this new interface.

Bug: 6376128, 6350773
Change-Id: I1dcb86d16ee3c4f07cdb2248d33dcff4ead3609a
/frameworks/base/media/java/android/media/AudioService.java
f5d70fd2add31cdb2e4ca1e931b47db95fa4b3e0 27-Apr-2012 Jeff Sharkey <jsharkey@android.com> Merge "Protect system services with DUMP permission." into jb-dev
6d5176638c2189595cede38fb92c3e7e8700e221 24-Apr-2012 Eric Laurent <elaurent@google.com> system and UI sounds volume policy

Implement a more consistent policy for system and UI sounds (key clicks, lock/unlock,
camera shutter, DTMF, low battery...):
- All system sounds are played over STREAM_SYSTEM stream type.
- The STREAM_SYSTEM volume that was previously fixed now tracks the volume of a "master"
stream type. This "master" stream type is STREAM_RING for phones and STREAM_MUSIC for
tablets which corresponds to the stream whose volume is modified by default by the volume
keys.
- The STREAM_SYSTEM volume ranges from -24dB to -6dB (-24dB to -12dB over headphones) when the
"master" stream volume ranges from its min to its max.
- DTMF tones are played over STREAM_DTMF that tracks the "master" stream volume in the same
manner with the following exception: when in call, DTMF stream tracks STREAM_VOICE_CALL volume.
- Camera shutter sound is played over STREAM_SYSTEM_ENFORCED stream that tracks the "master"
stream volume except in countries where regulation enforces this sound. In this case
its volume is fixed and cannot be muted.
- Low battery sound is played over STREAM_SYSTEM and therefore has a tunable volume and is
heard while in call.

Issue 6344620.
Issue 6069229.
Issue 6213100.

Change-Id: I53a237878ead596e706c5dbbb1420e62cde32bd7
/frameworks/base/media/java/android/media/AudioService.java
eb4cc492c93ab9635dde78b958a834120412e72a 27-Apr-2012 Jeff Sharkey <jsharkey@android.com> Protect system services with DUMP permission.

Change-Id: I5e53859f8b8e5473e54eca43ebd7de841f1a05ff
/frameworks/base/media/java/android/media/AudioService.java
45c90cefd13a03b852bb4b8da4be218876cbbb32 25-Apr-2012 Eric Laurent <elaurent@google.com> Fix AudioManager.forceVolumeControlStream()

AudioManager.forceVolumeControlStream() is used by VolumePanel to temporarily force the
stream type which volume is controlled by volume keys.

Current implementation is not working if the VolumePanel is not executed by the same process
as the one receiving the volume key events.

Issue 6302421.

Change-Id: I2700587a027ffb962429b42083312cd92fe79215
/frameworks/base/media/java/android/media/AudioService.java
59f482764e346a5c5ac118ee1f7b24da645c2559 06-Apr-2012 Eric Laurent <elaurent@google.com> Added support for USB audio devices

Two types of USB audio devices are defined:
- USB audio device: the audio device in USB device mode while
the Android device is in USB host mode.
- USB audio accessory: the audio device in USB host mode while
the Android device is in USB device mode.

Renamed intents for analog and digital docks to avoid confusion:
- ACTION_USB_ANLG_HEADSET_PLUG to ACTION_ANALOG_AUDIO_DOCK_PLUG
- ACTION_USB_DGTL_HEADSET_PLUG to ACTION_DIGITAL_AUDIO_DOCK_PLUG

Factorized code in AudioService broadcast receiver.

Change-Id: I1b6d0257a9d68ecb9495c78c98bac8c67fec7891
/frameworks/base/media/java/android/media/AudioService.java
1c35d117f01b5a6f66b82c57eb29350f16694070 05-Apr-2012 Justin Koh <justinkoh@google.com> am db9b114b: Merge "Adds flag argument to setMasterMute." into ics-aah

* commit 'db9b114b2e1f9c2034c3cd6df00245b039d90c28':
Adds flag argument to setMasterMute.
0273af55cf68d54d26d154b44d105d40fed79701 05-Apr-2012 Justin Koh <justinkoh@google.com> Adds flag argument to setMasterMute.

Adds flag argument to setMasterMute. This allows third parties to edit it
without showing the UI, for example.

TESTED = runs on Tungsten.

Change-Id: Idfd99a2476e60059cd93c9dfe07d03a389c3f5f5
/frameworks/base/media/java/android/media/AudioService.java
75cf9e19a575c28c200c02c0ab6f83bb79f5c50d 05-Apr-2012 Justin Koh <justinkoh@google.com> Fix the build.

Change-Id: Ibe818df8f360837688f12533cf0ac22ef89a8439
/frameworks/base/media/java/android/media/AudioService.java
6a8096d7d56ce4c65318f283ef666993f3020745 04-Apr-2012 Justin Koh <justinkoh@google.com> resolved conflicts for merge of bff6a514 to master

Change-Id: I741d5ab8ed0ce25a27330ffb55ba210534d11c3d
57978ed86286a33d5b1a0fd000ca3406ba9d87b3 04-Apr-2012 Justin Koh <justinkoh@google.com> Persists the master mute volume setting.

Persists the master mute volume setting across reboots.

TESTED = runs on Tungsten.

Change-Id: I9628b9369ca528b22413f62a9e7d697bae61d8ac
/frameworks/base/media/java/android/media/AudioService.java
b5f2088c8ebc3d880dac2141df19a57053b7bae0 03-Apr-2012 Mike Lockwood <lockwood@google.com> Merge commit '7f71d01'
3e29718d34eba7c6c455fa6bb622856fe651876e 03-Apr-2012 Mike Lockwood <lockwood@google.com> Merge commit '830ad08'
3caba517253d1703fc29b50740c4567b932279fb 03-Apr-2012 Justin Koh <justinkoh@google.com> Broadcast mastervolume regardless of change.

Broadcast mastervolume intents regardless of whether the system changed the
volume. This fixes the bug where the volume LEDs stop getting updates.

TESTED = runs on Tungsten.

Change-Id: Id363da3f825934fd7785ed3d3e436f74e657b7e6
/frameworks/base/media/java/android/media/AudioService.java
45edba1b8b0377dfe70a4f2b0afb0f04dd8e1ee9 28-Mar-2012 RoboErik <epastern@google.com> b/6232528 Reduce volume persist delay to 500ms

Change-Id: I45c32da0a1089ce8bc865e12b51c069a6db28fd4
/frameworks/base/media/java/android/media/AudioService.java
6c798970ccb8759d1e613b57111daa8da0ab44c7 02-Mar-2012 Lei Zhang <rzhang@google.com> Add batch volume adjust support to adjustMasterVolume() in AudioManager and
AudioService.

Change-Id: I09b1dfc93f14ca836e1ba2a400c00caed01fd541
/frameworks/base/media/java/android/media/AudioService.java
24b082f87e96c00d5c17d60c735423900be40e70 24-Feb-2012 RoboErik <epastern@google.com> Fix Audio ramping code

The audio ramping was being ignored and we were always adjusting
by the same amount.

Change-Id: Id4a6587fd488132816ae26776c0f798782470b1d
/frameworks/base/media/java/android/media/AudioService.java
9ac8d0c445a3ccde40c05f0f3ad0ec4e8265d4c6 07-Mar-2012 Eric Laurent <elaurent@google.com> AudioService: fix system stream muted by restore

Releases prior ICS (included) would persist the stream volumes in the
database when muted by silent mode. If the DB was backed up while in
silent mode, stream volume was backed up at 0.
When restored on a new device, the volume was restored at 0 which was
a problem for SYSTEM stream because it would never be corrected as
this stream volume is fixed.

Added a check on valid volume values when reading settings from the DB
and correct the DB if this happens.

Change-Id: Ie3b98eb74e10413c22aab7568b83ac3ace5bfc07
/frameworks/base/media/java/android/media/AudioService.java
d674dd50b7caf57aa8c9e7e4bc75c92d5f576167 02-Mar-2012 Lei Zhang <rzhang@google.com> Add batch volume adjust support to adjustMasterVolume() in AudioManager and
AudioService.

Change-Id: I34382839622a5cc5f2a8768aed011e8224cadff9
/frameworks/base/media/java/android/media/AudioService.java
1918d4353cb05fdfc59bf6244f06c5bb25102b3f 24-Feb-2012 RoboErik <epastern@google.com> Fix Audio ramping code

The audio ramping was being ignored and we were always adjusting
by the same amount.

Change-Id: I1dc122e033c382f556844c5acadcfb698c8d2092
/frameworks/base/media/java/android/media/AudioService.java
98ad9b9d6fd34aad487933170f50b5519313df61 16-Feb-2012 Eric Laurent <elaurent@google.com> Fix music volume regression on tablets

A regression was introduced by the change enabling per device volume:
music volume will not be completely silenced even if volume is shown at 0.

The problem is that when media volume goes to zero, silent mode is entered and
AudioService sends one message per stream/per connected device to the audiosystem
handler to mute volume on each stream. As those messages were sent with the
SENDMSG_NOOP attribute, some of them where lost.

Change-Id: Ic665b1e9dcaf09506a4ec19bf3fe6997d4b071fd
/frameworks/base/media/java/android/media/AudioService.java
9760647dd0ee67e7c20f3e9d661d2006b1df0b54 09-Feb-2012 Mike Lockwood <lockwood@google.com> Add support for non-linear ramping of master volume adjustment

Bug: 5472584

Change-Id: I1227007d1563eca739fb78b6d9595febc04a3f03
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
1ce5b26d707e0086e09af3cd0428f1b441145261 02-Feb-2012 Jason Simmons <jsimmons@google.com> Only send master volume or mute updates if the settings have changed
/frameworks/base/media/java/android/media/AudioService.java
9063154a793b0ab38b3c5992cbaed046427b4a82 06-Jan-2012 Mike Lockwood <lockwood@google.com> Restore persisted master volume if the media server restarts

Bug: 5755071

Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
b7bd88a3b6d4a34f8dd59c41fb8ed55135840069 05-Jan-2012 Mike Lockwood <lockwood@google.com> Don't allow changing master volume when muted

Bug: 5793021

Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
5c55a051ad7d86a464fb91426f1ea3c0250e38b3 15-Dec-2011 Mike Lockwood <lockwood@google.com> Defer persisting master data to avoid excessive database writes

Bug: 5705192

Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
3194ea94348bce8e7ee9f803698d877f46f8279a 07-Dec-2011 Mike Lockwood <lockwood@google.com> Remove reference counting and client death notification for master mute

The use case for master mute is to toggle it on and off from a
KEYCODE_VOLUME_MUTE event, so this was unnecessary and prevented unmuting
in certain cases

Bug: 5724755

Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
0dc37cce9d564ae43883c8dc8672b9266b881e63 01-Dec-2011 Mike Lockwood <lockwood@google.com> AudioService: Send broadcasts when master volume and mute state change

Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
ce952c8e13c535bedde77bcdb94dfcc7508475aa 14-Nov-2011 Mike Lockwood <lockwood@android.com> AudioManager: Add support for master mute

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
4767690f09ea3447b8c5c32fb28d27650aa18e00 08-Nov-2011 Mike Lockwood <lockwood@android.com> AudioManager: transparently convert volume settings for other streams to master volume if config_useMasterVolume is set.

This allows Music2 and other media apps to control master volume without changing their code

Bug: 5567694

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
8dc1dabd254249b7ddb8743e88fdb96580ffc585 27-Oct-2011 Mike Lockwood <lockwood@android.com> VolumePanel: Add support for master volume

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
8517e46f3d3c2ce11de09aa849a8533ffc1a2026 25-Oct-2011 Mike Lockwood <lockwood@android.com> Save and restore master volume in the settings provider

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
cbdb49dc5e1b993a0bc5c68dbfb9486bfa0cd762 20-Oct-2011 Mike Lockwood <lockwood@android.com> Simple master volume support

Still needs integration with Settings (for persistence) and VolumePanel UI.

Change-Id: I9eca92c4b1ef2df2564411006a35753ab9618dce
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
0e8392e1dc1c023cb4d14a10778ae9cca44aac86 09-Feb-2012 Mike Lockwood <lockwood@google.com> Add support for non-linear ramping of master volume adjustment

Bug: 5472584

Change-Id: Id75f8835f6693ae3fcb7ca451ada01f22faba1aa
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
a477bab9c3aec3cd48b633c321dcefb0d7d3f400 02-Feb-2012 Jason Simmons <jsimmons@google.com> Only send master volume or mute updates if the settings have changed

Change-Id: If12ec3b7a4b4bf5165d7538013759f07a845d8c4
/frameworks/base/media/java/android/media/AudioService.java
30c918ce7fbe171944b28fc91b3f22b3d631872d 11-Nov-2011 Glenn Kasten <gkasten@google.com> Use final on new member variables

Use final for member fields initialized to a new and that are never modified.

Change-Id: I042352c7bc21879613e7a50b1205b6923f8083cf
/frameworks/base/media/java/android/media/AudioService.java
4dd3674e517051f130fef36d2eb201c68ff61094 24-Jan-2012 Jean-Michel Trivi <jmtrivi@google.com> Bug 5567648 disassociate audio mode and audio focus

Don't automatically change the audio focus when
the audio mode changes. This is best handled by the
applications that change the audio mode so they
can address their usecases as they please (for
instance to define the behavior when switching calls).
Replaced the implicit "mode to focus" behavior with
two methods to request and abandon audio focus. These
methods are only to be used by the framework, and maintain
the logic in AudioService to prevent other apps to request
audio focus during a call.
A susequent change will update com.android.internal.telephony.CallManager
to take advantage of these two methods.

Change-Id: If84ebd508e985083e8cac82ece44940c72b5c669
/frameworks/base/media/java/android/media/AudioService.java
9bc8358ddaa01c3490f9709991989633a6a3dd42 19-Nov-2011 Eric Laurent <elaurent@google.com> audio framework: manage stream volume per device

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

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

Change-Id: I61ef1c45caadca04d16363bca4140e0f81901b3f
/frameworks/base/media/java/android/media/AudioService.java
5c17a820f9e46e0756c11795b3e6f89105f2f539 30-Nov-2011 Glenn Kasten <gkasten@google.com> Audio Java doc comment typos and minor changes

Change-Id: Id6ea6dccb8054c9f05db9a9c045387ce813659e6
/frameworks/base/media/java/android/media/AudioService.java
13f94dc5bdea85608cb2f9bded4e390389d40c0c 09-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Fix race conditions related to ringer mode"
0b8afdac736fcbc0b2ef7f39264fe5077d88b996 06-Jan-2012 Mike Lockwood <lockwood@google.com> Restore persisted master volume if the media server restarts

Bug: 5755071

Change-Id: I6934276049b4a9d713bb4754aa3bb2cd3b898604
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
d10a663be6e7f88fe855a0a9266af85f5a07d146 05-Jan-2012 Mike Lockwood <lockwood@google.com> Don't allow changing master volume when muted

Bug: 5793021

Change-Id: If93a41c4e61f1bc730759e77ee5b5f8165025c42
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
afbb047c3945e9c2b7e9bc6b25098d5fb80bba4e 15-Dec-2011 Eric Laurent <elaurent@google.com> AudioService: simplified handler messages.

For historical reasons, messages to the AudioSystem
handler in AudioService have a complex identifier combining several information.
Messages for a particular stream contain the stream type as part of the message type.
This complexity is not needed as the stream messages also carry a reference to the
VolumeStreamState object which contains all necessary information, including the stream type.

Also grouped parameters of MSG_PERSIST_VOLUME message into a single bit field to make room for
further needs.

Change-Id: Ia27af626b3447541e8f9eaceba21389a824d88e2
/frameworks/base/media/java/android/media/AudioService.java
c239379c0ce19bf1cbd8aaea9faacbbffeccb984 16-Dec-2011 Mike Lockwood <lockwood@google.com> AudioService: remove logging from adjustMasterVolume that was left in by mistake

Change-Id: I75c430d2c50c4cab3b6207efab5a6f11aed728d2
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
f9113d311b33a14b324a02e3310185af582a7882 15-Dec-2011 Mike Lockwood <lockwood@google.com> Defer persisting master data to avoid excessive database writes

Bug: 5705192

Change-Id: I252bd72ff72ef4a40174d4597059e89691acb34f
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
b782e8d71e693984cc5236f1cf08e0c3c11a4050 13-Dec-2011 Joe Onorato <joeo@google.com> logging

Change-Id: I6fde5617365f479884937615e0d3f0f4ecc2dc14
/frameworks/base/media/java/android/media/AudioService.java
ba195ebc76f23b6679443724ab58c9dc9f2df884 13-Dec-2011 Glenn Kasten <gkasten@google.com> Fix race conditions related to ringer mode

Consistently protect all reads and writes of mRingerMode by mSettingsLock.

Change-Id: I72675ff9009880cc212616f0f79f809a28eb6bff
/frameworks/base/media/java/android/media/AudioService.java
a8f4e8359531a2bbfd0ff7db86676937fdf20a65 07-Dec-2011 Mike Lockwood <lockwood@google.com> Remove reference counting and client death notification for master mute

The use case for master mute is to toggle it on and off from a
KEYCODE_VOLUME_MUTE event, so this was unnecessary and prevented unmuting
in certain cases

Bug: 5724755

Change-Id: I041a112cd39e1c00dcae27e2266a95ce225e9b64
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
52cb1da2c6567be55274ef2d9035e29ae27a31aa 07-Dec-2011 Amith Yamasani <yamasani@google.com> am f3364080: Merge "New and improved silent mode on lockscreen." into ics-mr1

* commit 'f336408000c4be36045401fb4df89528249e7383':
New and improved silent mode on lockscreen.
9c316f3c6ac785fd27be97a119dfe8f1303a8ed4 07-Dec-2011 Amith Yamasani <yamasani@google.com> am d49ec62c: am f3364080: Merge "New and improved silent mode on lockscreen." into ics-mr1

* commit 'd49ec62cfb0469c39f2b5d79cbf2a6f69cceb7d7':
New and improved silent mode on lockscreen.
6243edd818b84adfbe712d5d233d6414b33653ac 06-Dec-2011 Amith Yamasani <yamasani@google.com> New and improved silent mode on lockscreen.

3-state item to toggle between Silent/Vibrate/Ringer in long-press power menu.
No volume dialog on lockscreen, unless Power menu is up.

Set VIBRATE_IN_SILENT=1 when upgrading device.

Change-Id: I097d216f96c4abdbd83420e0c477106951b3607d
/frameworks/base/media/java/android/media/AudioService.java
3309386a1b62095ab91b5efe4e8aa5dbd8ea5066 01-Dec-2011 Mike Lockwood <lockwood@google.com> AudioService: Send broadcasts when master volume and mute state change

Change-Id: I7eb5041f0c14f419317e29ea6fa7faa9159cf165
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/base/media/java/android/media/AudioService.java
89972657bd7fdd9def17fe75e2529865b2369722 03-Dec-2011 Amith Yamasani <yamasani@google.com> am f8dad0b3: am afd01086: Merge "Further volume improvements." into ics-mr1

* commit 'f8dad0b37d9aa2476ef3ab84b9f4a7a9f4c960e4':
Further volume improvements.
54a796259055a633ec74afed0dce2327e5a86d51 02-Dec-2011 Amith Yamasani <yamasani@google.com> am afd01086: Merge "Further volume improvements." into ics-mr1

* commit 'afd01086795c7c1f6950a709180b2361625b8b6a':
Further volume improvements.
afd01086795c7c1f6950a709180b2361625b8b6a 02-Dec-2011 Amith Yamasani <yamasani@google.com> Merge "Further volume improvements." into ics-mr1
ee07e110d92005f9dbd317a23721d9b7c9a5ed37 02-Dec-2011 Eric Laurent <elaurent@google.com> am 6cfa9e6c: am 0d3a2e93: Merge "AudioService: strengthen A2DP device detection" into ics-mr1

* commit '6cfa9e6c507a721f647518569c89db9560056079':
AudioService: strengthen A2DP device detection
c1f069bb40f45b38684997fcfceb35be6e037665 02-Dec-2011 Eric Laurent <elaurent@google.com> am 0d3a2e93: Merge "AudioService: strengthen A2DP device detection" into ics-mr1

* commit '0d3a2e93394efa4729e5c29ff4515f9f2644b8c3':
AudioService: strengthen A2DP device detection
2ef6f1bb5603c2e221191117695725237f49a5d5 01-Dec-2011 Amith Yamasani <yamasani@google.com> Further volume improvements.

- Remove silent mode from Power menu
- Show volume dialog on lockscreen
- Allow beeps when adjusting volume in lockscreen

Bug: 5586083
Change-Id: I93052a8ec5004c784f20e04488af9382d495e711
/frameworks/base/media/java/android/media/AudioService.java
6bc7f2cd30b6bd90806942b0722e22daa2108493 30-Nov-2011 Eric Laurent <elaurent@google.com> AudioService: strengthen A2DP device detection

If the intent BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED is broadcast
before AudioService is started, The A2DP device connection is never detected
by the audio framework resulting in audio not being routed to A2DP unless the device
is rebooted or the A2DP headset reconnected.

Make sure that A2DP device connection state is sampled when
boot completed event is received.

Issue 5665159

Change-Id: I04d82020afc00af28c5ea0bb9879ed55bcc9b6f3
/frameworks/base/media/java/android/media/AudioService.java
47a0a8832f819b3b55c503aa787d615f036b7100 16-Nov-2011 Mike Lockwood <lockwood@android.com> Merge "AudioManager: Add support for master mute" into ics-aah
29270da5f7dee7e81b9d69446c7d2030aea6ff74 16-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am 4978c1a5: am 0ddb0143: Merge "Fix 5623252 unlink to death of audio focus client early" into ics-mr1

* commit '4978c1a5b07782d622ca9e3eedd649a5927d226f':
Fix 5623252 unlink to death of audio focus client early
08b2d32628d6c6230493dfcfdeafa219248f2ee5 16-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am 0ddb0143: Merge "Fix 5623252 unlink to death of audio focus client early" into ics-mr1

* commit '0ddb0143895b816d4ff5c174b346390e07f26556':
Fix 5623252 unlink to death of audio focus client early
e7edc868538e83152e7bc35c830fee0d629baefc 16-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5623252 unlink to death of audio focus client early

When removing an entry in the audio focus stack, don't wait for
this object's finalizer to unlink to the death of the associated
client, and unlink right away.
The FocusStackEntry.unlinkToDeath() method is made safe to call
by catching the exception it can throw inside its body.

Change-Id: Id347a933d72dcb41531adff2854fb00277032cc9
/frameworks/base/media/java/android/media/AudioService.java
eb80b31b5548650675c078ccfffc3091402a9382 15-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am 87597d9c: am 538dc6ac: Merge "Fix 5615747 Don\'t leak remote control client death handlers" into ics-mr1

* commit '87597d9ce00691f05703f728c17548df2bbc9cc2':
Fix 5615747 Don't leak remote control client death handlers
cfbcd3bf21c8453e9afd7740fdb7fc272c362389 14-Nov-2011 Mike Lockwood <lockwood@android.com> AudioManager: Add support for master mute

Change-Id: I98e87d1e266e0523c4aacb23cc5c4b3fdc7a1eac
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
0dba46f9b295ad1ec1cbeda0fd28d90624028816 15-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am 538dc6ac: Merge "Fix 5615747 Don\'t leak remote control client death handlers" into ics-mr1

* commit '538dc6acfd14ea59f0b294531f9417ca04ca621f':
Fix 5615747 Don't leak remote control client death handlers
a9509736c85c19fe4ad4ba97a0545f0422a3dfc1 15-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5615747 Don't leak remote control client death handlers

Whenever a remote control stack entry is GC'd or removed from
the stack, unlink its death handler.

Change-Id: Ia4ed6667351849fd388272591e24ffc16959beaf
/frameworks/base/media/java/android/media/AudioService.java
f1ec32db686586eddd023583e1c5978005c06d58 14-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am 9d36a995: am 258576a8: Merge "Fix 5607938 AudioFocusDeathHandler leaks GREF" into ics-mr1

* commit '9d36a99582518ed1a7fb005382e0128479b43e18':
Fix 5607938 AudioFocusDeathHandler leaks GREF
09d936feb886502c5dd78497dc0c5fd578751a9d 14-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am 258576a8: Merge "Fix 5607938 AudioFocusDeathHandler leaks GREF" into ics-mr1

* commit '258576a82c2293c3a988bf2dc6744fd8082421f9':
Fix 5607938 AudioFocusDeathHandler leaks GREF
527c44e8a455dd0fdef1aeb6d7d8f99bb0839295 14-Nov-2011 Glenn Kasten <gkasten@google.com> Merge "Don't check return value of new for being == null"
de1f065be109e1c313d8330c8e34210fedaac74e 12-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5607938 AudioFocusDeathHandler leaks GREF

The AudioFocus death handler was correctly updating the audio
focus stack when an audio focus client dies, but the death handler
was leaking GREF if unlinkToDeath() is not called.
The fix consists in making sure unlinkToDeath() is always called
by calling it in its finalizer.

Change-Id: I0c5343b4986ab582cadbf171fc53816952dc16f5
/frameworks/base/media/java/android/media/AudioService.java
62b9aec7a0a4e1cf8cfec7e39ea3103ab510d72e 07-Nov-2011 Glenn Kasten <gkasten@google.com> Don't check return value of new for being == null

new either succeeds or throws an exception

Change-Id: I1615e10c4f6730495c49e56b64714a00141ea8ff
/frameworks/base/media/java/android/media/AudioService.java
43f7bbdfbb26f9938e74558f2c1bf2260ec50fdf 10-Nov-2011 Eric Laurent <elaurent@google.com> am 7c61fa70: Merge "Fix problems in tablet silent mode." into ics-mr1

* commit '7c61fa70a50e15466f807dd194e530bc4fd3a96a':
Fix problems in tablet silent mode.
96a33d1caad2fab0bc28891cfbf553f4b050bf0b 08-Nov-2011 Eric Laurent <elaurent@google.com> Fix problems in tablet silent mode.

Do not enter silent mode when ALARM stream volume is changed
to 0 by volume down key: Only RING, NOTIFICATION and MUSIC
streams control silent mode.

Report correct volume (0) for NOTIFICATION stream when silent mode
is entered by changing NOTIFICATION stream volume to 0 with
volume down key.

Change-Id: I3e0816dfae40bc127cc30cca02cdca6ec19e30a4
/frameworks/base/media/java/android/media/AudioService.java
a2aa08e20cb4f1e302bb7ae05882cd1be8cfa0d2 08-Nov-2011 Mike Lockwood <lockwood@android.com> AudioManager: transparently convert volume settings for other streams to master volume if config_useMasterVolume is set.

This allows Music2 and other media apps to control master volume without changing their code

Bug: 5567694

Change-Id: I48b6260b193b22c395be5a31cd1d270b2929a91e
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
4528548a06224382ee4c9cb575c8b10ae9f02f1e 01-Nov-2011 Eric Laurent <elaurent@google.com> am cd84197a: am 6e91e5b6: Merge "Fix volume indication in vibrate mode." into ics-mr0

* commit 'cd84197ac1226432de2e13c8fd678a4c88511e0f':
Fix volume indication in vibrate mode.
8ca9a1cf350bde9a429b8a6fe7c673b964048a54 31-Oct-2011 Eric Laurent <elaurent@google.com> Fix volume indication in vibrate mode.

The latest change in silent/vibrate mode selection via volume keys
was such that ringtone volume was not showing 0 when entering vibrate mode
by continuous press on vol down.

Issue 5530217.

Change-Id: I9ba817648e5dca40e0d19f5f606d7763ae61b1c6
/frameworks/base/media/java/android/media/AudioService.java
92537e6ff21d4b20738fae851c2174ea568eb843 31-Oct-2011 Ed Heyl <ed@google.com> merged by hand (services/java/com/android/server/PowerManagerService.java needs to be reviewed)

Change-Id: I86d1111d86cd1646ebc8a88d58aa393089e9f928
c696a53d1fe4d61373c5dc64dd057d322da90c8f 29-Oct-2011 Amith Yamasani <yamasani@google.com> Bring back the old-style Ring/Vibrate/Silent states when using volume keys.

In order to completely mute the ringer (no vibrate), introduce an extra
state beyond mute, which mutes the vibrator as well, if it was enabled.

Bug: 5530217

Change-Id: Ib1f299ee6bbca56c1aa7e1100662591362d08307
/frameworks/base/media/java/android/media/AudioService.java
5020e7e2d37865da862846b97d9959e83244a35e 27-Oct-2011 Mike Lockwood <lockwood@android.com> VolumePanel: Add support for master volume

Change-Id: I3119eb2b7d3b5e7ce87f1660b50c10ab79c7bbdf
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
619f06444bc828c6cf5c3fa4f4a309c9497dab45 25-Oct-2011 Mike Lockwood <lockwood@android.com> Save and restore master volume in the settings provider

Change-Id: I135c48155c41735c870e3934469c47f05bd74973
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
dff25597a9a862143c69e70e6ed86790538c23c1 25-Oct-2011 Mike Lockwood <lockwood@android.com> Simple master volume support

Still needs integration with Settings (for persistence) and VolumePanel UI.

Change-Id: I9eca92c4b1ef2df2564411006a35753ab9618dce
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
b024c30a80684ac08daef3137b7ba0d347fe3ce5 15-Oct-2011 Eric Laurent <elaurent@google.com> Fix issue 5462427: Volume should never be 0 ...

Make sure that ring or notification volume index
never reaches 0 unless in silent mode.
Conversely, enter silent mode when this volume is set to 0.

Change-Id: Iff5e5e972b607f4736e7a704b26b2dadb40074b0
/frameworks/base/media/java/android/media/AudioService.java
950e8cb40a6d826af4cc2eef9d3908c1b70486e6 13-Oct-2011 Eric Laurent <elaurent@google.com> Indicate screen off condition to audio framework.

Add a mechanism for AudioService to notify audio framework and audio HAL
that screen is turned on or off. This indication can be used by lower
audio layers to trigger low power audio playback mode.
Current implementaiton based on setParameters() method is experimental
and will be replaced by a different interface when ready.

Change-Id: Ie72ada0a8edec3d71b47681b9f51cb5bc839d45b
/frameworks/base/media/java/android/media/AudioService.java
7ff866e8cf43afc64111e98863dab549b57447b4 14-Oct-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5153611 remove remote control client/display log from AudioService

Do not log debug messages for the RemoteControlClient and
IRemoteControlDisplay related features.

Change-Id: I81bfeec1770f81b78b679dc03fb40806393b170a
/frameworks/base/media/java/android/media/AudioService.java
26b3d1ff38998c7cb80a2950da0589ebd8510897 28-Sep-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 5357295 NPE on display when remote control client dies

When a IRemoteControlClient dies, that client is set to null
in the stack of remote control entries (mRCStack). This is done
by calling registerRemoteControlClient() with a null client.
The bug is that registerRemoteControlClient(), after storing
the new client, uses it to let it know what the current
remote control display is. When that display is non null, the
client is sent the current display. So when a client died
when there was a display, the client reference was accessed
in the part of the method where we haven't yet checked whether
it is null or not.
The fix consists in moving the setting of the display on the
client (method plugRemoteControlDisplay) only after having
checked that the client is non-null.

Change-Id: Ic74d6cba9e3a3a16e78cd80a1ae5901abfeb3905
/frameworks/base/media/java/android/media/AudioService.java
f0cff0456258478ba768097f73d4367ab67fd7a3 15-Sep-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5300223 RemoteControlClient uses PendingIntent for media button events

Update the implementation of the RemoteControlClient / Display
feature rely on PendingIntent as provided in the construction
of the RemoteControlClient instance.
The ComponentName that describes the target of the media button
events is set as the target of the Intent from which
a PendingIntent is constructed.
This ComponentName is still saved in the stack for persisting
the last media button event receiver.

This CL also updates the lockscreen IRemoteControlDisplay
implementation to use the PendingIntent supplied by the
application when sending transport control events. A (good)
side effect of doing this is that intent will be directly
targeted at the application.

Restoration of the media button event receiver
after reboot is not fully functional yet.

Change-Id: I2be82f2839e9dee1de02512437b3fb41cc386cde
/frameworks/base/media/java/android/media/AudioService.java
d7454be47f4111c0478a502353e11dea401378bd 14-Sep-2011 Eric Laurent <elaurent@google.com> Issue 5044873: Pb with BT SCO AudioManager API

Do not identify the SCO connection client by the binder interface
passed when starting the connection as this binder changes if the
AudioManager proxy changes. Use the client PID instead.

This solves an issue with gTalk starting a SCO connection from one
AudioManager proxy and then changing audio mode from another thus
terminating the previously started SCO connection.

Change-Id: Ia3067fecc551fc15df3bf75ce0c43d181859e4f0
/frameworks/base/media/java/android/media/AudioService.java
9f103de83f2d5d472960dcf1401e95b2ab57a477 09-Sep-2011 Eric Laurent <elaurent@google.com> Fix issue 4673378: switching from VoIP to GSM call

The problem is that any app can change the audio mode and override
a mode previously set by another app. If two apps (gTalk and Phone) compete
for audio mode ownership, there is no mechanism to maintain coherency
in the actual audio mode selected.

Added a mechanism in AudioService to manage an audio mode request stack.
Any app requesting a mode different from NORMAL enters at the top of the stack
and the requested mode is applied. When an app sets mode back to NORMAL, it exits
the stack and the new mode corresponding to the request at the top of the
stack (if any) is applied.

Change-Id: I68d1755d0922f680df4a19bfc5ab924f5a5d8ccd
/frameworks/base/media/java/android/media/AudioService.java
671db6f3ba1fdb3c907e0735fe6d0d284f5c34de 07-Sep-2011 Marco Nelissen <marcone@google.com> Fix startBluetoothSco race

Change-Id: I8b711bd3c6b12f2e3e92144c0dadac72261bf914
/frameworks/base/media/java/android/media/AudioService.java
dca56b9432e2cc851d1a58920071fed2e1e3d142 02-Sep-2011 Eric Laurent <elaurent@google.com> Fix issue 5252593: any app can restart the runtime

Replace null device address string by empty sting.

Change-Id: I285c35f3345334e6d2190493b1a8a5aca1a361a4
/frameworks/base/media/java/android/media/AudioService.java
a6ec356d2f5d2829fd8eff315a37f49501eac842 01-Sep-2011 Jean-Michel Trivi <jmtrivi@google.com> Merge "Fix 5243349 RemoteControlDisplay incorrectly updated"
b716f0b7b2d8e4b045843fc6a7004910eb344c19 01-Sep-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5243349 RemoteControlDisplay incorrectly updated

This fixes a case where the RCD would display transport control
for a RemoteControlClient that didn't have audio focus.
This was happening because registering an RCD was directly calling
the updateRemoteControlDisplay method, without first calling
the checkUpdateRemoteControlDisplay method which verifies the
conditions before updating the display. One of those conditions
is that the audio focus stack shouldn't be empty.

To verify this fix, several functions were also rename to clearly
indicate the lock order and verify we properly synchronize on
the right objects. In doing so, a missing synchronization on
audio focus was found.

Change-Id: If1baaac224ea676aeb83ac0aefcc53f87461c32e
/frameworks/base/media/java/android/media/AudioService.java
16b241a58f1ec4b317647b6fd0ad9b5cc3f7ba3d 31-Aug-2011 Eric Laurent <elaurent@google.com> Merge "Change condition to enter silent mode."
338794576667745b060ac269b2c2b36e0c6964f2 31-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5242200 only update RemoteControlDisplay when a client is present

A precondition for updateRemoteControlDisplay_syncRcs() is that
mRCStack is not null. This condition was not verified when
registering a RemoteControlDisplay.

Change-Id: I0b152410e57c590114b387e9ab83f0c4d15d060d
/frameworks/base/media/java/android/media/AudioService.java
3d4c06f90726a85e89dab13c41ddc15b9c912a3f 16-Aug-2011 Eric Laurent <elaurent@google.com> Change condition to enter silent mode.

Previously, silent mode was entered if volume was already at 0 and
volume down key was pressed once.

The new volume management policy specifies that silent mode is entered when
volume is at last audible step and volume down key is pressed once.

Change-Id: Id3e75a99c522d8afe276868010b6e73495d23fde
/frameworks/base/media/java/android/media/AudioService.java
958bba6862c9540c528263686b0de044b4a7a5f6 30-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5045498 Force display update when display registers

When an IRemoteControlDisplay registers, cause the
RemoteControlClient to send all its information to the newly
registered display.
The previous code was only sending a request for update: this
request didn't here cause the client to send the data because
a new client generation had not been synchronized among clients
and displays.
This CL uses the same code path to force an update as when audio
focus changes, or a new client registers, by calling the same
method that is called in those cases,
updateRemoteControlDisplay_syncRcs(flags).
Also in this CL: more method renames to indicate methods that
are called synchronized on mRCStack.

Change-Id: I54102f45ba1cd4812d958ecd883bec7bc45ae88f
/frameworks/base/media/java/android/media/AudioService.java
db8a361629f06f62b9e1c40d4413b3b5099bd124 27-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Update IRemoteControlDisplay when it registers.

When an IRemoteControlDisplay registers, it must receive information
from the current client.

Change-Id: Id845e7a87ac74c2db2c59e0281b28a45f8d20528
/frameworks/base/media/java/android/media/AudioService.java
18e7bce52318f00b5023f33933a571c477f2b61c 26-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Address multiple RemoteControlDisplay competing for registration

The RemoteControlClient / Display feature only supports one
display. If multiple displays are registered, this CL implements
the following policy:
- cannot unregister a display that is not the current one,
- registering a display when another is already registered
causes the old one to be unregistered.
This fixes a death handler leak where the previous display was
simply overwritten, without unlinking to its death.

Change-Id: I63f8a38093796e0960761936d7fc58d47b7589b3
/frameworks/base/media/java/android/media/AudioService.java
3094d955b8321f01e50cb0c448ae1c4c461f41c9 25-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix deadlock in AudioService

Locks related to audio focus and remote control should always be
taken in the following order:
1/ audio focus lock
2/ remote control stack
3/ current remote control client generation

Change-Id: If8be11bfef92849957e692b2bd52adbd67a2ef0b
/frameworks/base/media/java/android/media/AudioService.java
4b6df6a3dcbd9990e36438c529fa8c16b2580df9 24-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> More information for RemoteControlDisplay about new client

When the client gets cleared, let the display know the new
client generation ID is for a clear.
When a new client becomes current, let the display know
what the associated media button event receiver is.

Change-Id: I18e37a309b5b30ed361a68918379b60418409f1e
/frameworks/base/media/java/android/media/AudioService.java
68e37ae87ad9932f2119c1b2fc361c1aed5841e4 23-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Merge "Bug 5045498 New implementation of remote control API"
4426e42ac6107bf6b09f7c4cdad39eb161d8b9ca 19-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5045498 New implementation of remote control API

Remote control displays expose an IRemoteControlDisplay interface
which they register through AudioManager.
Remote control clients create a RemoteControlClient object, which
implicitely exposes an IRemoteControlClient interface registered
in AudioService through AudioManager.
AudioService tells all clients and displays when a new client
is the one that should be displayed.
A client's data gets sent to the display when it is valid, or
it sets new data (while being valid).

The implementation for setting metadata and album art is temporary,
and will migrate to the MetadataEditor API in future CLs.

Change-Id: Ibab6ea1d94c68f32482c760c6ae269541f885548
/frameworks/base/media/java/android/media/AudioService.java
73a56fe47720cc2659da6fc0a01fcc28940e7243 23-Aug-2011 Eric Laurent <elaurent@google.com> Revert "Change condition to enter silent mode."

This reverts commit c11c3ae4dd5d4054e5b44a7bdfe6b203bdb69976.
/frameworks/base/media/java/android/media/AudioService.java
8c60d89b3704164d5a13e80ace6bea4b51af37a3 18-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Merge "Bug 5045498 RemoteControlClient interface"
8f6684144a617982763db3d2281e86f2a9d368db 17-Aug-2011 Eric Laurent <elaurent@google.com> Merge "Fix issue 5126270: Holding volume down vibrates"
cc11b1b8bb47aa6be23ff5c4caf683ff90074121 17-Aug-2011 Eric Laurent <elaurent@google.com> Fix issue 5126270: Holding volume down vibrates

Clear AudioManager.FLAG_VIBRATE in adjustStreamVolume() if
already in silent mode.

Change-Id: I8035a8cc713e1880799d9aaf053d8e4d12acad75
/frameworks/base/media/java/android/media/AudioService.java
178889eff7fa3361a5cb08d6d43846a1baf5216b 16-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5045498 RemoteControlClient interface

Define a RemoteControlClient interface that applications must
implement and register to be displayed on the lockscreen.

Change-Id: I67276ae653f203e76727432231f1d76535c31942
/frameworks/base/media/java/android/media/AudioService.java
c11c3ae4dd5d4054e5b44a7bdfe6b203bdb69976 16-Aug-2011 Eric Laurent <elaurent@google.com> Change condition to enter silent mode.

Previously, silent mode was entered if volume was already at 0 and
volume down key was pressed once.

The new volume management policy specifies that silent mode is entered when
volume is at last audible step and volume down key is pressed once.

Pressing volume down key continuously will decrease volume until
last audible step is reached, not 0.

Change-Id: Ib7b530668473d6a5af1e748f445d6185afed2158
/frameworks/base/media/java/android/media/AudioService.java
931e73946390b43fc08f5ae66770fba0efba5345 16-Aug-2011 Eric Laurent <elaurent@google.com> Merge "Fix issue 5131056: key beeps when screen is locked"
96f218e0b9834b959f1acf34b51d325bb1c33a0d 16-Aug-2011 Eric Laurent <elaurent@google.com> Fix issue 5131056: key beeps when screen is locked

Clear AudioManager.FLAG_PLAY_SOUND in AudioService adjustSuggestedStreamVolume()
if keyguard is locked.

Change-Id: I2effb9cab8d946845e948b28899b17d7f24c1282
/frameworks/base/media/java/android/media/AudioService.java
0a9faa8cf934ef38319cd945b600825c6bb88b9c 15-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5045498 Send media button event receiver to remote control

When notifying the remote controls of an update, also pass the
associated media button event receiver.

Change-Id: I9125378653ce21e3bd672b936df638c0c6154edb
/frameworks/base/media/java/android/media/AudioService.java
baf674eedd5ecff9da0cf8cabe9868f7699b1695 15-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Fail request for audio focus when linkToDeath fails

When requesting audio focus and linkToDeath() threw a
RemoteException, AudioService was only logging a warning, and
was still changing the focus, with a non-null death handler.
The change first check that linkToDeath() didn't fail, and only
then proceeds to change the focus (dispatch focus change
notification, updates the focus stack, and updates the remote
controls).

Change-Id: I0b96dd3c6e924d93f419880349d49f8b360b110b
/frameworks/base/media/java/android/media/AudioService.java
061214bb71a4a4211e670001226c68f5e8036b84 14-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix leak of global references and AudioFocusDeathHandler objects.

Need to call unlinkToDeath() for the object to be garbage collected.
Save the object in the FocusStackEntry, unlink to death when we remove it from the stack.
See http://b/issue?id=5048400

Change-Id: I84c5ba46017d0a8744b5e7509a7c7a5c8dd918fb
author: olivier@google.com
/frameworks/base/media/java/android/media/AudioService.java
b5f04d6dbf5106140df367ae07f0e7708e1b650e 10-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Pass flags on remote control client information change in intent

Pass the flags about what information changed in the remote
control client in the intent used by the remote control display.
Also pass the IRemoteControlClient to verify it is still current
before sending the intent.

Marked some logs as to be removed before release.

Change-Id: Ib3aa22d061e5dfaf80a9c4c78774c931a2cf0fbd
/frameworks/base/media/java/android/media/AudioService.java
f1ddd51f9cd2f92b922bc636c307210a8d587c25 10-Aug-2011 Marco Nelissen <marcone@google.com> Check pids instead of IBinders

There can be multiple AudioManagers per process (because each Context has
its own cache of services), so AudioService should protect SCO activation
based on whether the pids match, not whether the IBinders match.

b/5044873

Change-Id: Ibec81365f95fec11f34b47becd0e473762bf06ad
/frameworks/base/media/java/android/media/AudioService.java
17da769e987de40e113c5b2a3b867b25ba7ac0a2 10-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> AudioService: don't use a soft reference on IRemoteControlClient

In the remote control stack, don't use a SoftReference to the
IRemoteControlClient because the client live in a different
process, which causes the reference to become null at the
earliest opportunity.

Change-Id: I7f7733f9a1a043825cd5e8769282b535657dd82d
/frameworks/base/media/java/android/media/AudioService.java
8d4ed0d8e1e0e0f4a8ed7fc1407a850dc2190040 08-Aug-2011 Neel Parekh <neel@google.com> Prevent NPE when registering a remote control client

Change-Id: Ia22b456b1cbdd89736118c7e68b7c68dd6e59c64
/frameworks/base/media/java/android/media/AudioService.java
7b6198cacc3e7dd31ef91537d809857d826fb7fa 07-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5045498 API for client to notify remote control info changed

Update to API for a client to notify what type of information
changed (e.g. playstate, metadata) to optimize small updates
without the remote control display having to do expensive
queries such as album art.

When the remote control display retrieves the flags about
what information changed, the flag gets cleared.

Change-Id: I7d3d8d3eecd1da44695d84905ed9e7b70fe38b86
/frameworks/base/media/java/android/media/AudioService.java
ced110ec5970c632f523dfc0350b6071461ea9bc 05-Aug-2011 Neel Parekh <neel@google.com> Make retrieving remote control client go through binder interface

The way the old way worked relied on the process retrieving the
current remote control client to be in the exact same process as
the AudioService. This removes that dependency.

Change-Id: I1ba8bf32b61ec1e979ef7eee9661ba801aa19690
/frameworks/base/media/java/android/media/AudioService.java
a30a21cf2ef37b490e3790aad3105cda115124d6 04-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Remove empty remote control client listener methods

Remove non-implemented methods for registering IRemoteControlClient
listeners.

Rename refreshRemoteControlDisplay() method to follow framework
conventions.

Change-Id: I9254e8eeea9020a530c9a32f328f0ef7dbd9dd0c
/frameworks/base/media/java/android/media/AudioService.java
045d179ff6568eaa30f66801e10fd888e2da0f9d 03-Aug-2011 Eric Laurent <elaurent@google.com> Merge "AudioService: ignore NOTIFICATIONS_USE_RING_VOLUME."
8f619182cb759718f64ab95fd6d61c16138f6952 22-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Remote control display API and implementation

Extend the media button event registration AudioManager API to
enable applications to register as a client of "remote controls"
and let them provide information meant to be displayed
by the remotes.
AudioService sends a AudioManager.REMOTE_CONTROL_CLIENT_CHANGED
intent to let remote controls know when / from whom they can
retrieve the information to display.
Only application that own audio focus, are the currently
registered media button event receiver, and have registered
a remote control client, are eligible to appear on the
remote control.

To address in future CLs:
- change how a remote control client forces a refresh
- rename methods called under lock to ___Locked()
- make API public

Change-Id: Icca30ab05dac2605ee9246f8acb27a03dcea077a
/frameworks/base/media/java/android/media/AudioService.java
4eb5a5713877227374d7bac97719873b2c17e92a 03-Aug-2011 Eric Laurent <elaurent@google.com> AudioService: ignore NOTIFICATIONS_USE_RING_VOLUME.

Do not take NOTIFICATIONS_USE_RING_VOLUME setting into account now
that it has been deprecated. STREAM_NOTIFICATION and STREAM_RING
always use the same volume setting.

Change-Id: Ibf6e5f86133d3781fd9e66455be64582318d93e6
/frameworks/base/media/java/android/media/AudioService.java
5531a3a3cfce0fe0dd279cdce2de30cf777f5227 20-Jul-2011 Eric Laurent <elaurent@google.com> Merge "Fix issue 5012047: silent mode mutes music"
72668b2c040b581b298b069f3b5af5ed7f212d89 20-Jul-2011 Eric Laurent <elaurent@google.com> Fix issue 4499450: Unknown Ringer Mode

Added a validity check on ringer mode values in AudioManager.setRingerMode().

Change-Id: Ie780edc1d347009d90f000018a71520b04e0c4a1
/frameworks/base/media/java/android/media/AudioService.java
c1d4166289ce016965d1147f7e8d37862ee347ec 19-Jul-2011 Eric Laurent <elaurent@google.com> Fix issue 5012047: silent mode mutes music

Implemented different silent mode behaviors for tablets and phones.
The behavior inherited from Honeycomb was for tablets only and
was muting music in silent mode.

Change-Id: Ib053e7b70ca02190debc87648ab8a163f9d39577
/frameworks/base/media/java/android/media/AudioService.java
b06ac839dd2d0437fc8314f6deb7233af5af521e 26-May-2011 Eric Laurent <elaurent@google.com> Issue 4364098: bluetooth SCO not working

AudioService does not need to unconditionally stop virtual calls
when the audio mode is changed from normal. Only stop virtual calls
that have been started from AudioService.

Change-Id: I75992d3655661e5910536a62dc8a8e0256d835e8
/frameworks/base/media/java/android/media/AudioService.java
dc03c61fe3cd8d0805480e48a974986439977a60 01-Apr-2011 Eric Laurent <elaurent@google.com> Bluetooth SCO audio API improvements.

The AudioManager API to control bluetooth SCO did not provide an easy way for
applications to handle SCO connection errors. When a request to activate SCO with
AudioManager.startBluetoothSco() failed, no state change was indicated via
AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED intent. The application had to
implement a timeout to handle connection failures.

The API change consists in defining a new intent AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED
and deprecate AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED. The new intent
will broacast a new state CONNECTING when the SCO connection is initiated.
The application can monitor changes from CONNECTING to either CONNECTED or DISCONNECTED
states to detect connection success or failure.
An extra indicating the previous state is also added to the new intent.

Also improved BluetoothHeadset service management in AudioService. A disconnection
from the service is not considered as a device or SCO link disconnection. Instead, if the
service interface is not present when a request to activate SCO is received, an
attempt is made to reconnect to the service.

Change-Id: I005fda1caaf74bb7de64fece44e9c7e628e828db
/frameworks/base/media/java/android/media/AudioService.java
72843377d50a8f95cceaf33d316ab68d9b47f2eb 18-Apr-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2659754 ConcurrentModificationException in audio focus changes

While iterating over the audio focus stack or the media button
receiver stacks, do not modify the stack other than through the
iterator object.

Change-Id: Ice8827e7d29afed72b40c93edf7401cd54ba4b0c
/frameworks/base/media/java/android/media/AudioService.java
d589fea865e90859324f00d21765fa7d7759e465 15-Apr-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2724503 Persist media button receiver across reboots

Whenever a new media button receiver is registered, save it
in the settings.

When the system audio settings are reloaded or when the
AudioService is created, the registered media button receiver
is restored.

Whenever a package is removed from the system, remove
any media button receiver from the same package that are in
the media button receiver stack. If this causes the currently
registered receiver to change (i.e. the top of the stack),
this will cause an update of the receiver stored in the
system settings.

Note that unregistering a media button receiver will not
cause the receiver saved in the settings to be updated,
this is ON PURPOSE. This is to prevent well behaved
application who unregister their receiver at the destruction
of their service, to not receive the intent after a reboot,
and to not encourage applications to never unregister
their receiver.

Change-Id: I941b777debaa56e88de93c3b03aec40331ea9ab1
/frameworks/base/media/java/android/media/AudioService.java
fa640154f1f42121d81242b2f1a10f03e52f0014 13-Mar-2011 Eric Laurent <elaurent@google.com> Partial fix for issue 3515250: video chat and SCO

Do not call directly into AudioSystem in setBluetoothScoOn() but
send a message to the AudioService handler instead. As the
procedure to switch audio path to BT SCO can last some time we should
not block the caller which can run in the UI thread.

Change-Id: I6ac4b5a934d69781db3aebe5d0e8137b52a0ada4
/frameworks/base/media/java/android/media/AudioService.java
382f4e6ea4dcf39105b36364582ed01642daa93c 08-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 4064086 Use a death handler on audio focus changes from mode

Use a death handler when audio focus changes are caused by audio
mode changes.

The bug comes from the fact that audio focus clients that use the
audio mode for automatic focus handling didn't register a death
handler, which was set to null. When such a client died, this
handler was compared against the one to remove from the
audio focus stack, which resulted in an NPE.
The fix consists in registering a valid IBinder object in the
audio focus stack, even for clients whose focus requests originate
from a change in audio mode, as implemented in the
handleFocusForCalls() method.

Change-Id: Id9e1d3d10afcd99969285f6d60fc4d7dde1e4a10
/frameworks/base/media/java/android/media/AudioService.java
854938a72d968c1bc0de4e2b0ea87777cfebc045 22-Feb-2011 Eric Laurent <elaurent@google.com> Fix issue 3388354.

Release all sco audio clients when the intent indicating
STATE_AUDIO_DISCONNECTED state is received.
Also clear mScoClients array when clients are released.

Change-Id: I63ec9d70fe72a102e09a4a473a367fb2e550b171
/frameworks/base/media/java/android/media/AudioService.java
a25c5d88d17f251262307ce31e799c9cf361d145 10-Feb-2011 Eric Laurent <elaurent@google.com> Fix issue 3435692

The problem is that the AudioService is not notified of the death of
IAudioFlinger binder interface because no methods was called on AudioFlinger
from system_server since the device booted. Therefore, AudioSystem did not created any
IAudioFlinger interface in the system_server process.
The root cause was always present but more likely to happen on a tablet than on a phone
as for instance no beeps are played when volume is adjusted.

The fix consists in having AudioSystem explicitly call a method on AudioFlinger when a
callback is installed to make sure that an IAudioFlinger binder interface is created
regardless of any other activity in the client process.

Change-Id: I9df34a36825af0b25cd0246dd02edbd712263f41
/frameworks/base/media/java/android/media/AudioService.java
d4b88c8829cdababbf16aaf903ba25a1669310e7 05-Feb-2011 Eric Laurent <elaurent@google.com> Merge "Issue 3395734: fix media server restart detection" into honeycomb
086396a92408b47ee32f7fedaae9af533608ff6d 05-Feb-2011 Eric Laurent <elaurent@google.com> Issue 3395734: fix media server restart detection

Commit 25101b0b in AudioSystem for issue 3395734 broke the mechanism
in AudioService to poll and detect the restarting of media server
process after a crash.

The fix consists in changing the method used to poll AudioSystem and
trigger a callback indicating success when media server is responding
(the method must be on IAudioFlinger and not IAudioService to trigger the callback).

Change-Id: I843c0194de9cbf82c779cabbf2f3cbf8064603c8
/frameworks/base/media/java/android/media/AudioService.java
402f7f29634a9f68e7929be828a927a3e2f5efe9 04-Feb-2011 Eric Laurent <elaurent@google.com> Fix issues 3425035 and 3423785.

- Make sure that STREAM_MUSIC is affected by ringer mode on non voice capable
devices whatever the saved settings say.

- Added a hidden method to AudioManager for VolumePanel to override
the stream selection logic while the panel is showing.

Change-Id: Ib2ff2a7af63decb4e29c45700c41e5058f79d877
/frameworks/base/media/java/android/media/AudioService.java
25101b0b9a84571ead15b26e9f4cd9c4298d7823 02-Feb-2011 Eric Laurent <elaurent@google.com> Fix issue 3371080

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

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

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

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

Change-Id: I7e5a0724099450b9fc90825224180ac97322785f
/frameworks/base/media/java/android/media/AudioService.java
834662d4224ebbb95527cb43eaf9dcea548d7b19 28-Jan-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 3395289 Use MODE_IN_COMMUNICATION to evaluate stream vol changes

When the user is in a phone or VoIP call, the volume keys should
control the STREAM_VOICE_CALL volume. Before MODE_IN_COMMUNICATION
was introduced to cover VoIP use cases, having an active VoIP call
was determined by checking whether there was any track used the
output stream STREAM_VOICE_CALL, which can give false positives.
This CL checks instead against the audio mode to see if
MODE_IN_COMMUNICATION is selected to determine if a VoIP call
is in progress.

This implies that applications that play on STREAM_VOICE_CALL
shouldn't rely on that fact alone to expect the volume keys
to control the STREAM_VOICE_CALL volume, and should instead,
rely on the official mechanism for that:
android.app.Activity.setVolumeControlStream(int)

Change-Id: Ia487951ea1684477aa3d522c9031fad484d8a40d
/frameworks/base/media/java/android/media/AudioService.java
dde68c64fd8e97a592633ec4c09283ec928e5697 24-Jan-2011 Jaikumar Ganesh <jaikumar@google.com> Rename virtual call API to ScoUsingVirtualCall.

This API makes more sense with regard to headset profile.
Bug: 3381532

Change-Id: Ife07d101a3b04bcddb31e7ae86712e1d97a660c5
/frameworks/base/media/java/android/media/AudioService.java
117b7bb5b5a4457711f59bde3dcc83d8f111c524 17-Jan-2011 Eric Laurent <elaurent@google.com> Fix issue 3354692.

The problem is that SoundPool never calls the onLoadComplete() callback
when load() method fails because the file cannot be opened.
AudioService loadSoundEffects() was blocked waiting for a callback
that never came.
In this particular case, this happened on a specific build where sound
effects assets were not included.

The fix consists in waiting for the callback only if at least one sample is
accepted by SoundPool load().

Also moved the initial loading of sound effect samples from the boot completed
broadcast receiver to the audio service message handler to avoid waiting in the
main system server thread.

Change-Id: I902e5988f8b644a81d8e585c52eed1df4ca0ec05
/frameworks/base/media/java/android/media/AudioService.java
a60e212d0dda7d2a748180ce77405f2463c9cf53 29-Dec-2010 Eric Laurent <elaurent@google.com> Fix issue 3261656.

The problem can occur if a sample is started at the same time as the last AudioTrack callback
for a playing sample is called. At this time, allocateChannel() can be called concurrently with moveToFront()
which can cause an entry in mChannels being used by moveToFront() to be erased temporarily by allocateChannel().

The fix consists in making sure that the SoundPool mutex is held whenever play(), stop() or done() are called.

In addition, other potential weaknesses have been removed by making sure that the channel mutex is held while
starting, stopping and processing the AudioTrack call back.

To that purpose, a mechanism similar to the channel restart method is implemented to avoid stopping channels
from the AudioTrack call back but do it from the restart thread instead.

The sound effects SounPool management in AudioService has also been improved to make sure that the samples have
been loaded when a playback request is received and also to immediately release the SoundPool when the effects are
unloaded without waiting for the GC to occur.
The SoundPool.java class was modified to allow the use of a looper attached to the thread in which the sample
loaded listener is running and not to the thread in which the SoundPool is created.

The maximum number of samples that can be loaded in a SoundPool lifetime as been increased from 255 to 65535.

Change-Id: I368a3bdfda4239f807f857c3e97b70f6b31b0af3
/frameworks/base/media/java/android/media/AudioService.java
c7fcba4b7bd3d78e7cfe975a3f8e4dde2f6738b7 06-Jan-2011 Joe Onorato <joeo@google.com> Make the volume keys adjust the media volume by default if the device is not "voice capable."

Change-Id: Ide396f8940a075c0b00b7c983c1769c1cc0f17bf
/frameworks/base/media/java/android/media/AudioService.java
2c61bee2b05a6f4cf06a0048b3c0a81f248a48cd 15-Dec-2010 Eric Laurent <elaurent@google.com> Change audio routing policy for HDMI

HDMI device should have a higher priority than analog dock audio but a lower priority
than wired headsets.
Also modified AudioService so that HDMI is mapped to DEVICE_OUT_AUX_DIGITAL device and not
DEVICE_OUT_DGTL_DOCK_HEADSET as before to enable discrimination between SPDIF going to
digital dock and SPIDF going to HDMI.

Change-Id: I887d0c73479784dd2edaf41ce1a7d8d0bdcbb4bd
/frameworks/base/media/java/android/media/AudioService.java
2ade576148fe33c5ff6098d30ccfbcf28df70e8e 11-Dec-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 3275151 Request and abandon audio focus with audio mode changes

Before the introduction of the MODE_IN_COMMUNICATION audio mode,
"calls" were only made through telephony and the PhoneStateListener
was used to request and abandon audio focus as calls where started
and ended. VoIP applications do not cause phone state events to
be broadcast, and set the audio mode to MODE_IN_COMMUNICATION
directly. This change monitors mode changes to automatically
grab and abandon audio focus.

Change-Id: Ie9a4193e35ba8447764fac66a988959a93c4909f
/frameworks/base/media/java/android/media/AudioService.java
62ef767b15a712bab31cc0d5508a330906f535c2 24-Nov-2010 Eric Laurent <elaurent@google.com> Fix issue 3159946.

AudioService now uses SCO virtual calls instead of voice recognition to
implement startBluetoothSco() method.
Also make sure that a virtual call is not started when SCO audio is active
due to in call audio or voice recognition.

Change-Id: I93ed119afbc57250a4433201156714e35f70fea4
/frameworks/base/media/java/android/media/AudioService.java
8f677d66d9c3ba34c97e69b2bb9e161f129af0ee 15-Nov-2010 Jean-Michel Trivi <jmtrivi@google.com> Add new audio mode for audio communications other than telelphony.

The audio mode MODE_IN_CALL signals the system the device a phone
call is currently underway. There was no way for audio video
chat or VoIP applications to signal a call is underway, but not
using the telephony resources. This change introduces a new mode
to address this. Changes in other parts of the system (java
and native) are required to take this new mode into account.
The generic AudioPolicyManager is updated to not use its phone
state variable directly, but to use two new convenience methods,
isInCall() and isStateInCall(int) instead.

Change-Id: Id744cd26520ea1d1a4795eabe6a1f0c58789af76
/frameworks/base/media/java/android/media/AudioService.java
26e37349831476d3225570af2dfbf1e459374c6b 03-Nov-2010 Praveen Bharathi <pbharathi@motorola.com> frameworks/base: switch audio to hdmi when cable is plugged in

Change-Id: I01c4ee968bc0ffbb6ce75370935571cc1ff6f8c7
Signed-off-by: Iliyan Malchev <malchev@google.com>
/frameworks/base/media/java/android/media/AudioService.java
30d181690e48b26cdfae3b144d23f1e16c75da37 01-Nov-2010 Jaikumar Ganesh <jaikumar@google.com> Add STATE_AUDIO_CONNECTING state.

Why is it needed: SCO audio connections can fail.
Currently no indication is given to clients which are waiting
for SCO connections. This was working fine before because
SCO connections where blocking calls, which was wrong in itself.

Change-Id: Ic449b2db8506a7a5ae6be6c68715f1a7343f9e40
/frameworks/base/media/java/android/media/AudioService.java
21e941bf43362ddc6639a9f2d0828053360f53d7 06-Oct-2010 Praveen Bharathi <pbharathi@motorola.com> Added support for dock headset observer

Change-Id: I06b2e65e3bfa10735e6c7fd3349afa9ae7d45292
Signed-off-by: Praveen Bharathi <pbharathi@motorola.com>
/frameworks/base/media/java/android/media/AudioService.java
5a1e4cf83f5be1b5d79e2643fa791aa269b6a4bc 19-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Update BT APIs return type from Set to List.

Change-Id: Ia27220dd26cde13007f6938c830517ee7f6968ce
/frameworks/base/media/java/android/media/AudioService.java
82aa7f017daaaeb96c13e6e3491d5037ab471085 28-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Update code for new BT APIs.

Change-Id: Idf806cba8160e6075e33e26ee9936663b850e96c
/frameworks/base/media/java/android/media/AudioService.java
e73131a68408a0495ba96a4d5a60799ba293c176 14-Jun-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2684341 Don't steal the media button event from the phone
app is the phone is ringing, even in silent mode.

Use the PhoneStateListener to know whether the phone is ringing,
as the mode is not MODE_RINGTONE when ringing in silent mode.

Change-Id: Iede350cecde0b663d50f9b4a57f9a9ef08066c0d
/frameworks/base/media/java/android/media/AudioService.java
e2dd8c4592762414c2c27e4589be7edc91a5ecae 01-Jul-2010 Eric Laurent <elaurent@google.com> Fix issue 2811538: System server crash when disconnecting BT headset after using SCO off call.

Problem:
When the bluetooth device is removed, the AudioService clears all active SCO connections
and unlinks from the client application's binder interface death.
The problem is that the unlinking is done even if no more connections are active for a given client,
which throws a runtime exception that is not catched causing the system server to crash.

The fix consists in calling unlinkToDeath() in ScoClient.clearCount() only if the number of
active SCO connections for this client is not 0. The NoSuchElementException exception is also
catched when calling unlinkToDeath()

Change-Id: I29a28fcce1a579217cea271956a55778e05d3e37
/frameworks/base/media/java/android/media/AudioService.java
3c652ca5a546e7227a5f4bdbf0f81552b2c91383 22-Jun-2010 Eric Laurent <elaurent@google.com> Fix issue 2301630: Mismatch of state occurs when media server is killed while in-call.

Use setParameters() API to indicate to audio HAL that we are restarting the media server after a crash.
The use made by audio HAL implementation of this indication is platform specific.

Change-Id: I085b174fa1474575da0e4d295921079b6b68efb8
/frameworks/base/media/java/android/media/AudioService.java
740e39be6af3e366a4b82c030b5ea67ab144b42a 02-Jun-2010 Jaikumar Ganesh <jaikumar@google.com> Pass BluetoothDevice to the Bluetooth Headset calls.

This is to support multiple headsets at the same time, atleast
at the framework level.

Change-Id: I91d05c6c2828c9a09d00806d5e79f1e9c9c7cf84
/frameworks/base/media/java/android/media/AudioService.java
392a2bbb52688ebd25768a7784d9edca7f498110 11-May-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2670395 and 2599698
When the user selects a "Silent" notification sound, the Uri encoded
path is an empty string. Setting this Uri as the data source of the
MediaPlayer used to play notifications caused the completion listener
to not be called, which with the AudioFocus logic causes the Music
app to pause and never resume. The NotificationPlayer modifications
cause the MediaPlayer for the notification to only request audio
focus when the data source is not empty.
The audio focus code in AudioService is defensively synchronized
against a unique lock, and the exception observed in bug 2670395
is explicitely caught in case another edge case wasn't caught by
this fix.
The AudioFocus handling in AudioManager is modified so only the
requestAudioFocus and abandonAudioFocus methods are meant to be
used, as registerAudioFocusListener and unregisterAudioFocusListener
provided no additional functionality over the request/abandon
methods. abandonAudioFocus() also removes the listener from the
map in AudioManager since after abandonning focus, the listener
would no longer be called.

Change-Id: I3b553ee8a8163c25e01117d7e5479dd5fdfa7c6b
/frameworks/base/media/java/android/media/AudioService.java
a847ba4080675d395de725cfac5dfd9d5a993d4e 23-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2619062 Music is routed to Phone speaker, though it is
connected to A2DP media profile

When the phone is docked and using the dock A2DP, and the user
connects another A2DP device, make the dock unavailable immediately
before connecting the new A2DP device.

Change-Id: I82d53836fb509ee4ea7cdb68f467dfb946c634f8
/frameworks/base/media/java/android/media/AudioService.java
b4bccb6d8df16a2c5235cead187156bc721cf074 20-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Update AudioService to reflect phone state changes with AudioFocus.
Phone calls and rings are treated as a new client, with a dedicated
client ID that identifies it in the audio focus stack. When it is
present in the stack, others clients cannot request audio focus
(request is denied).
Because the phone state is now mostly handled like a new client,
there is no need monitor mode changes and to keep track of
undispatched focus changes, as those will delayed focus gains
will now automatically happen at the end of the call when the
phone client is removed from the focus stack.

Change-Id: I11ff73b015ab93f07040755fd8ee75c8d675e025
/frameworks/base/media/java/android/media/AudioService.java
3891c4cc918e8062abb97c542a8625d556dccc59 20-Apr-2010 Eric Laurent <elaurent@google.com> Fix issue 2602879: camera shutter sound not playing.

The problem occurs if the device is powered down in silent mode. When the device restarts,
AudioService reads current ringer mode from saved settings but does not call setRingerModeInt()
to perform actions required when ringer mode changes.
The volumes of streams affected by ringer mode are actually at 0 because they are also read from settings
but their mute state is not applied correclty. When we later exit from silent mode, the streams
other than STREAM_RING that are affected by ringer mode are not restored as they are not considered
muted. This applies to STREAM_SYSTEM but also to STREAM_NOTIFICATION if its volume is controlled independently
from STREAM_RING.

The fix consists in calling setRingerModeInt() when AudioService starts.

Change-Id: Ica75b9874938dda1bc1b634c3e97db4a650d295c
/frameworks/base/media/java/android/media/AudioService.java
3b5912602bec6ccbe8eef8a576730b1565f0067c 20-Apr-2010 Eric Laurent <elaurent@google.com> Fix issue 2604270 Device auto connects to Car Dock (Media profile) after undocking.

There was a regression introduced by change 4c637b9e34f4c8db69a64ad21a4e2bcfa7485b5f
fixing issue 2578813. As the A2DP device disconnection is notified to the audio policy manager
after a delay, there is a period during which the A2DP device is actually not connected but the
A2DP output is considered present by audio framework. If a playback is started during this period,
The A2DP output requests the activation of the A2DP sink which in turn triggers a reconnection
of the A2DP sink.

The fix consists in suspending the A2DP output immediately when receiving the A2DP disconnection
intent so that any activity on A2DP output is ignored until the output is actually closed by the
audio policy manager.

Change-Id: I16eaace45e12bfc970f50836b46a73b756b493f0
/frameworks/base/media/java/android/media/AudioService.java
758dd527f64f1e827adfe09f0141ab213733ca22 13-Apr-2010 Eric Laurent <elaurent@google.com> Fix issue 2592680: Saved ringer volume forced to 0 when receiving a call in silent mode.

This is a regression introduced by change 5b4e654d0c7de8e4d58d73e73b0d5220f19b68f7 for issue 2472495.
When AudioService changes audio mode, setMode() reapplies current volume for the default active stream
which in this case is STREAM_RING.
Because the new implementation of silent mode actually mutes the ringer stream,
setStreamVolumeInt() now applies the volume change received while in silent mode
to the last audible value and we end up clearing the last audible volume for ringer.

The fix consists in not modifying last audible value when the new value is 0.

Also removed obsolete code in setStreamVolumeInt() since new implementation of setRingerModeInt()
in change 5b4e654d0c7de8e4d58d73e73b0d5220f19b68f7.

Change-Id: I746f3bc1af39a602ce12d130ce592007b2d0ebb6
/frameworks/base/media/java/android/media/AudioService.java
527c3ab51e258dfa15c6240f701693cf914e8e93 13-Apr-2010 Eric Laurent <elaurent@google.com> Fix issue 2589563: Able to set ringer volume to 0 outside of silent mode.

The problem happens only if volume down key is pressed while
already in silent or vibrate mode. In this case, AudioService accepts
changing the last audible index for ringer volume from 1 to 0.
When volume up is pressed, current ringer volume value is restored from 0
instead of 1.

The fix consists in keeping last audible index at 1 once in silent of vibrate
mode even is volume down key is pressed.

Change-Id: Id08edd12ce985c22233124545eba2c3e4b8cdc8e
/frameworks/base/media/java/android/media/AudioService.java
4c637b9e34f4c8db69a64ad21a4e2bcfa7485b5f 13-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2578813 Delay pausing music and routing audio for car docks

Moved broadcast of ACTION_AUDIO_BECOMING_NOISY from BluetoothA2dpService
to AudioService.
Broadcast ACTION_AUDIO_BECOMING_NOISY when disconnecting an A2DP
device.
Disconnect from A2DP docks with a delay to handle transient
disconnections.
Cancel delayed A2DP disconnections when connecting to a dock as this
can be a reconnection after a transient disconnection.

Change-Id: I1ee9e99f3ffa20727af38a4c4c8711942894a696
/frameworks/base/media/java/android/media/AudioService.java
bcac496076ef6f439147e7a2be71e8a2b76ddede 12-Apr-2010 Daniel Sandler <dsandler@android.com> Honor the "Never vibrate" setting for incoming calls.

Bug: 2579295
Change-Id: Ia4207492c5dfa2c39d27372c4892b60121b6d9e8
/frameworks/base/media/java/android/media/AudioService.java
2930bb2d47be279dd228ba8c749c1e39e5da8be1 10-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix monkey bug 2586534 java.util.ConcurrentModificationException
Unlike the other audio focus and media button stack handling
methods, abandonAudioFocus() and unregisterAudioFocusClient() were
not synchronized around their focus stack. This CL corrects this.

Change-Id: I5ada574e4e163fa95da9dad2fefe610b48303320
/frameworks/base/media/java/android/media/AudioService.java
55d1bb3483e17a11d122e68044e552d96ab55ff4 02-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2565463 Ensure an object cannot appear twice in the
AudioFocus stack.
Enforce parameter check in AudioManager.requestAudioFocus()
Typo correction in AudioService.unregisterMediaButtonEventReceiver()

Change-Id: Iedd6081a2a096bd7effbaeb9f888a31691201b3b
/frameworks/base/media/java/android/media/AudioService.java
5b4e654d0c7de8e4d58d73e73b0d5220f19b68f7 20-Mar-2010 Eric Laurent <elaurent@google.com> Fix issue 2472495: Phone cannot be set to silent mode via volume keys while Driveabout is taking.

The problem is that AudioService.adjustStreamVolume() only handles the ringer mode change when the
STREAM_RING volume changes from 1 to 0 or 0 to 1. If another stream is soloed, the STREAM_RING stream
volume is forced to 0 and then never transits from 0 to 0 when volume down key is pressed.

The fix consists in considering the saved value instead of current value when ajusting or setting
the volume of a muted stream: only the saved value is adjusted too, leaving the stream muted but updating
the value that will be restored when it will be unmuted.

Also changed implementation of stream volume control by setRingerModeInt() to use stream mute feature
instead of direct volume control.

Change-Id: Id85d76450b36d61a0fe8195eb4bffe63ffbd427c
/frameworks/base/media/java/android/media/AudioService.java
e5e1e870fdb35f5291790e6d178bde7126f6fe35 19-Mar-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix two AudioFocus issues:
- if a focus owner abandons audio focus during a call, the next
focus owner in the stack was never notified
- if a focus owner requests the focus while alread owning it, and
the type of focus request changes, the previous focus owner was
not notified that the type of focus loss had changed.

Change-Id: Iee6c6e17bcdd3c225a4b600f40ba434294870f17
/frameworks/base/media/java/android/media/AudioService.java
078fd47e91d495175927d1a4a8b9aad039a7ba4e 19-Mar-2010 Jean-Michel Trivi <jmtrivi@google.com> Support focus requests where ducking of the loser of audio focus
is acceptable for the new audio focus owner.

Change-Id: I965483f12eeb717115a8f6992d8f1ab7fafa4e45
/frameworks/base/media/java/android/media/AudioService.java
3def1eec2baed0b8845ec32c871e249dc533a9d9 18-Mar-2010 Eric Laurent <elaurent@google.com> Issue 2416481: Support Voice Dialer over BT SCO.

Added public methods to AudioManager API so that unbundled applications can use bluetooth
SCO audio when the phone is not incall.
Without this change, the only way to activate and use bluetooth SCO is via the BluetoothHeadset API
which is not public yet.

Change-Id: Ia1680f219ea1d0943092d475d5be7d6638983ebb
/frameworks/base/media/java/android/media/AudioService.java
d327f21626217aa3c9c0cdb7a84a742c531e59a3 17-Mar-2010 Jean-Michel Trivi <jmtrivi@google.com> Implementation of the policing of transport control key press
events among multiple applications competing for the remote control
focus.
AudioManager defines a new API for applications to use in order to
register their BroadcastReceiver for the media button as the one
to receive the corresponding intent, but all applications at the
same time (in an ordered broadcast).
AudioService handles a stack of remote control focus owners. It
traps ACTION_MEDIA_BUTTON intents and sends a new intent to the
remote control focus owner.

Change-Id: I3c109221ecfb160cbb1ec0e40a71b241aad73812
/frameworks/base/media/java/android/media/AudioService.java
758559e6b7e310cf46cc269437f44decd58d68d6 09-Mar-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2329540
Part 1 of the fix: when the user doesn't elect to use the car dock
for music and media, the APM was not aware of the device being
docked.
This is fixed by dissociating the notification for the APM of
the docking to the dock from the sink state change of the A2DP
device.
Also missing was forcing the volumes to be reevaluated whenever
the device is docked or undocked, as volumes for docks may
differ, even when the same output device is being used.

Change-Id: If5314e27821a71adbd6df6fdf887c45208241d96
/frameworks/base/media/java/android/media/AudioService.java
31951ca52aa007891b0be975318199e207c70e02 03-Mar-2010 Eric Laurent <elaurent@google.com> Fix issue 2456968: Alarm rings in "silent mode and when Alarm in silent mode is turned off".

The problem is that even if silent mode is active, changing the alarm volume will change current
alarm stream volume. This is true for other stream types affected by ringer mode (ring, notification...) but
the UI design is such that it is not possible to change these volumes while in silent mode.

The fix consists in modifying AudioService.setStreamVolumeInt() so that when a stream is affected by ringer mode
and we are in silent mode, only the saved volume value is modified, current value remaining to unchanged (0).
/frameworks/base/media/java/android/media/AudioService.java
d5176cfe6eae954e9cef1e2ec17859a5089e1330 28-Jan-2010 Jean-Michel Trivi <jmtrivi@google.com> First implementation of the audio focus management as an extension
of AudioManager and AudioService.
/frameworks/base/media/java/android/media/AudioService.java
6329bf7b1e2217c6c9477bd57349a1edade18417 26-Feb-2010 Daniel Sandler <dsandler@google.com> New vibrate/silent mode behavior.

In earlier versions of Android, "vibrate mode" (in which
only alarms and media produce sound, but notifications may
operate the vibe motor) was only accessible by adjusting the
ringer volume (via the device's volume rocker) down until
the "vibrate" icon appeared (between the lowest ring volume
and silent mode).

Many users prefer that "silent mode" always allow vibration.
Others prefer Android's historical behavior, in which silent
mode stops the vibes as well.

To accommodate these two distinct usage patterns, we now
allow the user to decide whether vibration is allowed in
"silent mode", a user interface abstraction that now spans
both AudioManager.RINGER_MODE_VIBRATE and
AudioManager.RINGER_MODE_SILENT.

To minimize API impact (and therefore maximize backward
compatibility), RINGER_MODE_VIBRATE and RINGER_MODE_SILENT
remain unchanged. What has changed is what happens when the
user activates silent mode, either via Settings,
GlobalActions (longpress on power), volume rocker, or the
keyguard tab. In essence, there is now only one "silent"
position in these controls, and whether RINGER_MODE_VIBRATE
or RINGER_MODE_SILENT is actually set on the AudioService is
determined by a new one-off setting
(System.VIBRATE_IN_SILENT). This new setting isn't meant to
be a long-term API, however: in the future we hope to
replace and extend this design with a much more
sophisticated set of systemwide feedback profiles. ETA TBD.

Related changes:
* I09ad7d69 (GlobalActions and keyguard)
* I22ba7bcf (Settings app)

Bug: 2457183
Change-Id: I14cf91b0910261ffdfd1bf302423f41ec747d057
/frameworks/base/media/java/android/media/AudioService.java
9ce379aef155e0c21b5d82d8dc713c62792e4f30 16-Feb-2010 Eric Laurent <elaurent@google.com> Fix issue 2440226: Car dock volume synchronization.

AudioService now sends intent AudioManager.VOLUME_CHANGED_ACTION when the volume is changed
on any stream type (previously the intent was sent only for STREAM_BLUETOOTH_SCO stream).
A new extra for previous volume value is added to the intent.
/frameworks/base/media/java/android/media/AudioService.java
23f25cda0c73f8eb878844dea32fb0bd419edca2 25-Jan-2010 Eric Laurent <elaurent@google.com> Fix issue 2378022: AudioService should direct volume control to STREAM_VOICE_CALL stream when STREAM_VOICE_CALL stream is active.

Modified AudioService.getActiveStreamType() so that STREAM_VOICE_CALL is selected when a track using this stream
type is playing.

Chanded isMusicActive() for a more generic isStreamActive(stream) method in AudioSystem, IAudioFlinger and AudioFlinger.
/frameworks/base/media/java/android/media/AudioService.java
9272b4b4a44fe1f33e3030810618194f817caaec 24-Jan-2010 Eric Laurent <elaurent@google.com> Fix issue 2349345: Media sound output stuck on earpiece rather than speaker.

This change fixes a problem occuring when an application (for instance a VoIP application)
changes the audio mode to MODE_IN_CALL and crashes. In this case, the audio routing policy
remains as if we were in call until the audio mode is changed back to MODE_NORMAL, for instance when a new call
made or received and terminated.

The fix consists in registering a death receipient to the binder that made the setMode() request and resetting the audio
mode in case of client process crash.
/frameworks/base/media/java/android/media/AudioService.java
84b42b836845a921c853a3f8aa93227e1177f61d 09-Jan-2010 Eric Laurent <elaurent@google.com> am d31d7397: am 663ec308: Fix issue 2361949: A2DP suspend parameters set wrongly.

Merge commit 'd31d7397ba26dcd913e96d06f0a8fd593780d629'

* commit 'd31d7397ba26dcd913e96d06f0a8fd593780d629':
Fix issue 2361949: A2DP suspend parameters set wrongly.
663ec308801a34de82db9ab993f0e906da690f89 08-Jan-2010 Eric Laurent <elaurent@google.com> Fix issue 2361949: A2DP suspend parameters set wrongly.

Move reset of A2DP suspend state from handleSinkStateChange() in BluetoothA2dpService to
BluetoothA2dp.ACTION_SINK_STATE_CHANGED intent receiver in AudioService.
Previous implementation could cause a false reset of suspend state if a new sink attempted to
connect while A2DP was suspended.
New implementation only resets A2DP suspend state when a new sink is actually connected.
/frameworks/base/media/java/android/media/AudioService.java
a0b517609dfd8436a98bdebb31466f19ffec6cb5 28-Dec-2009 Eric Laurent <elaurent@google.com> am 68e9014e: am 484d2888: Fix issue 2299360: Change in in-call volume affects the Bluetooth in-call volume and vice versa.

Merge commit '68e9014e47f7350b3889e1704dde809b2a926968'

* commit '68e9014e47f7350b3889e1704dde809b2a926968':
Fix issue 2299360: Change in in-call volume affects the Bluetooth in-call volume and vice versa.
cf4fc6263c1c24ffa91a65a75edb126143a2617e 23-Dec-2009 Eric Laurent <elaurent@google.com> am f31f365a: am eb5ffc23: Merge change Id8e98194 into eclair

Merge commit 'f31f365a7708c931e955670bc6213fdc8f91a87a'

* commit 'f31f365a7708c931e955670bc6213fdc8f91a87a':
Fix issues 2333450 and 2333559:
eb14a783be073b5fd6e8c8c9bc87d2d1919f2c9e 17-Dec-2009 Eric Laurent <elaurent@google.com> Fix issues 2333450 and 2333559:

Add new config values to AudioSystem::FOR_DOCK force usage to differenciate car and desk docks.
Use a receiver for the sticky Intent.ACTION_DOCK_EVENT in AudioService to detect the type
of dock and select force usage accordingly.
/frameworks/base/media/java/android/media/AudioService.java
484d2888680e18e6ad8c3fcc51e3b70a705a096e 08-Dec-2009 Eric Laurent <elaurent@google.com> Fix issue 2299360: Change in in-call volume affects the Bluetooth in-call volume and vice versa.

Add a separate system settings entry for bluetooth SCO volume.
/frameworks/base/media/java/android/media/AudioService.java
1c633fc89bae9bf0af6fe643ac7ad2e744f27bed 09-Dec-2009 Dianne Hackborn <hackbod@google.com> Implement API to have new broadcasts replace existing broadcasts.

Use this in various places where it should serve no purpose to deliver
both broadcasts. This is intended to reduce somewhat the flurry of
broadcasts that we churn through during boot.
/frameworks/base/media/java/android/media/AudioService.java
6154412ee8e07e9cde129cccb944dd7ed9dcef53 08-Dec-2009 Jean-Michel Trivi <jmtrivi@google.com> Partially fix bug 2111240 Detect docking / undocking event by reporting
to the AudioPolicyManager a new forced usage AudioSystem::FOR_DOCK
which can take the FORCE_NONE, FORCE_BT_DOCK or FORCE_WIRED_ACCESSORY
values. This CL is complemented by an update of the APM to take into
account the FOR_DOCK usage.
/frameworks/base/media/java/android/media/AudioService.java
923d7d721d37f6ba5148e7d79d61a4fa48e79df2 12-Nov-2009 Eric Laurent <elaurent@google.com> Fix issue 2242614: Wired headset not recognized: bogus "state" in ACTION_HEADSET_PLUG broadcast.

The headset state indicated by HeadsetObserver in the broadcast intent ACTION_HEADSET_PLUG was not 0 or 1 as specified in the java doc but contained a bit field indicating the type of headset connected.

Modified HeadsetObserver to broacast a state conforming to java doc.
Added an extra to intent ACTION_HEADSET_PLUG to indicate if headset has a microphone or not.
Removed handling of non standard headset indications from HeadsetObserver.
Removed platform specific devices from output devices defined in AudioSystem.
Modified AudioService to use new ACTION_HEADSET_PLUG intent extra instead of bitfield in state.
/frameworks/base/media/java/android/media/AudioService.java
11a74a75653197a3d31fe91590cd8312f5270c44 28-Oct-2009 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2201417. Whenever the System setting that indicates
whether the notifcation stream uses the ring volume changes, the
table of stream volume aliases in AudioService is updated. But the
name of the alias stored in VolumeStreamState.mVolumeIndexSettingName
was not updated whenever the NOTIFICATIONS_USE_RING_VOLUME setting
was updated. This caused the wrong volume setting to be persisted.
This change ensures the setting name is updated whenever the volume
alias is, and persists the notification volume change right away
(instead of after a delay), so that registered observers are notified
right away. The notification seekbar in the sound settings is an
example of such an observer.
/frameworks/base/media/java/android/media/AudioService.java
89e74ba1419732dd5c7f939e48d4aa7989fd3a51 01-Oct-2009 Eric Laurent <elaurent@google.com> Fix Issue 2158631: AudioService: volume control sometimes not restored after media server process crash.

The problem comes from the fact that the AudioSystem callback indicating that the media server is active again is ignored if it is received before the delayed message indicating media server death. This happens if another application or service running in the system server process makes a request to the AudioSystem in the interval between the death of the media server and the reception of the corresponding delayed message.

The fix consists in resetting mMediaServerOk flags immediately when the death callback is received and not when the delayed message is received.
/frameworks/base/media/java/android/media/AudioService.java
a2ef57dba9ac77d8eccacd646b2b8a8d99fe9d8b 28-Sep-2009 Eric Laurent <elaurent@google.com> Fix issue 2141503: Keyclick sound doesn't honor volume settings.

Use music stream volume minus 3 dB for sound effects if volume is not explicitly requested by application.
/frameworks/base/media/java/android/media/AudioService.java
005b228cdfb369d9b3b325884c0337ba5968bf8c 10-Sep-2009 Nick Pelly <npelly@google.com> API_CHANGE: Cleanup, javadoc and unhide more Bluetooth API.

This is a large batch, and covers:

-- Bluetooth Device Discovery --
BluetoothAdapter.ACTION_DISCOVERY_STARTED
BluetoothAdapter.ACTION_DISCOVERY_FINISHED
BluetoothAdapter.startDiscovery()
BluetoothAdapter.cancelDiscovery()
BluetoothAdapter.isDiscovering()

-- Bluetooth bonding (pairing) --
BluetoothAdapter.getBondedDevices()
BluetoothDevice.ACTION_BOND_STATE_CHANGED
BluetoothDevice.EXTRA_BOND_STATE
BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE
BluetoothDevice.BOND_NONE
BluetoothDevice.BOND_BONDING
BluetoothDevice.BOND_BONDED
BluetoothDevice.getBondState()
BluetoothDevice.createBond()
BluetoothDevice.cancelBondProcess()
BluetoothDevice.removeBond()

-- BluetoothClass --
BluetoothDevice.ACTION_CLASS_CHANGED
BluetoothDevice.EXTRA_CLASS
BluetoothDevice.getBluetoothClass()
BluetoothClass.Service.*
BluetoothClass.Device.Major.*
BluetoothClass.Device.*
BluetoothClass.getDeviceClass()
BluetoothClass.getMajorDeviceClass()
BluetoothClass.hasService()

-- Misc BluetoothDevice --
BluetoothDevice.ACTION_ACL_CONNECTED
BluetoothDevice.ACTION_ACL_DISCONNECTED_REQUESTED
BluetoothDevice.ACTION_ACL_DISCONNECTED
BluetoothDevice.ACTION_DISCOVERED
BluetoothDevice.ACTION_NAME_CHANGED
BluetoothDevice.EXTRA_DEVICE
BluetoothDevice.EXTRA_NAME
BluetoothDevice.EXTRA_RSSI

-- Misc BluetoothAdapter --
BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED
BluetoothAdapter.EXTRA_LOCAL_NAME
BluetoothAdapter.checkBluetoothAddress()

I deprecated BluetoothIntent and moved each intent into the class it relates
to.

Change-Id: I877b1280428ab46278b2bc25668bb44cda22dc36
/frameworks/base/media/java/android/media/AudioService.java
dc1d17a1dbfc2ae01c20012133a836b62f5b6930 10-Sep-2009 Eric Laurent <elaurent@google.com> Fix issue android.permission.cts.NoAudioPermissionTest:testRouting is failing.

Add audio permission checks in setSpeakerphoneOn() and setBluetoothScoOn() methods.
/frameworks/base/media/java/android/media/AudioService.java
78333dd750c7353e47163407a662ef39a3c6b24a 27-Aug-2009 Jaikumar Ganesh <jaikumar@google.com> Set Routing to A2DP only when state is Connected.

We were setting the routing to A2DP when the state was Connecting too.
This was incorrect and can cause problems. One such problem was when
handling an incoming connection we set the routing to A2DP before
authorization. And even if authorization succeeds we get out sync with
AVDTP command state.
/frameworks/base/media/java/android/media/AudioService.java
6ee9952bc20be72b9419cb653c9e2e833889a3d3 25-Aug-2009 Eric Laurent <elaurent@google.com> Fix issue 2076322: AudioService, too many stream volume steps.

MAX_STREAM_VOLUME[] now contains the maximum valid index instead of the number of indexes for all stream types.
/frameworks/base/media/java/android/media/AudioService.java
a56d1c72190462aa9e377906583eceb58e0efcdd 19-Aug-2009 Nick Pelly <npelly@google.com> Fix AudioService on HFP power off due to new Bluetooth API.

HEADSET_STATE_CHANGED_ACTION contains a null BluetoothDevice when the HFP
disconnects.
/frameworks/base/media/java/android/media/AudioService.java
bd022f423a33f0794bb53e5b0720da2d67e4631c 15-Aug-2009 Nick Pelly <npelly@google.com> Bluetooth: API change.

Split BluetoothDevice into BluetoothDevice and BluetoothAdapter.

BluetoothAdapter: Represents the local BT adapter. Operations on the local
adapter (start a scan, etc).
BluetoothDevice: Represents a remote BT device. Operations on remote devices
(pair, connect, etc).

IBluetoothDevice.aidl -> Bluetooth.aidl
BluetoothDeviceService.java -> BluetoothDeviceService.java

TODO:
Javadoc
/frameworks/base/media/java/android/media/AudioService.java
5982013cfc8274ff0bafaba83c676b3a8890cba9 14-Aug-2009 Jared Suttles <jared.suttles@motorola.com> Change the number of volume steps from 6 to 7 per Verizon Requirements

Submitted on behalf of Helen Tran <Helen.Tran@motorola.com>
Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
/frameworks/base/media/java/android/media/AudioService.java
d5603c126acdd94d9f7400bb1d04188020a425b4 06-Aug-2009 Eric Laurent <elaurent@google.com> AudioService now differentiates BT headsets and car kits.

The BT headset detection now makes the difference between car kits and headsets, which can be used by audio policy manager.
The headset connection is also detected earlier, that is when the headset is connected and not when the SCO socket is connected as it was the case before. This allows the audio policy manager to suspend A2DP output while ringing if a SCO headset is connected.
/frameworks/base/media/java/android/media/AudioService.java
c42ac9d4d03f62c3a1ba197a28a81fda44bd8b7f 29-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 2019031: Volume changes have no effect.

Send initStreamVolume() for each stream when media server restarts.
Also added restoring of phone state, device connection state and forced device for communications.
/frameworks/base/media/java/android/media/AudioService.java
d25ae67ca8f003ada2881154514523d8614d4b7e 27-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 2004738: Settings Backup Agent consistently throws ArrayIndexOutOfBoundsException during restore.

Use stream alias when accessing VOLUME_SETTINGS array.
/frameworks/base/media/java/android/media/AudioService.java
a553c25b33c99b345cf1c8688f8df0ed8df14e5a 17-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1795088 Improve audio routing code

Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
/frameworks/base/media/java/android/media/AudioService.java
fd6e4820c6ee91c9c232a7598c1e45c002b868e7 17-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1985479 lots of backup NPEs.

Check that stream type is not STREAM_BLUETOOTH_SCO before writting to settings.
/frameworks/base/media/java/android/media/AudioService.java
4050c93601b3c3609b21cc1e18a29b64747e7fa9 08-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1967295: Add a method to request reloading of audio settings by AudioService.
/frameworks/base/media/java/android/media/AudioService.java
d1f362fe144e6cbcb759fa9086a80adbfe9c7589 16-Jun-2009 Mike Lockwood <lockwood@android.com> AudioService: Fix routing problem recently introduced in setRouting().

Do not disable a route unless routes is zero, to avoid accidentally disabling
if the same route is enabled twice in a row.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/media/java/android/media/AudioService.java
9bcf401d13d47416043a704430388abd59aef7cd 12-Jun-2009 Eric Laurent <elaurent@google.com> Fix issue #899198 MODE_RINGER_STREAMS_AFFECTED does not restore volumes correctly

The problem is that setRingerModeInt() does not handle streams not affected by ringer mode: when enabling "Alarm in silent mode" while in silent mode, setRingerModeInt is called after alarm streamis removed from ringer mode affected streams, and nothing is done.

The fix constists in also processing streams that are not affected by ringer mode and to restore last audible volume for them. It does not arm reapplying the volume for streams the are never affected by ringer mode as we don't do this very often.

The other problem noted in the bug report (ringer volume always restored to non zero value when exiting silent mode even if set to zero before) is also fixed: a new parameter is added to setIndex() and setStreamVolumeInt() to explicitely request to store the volume index as last audible instead of doing it automatically if index > 0.
/frameworks/base/media/java/android/media/AudioService.java
b9c9d260f21b321527c4622a123af9767630d94d 06-May-2009 Eric Laurent <elaurent@google.com> fix issue 1713090: After a Bluetooth call, MusicPlayer starts playing on speaker rather than wired external audio.

Temporary fix until audio routing is refactored in Eclair release:
- centralized and synchronized all audio routing control in AudioService.setRouting()
- deprecated AudioManager.setRouting() and AudioManager.getRouting() methods
/frameworks/base/media/java/android/media/AudioService.java
1a9f7399bb32c81ad5cc8c9d74ab3065b4a150ac 25-Mar-2009 Niko Catania <> Automated import from //branches/donutburger/...@140800,140800
/frameworks/base/media/java/android/media/AudioService.java
b109615ebebd6f3b9ae789412279f576c3ace46b 25-Mar-2009 Jason Parekh <> Automated import from //branches/donutburger/...@140507,140507
/frameworks/base/media/java/android/media/AudioService.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/media/java/android/media/AudioService.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/media/java/android/media/AudioService.java
3001a035439d8134a7d70d796376d1dfbff3cdcd 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
/frameworks/base/media/java/android/media/AudioService.java
da996f390e17e16f2dfa60e972e7ebc4f868f37e 13-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@131421
/frameworks/base/media/java/android/media/AudioService.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/media/java/android/media/AudioService.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/media/java/android/media/AudioService.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/media/java/android/media/AudioService.java