6667 Commits

Author SHA1 Message Date
Glenn Kasten
a501b5b8d5 AudioTrack error checks
getMinBufferSize():
  Simplify native_get_min_buff_size error checks and handle more errors.

setPlaybackHeadPosition():
  Disallow for streaming mode [underlying AudioTrack C++ requires this].
  Disallow setPlaybackHeadPosition before write().
  Remove unnecessary synchronization around native_set_position().

setLoopPoints():
  As setLoopPoints() is effectively a variant of setPlaybackHeadPosition(), do the same error checks.

write():
  Don't set "write completed" state if write() parameters are invalid or native write fails.
  It was setting "write completed" flag too early, and ignoring native write return value.
  Detect integer overflow.

reloadStaticData():
  Disallow reloadStaticData() before write().

Change-Id: Iec36fc0ea67095e18a2c238b148dad5545c102c1
2012-12-05 17:08:48 -08:00
Glenn Kasten
9c1d2de177 Merge "Make mInitializationLooper final" 2012-12-05 15:44:07 -08:00
Glenn Kasten
4e71faec0c Merge "Simplify throw statements" 2012-12-05 15:35:39 -08:00
Glenn Kasten
0fc11dd059 Merge "Remove redundant AudioTrack. qualifiers" 2012-12-05 15:28:06 -08:00
Glenn Kasten
df3cb52798 Remove redundant AudioTrack. qualifiers
Symbols of the current class don't need to be qualified.

Change-Id: Ic89ce568771165d01d4b5bcf835c591ca0b86541
2012-12-05 15:24:40 -08:00
Andreas Huber
08067d376e Make it clear that non-optional MediaFormat keys are required
Also mark KEY_CHANNEL_MASK optional.

Change-Id: I569087f564dc60a89b15a3440a9b1c538927f610
2012-12-05 11:12:26 -08:00
Eric Laurent
526b035bc5 Merge "Allow mute when playing over fixed volume device" 2012-12-04 18:25:37 -08:00
Glenn Kasten
1e821372be Merge "Replace hard-coded sample rate values by constants" 2012-12-04 16:32:41 -08:00
Eric Laurent
3ef7549876 Allow mute when playing over fixed volume device
Modified AudioService to add the possibility to mute/unmute music
with volume keys while playing over fixed volume devices (HDMI, digital dock).
VOL- forces volume to 0 and VOL+ forces volume to maximum.

Bug 7377764.

Change-Id: Ibaf805d76c30e3c0e395547cd3ce0087dbfb9f30
2012-12-04 14:29:24 -08:00
Marco Nelissen
a5c9fd93cc Merge "Fix default ring/alarm/notification insertion" 2012-12-03 15:39:42 -08:00
Marco Nelissen
4ecfce6f6f Fix default ring/alarm/notification insertion
Before directly inserting an item that is the default ringtone, alarm or
notification, flush the MediaInserter, since a parent of the inserted item
might not have been flushed yet.

b/7650557

Change-Id: Icdd25bd9cac8b43a75e63318b936246562744c59
2012-12-03 15:15:47 -08:00
Andreas Huber
1adc5975fa am 800c8ab6: am 2644494a: Merge changes I8462f040,Ie471f40f
* commit '800c8ab68d695f1b6c5332c80a32316cdca69954':
  MediaCodec: Allow getting the codec info directly
  MediaCodec: Allow getting the chosen component name
2012-11-30 14:28:14 -08:00
Andreas Huber
800c8ab68d am 2644494a: Merge changes I8462f040,Ie471f40f
* commit '2644494a9841c1f842d790b60911699f09eb63d1':
  MediaCodec: Allow getting the codec info directly
  MediaCodec: Allow getting the chosen component name
2012-11-30 14:26:16 -08:00
Andreas Huber
2644494a98 Merge changes I8462f040,Ie471f40f
* changes:
  MediaCodec: Allow getting the codec info directly
  MediaCodec: Allow getting the chosen component name
2012-11-30 13:26:51 -08:00
Eric Laurent
b686eceac9 am b46857d2: am b1f45c4a: am c3eb57b2: Merge "AudioService: improve initial safe volume delay" into jb-mr1.1-dev
* commit 'b46857d228edc53878e738ffd484dea1acf44baf':
  AudioService: improve initial safe volume delay
