Commit Graph

7732 Commits

Author SHA1 Message Date
Mikhail Naganov
a00883db12 AudioService: Track client app recording activity
Update RecordActivityMonitor to use events sent from clients
about their recording activity and coalesce them with
configuration update events sent from audioserver (APM). This
allows providing a high-level view on the recording
configurations consistent with client expectations.

For recorders that are managed entrirely on the server side
(AAudio MMAP) all events do contain configs. These recorders
do not have an associated death handler and need to be cleared
on audioserver restart.

Clearing client-managed trackers on audioserver restart is not
needed anymore. Clients will either continue
recording (AudioRecord handles IAudioRecord re-instantation) or
stop recording and notify AudioService about that.

Bug: 123312504
Test: android.media.cts.AudioRecordingConfigurationTest
      AudioRecordTest#testAudioRecordInfoCallback
      MediaRecorderTest#testAudioRecordInfoCallback
      manual testing using Oboe and Solo test apps

Change-Id: I4718f983c2d90e9c3e7480719a24bd187df7f80a
2019-04-24 15:13:48 -07:00
Jean-Michel Trivi
22ad8a5eb9 Merge "AudioAttributes: fix regression with setLegacyStreamType in Builder" into qt-dev 2019-04-24 16:54:32 +00:00
Jean-Michel Trivi
9f70d4e29b AudioAttributes: fix regression with setLegacyStreamType in Builder
A regression was introduced by commit @6d69bde which caused a new
  Builder instance to be created when using setLegacyStreamType(),
  instead of returning the current one.

Bug: 130274354
Test: atest android.media.cts.AudioAttributesTest#testSetLegacyStreamOnBuilder
Change-Id: Ib66a0beb5f0f4489a6003cb9be6b8313b3318eac
2019-04-24 08:20:17 -07:00
Hyundo Moon
9b72ad0924 Make MediaController#getSessionInfo() as @NonNull
Bug: 131069100
Test: atest CtsMediaTestCases:android.media.cts.MediaSessionTest;
      atest CtsMediaTestCases:android.media.cts.MediaControllerTest;
Change-Id: I5ecf04fd090dc684f5c7a84c1375de1639f7b4bd
2019-04-22 23:59:54 +09:00
Jeff Sharkey
6378402da1 Canonicalize default ringtones.
Bug: 130445562
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Ia4dee2f5596147ac50b2393fccb8516cc43b0102
2019-04-17 23:49:57 +00:00
Hongwei Wang
c4a3f5c377 Merge "Allows constructing ECHO REFERENCE AudioRecord" into qt-dev 2019-04-17 22:22:36 +00:00
TreeHugger Robot
f02aabe529 Merge "Treat FLAG_MUTE_HAPTIC separately from mFlags." into qt-dev 2019-04-17 20:30:30 +00:00
Jeff Sharkey
42bf6d8a42 Adjust MTP to reference by specific volume name.
The MediaStore.VOLUME_EXTERNAL volume is a merged view of all storage
devices, and clients working on a specific volume need to focus on
the volume they're interested in.

Bug: 129840030
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I91cee6a96d7f9360e6a93a9a3c389b097b6b9967
2019-04-17 11:16:15 -06:00
Jeff Sharkey
715c495a41 Merge "Canonicalize ringtones before returning." into qt-dev 2019-04-17 02:14:22 +00:00
jiabin
1073ee6330 Treat FLAG_MUTE_HAPTIC separately from mFlags.
For get/set APIs, FLAG_MUTE_HAPTIC is known as a boolean value instead
of a flag. In that case, it should not be changed when calling set flags
API to modify the flags. By doing this, it helps the FLAG_MUTE_HAPTIC is
set correctly.

Bug: 130670988
Test: Manually
Change-Id: I6a507d1f6f82e5ea6520f83279f73f851605c93f
2019-04-16 17:27:41 -07:00
TreeHugger Robot
111ad6a13e Merge "AudioPolicy: more TestApi for ... testing" into qt-dev 2019-04-17 00:22:04 +00:00
TreeHugger Robot
2199664e37 Merge "Remove MiniThumbFile" into qt-dev 2019-04-16 19:53:39 +00:00
Jeff Sharkey
aaa19ced73 Canonicalize ringtones before returning.
Bug: 130475623
Test: none
Change-Id: I6408800290077dfc7d0252a9b23443c3a70d4563
2019-04-16 13:47:37 -06:00
Jean-Michel Trivi
19777d9c49 AudioPolicy: more TestApi for ... testing
Add uid- device affinity APIs in test API.

