1460 Commits

Author SHA1 Message Date
Mike Lockwood
8d8176d41b Merge "AudioService: Fix problem handling USB audio disconnect" into jb-dev 2012-05-10 17:58:47 -07:00
Mike Lockwood
9841818b9a 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>
2012-05-10 17:49:30 -07:00
Eric Laurent
2448201852 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
2012-05-10 17:20:26 -07:00
Eric Laurent
24938df9e4 Merge "AudioService: synchronized access to volume index" into jb-dev 2012-05-10 15:20:08 -07:00
Eric Laurent
3172d5e3e7 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
2012-05-10 14:55:20 -07:00
Jean-Michel Trivi
08fb063f07 Add compression level key for FLAC encoding
Change-Id: Ic4c32694841b6f37ca44061d14bb81fc267696cc
2012-05-09 19:16:14 -07:00
Andreas Huber
f86374adec Remove SEEK_CLOSEST constant from MediaExtractor, its implementation makes no
sense for the java API.

Change-Id: I3f2eabb5ca5ffb6c1f03141bfd303310111e8774
related-to-bug: 6276111
2012-05-09 11:32:51 -07:00
James Dong
3b5fdf510b Merge "Fix: Missed parcel recycling in MediaPlayer." into jb-dev 2012-05-08 18:29:44 -07:00
Eric Laurent
bffc3d1bd3 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
2012-05-08 15:10:37 -07:00
Andreas Huber
8aa735f71e Clarification of MediaCodec behaviour when codec specific data is included
in the format passed to configure().

Change-Id: I150f52e8092c0f7d897891f02ba6b1d89b6230f4
related-to-bug: 6364139
2012-05-08 11:33:12 -07:00
Jeff Sharkey
1d8e5c5880 Handle silent ringtone, title without permission.
Silent ringtones have a valid Uri, but isn't openable by MediaPlayer,
so treat as no-op playback instead of throwing.  Also handle missing
permissions when resolving title.

Bug: 6448074, 6447538
Change-Id: I656675d7fc2e78a6ba05824e13bdd43193fcfdf2
2012-05-07 13:30:10 -07:00
Insun Kang
be0ea968bf Fix: Missed parcel recycling in MediaPlayer.
Change-Id: I2c99f771b33bf627af10e8baea455181558360e6
related-to-bug: 6405934
2012-05-07 11:31:18 +09:00
Andreas Huber
c52c957c45 Merge "Various changes to Media* APIs requested by the api council." into jb-dev 2012-05-04 08:53:23 -07:00
Andreas Huber
60d610bf10 Various changes to Media* APIs requested by the api council.
Change-Id: Iec2f50c99cf5f00a442737231361334e9ab46340
related-to-bug: 6432753
2012-05-03 16:02:29 -07:00
Jean-Michel Trivi
f26f01784e 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
2012-05-02 11:20:22 -07:00
Eric Laurent
f3afe15754 Merge "AudioManager: deprecate vibrate settings" into jb-dev 2012-05-01 16:29:39 -07:00
Eric Laurent
cd1cd73bae AudioManager: deprecate vibrate settings
Deprecate methods, intent and constants related to vibrate
settings management: getVibrateSetting(), setVibrateSetting(),
shouldVibrate() ...

According to new vibrate/notification policy, applications should
maintain their own vibrate settings.

Issue 6036529.

Change-Id: I99bcef2c5f602131f1d9b0222f7fb39f3bbef823
2012-05-01 16:26:04 -07:00
James Dong
cb6662ac53 Merge "Add video scaling mode support with a new public method in MediaPlayer.java class" into jb-dev 2012-05-01 13:34:28 -07:00
Andreas Huber
48dc91b514 Make java constants consistent with native counterparts.
Change-Id: I481dfc18c170b4c60682ef1b38b57e10fb73d004
2012-05-01 12:27:26 -07:00
James Dong
454014e55f Add video scaling mode support with a new public method in MediaPlayer.java class
o related-to-bug: 5454345

Change-Id: I379b679eb6dd87f47f87a58791a5d0c7251b3a74
2012-05-01 12:22:35 -07:00
Eric Laurent
94affdd80e Merge "fix unmute from volume panel on tablets" into jb-dev 2012-05-01 10:47:57 -07:00
Eric Laurent
f740664cd8 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
2012-05-01 10:05:21 -07:00
Jean-Michel Trivi
8ccfbdddab Merge "Optimize how AudioService receives media button events" into jb-dev 2012-05-01 08:57:18 -07:00
Jean-Michel Trivi
c68022258e 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
2012-04-30 17:46:19 -07:00
Andreas Huber
b12a539069 New API to set the video rendering mode on a MediaCodec instance.
Change-Id: I6d765bb4cab7bcf29f09364293c24e8a6930078b
related-to-bug: 6364139
2012-04-30 14:46:22 -07:00
Dave Burke
ec3f31f621 Added support for HE-AAC recording.
Not unhiding HE-AACv2 since that requires stereo mics.

Bug: 6275957

Change-Id: I953a6d21e615c8fd23f9390e3c86d63089f5fb75
2012-04-30 09:24:01 -07:00
James Dong
6d6f233a62 Merge "Unhide APIs for timed text and multiple audio track switch APIs" into jb-dev 2012-04-27 17:49:28 -07:00
James Dong
7a9734d769 Unhide APIs for timed text and multiple audio track switch APIs
o made all the member variables in helper classes for TimedText to be public and final
  since they are read-only
o removed Text and TextPos helper classes
o added two public methods in TimedText class: getText() and getBounds()
o cleaned up the javadoc of related methods in MediaPlayer.java and TimedText.java classes
o make the inner classes of TimedText static and final
o change invoke and let it throw RuntimeException on failure (thus a test class needs to be
  modified also).