2012-11-30 09:33:01 -08:00
Eric Laurent
b46857d228 am b1f45c4a: am c3eb57b2: Merge "AudioService: improve initial safe volume delay" into jb-mr1.1-dev
* commit 'b1f45c4a587e5adda39774a867c78b56682c5f0d':
  AudioService: improve initial safe volume delay
2012-11-30 09:31:03 -08:00
Eric Laurent
c3eb57b22f Merge "AudioService: improve initial safe volume delay" into jb-mr1.1-dev 2012-11-30 09:26:30 -08:00
Eric Laurent
05274f348e AudioService: improve initial safe volume delay
AudioService relies on a valid mmc in order to enforce the headset
volume limitation or not. There is a timeout to enforce the limitation
if no mcc is configured after boot.
Until this timeout is reached or a valid SIM is detected the headset
volume is not limited.

This change makes that the last known volume limitation state (enforced or
not) is persisted so that next time we boot, last known state is applied until
a new mcc is configured if any. In most cases, the mcc does not change from one
boot to the next and we do the right thing. If teh mcc does change, the correct
policy will be enforced when the mcc is detected or after the timeout.

Also fix a bug where the volume panel was not displayed if the limitation mechanism
is triggered at the first press on VOL+ key.

Bug 7455275.

Change-Id: Id0f2996d893d38c6a14f4f9e4a0e9e3be17ef127
2012-11-29 17:46:05 -08:00
Glenn Kasten
f4e58051e2 Simplify throw statements
Conventional throw statement syntax does not require parentheses

Change-Id: I9cb3e76d60d688d2e0b77a18674527a87548e297
2012-11-29 16:47:37 -08:00
Glenn Kasten
ad67c95464 Replace hard-coded sample rate values by constants
Change-Id: If561dd4d336a70dfda3b741d4e50e289a978580c
2012-11-29 16:32:23 -08:00
Glenn Kasten
b09707a041 Make mInitializationLooper final
This emphasizes that it doesn't change after construction,
and will prevent accidental modification in the future.

Change-Id: I18a2cecda79bd936967de26cdaaa7b731559545d
2012-11-29 15:30:45 -08:00
Adam Powell
03919d4084 am 2a1f11e9: am 57c23a46: am 10479a29: Merge "Clean up behavior of type arguments for MediaRouter#getSelectedRoute" into jb-mr1.1-dev
* commit '2a1f11e9750951d072d04155cfe3b7b7f7b96bb7':
  Clean up behavior of type arguments for MediaRouter#getSelectedRoute
2012-11-29 14:33:00 -08:00
Adam Powell
2a1f11e975 am 57c23a46: am 10479a29: Merge "Clean up behavior of type arguments for MediaRouter#getSelectedRoute" into jb-mr1.1-dev
* commit '57c23a464a8428f089531a5d3cab20c81eb6ccee':
  Clean up behavior of type arguments for MediaRouter#getSelectedRoute
2012-11-29 14:26:57 -08:00
Adam Powell
1cf2ca8358 Clean up behavior of type arguments for MediaRouter#getSelectedRoute
MediaRouter's policy so far has been around a single selected route,
but when route types are entirely orthogonal this should not be the
case. However we still don't want to get into a situation where we
have multiple, very different routes selected for different types at
the same time, we still want to have more of an element of
predictability.

Behavior of getSelectedRoute is now:

* If the selected route matches at least one type with the requested
  type flags, it is still considered selected for that request.

* If the caller specifically requested the selected user route and the
  currently selected route is not a user route, return null.

* If the requested type flags do not match any types with the selected
  route, return the default system route.

Note that this is "any" behavior instead of "all" - this matches
existing usage of the method. We may consider adding an "all" variant
later on.

Bug 7588042

Change-Id: I3a79d8153ca6b882fd3ef6b9b1de8f538873dec2
2012-11-28 11:22:01 -08:00
Jean-Michel Trivi
0572954507 am 015ec39d: am 5985d106: am c7dd6640: Merge "Fix audio focus evaluation order for display update" into jb-mr1.1-dev
* commit '015ec39dffe54687781357f9ef751b6218159c5d':
  Fix audio focus evaluation order for display update
2012-11-20 18:07:10 -08:00
Jean-Michel Trivi
015ec39dff am 5985d106: am c7dd6640: Merge "Fix audio focus evaluation order for display update" into jb-mr1.1-dev
* commit '5985d106f784388f979f86598408cb7c8615ebee':
  Fix audio focus evaluation order for display update