Bug: 129708340
Test: atest AudioPolicyTest
Change-Id: Iba1eb996758e366994e610617a63254b774bcb17
2019-04-16 12:08:26 -07:00
Jean-Michel Trivi
7e46f59a60 Merge "AudioManager: test API for dynamic audio policy" into qt-dev 2019-04-15 22:46:46 +00:00
Jean-Michel Trivi
4ad4600d75 AudioTrack: offload is not tied to USAGE_MEDIA
Offload support check now supports passing AudioAttributes.
Do not require AudioTrack usage to be USAGE_MEDIA, check of use
  case will be done in AudioSystem.isOffloadSupported().

Bug: 129133576
Test: use offload for USAGE_ASSISTANT
Change-Id: I00065fb936600cfcdf29bc019173699db7ec5a2f
2019-04-15 12:06:19 -07:00
Jean-Michel Trivi
848eab444c Merge "AudioPolicy: fix test API for focus policy" into qt-dev 2019-04-15 16:38:09 +00:00
Kevin Rocard
4bea465dbb Merge "Add getters to AudioPlaybackCaptureConfiguration" into qt-dev 2019-04-15 16:02:07 +00:00
TreeHugger Robot
acf6698f0c Merge "Add AudioManager.getAllowedCapturePolicy" into qt-dev 2019-04-15 15:44:32 +00:00
Kevin Rocard
de5cc3c8c1 Add getters to AudioPlaybackCaptureConfiguration
Unfortunately AudioMixingRule being in a different package,
some of its members had to be made public @hide to be used
by AudioPlaybackCaptureConfiguration.

Bug: 129948989
Test: atest AudioAttributesTest
Change-Id: Ie8cdf67aee9ff7cf9144a66d47c301712516cf87
Signed-off-by: Kevin Rocard <krocard@google.com>
2019-04-15 08:35:29 -07:00
TreeHugger Robot
6335a6149a Merge "Add AudioAttributes.getAllowedCapturePolicy" into qt-dev 2019-04-15 09:45:00 +00:00
Kevin Rocard
ffc73ad49f Merge "Add documentation for the APC feature" into qt-dev 2019-04-15 08:00:05 +00:00
TreeHugger Robot
88774ef6eb Merge "DO NOT MERGE: Revert "Media: Add MediaRouterManager to control media route of other apps"" into qt-dev 2019-04-15 05:47:22 +00:00
Kyunglyul Hyun
a1c7990bc4 DO NOT MERGE: Revert "Media: Add MediaRouterManager to control media route of other apps"
This reverts commit 1c8188f2b4.

Bug: 130511870
Test: atest android.media.cts.MediaRouterTest
Change-Id: I1de6fbeb81b1d5ef0ec4b73173b6525d4c6edc07
2019-04-15 11:44:55 +09:00
Jean-Michel Trivi
0c88f4965e AudioManager: test API for dynamic audio policy
Add test api to check if a dynamic audio policy is already registered

Bug: 129708340
Test: atest AudioPolicyTest
Change-Id: Id9709e16d775f9552eccb52f60584588c320d9f0
2019-04-13 14:42:28 -07:00
Jean-Michel Trivi
ec97732069 AudioPolicy: fix test API for focus policy
Remove AudioPolicy.Builder.setIsTestFocusPolicy from system API
  definitions.
Add the required AudioPolicy-related methods to test API, along
  with the test-only AudioPolicy.Builder.setIsTestFocusPolicy
  method

Bug: 130225439
Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t 'com.google.android.gts.audiopolicy.AudioPolicyHostTest#testFocusPolicy'

Change-Id: I14f52bdc33b7a342f21e664104718b40f4b8a932
2019-04-13 13:56:56 -07:00
Kevin Rocard
654b3cb1c7 Add documentation for the APC feature
Test: m offline-sdk-docs
Bug: 111453086
Bug: 128454790
Change-Id: Ibeef672b1e3090bb83304cce4b58f0ffab7a9cdc
Signed-off-by: Kevin Rocard <krocard@google.com>
2019-04-12 21:09:02 +00:00
Kevin Rocard
9bf75facd8 Add AudioAttributes.getAllowedCapturePolicy
Bug: 129948989
Bug: 128454287
Test: atest AudioAttributesTest
Change-Id: Ide4a6c160791ade1b93796ba4d2fca9e3c1f9eed
Signed-off-by: Kevin Rocard <krocard@google.com>
2019-04-12 19:10:39 +00:00
Kevin Rocard
019f60d393 Add AudioManager.getAllowedCapturePolicy
For now the value is stored in AudioManager. It needs to be moved
in AudioService.

