Commit Graph

10073 Commits

Author SHA1 Message Date
Jean-Michel Trivi
18e5f07e7d AudioService: SpatializerHelper initializes sensors
When the Spatializer effect reports it is initialized, initialize
the sensors for head / screen.

Bug: 191404931
Test: adb logcat | grep SpatializerHelper
Change-Id: I58c22b69b32057765bced49fd9d56cbf3b6cf5a6
2021-09-21 10:07:06 -07:00
Jean-Michel Trivi
7966f9aa68 Spatializer: support for effect parameters
Add set/get API for implementatation-specific parameters

Bug: 191404931
Test: atest SpatializerSystemTest
Change-Id: Ibc49e05670c7bc473dad2421808b4a60970f16c9
2021-09-20 22:02:03 -07:00
Jean-Michel Trivi
68bfa3b30a Immersive audio APIs for headtracking
Headtracking:
- setter / getter and listener for headtracking mode
- listener for head pose
- global transform
- recentering

Bug: 191404931
Test: atest SpatializerHeadTrackingTest
Change-Id: I15cea62365584f84ae5a9149719902c671944f28
2021-09-16 13:15:05 -07:00
Jean-Michel Trivi
c5f69571ef AudioManager.getSpatializer() never returns null
Spatializer instance returned by AudioManager.getSpatializer()
 is never null.
Instead of having this getter return null when the device
 doesn't support spatialization, the user can query the
 instance for it's level of support for the feature.
The level of support is independent of the state of the
 spatializer.

Bug: 191404931
Test: atest SpatializerTest
Change-Id: Id08670749b4d34230313d2cd829aa5ba414dae21
2021-09-14 13:11:58 -07:00
Jean-Michel Trivi
838913c584 AudioService: initialize Spatializer, track routing changes
Implement initialization of SpatializerHelper, the AudioService
 proxy for the native Spatializer effect.
Implement release of Spatializer effect when feature is disabled
Implement Spatializer available dispatch.
Track routing changes reported through AudioSystem to
 check if device for media routing is compatible with
 spatialization. Use result to update Spatializer
 availability

Bug: 188502620
Test: adb logcat | grep Spatializer, check for "init succeeded"
Change-Id: Ib06b1f54fee20a5057768a7a31a047bd1fba930d
2021-09-13 18:21:53 -07:00
TreeHugger Robot
d7f0b9dcd6 Merge "Clean up ownership in frameworks/base/" into sc-dev am: 88c2fc9cea am: bdd1e411ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15778521

Change-Id: I4afe3da79aae9c95b8f8a5972f5b379b39b605fb
2021-09-09 16:21:45 +00:00
Santiago Seifert
fefe435dd4 Clean up ownership in frameworks/base/
This is a cherrypick of aosp/1804116.

Bug: 197217250
Change-Id: I04bee764bf50734523ff2210d30ed052dcb036bd
Merged-In: I04bee764bf50734523ff2210d30ed052dcb036bd
Test: No code changes done.
2021-09-07 18:38:10 +01:00
Naomi Musgrave
065f4d876e [MediaProjection] Store WindowContext in VirtualDisplay
Follow on from ag/15684817, where the WindowContext is cached in
MediaProjection. To allow multiple VirtualDisplays to be created
from the same MediaProjection, instead create a new WindowContext
for each one, and associate with that VirtualDisplay.

As before, the WindowContext must be stored in a field to prevent
it from being garbage collected.

Bug: 197579637
Bug: 198415847
Test: manual
Change-Id: If3f84b3778104bf12617d224876700f8ee3b2b45
2021-09-02 13:08:24 +00:00
Naomi Musgrave
cb50daa74c [MediaProjection] Store WindowContext in field
When WindowContext is a local variable for starting layer mirroring,
the variable is eventually garbage collected. When this occurs
when MediaProjection is still running, then DisplayContent
fails to transform the captured content from
onConfigurationChanged.

The destroyed WindowContext triggers unregistering the
WindowContainerListener. Even though the WindowToken is
still being used by DisplayContent, DisplayContent is no
longer able to retrieve the WindowContainer associated
with the WindowToken. The WindowToken set when layer
mirroring begins is used to indicate the layer of
the hierarchy to mirror.

Bug: 197579637
Test: Manual
Change-Id: Ib8a971d1a85ebfe9db59d9267cc387f4f4d15991
2021-09-01 10:29:44 +01:00
Jean-Michel Trivi
e9dd14e011 New APIs for immersive audio
- AudioManager: entry point for getting
 a Spatializer object, if supported
- Spatializer: entry point for spatializer
 capabilities, system APIs for configuration
 and compatibility with devices
- AudioAttributes: additions for behavior of
 a track for virtualization