o related-to-bug: 6110705,5542712

Change-Id: Ia1dd1fd5eb8e9fd1b61c6c0d67405edb627a3002
2012-04-27 15:48:46 -07:00
Jeff Sharkey
098d580cc2 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
2012-04-27 14:15:05 -07:00
Jeff Sharkey
f5d70fd2ad Merge "Protect system services with DUMP permission." into jb-dev 2012-04-27 10:16:40 -07:00
Eric Laurent
6d5176638c 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
2012-04-26 18:36:56 -07:00
Jeff Sharkey
eb4cc492c9 Protect system services with DUMP permission.
Change-Id: I5e53859f8b8e5473e54eca43ebd7de841f1a05ff
2012-04-26 18:17:29 -07:00
Dave Burke
2996cf03a2 Merge "Unhide new AAC-ELD audio record type." into jb-dev 2012-04-26 10:58:57 -07:00
Andreas Huber
129a6ccbb8 Merge "The MediaExtractor can now unselect tracks and has more control over seeking." into jb-dev 2012-04-26 10:56:58 -07:00
Andreas Huber
f2855b3df5 The MediaExtractor can now unselect tracks and has more control over seeking.
Change-Id: I12c28bf31fe9fb4057352999fa38213ae289a417
related-to-bug: 6276111
2012-04-26 10:43:31 -07:00
Eric Laurent
8037cad6c1 Merge "Fix AudioManager.forceVolumeControlStream()" into jb-dev 2012-04-26 10:22:13 -07:00
Dave Burke
6644a826a1 Unhide new AAC-ELD audio record type.
Change-Id: Ibb9d3cd797c0b14c495776dc172ff7dadf6df7d6
2012-04-25 23:15:22 -07:00
Eric Laurent
45c90cefd1 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
2012-04-25 18:28:09 -07:00
Marco Nelissen
0b718392c1 Further speed up playlist processing
Previously when processing playlists, the entire audio table would be read for
every line in a playlist file. While there would be only one query, a lot of
data was being moved from sqlite to java over and over again, and if the data
didn't all fit in a CursorWindow, additional queries would be done under the
hood.
With this change, playlists are first cached in memory. Then the audio table
is queried, and for every row in the audio table, the best match from the
playlist cache is found. This way the audio table is only traversed once,
so each row is only fetched once. Once the entire audio table has been read,
the in-memory playlist cache contains the best matching entry for each line,
and the playlists are written out to the database. Currently, the audio table
is traversed once for each playlist. This could be further optimized in the
future by processing all playlists at the same time.

b/6346786

Change-Id: Iead3f9ae838d600d085e8e6d3c4874d42314468e
2012-04-25 16:30:42 -07:00
Jeff Sharkey
d7a2a428db Merge "Move RINGTONE_PICKER to handle external storage." into jb-dev 2012-04-25 15:25:46 -07:00
Jeff Sharkey
6dcf382b1b Move RINGTONE_PICKER to handle external storage.
To give RINGTONE_PICKER external storage access, move it from system
to MediaProvider.  Fix OOBE when getRingtoneUri() kicked requery().

Bug: 6346701
Change-Id: I837002eef0580b8cdd8920a27b068c745995a8a3
2012-04-25 14:56:13 -07:00
Jean-Michel Trivi
1b8f499a14 Allow multichannel configurations in android.media.AudioTrack
Compare the channel configuration against a mask of the public
 channel masks in AudioFormat for up to 5.1 with back channels,
 and allow combinations within this mask.

Change-Id: I84b72dfd88d4490f0c67bf10d13151a9eb06f6a8
2012-04-25 11:12:37 -07:00
Marco Nelissen
08f70fa5b8 Speed up playlist processing
When matching entries in playlists, only consider audio files.

b/6346786

Change-Id: Ia744d002c2821a81840303b9409593da48a08b73
2012-04-23 13:53:20 -07:00
Andreas Huber
74a78b0f6e Add the ability to query the amount of cached data to MediaExtractor.
Change-Id: I47ae60bc6fb8d88979c1f0d650b6ac528e811371
related-to-bug: 6364341
2012-04-20 11:57:26 -07:00
James Dong
f3dbb59f1d Merge "Update javadoc for timed text / multiple audio track APIs" 2012-04-19 14:17:43 -07:00
Andreas Huber
0d1ba15056 Merge "DRM errors signaled by the CryptoPlugin are now visible to MediaCodec clients" 2012-04-19 13:51:10 -07:00
James Dong
831f0a90ca Update javadoc for timed text / multiple audio track APIs
o Throw runtime exception when selectTrack, unselectTrack, getTrackInfo fails
o remove redundant code for selectTrack and unselectTrack methods

o related-to-bug: 6110705,5542712

Change-Id: I59f0ed638e93d0365eccab1e33c9d50354a9c1ba
2012-04-19 13:46:23 -07:00
Andreas Huber
bfc56f497d DRM errors signaled by the CryptoPlugin are now visible to MediaCodec clients
through a custom exception "MediaCodec.CryptoException".

Change-Id: I30215e9e13bab68abad23e27dcead7c1accd07f1
related-to-bug: 6365261
2012-04-19 13:42:14 -07:00
Jean-Michel Trivi
c9496495ba Merge "Unhide Visualizer scaling mode definitions and methods" 2012-04-19 10:52:25 -07:00
Jean-Michel Trivi
951794616f Unhide Visualizer scaling mode definitions and methods
Unhide Visualizer set/get methods, and associated constant
 definitions.

Change-Id: Iaafe5f7a2f1273f72c3f7f842b416b93614dfa65
2012-04-19 10:34:50 -07:00