2012-11-20 18:05:09 -08:00
Jean-Michel Trivi
4dd3fb3e2c Fix audio focus evaluation order for display update
Change 1f9196a8e5de9b004e61afabc70b18caf7cf9c7e introduced
 an issue when trying to ignore audio focus entries in the
 stack that don't use the music stream, or are for transient
 audio focus gain, for remote control display updates.
The bug was that the audio focus stack traversal was not
 starting from the top, as it should. It was using
 the iterator order, which, in the case of a stack, starts
 with the bottom-most entry.
The fix consists in traversing the stack from the top, i.e.
 from the last element of the vector used to hold the stack
 entries.

Bug 7311023

Change-Id: I0c1900dbf98599a621a420ab55531a3eee838fe5
2012-11-20 17:59:34 -08:00
Marco Nelissen
68cc52cf67 am 803db164: am aeb62686: Merge "Fallback to fallbackring if ringtone can\'t be played."
* commit '803db1646aedb451b76d33a4f30b16942c5d3ca4':
  Fallback to fallbackring if ringtone can't be played.
2012-11-16 13:07:04 -08:00
Marco Nelissen
803db1646a am aeb62686: Merge "Fallback to fallbackring if ringtone can\'t be played."
* commit 'aeb6268645d571dfc9f2d387a7ad2471039ddb54':
  Fallback to fallbackring if ringtone can't be played.
2012-11-16 13:03:33 -08:00
Oscar Rydhé
1c25a21ffc Fallback to fallbackring if ringtone can't be played.
If the specified ringtone file exists but cannot be played
the Ringtone will try to play the ringtone in a remote player.
But since the file is corrupt it will not be played in the
remote player either.
According to the documentation it should attempt to
fallback on another sound. This commit will do that.

Change-Id: I0216d61ca874eef0f168ad4d5bfb07491e01e654
2012-11-16 14:22:14 +01:00
Martin Storsjo
93077a2902 MediaCodec: Allow getting the codec info directly
This saves the caller from manually iterating through the
MediaCodecList for finding the right codec.

This adds new public API.

Change-Id: I8462f040573427542d86d1b957a5aef53dd55e8e
2012-11-14 20:52:01 +02:00
Andreas Huber
f7f2357338 am 35de4831: am d1e8f467: am 99a86d06: Clarify that MediaFormat.KEY_IS_ADTS only applies to decoding AAC audio content
* commit '35de48317f51a1331e2c6f279c5a2e76b65469ad':
  Clarify that MediaFormat.KEY_IS_ADTS only applies to decoding AAC audio content
2012-11-14 10:45:56 -08:00
Andreas Huber
35de48317f am d1e8f467: am 99a86d06: Clarify that MediaFormat.KEY_IS_ADTS only applies to decoding AAC audio content
* commit 'd1e8f467602307090f36a899b47f5088d0bc0201':
  Clarify that MediaFormat.KEY_IS_ADTS only applies to decoding AAC audio content
2012-11-14 10:24:24 -08:00
Andreas Huber
99a86d0633 Clarify that MediaFormat.KEY_IS_ADTS only applies to decoding AAC audio content
and cannot be used to configure the _encoder_ to emit ADTS content.

Change-Id: I47177099b204027b726b2c7ec9b93be6835d88f6
related-to-bug: 7542186
2012-11-14 09:16:59 -08:00
Martin Storsjo
056ef2ed5f MediaCodec: Allow getting the chosen component name
Currently, when the codec was opened by createDecoder/EncoderByType,
the caller does not know what codec actually was chosen, and
(for encoders) thus cannot know what color formats it supports.

This adds new public API.

Change-Id: Ie471f40f8104b37d27ced3dba5a54facc6504b1b
2012-11-14 14:46:57 +02:00
Craig Mautner
0f32fdc3db am 50acd731: am 67a3fb6f: am c10914ca: Merge "Support Wifi display devices that rename themselves." into jb-mr1.1-dev
* commit '50acd73173e5ca68db0a4cc01e75a2faef86b2fb':
  Support Wifi display devices that rename themselves.
