Commit Graph

10086 Commits

Author SHA1 Message Date
Jean-Michel Trivi
c4c4ccc037 AudioService: dump routing cache in AudioSystemAdapter
Bug: 211217374
Test: adb shell dumpsys audio, look under AudioSystemAdapter
Change-Id: Ibfa62f09165287d4dc7a6822debcd1ff1a38eca6
2022-01-10 19:10:35 -08:00
Jean-Michel Trivi
a991d6bdc2 MediaFormat: fix key value for KEY_MAX_OUTPUT_CHANNEL_COUNT
Fix type that used "_" instead of "-"

Bug: 198197610
Test: TBA on new decoder
Change-Id: Ief5ae1f708b27347bf5a700abfd51f9c53e2c888
2021-10-26 09:13:07 -07:00
Hyundo Moon
5a9ab8d69a Merge "MediaRouter: Route setBluetoothA2dpOn() via MediaRouterService" into sc-qpr1-dev am: 2c7ec2cbf5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16044773

Change-Id: I017be1b10677f78ee7f5b290a13eab376c4e0615
2021-10-20 02:27:48 +00:00
TreeHugger Robot
d159eccc3c Merge "MediaFormat: codec-agnostic key for max number of output channels" into sc-v2-dev 2021-10-16 02:58:36 +00:00
Jean-Michel Trivi
632f1930b8 MediaFormat: codec-agnostic key for max number of output channels
New key behaving like KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT but not
AAC specific.

Bug: 198197610
Test: TBA on new decoder
Change-Id: If4d5f4580cba4ababbe4f18e19efbd070ec8f65c
2021-10-15 10:04:51 -07:00
Hyundo Moon
2942e4b584 MediaRouter: Route setBluetoothA2dpOn() via MediaRouterService
The direct binder usage of AudioService.setBluetoothA2dpOn() is now
blocked by permission for security reasons.
This CL routes the usage to the MediaRouterService.

Bug: 181962322, Bug: 189176702
Test: GMM can play navigation sound when BT is connected
Change-Id: Ib13c224a0d412ef6d802eeaadd246649c819c26f
2021-10-15 02:58:03 +00:00
Richard Folke Tullberg
4b8954d48b AudioTrack: Do not throw exception from isMultichannelConfigSupported
Test: atest AudioTrackTest#testInvalidMinBufferSize
Bug: 200571916
Change-Id: I85f2cb2d6f3ba84ed93a505fc3eb35387bc8a5ce
2021-10-13 10:41:31 -07:00
Jean-Michel Trivi
31ecebec87 Merge "Spatializer: add API for monitoring output changes" into sc-v2-dev 2021-10-13 03:43:04 +00:00
Jean-Michel Trivi
859de8a0ed Spatializer: add API for monitoring output changes
Add privileged API for monitoring audio output stream changes
for the output used by the spatializer effect.

Bug: 202723925
Test: atest SpatializerTest
Change-Id: Ie35ff41e2bec8448997873ca4cf1e229080d2f6a
2021-10-12 08:46:14 -07:00
Jean-Michel Trivi
a99e72ca97 Spatializer: document state getters when feature is unsupported
Bug: 202834359
Test: atest SpatializerTest
Change-Id: I65b5cb097b84e7b4c8614cf74150c24dfa2f4f0f
2021-10-12 07:49:23 -07:00
Andy Hung
a9f98ae11a AudioTrack: Fix track creation of 9.1.4 and 9.1.6 streams
Required support if the platform supports 14 or 16
channels internally, otherwise CTS test fails.

Test: atest AudioTrackTest#testImmersiveAudio
Bug: 202162797
Change-Id: I052f2e38a27a63e5304b7fb6bffaaabe37efa8eb
2021-10-06 17:40:13 -07:00
Sungsoo Lim
d0c29f1bf1 DO NOT MERGE: Revert "Reset app routes when global a2dp state changed"
This reverts commit 07e40316f8.

Bug: 193831720, Bug: 168093983, Bug: 156549746
Test: manual
Change-Id: I86df6f9f1d672c455cd0aedc58012b3335659479
(cherry picked from commit 6d4a00b17a)
2021-09-23 15:31:31 +09:00
Sungsoo Lim
ef07a1a45a DO NOT MERGE: Revert "Call route selected/unselected callbacks"
This reverts commit 6adeb2c9f1.

Bug: 193831720, Bug: 168093983
Test: manual
Change-Id: I0c0c3ac9ed63bafe419c8a127772d4042abbab89
(cherry picked from commit 89d28318a0)
2021-09-23 15:31:20 +09:00
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