Bug: 129948989
Test: atest AudioAttributesTest
Change-Id: I7f3ef4c9dbeb00169374efcc5829666c0e8121d5
Signed-off-by: Kevin Rocard <krocard@google.com>
2019-04-12 10:17:20 -07:00
Hayden Gomes
ebd6aaa4b0 Replacing AudioVolumeGroups with List
Bug: 129262395
Test: Built and ran on device
Change-Id: I838296ead584b85be50028c410b9a2d0ba3b0398
2019-04-11 17:07:19 -07:00
Hayden Gomes
8e8e9ce626 Removing name getter from AudioProductStrategy
Test: ran make and flashed onto device
Bug: 129265140
Change-Id: Ia6dad73e954f45b30cab970386e8fd3a66416ede
2019-04-11 16:56:34 -07:00
Hayden Gomes
6d69bde308 Replacing AudioProductStrategies with List
- Removed AudioProductStrategies and updated usages to work with
List<AudioProductStrategy>
- ditributed looping logic to the respective callers

Test: built successfully with make and ran on device
Bug: 129265140
Change-Id: If95ba9c2418a1fda29590ca1af2d04e7395c2130
2019-04-11 16:56:34 -07:00
Hayden Gomes
5d211a8253 Merge "Add IntRange for min and max volume index getters" into qt-dev 2019-04-11 22:54:07 +00:00
Hayden Gomes
695f8022fe Add IntRange for min and max volume index getters
Test: Built and ran on device
Bug: 129265140
Change-Id: Ibebc1c54de7e09e81dabd65c22e4fea8450547c8
2019-04-11 12:13:57 -07:00
TreeHugger Robot
de2861cff9 Merge "Rename mute haptic channel API." into qt-dev 2019-04-11 00:35:19 +00:00
Andy Hung
d5701f0ecb Merge "AudioTrack: getLatency continues UnsupportedAppUsage" into qt-dev 2019-04-10 00:38:42 +00:00
jiabin
3b18011b11 Rename mute haptic channel API.
Rename as setHapticChannelsMuted to keep symmetrical with the query API.

Test: make
Bug: 130247632
Change-Id: I5e32e414bd6e11f651e212347a883af4e08d8863
2019-04-09 16:56:13 -07:00
Andy Hung
ce795489ee AudioTrack: getLatency continues UnsupportedAppUsage
Exoplayer needs this API for devices with timestamp issues.

Test: compiles
Bug: 112561552
Bug: 130237544
Change-Id: I136d80011765ac83be8f5258c4ba139ee1f1ef75
2019-04-09 13:30:33 -07:00
Hongwei Wang
4d4a96f128 Allows constructing ECHO REFERENCE AudioRecord
Bug: 129882605
Test: dumpsys media.audio_policy
Change-Id: I9eb7f64c11f0bd2bcbcf1e381337888d128fc9aa
2019-04-08 19:27:36 +00:00
Tobias Thierer
79dd28f874 Merge changes I4e32a588,I202c5653 into qt-dev
* changes:
  Make MediaHTTPConnection thread safe.
  Revert "MediaHTTPConnection: move connection states into an inner class"
2019-04-08 18:15:39 +00:00
Tobias Thierer
5b9febae78 Make MediaHTTPConnection thread safe.
MediaHTTPConnection's public methods are called from multiple Binder
threads. Since both HttpURLConnection and access to the various
connection related fields is not thread safe, this CL guards most
methods by a single lock. This means that the methods can now block
when called, although this should be rare:

 - there are two processes that call these methods. One process
   only calls getSize(), and the other process calls methods
   from a single thread (ie. at not overlapping clock times).
 - should lock contention unexpectedly increase in future, then
   that would be bad (because Binder thread pool threads would
   be blocked/unavailable), but it would not be easy to detect.
   It would be easy to detect if we could stop getSize() being
   called at overlapping clock times, since we could then use
   ReentrantLock.tryLock() to assert that the lock is never contended
   outside of disconnect().

