1305 Commits

Author SHA1 Message Date
John Grossman
720aa28279 Switch the way we configure for MediaPlayer retransmission.
This is a cherry-pick of I6ab07d89b2eeb0650e634b8c3b7a0b36aba4e7dd
with merge conflicts addressed by hand and additional changes made in
response to code review feedback.

Move in the direction of a more publishable API for configuring a
media player for retransmission.  It used to be that we used a custom
invoke and a modified URL (prefixed with aahTX://).  There are many
issues with this technique and it was never meant to stand the test of
time.

This CL gets rid of all that.  A new (but currently hidden) method was
introduced to the java level MediaPlayer API, called
setRetransmitTarget(InetSocketAddress), which allows an app writer to
set the retransmit target.  For now, this method needs to be called
before a call to setDataSource (which is pretty unusual for the
MediaPlayer API) because this mid level code uses this as a cue to
instantiate an aahTX player instead of relying on the data source to
select a player.  When retranmit functionality becomes part of the
existing android player implemenation, this
set-retrans-before-set-data-source behavior can go away, along with
the aahTX player itself.

Change-Id: I3b46c5227bbf69acb2f3cc4f93cfccad9777be98
Signed-off-by: John Grossman <johngro@google.com>
2012-03-01 14:41:35 -08:00
Andreas Huber
0ae6b481e4 Merge "Implementation of a java media codec interface and associated tools." 2012-02-22 15:13:44 -08:00
Andreas Huber
88572f7a3e Implementation of a java media codec interface and associated tools.
Change-Id: I13e54062d4de584355c5d82bb027a68aeaf2923b
2012-02-22 15:06:06 -08:00
James Dong
a352d1e241 Merge "Allow to record time lapse videos without using setProfile()" 2012-02-22 11:47:07 -08:00
James Dong
a4d205d02c Allow to record time lapse videos without using setProfile()
o also added a check on whether capture rate was set before starting time lapse video recording.

o related-to-bug: 6045507

Change-Id: I8e1fdc8e8931e2684ab3822dc6260db44658e87d
2012-02-22 10:20:46 -08:00
Marco Nelissen
58ef68905d Eliminate scanner file cache
Get rid of the file cache, since it tends to run out of memory for large
numbers of files. This slows down the scanner somewhat, but recent
optimizations more than make up for that.

With this change, the postscan phase of the media scan now only processes
playlists. Removal of entries for files that no longer exist is done as
part of the prescan.
Lookups in the file cache are replaced by simple queries, which are still
reasonably fast because of a new index recently added to the media provider
database. Note that there was a bug in the case-insensitive matching for
file cache entries, in that e.g. an uppercase a-accent-aigue would be mapped
to its lowercase version, whereas the underlying case-insensitive filesystem
treats them as different characters. Getting rid of the file cache also fixes
this issue.

Bug: 4474617
Change-Id: I39c6f1a35bb518ef7ab912e9b9401663821ef48e
2012-02-22 08:37:26 -08:00
John Grossman
3540a0197f Enhance Visualizer behavior in the case of mediaserver death.
Bring the Visualizer class into line with the SDK documentation by
returning ERROR_DEAD_OBJECT instead of ERROR_INVALID_OPERATION when
the Visualizer loses its binder connection to the mediaserver because
of a mediaserver restart.

Also add a new callback interface to allow clients to be
asynchronously notified in the case of server death.  Right now, the
interface definition and the registration method are flagged as hidden
pending API council review/approval.

See http://b/issue?id=5717519 for details.

Change-Id: Ic15856f27ed5a950a583ac11ca81f79bd7e9b1a0
Signed-off-by: John Grossman <johngro@google.com>
2012-02-16 13:45:11 -08:00
John Grossman
449725f9aa Reuse callback buffers in the Visualizer.
Don't re-allocate buffers used by Visualizer callbacks as this causes an
unacceptable amount of GC thrash.  Instead, lazily allocate the buffers and only
reallocate them when the required size changes.

See http://b/issue?id=5717519 for details.

Change-Id: Ibd157ed51f30687ce7c4ef0b4003258a484e0f5d
Signed-off-by: John Grossman <johngro@google.com>
2012-02-16 13:45:11 -08:00
Eric Laurent
98ad9b9d6f 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
2012-02-15 17:21:37 -08:00
Marco Nelissen
d121cfcbb4 Further optimize media scanner.
Inserts of directories can be done in bulk as long as they're inserted before
the files contained within. Extend MediaInserter to accommodate giving priority
treatment to directories.
Bulk deleting of entries can be further sped up (by a factor of ~3 in my tests)
by deleting entries in database order. Switch the file cache to use
LinkedHashMap instead of HashMap to allow iterating over the cache in database
order. Also use bindArgs to allow for better caching of sql statements.

Change-Id: Ieb9ffc4e866c6cd505bf795eb80ff5d03ffc56bd
2012-02-13 15:39:15 -08:00
Mike Lockwood
9760647dd0 Add support for non-linear ramping of master volume adjustment
Bug: 5472584

Change-Id: I1227007d1563eca739fb78b6d9595febc04a3f03
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-02-10 15:58:07 -08:00
Jason Simmons
1ce5b26d70 Only send master volume or mute updates if the settings have changed 2012-02-10 14:44:08 -08:00
Jason Simmons
e3f5979307 Make AudioManager.adjustMasterVolume public and hidden 2012-02-10 14:44:08 -08:00
Mike Lockwood
9063154a79 Restore persisted master volume if the media server restarts
Bug: 5755071

Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-02-10 14:44:08 -08:00
Mike Lockwood
b7bd88a3b6 Don't allow changing master volume when muted
Bug: 5793021

Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-02-10 14:44:07 -08:00
Mike Lockwood
5c55a051ad Defer persisting master data to avoid excessive database writes
Bug: 5705192

Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-02-10 14:44:07 -08:00
Mike Lockwood
3194ea9434 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>
2012-02-10 14:44:06 -08:00
Mike Lockwood
0dc37cce9d AudioService: Send broadcasts when master volume and mute state change
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-02-10 14:44:06 -08:00
Mike Lockwood
fa7b06147c AudioManager: Add wrapper methods for master volume support
Signed-off-by: Mike Lockwood <lockwood@android.com>
2012-02-10 14:44:05 -08:00
Mike Lockwood
ce952c8e13 AudioManager: Add support for master mute
Signed-off-by: Mike Lockwood <lockwood@android.com>
2012-02-10 14:44:05 -08:00
Mike Lockwood
4767690f09 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>
2012-02-10 14:44:04 -08:00
Mike Lockwood
8dc1dabd25 VolumePanel: Add support for master volume
Signed-off-by: Mike Lockwood <lockwood@android.com>
2012-02-10 09:05:49 -08:00
Mike Lockwood
8517e46f3d Save and restore master volume in the settings provider
Signed-off-by: Mike Lockwood <lockwood@android.com>
2012-02-10 09:05:39 -08:00
Mike Lockwood
cbdb49dc5e 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>
2012-02-10 09:01:28 -08:00
Scott Main
e7eeace594 am ec12ae99: am 79cfde69: am 52bfc243: docs: fix misc doc bugs from external issue tracker
* commit 'ec12ae9933e463181338834387caa7c58b330635':
  docs: fix misc doc bugs from external issue tracker
2012-02-09 12:53:12 -08:00
Scott Main
52bfc24368 docs: fix misc doc bugs from external issue tracker
Change-Id: If6ff3476670e42b321d56d4a1482ccff96d4d500
2012-02-09 12:45:16 -08:00
Marco Nelissen
b3f04a6569 Merge "Delete entries in bulk" 2012-02-08 10:15:01 -08:00
Marco Nelissen
9ff4774cac Delete entries in bulk
Deleting entries from the database in bulk greatly speeds up the media
scanner in some cases; removing 31k entries used to take about 2 hours,
now it takes about 15 minutes.

Change-Id: Ia8f3fd6d828289e3d67178e9ad10399ded8d70d2
2012-02-08 10:13:11 -08:00
Marco Nelissen
f047c14f23 Merge "Make media scanner use new delete-parameter" 2012-02-07 08:28:02 -08:00
Marco Nelissen
ac259f17a0 Make media scanner use new delete-parameter
This speeds up the media scan case where many files were deleted or moved.

Change-Id: I86e6fc6d0968eebf24923c0b5587b90d309721bb
2012-02-07 07:54:39 -08:00
James Dong
874d1f1f65 Unhide AAC_ADTS file format
o also actually decprecated RAW_AMR file format

Change-Id: Ic8ef5b0dca6f793fddf9e79d431e79f5083f7bff
2012-02-02 15:50:24 -08:00
Marco Nelissen
d6b3e0cc36 Enable media scanner bulk inserts
Change-Id: I357162d0fe498a182ccb14630fe565daaa8bb0c1
2012-02-02 10:35:22 -08:00
Marco Nelissen
f3a3b9ec9c Merge "Handle adding/removing/renaming nomedia paths" 2012-01-30 08:27:57 -08:00
Jeff Brown
2d2d7d6f42 Merge "Implement a cancelation mechanism for queries." 2012-01-27 17:37:24 -08:00
Jeff Brown
75ea64fc54 Implement a cancelation mechanism for queries.
Added new API to enable cancelation of SQLite and content provider
queries by means of a CancelationSignal object.  The application
creates a CancelationSignal object and passes it as an argument
to the query.  The cancelation signal can then be used to cancel
the query while it is executing.

If the cancelation signal is raised before the query is executed,
then it is immediately terminated.

Change-Id: If2c76e9a7e56ea5e98768b6d4f225f0a1ca61c61
2012-01-27 17:33:21 -08:00
Glenn Kasten
30c918ce7f Use final on new member variables
Use final for member fields initialized to a new and that are never modified.

Change-Id: I042352c7bc21879613e7a50b1205b6923f8083cf
2012-01-27 16:13:00 -08:00
Marco Nelissen
ca78f3d9af Handle adding/removing/renaming nomedia paths
b/5849015
Change-Id: I3ec7419498d1ecc83db6d4605b3d7610349231f7
2012-01-27 15:10:14 -08:00
Jean-Michel Trivi
11001c344a Merge "Bug 5567648 disassociate audio mode and audio focus" 2012-01-27 14:15:37 -08:00
Jean-Michel Trivi
4dd3674e51 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
2012-01-27 13:32:45 -08:00
Glenn Kasten
c14639a9a1 Merge "Use audio_source_t consistently" 2012-01-27 09:06:00 -08:00
Glenn Kasten
0f0fbd9441 Use audio_source_t consistently
Was a mix of audio_source_t, uint8_t, and int.

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

Change-Id: Ie5e25d646dcd59a86d7985aa46cfcb4a1ba64a4a
2012-01-26 16:50:19 -08:00
Jean-Michel Trivi
a701da8eba Update AudioTrack.stop() javadoc
Add more information on the behavior of
  android.media.AudioTrack.stop()

Change-Id: Id0f968e6bb8fe38765a86c43fc065908ee84edf1
2012-01-24 16:53:57 -08:00
Glenn Kasten
ee7fea9f2f Remove dead setRingerMode(mode, mask)
Change-Id: Ia4cc8be8424a40b3dcb7ebd0264fdff4e5247f7f
2012-01-18 15:10:31 -08:00
Eric Laurent
9bc8358dda 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
2012-01-17 15:15:04 -08:00
Sungsoo Lim
6c4c155696 MediaScanner: Disable bulk insert for settings
Since the settings (notifications, ringtones, and alarms) request
rowId after inserting into DB, do not use bulk insert for them.
(Bulk insert does not return the rowId)

Change-Id: I8faf993f8ac2da96672594a1c92ddc917f964d6f
2012-01-11 11:34:20 +09:00
Glenn Kasten
b282e08ab6 Fix build
Change-Id: Ia140af1a61edf124ef3d48b60351f850a3475af1
2012-01-09 13:11:07 -08:00
Glenn Kasten
5c17a820f9 Audio Java doc comment typos and minor changes
Change-Id: Id6ea6dccb8054c9f05db9a9c045387ce813659e6
2012-01-09 12:15:18 -08:00
Glenn Kasten
13f94dc5bd Merge "Fix race conditions related to ringer mode" 2012-01-09 12:01:37 -08:00
Marco Nelissen
18c6afa0c5 Merge "Also accept non-parenthesized genre numbers" 2012-01-06 08:08:15 -08:00
Marco Nelissen
ad35f9165e Also accept non-parenthesized genre numbers
b/5790684

Change-Id: Ia13feebeaadd45d9196486c012538c5b80840163
2012-01-05 15:15:53 -08:00