Bug: 191404931
Test: atest AudioAttributesTest SpatializerTest
Change-Id: I06f8acdd979f8d4374042f8209082c79f49a1f75
2021-08-30 16:55:37 +00:00
Jean-Michel Trivi
c3537ee73a Merge "Revert "New APIs for immersive audio"" into sc-v2-dev 2021-08-26 15:12:10 +00:00
Jean-Michel Trivi
4b40a261e0 Revert "New APIs for immersive audio"
This reverts commit 50673d80be.

Reason for revert: non-existing bug number prevents API council tracking

Bug: 191404931
Change-Id: Iaccc698a1034e9387b7918eda826438dfe3a9485
2021-08-26 15:11:59 +00:00
Eric Laurent
9cfdca44f0 Merge "Notification playback: pause on release" into sc-dev am: e198354a0c am: 1893dc2843
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15505426

Change-Id: I05c1f04a8dac81674561833881d1c384c1088eee
2021-08-24 18:32:27 +00:00
Eric Laurent
8500f6c136 AudioSystem JNI: Add support for spatializer APIs
Add support for the following APIs in AudioSystem JNI:
- getSpatializer
- canBeSpatialized

Bug: 188502620
Test: make
Change-Id: I1942edc6c9fec3babfe870586f7a014d55b1ce70
2021-08-24 13:47:03 +02:00
Jean-Michel Trivi
c69743ea16 Notification playback: pause on release
When releasing a MediaPlayer outside of a playback
completion (back to back notifications), pause and
wait 100ms before releasing the player.

Bug: 193832902
Test: create back-to-back notifications, check for glitch
Change-Id: Ib8baba4bf2b41e75b526e8490b6c2f31c85c193c
2021-08-20 17:29:57 -07:00
Jean-Michel Trivi
50673d80be New APIs for immersive audio
- AudioManager: query of platform support for
 the whole feature
- Spatializer: entry point for spatializer
 capabilities, system APIs for configuration
 and compatibility with devices
- AudioAttributes: additions for behavior of
 a track for virtualization

Bug: 91404931
Test: atest AudioAttributesTest SpatializerTest
Change-Id: Ia81ae07a0e66497b0731209907ca62a524c0a515
2021-08-16 11:33:38 -07:00
TreeHugger Robot
3e5e27f2b6 Merge "MediaProjection captures DisplayArea" into sc-v2-dev 2021-08-10 14:03:05 +00:00
Naomi Musgrave
fd5715bb31 MediaProjection captures DisplayArea
MediaProjection is used by apps to capture the contents of
a display. Apps consume the content from a surface passed
in to MediaProjection#createVirtualDisplay. The images
written out to the surface can be used for saving
screenshots of the current display, screen recording,
or casting to a different display.

MediaProjection is currently tied to capturing a physical
display. This change instead captures the DisplayArea
the app is launched on. This is consistent with Display API
sandboxing, which returns the DisplayArea bounds rather
than the physical display bounds.

Note that apps use the Display APIs to size the
VirtualDisplay and output surface.

Verified: screenshots, screen recording, and casting

Bug: 180624777
Bug: 195280234
Test: atest WmTests:DisplayContentTests

Change-Id: I086fa1ae668dbdf0f25252c13614445af04d86f3
2021-08-09 15:20:32 +00:00
Ahaan Ugale
1850753280 Merge "Send the HotwordDetectionService UID to AudioPolicy" into sc-dev am: 298c5093dc
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15465671

Change-Id: I647647a218ee2ae43b1d2c7740e5a22da11087ab
2021-08-05 19:29:48 +00:00
Ahaan Ugale
3ac246c432 Send the HotwordDetectionService UID to AudioPolicy
This change follows the pattern of how the IME UID is set.

The UID is stored in AudioService and re-sent there if the audio server
dies.

Fix: 194368677
Test: manual - hotword works when another app is using the mic and in
 Auto projection mode; also after restarting the process or killing
 audio server
Test: atest HotwordDetectionServiceBasicTest
Change-Id: I325cb33d17387e62302967b261b6fe61086d8893
2021-08-04 21:29:21 -07:00
Naomi Musgrave
93a74ca03b Merge "Revert "MediaProjection captures DisplayArea"" into sc-v2-dev 2021-08-03 12:19:43 +00:00
Naomi Musgrave
da38617955 Revert "MediaProjection captures DisplayArea"
This reverts commit 45dd2a3202.

Reason for revert: b/195280234 is blocking droidfood

Bug: b/195280234
Change-Id: I09593dffb797d1e4c60cff52e7901ed6c00f719c
2021-08-03 09:19:23 +00:00
Kyunglyul Hyun
35b739a405 Merge "Don't return selected routes as transferable" into sc-dev am: 284388a267
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15426495

