Commit Graph

7820 Commits

Author SHA1 Message Date
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
Kevin Rocard
506541c1d1 Add AudioAttribute flag missing in FLAG_ALL
Test: Compile
Bug: 111453086
Change-Id: I09212262f56253decd48fd9204404e744f0772ab
Signed-off-by: Kevin Rocard <krocard@google.com>
2019-04-03 12:45:01 -07:00
Eric Laurent
e6243996ef Revert "Mute haptic channels by default."
This reverts commit 48af5aeeba.

No idea on how this simple CL can cause this problem but A/B tests
and bisection show that the problem disabpears when reverted.

Bug: 129721367
Test: no repro on build with revert.
Change-Id: I13e3d788d255c4b6e873bb1e9ce2cf92d2a18e41
2019-04-02 18:59:12 -07:00
TreeHugger Robot
bb261a3caf Merge "Fix ringtone null pointer exception" 2019-04-02 20:23:35 +00:00
Youming Ye
33c666d955 Fix ringtone null pointer exception
Bug: 128468578
Test: Build
Change-Id: If65f0194712c8358fdbd88e7d04478f8395a012b
2019-04-02 19:53:15 +00:00
TreeHugger Robot
2118cc3042 Merge "Mute haptic channels by default." 2019-03-31 22:52:58 +00:00
jiabin
48af5aeeba Mute haptic channels by default.
In case the apps start vibration while playing asserts containing haptic
channels, it will be safer to mute haptic channels by default. Apps will
need to explicitly enable haptic channels if they want haptic via audio.

Bug: 129544270
Test: play with/without enabling haptic channels.
Change-Id: Id35d25c2be1c0b26053389f0b277b1ce321ad29e
2019-03-29 11:05:47 -07:00
TreeHugger Robot
dcb8edfc4d Merge "MediaRecorder: Add IntDef to setAudioSource" 2019-03-28 20:14:17 +00:00
TreeHugger Robot
20309bb9c3 Merge "Remove deprecateStreamTypeForPlayback from HwAudioSource" 2019-03-28 19:38:19 +00:00
TreeHugger Robot
9ad0766f16 Merge "Add application wide capture policy" 2019-03-28 19:37:13 +00:00
Hongwei Wang
50b1abc246 Merge changes from topic "renault-non-api-change"
* changes:
  Get volume indexes from Audio Policy Service
  Use AudioProductStrategies within AudioAttributes
2019-03-28 08:21:59 +00:00
Kevin Rocard
cba4b211e5 Merge "Introduce a system APC with its corresponding opt-out" 2019-03-27 20:41:06 +00:00
TreeHugger Robot
49cf94e9d4 Merge "media: rename KEY_MAX_BFRAMES to KEY_MAX_B_FRAMES" 2019-03-27 20:30:47 +00:00
Hongwei Wang
ace9250688 Remove deprecateStreamTypeForPlayback from HwAudioSource
It used to be there to hide from API list, and since it's been addressed
in PlayerBase, this pseudo override is no longer needed.

Bug: 126702177
Test: make system-api-stubs-docs-update-current-api
Change-Id: I8caa75410d1ffb2b0e690a82396ac978b03a2844
2019-03-27 11:24:34 -07:00
Wonsik Kim
d18e1f34fe media: rename KEY_MAX_BFRAMES to KEY_MAX_B_FRAMES
Rename it to be consistent with use of I_FRAME.

Bug: 129344870
Test: builds
Change-Id: I816439074837452cdbd9ed2a734ea237517ad26f
2019-03-27 08:49:58 -07:00
Hyundo Moon
4e953bb406 Merge "Remove ControllerCallbackLink" 2019-03-27 00:20:14 +00:00
Jeff Sharkey
02aefee533 Merge "Unify media permissions enforcement in framework." 2019-03-26 23:54:22 +00:00
Jeff Sharkey
859856d8d6 Unify media permissions enforcement in framework.
This opens the door to the same consistent logic being shared by
anyone across the OS who wants to enforce storage permissions.

Bug: 126788266
Test: atest --test-mapping packages/apps/MediaProvider
Exempted-From-Owner-Approval: Trivial permissions refactoring
Change-Id: I3107425f8dafa6ba05918bb67c3c0cb5d3899657
2019-03-26 23:54:08 +00:00
Hyundo Moon
4e4459b403 Remove ControllerCallbackLink
Bug: 129323028
Test: atest CtsMediaTestCases:android.media.cts.MediaSessionTest;
      atest CtsMediaTestCases:android.media.cts.MediaControllerTest;
      atest CtsMediaTestCases:android.media.cts.MediaBrowserTest;
      atest CtsMediaTestCases:android.media.cts.MediaSessionManagerTest;
Change-Id: I5b1fedc70cee7311364925562ad253a68b2bfe6e
2019-03-26 20:05:29 +09:00
Kyunglyul Hyun
2d70f04a1d Merge "Media: Add MediaRouterManager to control media route of other apps" 2019-03-25 23:39:34 +00:00
Jean-Michel Trivi
fcf1e54d29 PlayerBase: conditional muting on OP_PLAY_AUDIO changes
Do not mute based on OP_PLAY_AUDIO client side.
Disable legacy behavior with constant without affecting
  audio service logs.

Bug: 112339570
Test: enter DnD, play notifications, verify not heard
Change-Id: I8a963af02fc2b42844470a4212fec8e2f6a5e4e0
2019-03-25 16:13:41 -07:00
Jeff Sharkey
ff200957fd Query specific collections for properties.
We're now enforcing the public API schema, so clients like MTP need
to query specific collections when asking for properties that are
specific to those media types.

Also refactor MediaScanner calls to go through MediaProvider, so
they can be handled by ModernMediaScanner.  We no longer directly
try inserting items, and instead rely completely on the scanner.

Bug: 127625964, 122263824
Test: atest MediaProviderTests
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ic86982766606a619afafe725f9c60013a5671840
2019-03-24 14:21:01 -06:00
Hyundo Moon
2809f8fe1e Merge "Remove SessionCallbackLink" 2019-03-24 12:15:07 +00:00
Jeff Sharkey
ae80b5417b Merge changes from topic "mar22z"
* changes:
  Point people towards ModernMediaScanner.
  Translate paths before leaving app sandbox.
2019-03-23 17:59:03 +00:00