Because it's a requirement for disconnect() to quickly stop another
thread that is blocked in readAt(), disconnect() is the only method
that doesn't acquire the lock immediately; the mConnection field
is marked volatile so that disconnect() has a high chance of reading
that field and calling disconnect() on it without waiting for
another thread (there's a small risk that another thread might
acquire the lock and start a new connection while disconnect()
is waiting for the lock; in that case, after acquiring the lock,
disconnect() will also disconnect that new connection; this is
subject to potential change in future.

Initially, a ReentrantLock object was considered but for now this
CL instead uses the synchronized lock on "this" because:

 - it minimizes churn on the lines of code in this file because
   synchronized (this) { } can be expressed by introduction of
   the word "synchronized" on the method header, whereas
   mLock.lock(); try { ... } finally { mLock.unlock(); } would
   indent all the lines in-between and thus pollute git annotate.
 - some methods were already synchronized.
 - ReentrantLock.tryLock() is not used for now; most of the time,
   lock acquisition should be uncontended but the two cases of
   lock contention mentioned above exist, which makes it difficult
   to distinguish surprising from unsurprising lock contention.
   While this is the case, it seems better to keep the code
   simple and to just unconditionally block.

Bug: 114337214
Fixes: 114337214
Fixes: 119900000
Fixes: 129444137
Fixes: 128758794
Fixes: 63002045

Test: Checked manually that bug 114337214 no longer reproduces on
      Android API level 27 (Oreo MR1) after cherrypicking this CL.
Test: Ran the following on internal master with this CL:
      make cts && cts-tradefed run cts -m CtsMediaTestCases \
      -t android.media.cts.NativeDecoderTest#testAMediaDataSourceClose \
      --abi arm64-v8a
Test: Ran the following both on AOSP (158 tests) and internal master (178):
      atest CtsMediaTestCases:android.media.cts.{MediaPlayer{,2},Routing}Test

      All these tests pass except that on AOSP only, the following test
      fails both before and after my CL (appears unrelated):
      android.media.cts.RoutingTest#test_MediaPlayer_RoutingChangedCallback

(cherry picked from commit 8d9fccee62)

Change-Id: I4e32a58891c3ce60ddfa72d36060486d37906f8d
Merged-In: I4e32a58891c3ce60ddfa72d36060486d37906f8d
2019-04-08 18:14:42 +00:00
Tobias Thierer
241377b10a Revert "MediaHTTPConnection: move connection states into an inner class"
This reverts commit 621e7968ad.

Many of the fields that were moved are annotated @UnsupportedAppUsage,
so the CL would have had undesirable app compat impact. Further,
because investigation has revealed that lock contention *is* possible,
we need to always acquire the lock anyway so there is no longer a
benefit in keeping all of the mutable state in a single field that
can be atomically set to null.

Bug: 114337214
Test: Treehugger

(cherry picked from commit dc9f4b4d5d)

Change-Id: I202c5653cb086d99228491e161a159bad640105a
Merged-In: I202c5653cb086d99228491e161a159bad640105a
2019-04-08 18:14:04 +00:00
Eric Laurent
960c4f06ae Merge "fix AudioAttributes matching rule in AudioProductStrategy" into qt-dev 2019-04-05 16:00:00 +00:00
Eric Laurent
f83192de79 Merge "Revert "Revert "Mute haptic channels by default.""" into qt-dev 2019-04-05 16:00:00 +00:00
Wonsik Kim
b06132ad90 media: fix documentation for MediaFormat.KEY_PREPEND_HEADERS_TO_SYNC_FRAMES
Bug: 32746212
Test: builds
Change-Id: I38ecfa879091bc4016fbae04eab77ed6fd9eb1c1
2019-04-04 12:54:59 -07:00
Eric Laurent
c9d353dcf8 Revert "Revert "Mute haptic channels by default.""
This reverts commit e6243996ef.

Bug: 129721367
Test: change volume in Play Music
(cherry picked from commit ab3a3f8c02)

Change-Id: Id6e63e87265717130dde0e1b46e28edbb0b53edb
2019-04-04 18:07:25 +00:00
Eric Laurent
337a86626e fix AudioAttributes matching rule in AudioProductStrategy
The matching rule on audio attributes flags must be that ALL flags
set in the reference attributes are present in the compared attributes
and not just some flags.

Bug: 129721367
Test: change volume in Play Music
Change-Id: I462fd73fb9b78b094411c6f3b52004349f49bcf3
(cherry picked from commit 9b0bb840cd)
2019-04-04 18:07:02 +00:00
Anton Hansson
5312e4b0ae Remove MiniThumbFile
Not referenced from anywhere.

Bug: 115735819
Test: make
Change-Id: I17af24c3e5e87de4eb3a67e52de9032521f71f65
2019-04-04 06:38:12 +00:00
TreeHugger Robot
23961b92bb Merge "Add AudioAttribute flag missing in FLAG_ALL" 2019-04-03 21:18:17 +00:00
Jean-Michel Trivi
c6d7460140 Merge "PlayerBase: conditional muting on OP_PLAY_AUDIO changes" 2019-04-03 19:58:59 +00:00