Change-Id: I10d80e80ba07bdd89602659dab2d173ee8650192
2021-07-31 04:13:52 +00:00
Kyunglyul Hyun
284388a267 Merge "Don't return selected routes as transferable" into sc-dev 2021-07-31 03:55:57 +00:00
Zimuzo Ezeozue
ce692ac89c Merge "Fix fd leak while bypassing transcoding in media APIs" into sc-dev am: 3fefc5c3ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15423590

Change-Id: I88486c8e7278e5899405a379034a453ed95b19f9
2021-07-30 14:39:01 +00:00
Naomi Musgrave
45dd2a3202 MediaProjection captures DisplayArea
MediaProjection is used by apps to capture the contents of
a display. Apps consume the content from a surface passed
in to MediaProjection#createVirtualDisplay. The images
written out to the surface can be used for saving
screenshots of the current display, screen recording,
or casting to a different display.

MediaProjection is currently tied to capturing a physical
display. This change instead captures the DisplayArea
the app is launched on. This is consistent with Display API
sandboxing, which returns the DisplayArea bounds rather
than the physical display bounds.

Note that apps use the Display APIs to size the
VirtualDisplay and output surface.

Verified: screenshots, screen recording, and casting

Bug: 180624777
Test: atest WmTests:DisplayContentTests
Change-Id: I909e9d32f573aec33869d9f49d6caffc8d7420aa
2021-07-30 09:48:42 +00:00
Kyunglyul Hyun
91c76bc5f4 Don't return selected routes as transferable
MediaRouter2Manager returned selected routes
as "transferable" routes.
This CL fixes it.

Bug: 194370296
Test: manually
Change-Id: I85e0e94bd38e07ee1a99369e9de5a4564aee6d58
2021-07-30 05:23:04 +00:00
Zim
366493edd2 Fix fd leak while bypassing transcoding in media APIs
To call the media service while bypassing transcoding there are 4 file
descriptors involved:

A: The original file descriptor the app owns and is responsible for
closing
B: Dupe of A, to pass into the MediaStore API as an input to receive a
non-transoding fd
C: The output from the MediaStore API
D: Final fd owned by the media service, after C gets duped over binder
as part of setDataSource

We were leaking (B) and (C). Now we close them appropriately.

See I0124ec8fbd0471237e99bab321f903544f8fe1f8 for another 2 fd leak
fix in MediaProvider

Test: atest TranscodeTest
Test: Manual with 'adb shell lsof | grep <filename>'
Bug: 194828489
Bug: 179804072
Change-Id: I978257bbc4a8f6813b6e6a5ce22124257204f432
Merged-In: I978257bbc4a8f6813b6e6a5ce22124257204f432
2021-07-29 22:05:17 +01:00
Shubang Lu
2233656aa0 Merge "Change default value from NONE to UNKNOWN" into sc-dev am: 8e31f85e02
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15377214

Change-Id: Id8efdbbf549be60cf2ba769b2cceafdba239b1ac
2021-07-28 18:24:32 +00:00
shubang
d7b1d8e6a0 Change default value from NONE to UNKNOWN
Bug: 194523273
Test: atest MediaMetricsAtomTests
Change-Id: Ib5b96db02089f3b785507c7f5fd822bcb68f35ea
2021-07-23 14:32:22 -07:00
Ray Essick
b3695ff530 Merge "Describe Video Encoding Floor" into sc-dev am: 11badea7d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15238435

Change-Id: I211c47fc69fb419c5c2469d6ec4f12dd755983de
2021-07-22 03:15:37 +00:00
Ray Essick
11badea7d3 Merge "Describe Video Encoding Floor" into sc-dev 2021-07-22 03:10:53 +00:00
Andy Hung
5a97294940 Merge "MediaMetricsManager: Authorize log session ids" into sc-v2-dev 2021-07-19 21:30:31 +00:00
TreeHugger Robot
0426c88c1f Merge "Add PCM float profile if extended precision PCM shows but not pcm float." into sc-dev am: 14e7e8316f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15302848

Change-Id: I163f483af6d49def9ec848592c94f283bae835e0
2021-07-19 16:27:45 +00:00
TreeHugger Robot
14e7e8316f Merge "Add PCM float profile if extended precision PCM shows but not pcm float." into sc-dev 2021-07-19 16:12:47 +00:00
jiabin
3e575e58cc Add PCM float profile if extended precision PCM shows but not pcm float.
This is required for backwards compatibility. This ensures pre-S apps
that look for pcm float continue to see that encoding if the device
supports extended precision integers.