2012-11-13 10:07:29 -08:00
Craig Mautner
50acd73173 am 67a3fb6f: am c10914ca: Merge "Support Wifi display devices that rename themselves." into jb-mr1.1-dev
* commit '67a3fb6f3b787f0151c7f76f0c19dd1c8b80ae4e':
  Support Wifi display devices that rename themselves.
2012-11-13 10:04:27 -08:00
Craig Mautner
c10914ca5c Merge "Support Wifi display devices that rename themselves." into jb-mr1.1-dev 2012-11-13 10:00:04 -08:00
Glenn Kasten
068225de01 Add all-channel setVolume() API
Add combined channel APIs setVolume to AudioTrack, MediaPlayer, and
SoundPool to make later migration easier, and encourage apps to use
that API.  The new APIs are @hide for now.

Change-Id: I0c87bfdbff4f4292259fa33e65f67badbafd270b
2012-11-08 17:50:43 -08:00
Eric Laurent
91d5cc56d3 am 2b988843: am 30717b68: Merge "AudioService: undock audio glitch - DO NOT MERGE" into jb-mr1.1-dev
* commit '2b9888439d4016ac4890b0c6018d2f5a9e5bd653':
  AudioService: undock audio glitch - DO NOT MERGE
2012-11-08 15:45:27 -08:00
Eric Laurent
8a8e2a4b9c am 98e5c814: am 73176865: Merge "audio service fix dock after crash - DO NOT MERGE" into jb-mr1.1-dev
* commit '98e5c81438f36d907215eeba338ee834c29791de':
  audio service fix dock after crash - DO NOT MERGE
2012-11-08 15:45:23 -08:00
Eric Laurent
0214f2b856 AudioService: undock audio glitch - DO NOT MERGE
merge from master:

"AudioService: improve low end dock audio control

Low end docks have a menu to enable use of audio
for media: automatically enabling/disabling use of audio
when the dock is connected/disconnected is useless
and can be the source of audio glitches.

Bug 7463620."

Change-Id: I3b7e7ebe660bb3f0e4367d2a3ed63ee76f78fe58
2012-11-08 09:17:56 -08:00
Eric Laurent
cd3231f501 audio service fix dock after crash - DO NOT MERGE
merge from master:
"audio service: set dock use on mediaserver restart

Restore forced usage of dock audio for media according to
current setting when media server restarts."

Bug 7485250.

Change-Id: Ie67b80ede1ed92d223dd96de83c1beb985dfba06
2012-11-08 09:05:22 -08:00
Jeff Brown
74da109102 Support Wifi display devices that rename themselves.
Some Wifi display devices like to rename themselves after a
connection completes (or at other times).  Make sure to update
the name of the display when we detect that it changed in
our scan results.

This problem is somewhat complicated by the fact that we remember
the display name persistently, so we need to update our list
of remembered displays too.

Improve the state machine to avoid redundant attempts to
disconnect or cancel connection.

Bug: 7478895
Change-Id: I35a9e2c6a8deadbe892dacd5e3b4a5a2b12d6cf0
2012-11-07 18:43:32 -08:00
Kenny Root
7b172a49a9 am 58ed5d74: am 768d9e1a: Merge "Correct executable bit for source files"
* commit '58ed5d748c0b9b64845975ef5844ad313de7c3f6':
  Correct executable bit for source files
2012-11-07 13:08:25 -08:00
Kenny Root
58ed5d748c am 768d9e1a: Merge "Correct executable bit for source files"
* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
  Correct executable bit for source files
2012-11-07 11:52:12 -08:00
Kenny Root
3a084af2e9 Correct executable bit for source files
Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
2012-11-07 10:27:31 -08:00
Eric Laurent
be78e991fd Merge "AudioService: improve low end dock audio control" 2012-11-06 08:37:55 -08:00
Eric Laurent
08ed1b9d20 AudioService: improve low end dock audio control
Low end docks have a menu to enable use of audio
for media: automatically enabling/disabling use of audio
when the dock is connected/disconnected is useless
and can be the source of audio glitches.

Bug 7463620.

Change-Id: I3b7e7ebe660bb3f0e4367d2a3ed63ee76f78fe58
2012-11-05 16:04:58 -08:00
Marco Nelissen
da005f4600 am ff25dd33: am 6791ebde: am 7a4d856c: Merge "Removed offensive music genre"
* commit 'ff25dd337d1f7a079495c0c5f5bb69fd1f97548f':
  Removed offensive music genre
2012-11-05 15:47:32 -08:00