Test: atest AudioManagerTest
Bug: 193747274
Change-Id: Ia244bdcd51520dd082a292baab54f1795ccccaea
2021-07-16 11:40:30 -07:00
Kriti Dang
4559e5b9d5 Merge "Make AudioManager.getReportedSurroundFormats a TestApi" into sc-dev am: 0077afd88a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14840460

Change-Id: I9ae1460e47528ffb38d00ed85a259d9e2e5077b6
2021-07-16 08:15:41 +00:00
Kriti Dang
0077afd88a Merge "Make AudioManager.getReportedSurroundFormats a TestApi" into sc-dev 2021-07-16 08:03:05 +00:00
TreeHugger Robot
21affc98b2 Merge "Tuner APIs: add locks to avoid crashes caused by NPE" into sc-dev am: d7d85eb143
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15290582

Change-Id: Ifbde38a339e107c0fa9378034abc746fea7c2d3e
2021-07-16 01:56:38 +00:00
Jean-Michel Trivi
dc38caf6db Merge "AudioFormat: new channel masks and more javadoc" into sc-v2-dev 2021-07-15 16:20:34 +00:00
shubang
5558cb1cc9 Tuner APIs: add locks to avoid crashes caused by NPE
Bug: 193604292
Test: atest android.media.tv.tuner.cts.TunerTest
Change-Id: I08aaf38489ab7ea29f99e416b0e1082a3d0ee249
2021-07-14 22:18:35 -07:00
Andy Hung
98b9b4e03c MediaMetricsManager: Authorize log session ids
Send log session ids generated by MediaMetricsManager to
the MediaMetricsService, to restrict communicated log session ids.

Test: atest AudioTrackTest#testSetLogSessionId
Test: adb shell dumpsys media.metrics
Bug: 193265974
Change-Id: I1ea10cec4d8b744d44c4e98b2013328e0dd173e1
2021-07-14 13:24:02 -07:00
Kriti Dang
00e49c1482 Make AudioManager.getReportedSurroundFormats a TestApi
Access to the API needed from a tunnel mode CTS test.
TestAPIs dont work in CTS test if they intrenally call AudioSystem.
Changing getSurroundFormats and getReportedSurroundFormats to call
AudioService instead of AudioSystem.

Bug: 189823767
Test: atest android.media.cts.DecoderTest#testTunneledAudioPTSGapsAc3
Change-Id: If6287743f57b77d0eb2639e4a2e9409c7d778f06
Merged-In: If6287743f57b77d0eb2639e4a2e9409c7d778f06
2021-07-14 17:25:25 +00:00
TreeHugger Robot
f03fa75cc8 Merge "Add unregisterClient in instance close." into sc-dev 2021-07-12 15:44:38 +00:00
Henry Fang
6d663b07c4 Add unregisterClient in instance close.
bug: 193109848
Test: atest android.media.tv.tuner.cts
Change-Id: I4e15cc482c4900d12d55a1d8527da0c41a356f88
2021-07-12 15:33:20 +00:00
Ray Essick
82ccbf9433 Describe Video Encoding Floor
New prose in MediaCodec and MediaRecorder describing the behavior.

Bug: 192086134
Test: make docs
Change-Id: I004688adcbd731b4ed0461628ce4cdb6b7035561
2021-07-09 17:23:27 -07:00
jiabin
0f3339cfc2 Cache weak reference for static context.
Use weak reference to cache static context to avoid leak.

Test: atest RingtoneManagerTest
Test: atest RequestPinItemTest
Bug: 192995480
Change-Id: Idbfc9bd0c93ddb40693989c0d09719af24363f1d
2021-07-09 14:53:26 -07:00
Jean-Michel Trivi
408a8215f8 AudioFormat: new channel masks and more javadoc
Define new channel masks to support immersive audio apps.
Define new channel combinations commonly used for m-chan content.
Document existing and new masks.

Bug: 191404931
Test: atest AudioFormatTest
Change-Id: I59ff6770e9b4958659df8b93eaa649d299ea6922
2021-07-09 08:45:12 -07:00
Jiabin Huang
1d4e2f5bb0 Merge "Add context in AudioManager.hasHapticChannels." into sc-dev 2021-07-02 22:54:18 +00:00
jiabin
cfcf10324a Add context in AudioManager.hasHapticChannels.
A context will be required for resolving a Uri. Using the context in
AudioService may not always work and it may cause not oneway binder call
issue. In that case, using the context in RingtoneManager could help.
In AudioManager, caching a static context so that it can be used when
there is not context provided.

Test: atest RingtoneManagerTest
Bug: 187842281
Change-Id: Ia2f514cb8f821926cf3d353cf912a44aeb584ab6
2021-07-02 10:05:07 -07:00