Commit Graph

16036 Commits

Author SHA1 Message Date
Arnaud Berry
76724683e3 Add BIND_INCLUDE_CAPABILITIES flag when binding to the service.
This allows headless media applications to access the location if they
have the permission and is needed for AAOS apps in particular.

Bug: 169242810
Bug: 156904507
Test: manual with AAOS Media app
Change-Id: I1196718638fba336a815809578f643814545baf4
2020-09-23 16:21:50 +00:00
jiabin
fcd4cbf4f4 Add package name when creating AudioTrack.
The package name will be used when starting external vibration. The
package name will be sent to vibrator service to check if the
application has the permission to start vibration,

Bug: 165910728
Bug: 162343845
Test: atest AudioTrackTest MediaPlayerTest
Test: start audio-coupled-haptic playback
Change-Id: I04b4711d11ab5f0f0716ea4c5e1c0f754fe834bb
Merged-In: I04b4711d11ab5f0f0716ea4c5e1c0f754fe834bb
2020-09-16 00:14:43 +00:00
Jin Seok Park
bb6d38615e DO NOT MERGE: Rename temp file to use a valid image file extension
MediaProvider added a restriction in R for apps targeting SDK 30 to
not allow .tmp files in image file directories such as "Pictures" and
"DCIM". This CL renames the temp file to avoid this restriction.

Also added test to check for writing to FileDescriptor instances.

Bug: 160874777
Test: atest CtsMediaTestCases:android.media.cts.ExifInterfaceTest
    Also tested with an image file inside /Pictures
Change-Id: Iedb548651c0048b0aecc4b34e9c94f778cf5d1e0
(cherry picked from commit 5abacddfc3)
2020-08-26 02:47:51 +00:00
Eric Laurent
148c8bc210 Merge "AudioService: Add metrics for audio mode" into rvc-dev 2020-07-19 16:46:20 +00:00
Eric Laurent
6915e2ff50 AudioService: Add metrics for audio mode
A metrics for audio mode changes and failure to release IN_COMMUNICATION
mode when inactive.

Bug: 153934174
Bug: 161444687
Test: repro steps in Bug and verify logs and metrics
Change-Id: Ib3beab2e8b64e7354ff1a32f04561e7b95f61855
2020-07-16 08:39:22 -07:00
Henry Fang
f0e3e4f470 Fix MediaCas CTS failure
TRM is checking input parameters and won't allow null executor.
Use context main executor to call Tuner Resource Manager (TRM)

Also fix ConcurrentModificationException when use HashMap.forEach to free element in hashmap.

Test: atest MediaCasTest
bug: 161391585
Change-Id: Ie5111b46b5b601f0a5b56e5828d79771e153a210
2020-07-15 19:06:25 -07:00
TreeHugger Robot
c0fcd758c4 Merge "Add FEATURE_REMOTE_GROUP_PLAYBACK" into rvc-dev 2020-07-02 00:47:56 +00:00
Lajos Molnar
e167804b42 media: clarify keys used for CodecCapabilities.isFormatSupported
Bug: 159281744
Change-Id: Id93dd2529e468b76bdd01e2a8ebe14b8435a54d7
2020-07-01 14:56:30 -07:00
Kyunglyul Hyun
e44b5a2641 Add FEATURE_REMOTE_GROUP_PLAYBACK
Can be used to distinguish a group route from single device routes

Bug: 160113560
Test: N/A
Change-Id: Id65aded4ce396bbfaec7040fc2227b769f8c5794
2020-07-01 14:07:39 +08:00
TreeHugger Robot
baa0a1faa3 Merge "ImageWriter: always detach the origially attached buffer" into rvc-dev 2020-06-26 16:14:58 +00:00
Shuzhen Wang
b9adb57604 ImageWriter: always detach the origially attached buffer
This avoids buffers piling up in the ImageWriter queue with no way to
free them.

Test: Camera CTS
Bug: 150658436
Change-Id: I70b10ddaa75aa9ab29f6ad7de9871a634a88813e
2020-06-26 16:14:19 +00:00
TreeHugger Robot
26bf8c7aa0 Merge "Camera: Clarify timestamp behavior for VIDEO_RECORD usage flag" into rvc-dev 2020-06-26 16:09:09 +00:00
Jean-Michel Trivi
a750903b42 Merge "AudioAttributes: fix setter for flags" into rvc-dev 2020-06-26 03:49:30 +00:00
Jean-Michel Trivi
b097d9e1cd AudioAttributes: fix setter for flags
A regression was introduced by d0c4968 which prevented @SystemApi
flags to be set in the builder of an AudioAttributes, causing
FLAG_BYPASS_INTERRUPTION_POLICY and FLAG_BYPASS_MUTE to get
ignored.
Note that even though any client can set System flags, they will
be discarded and ignored server side in the audio policy service if
the caller doesn't have the permissions.

Bug: 154205921
Test: fire alerts with packages/apps/CellBroadcastReceiver/tests/testapp
Change-Id: I9d593787c18a510aa702dc0da85254f0d9574f11
2020-06-26 03:48:35 +00:00
Shuzhen Wang
f09a4cdbd6 Camera: Clarify timestamp behavior for VIDEO_RECORD usage flag
Test: make docs and read the doc
Bug: 143240912
Change-Id: I64032c7e2644680888979696968bdebd772530cc
2020-06-25 16:31:14 -07:00
Kyunglyul Hyun
f19e811c88 Don't check selectedRoutes of created sesions
There are cases that a newly create session does not contain
the requested route. (e.g. static group)
This CL removes check that disallowed those cases.

Bug: 159881597
Test: Run CTS, atest mediaroutertest and manually
using support v7 demos, which is edited to call
notifySessionCreated with member routes selected

Change-Id: I30741d2f3587d0fa9ee5a10fdb8fab9e0d82c721
2020-06-25 19:16:45 +09:00
TreeHugger Robot
4b23ea8b74 Merge "Fix CryptoInfo.toString" into rvc-dev 2020-06-24 16:58:11 +00:00
TreeHugger Robot
6f8ee88a04 Merge "Fixed a invalid fd issue" into rvc-dev 2020-06-24 16:00:32 +00:00
Santiago Seifert
3c715d5778 Fix CryptoInfo.toString
It's using the key length when it should use the iv length.

Bug: 154120292
Test: Manually.
Change-Id: I98d71b974688acbeef0c7112298c5edf37d47ef7
2020-06-24 14:58:47 +01:00
Kyunglyul Hyun
82ff3f1472 Merge "MediaRouter: Defer releasing routing controller when transfer" into rvc-dev 2020-06-24 06:41:39 +00:00
Henry Fang
7f61a67c41 Fixed a invalid fd issue
LinearBlock close the fd why it's recycled, so we need dup the fd to create a LinearBlock.

bug: 159753135
Test: Manual
Change-Id: Ic2b4e3c535e60983b2a4fc5f5ce6e809731fd581
2020-06-23 17:47:51 -07:00
Madhava Srinivasan
d03a59938e Merge "Persisting setDeviceVolumeBehavior calls" into rvc-dev 2020-06-23 14:51:38 +00:00
Madhava Srinivasan
b5ed600d41 Persisting setDeviceVolumeBehavior calls
This change does the following
0. Robustly enforce setDeviceVolumeBehavior.
Prior to this change, setDeviceVolumeBehavior could have been overridden
in cases like HDMI_CEC enable/disable, HDMI re-plug, etc.

1. Persist setDeviceVolumeBehavior across AudioService restarts and
system reboots.
Prior to this change, setDeviceVolumeBehavior was lost on AudioService
crash/restart, or system restart.

2. Persist software volume across reboots.
Prior to this change, HDMI_OUT device was initialized as a "Fixed"
Volume device and then updated to either full volume device or
"variable" volume device based on the outcome of HDMI-Sink's CEC
capabilities. However, when connected to a non-CEC capable sink this
would result in audio resetting to 100% on each reboot.

3. Some refactoring around how mFixedVolumeDevices and
mFullVolumeDevices are updated in some instances.

Bug: 153193369
Bug: 155482023
Test: Locally on ADT3
Change-Id: I4adb38c64fe1ae7713992ab83acbd66bce4524a4
2020-06-22 20:22:01 -07:00
Kyunglyul Hyun
6a2f1d67b7 MediaRouter: Defer releasing routing controller when transfer
In order to allow media router to communicate with the old routing
controller for synchronizing media status during transfer,
this CL postpone releasing the old routing controller.

Basically media router should release the old routing controller by
itself when it's done with the old routing controller.
If it didn't, the old routing controller is automatically released
after timeout (30s for now)

This CL also clarifies "old routing controller" in onTransfer callback.
Now it is consistent regardless of who requested transfer.

A request from MediaRouter2Manager is handled by MediaRouter2 to
simplify session creation logic.
Limitation of this approach is that a routing session unknown to
MediaRouter2 can't be transferred to a different provider but it is out
of R scope so it's okay.

Bug: 158713035
Test: CTS test && atest mediaroutertest && manually transfer using
support v7 demos

Change-Id: I168af69e2a25240227aea0fd9e892eaa91e78ee3
2020-06-23 11:28:35 +09:00
Andy Hung
72998aeaf7 Merge "AudioTrack: Update javadoc" into rvc-dev 2020-06-22 17:15:09 +00:00
Sungsoo Lim
7bfb0c31bf Merge "Prevent unnecessary call of setBluetoothA2dpOn(false)" into rvc-dev 2020-06-22 06:23:42 +00:00
Kyunglyul Hyun
c8f4a8a5e9 Merge "System routes are not automatically exposed" into rvc-dev 2020-06-22 04:52:17 +00:00
Kyunglyul Hyun
e1b8006e2b Handle multiple active bluetooth devices
When dealing with a pair of hearing aid devices are active,
a single "selected route" is not sufficient.

Instead, this CL introduces activeRoutes which can hold multiple active
bluetooth route and deal with them.

Bug: 152585170
Test: cts tested & manually w/ A2dp BT devices
Change-Id: I2c2b8967d9f221db73f9d3b9332de7c76d07a0f9
2020-06-21 21:51:44 +09:00
Andy Hung
c1bd8cbfd3 AudioTrack: Update javadoc
Remove todo, audio TV metadata still pending final update for rvc-tv-dev.

AudioDeviceInfo.getEncapsulationModes suppresses return of
AudioTrack.ENCAPSULATION_MODE_NONE.

Test: make docs and check
Bug: 147778408
Change-Id: Ia7da6c3805e42f7a6b9a3b18d44f4c4ef92171a4
2020-06-19 18:57:14 -07:00
Wonsik Kim
7e1b558949 Merge "media: fix race condition on async release" into rvc-dev 2020-06-20 00:39:43 +00:00
Wonsik Kim
e37ef4bc92 media: fix race condition on async release
Clear Java object state at releaseAsync(), and delete native object
upon async release complete.
Clearing CodecBase object only led to a rare race condition which
caused null pointer dereference.

Bug: 158501286
Test: atest CtsMediaTestCases:MediaCodecTest#testAsyncRelease (100 times)
Test: atest CtsMediaTestCases:MediaCodecCapabilitiesTest#testGetMaxSupportedInstances
Test: atest CtsMediaTestCases -- --module-arg CtsMediaTestCases:size:small
Change-Id: I691d39007c0ea770318f4038558ad338252bd2fb
2020-06-19 13:04:02 -07:00
Kyunglyul Hyun
c036350122 System routes are not automatically exposed
From this CL, even for system routes (phone speaker, bt routes),
features are required to get notified of events on routes or to
get them as "available" routes.

By adding this, apps can disable cast -> phone feature.

Bug: 159090706
Test: cts test && atest mediaroutertest && manually
using support v7 demos such that
  with LIVE_AUDIO : nothing changed
  w/o LIVE_AUDIO : cast -> phone feature is disabled
  unregistering callback : cast -> cast (media transfer) and
                           phone -> phone is only enabled <- this is
                           the expected behavior for apps that updates
                           AndroidX library

Change-Id: I4bd27eb1d4776b9cedb59b10e1bac5868d56d305
2020-06-19 22:54:59 +09:00
TreeHugger Robot
c266b0398e Merge "Fix MediaEvent release issue" into rvc-dev 2020-06-19 07:29:26 +00:00
Sungsoo Lim
0ea65316f4 Prevent unnecessary call of setBluetoothA2dpOn(false)
When an active BT device is changed, instead of just notifying that
the changed BT name, AudioService sometimes notify it with two steps.

1) Notify prev BT disconnected
2) Notify new BT connected

By not calling setBluetoothA2dpOn(false) when BT is disconnected,
we can prvent the unnecessary call of it.

Bug: 144784716
Test: manual
Change-Id: I31442204cd4dd4a78552e0f993e9dfa37d6fc03f
2020-06-19 14:42:08 +09:00
Kyunglyul Hyun
6edbf48c2b Merge "Log transferring and fix verbose system logs" into rvc-dev 2020-06-19 04:32:01 +00:00
shubang
c84fe12f1d Fix MediaEvent release issue
Bug: 158876323
Test: make;
Change-Id: Idedf41620b5a32ca552836d00b1db78adcfd1a7f
2020-06-17 14:57:10 -07:00
Kyunglyul Hyun
f9ad0f6e3c Refresh mFilteredRoutes when routes are changed
When a route changes its features, the returned getRoutes() can be
changed.

Bug: 159142641
Test: run support v7 demos manually to check onRouteAdded callback is
invoked

Change-Id: Icea855d631a566fd9129f98306e3ea8af4920764
2020-06-17 20:29:04 +09:00
Kyunglyul Hyun
a464837e48 Log transferring and fix verbose system logs
This CL logs transfer between routes to easily track potential bugs.
Selecting a route was also logged in MediaRouter.

It also reverts the log level of SystemMediaRoute2Provider because
we resolved issues related to it.

Bug: 156996903
Test: N/A
Change-Id: I6d7e165a79679305fd21a378fd3ae35b941c17c6
2020-06-17 13:54:06 +09:00
Hyundo Moon
ac9df100f5 Clear preferred feature when unregistering MediaRouter2
MediaRouter2Managers' preferred feature didn't get cleared even when the
MediaRouter2 is unregistered/died. As a result, when an app is
reinstalled/relaunched, the routes for the previous process are still
shown in the MediaRouter2Manager.

This CL fixes the problem.

Bug: 158824569
Test: Passed CTS and mediaroutertest
      Also tested with reinstalling support7Demos.
Change-Id: Ib5d84c41862177af32931e0d69b02f461105bba6
2020-06-12 21:01:56 +09:00
TreeHugger Robot
70b9d348eb Merge "Reset app routes when global a2dp state changed" into rvc-dev 2020-06-12 06:37:46 +00:00
Hyundo Moon
6d8d91dcfb Merge "MediaRouter2: Prevent printing same logs from different lines" into rvc-dev 2020-06-12 05:23:25 +00:00
Sungsoo Lim
07e40316f8 Reset app routes when global a2dp state changed
Bug: 156549746
Test: manual
Change-Id: I8985136220c9cb96bd4da013653a69f12bfbb6b1
2020-06-12 12:13:08 +09:00
Hyundo Moon
369be956e0 MediaRouter2: Prevent printing same logs from different lines
This CL prevents duplicate logs which are printed from
different code locations, which makes investigating future bugs easier.
Also modifies some logs to make them clearer.

Bug: 157873330
Test: Builds successfully
Change-Id: I90ca0e6b46e2b796d069dbecef4a8000cca85b4b
2020-06-12 11:28:13 +09:00
Kyunglyul Hyun
55e5ac8fc0 Merge "Add address to MediaRoute2Info" into rvc-dev 2020-06-11 10:53:55 +00:00
Hyundo Moon
f3ff3de37e Merge "Prevent abuse of MediaRoute2ProviderService#notifyRequestFailed()" into rvc-dev 2020-06-11 01:10:25 +00:00
Ytai Ben-tsvi
3917b729a6 Merge changes Ibf4ecdb4,I1e4adf9f into rvc-dev
* changes:
  Correctly propagate service state change
  Support null audio format in recognition event
2020-06-10 19:31:42 +00:00
Kyunglyul Hyun
1ea19b1d01 Add address to MediaRoute2Info
The route ID of a bluetooth route was its hardware address and
SettingsLib depended on that to get BluetoothDevice.

We can't use the address as ID for a pair of hearing devices,
which has their own address but should have the same route ID.

Instead, this CL adds "address" field explictly to be used for bluetooth
routes.
Maybe it can be used by other devices as well.

Bug: 157708273
Test: make -j42 RunSettingsLibRoboTests && cts test
Change-Id: Ib940da9975fc8d68ec3fb7cf2c4a85c0d1a195f3
2020-06-10 20:59:15 +09:00
Ytai Ben-Tsvi
7caef40ad0 Support null audio format in recognition event
The audio format doesn't always make sense in recognition events, for
example in a failure or abort event, so we allow it to be null.
However since the SoundTrigger.java API doesn't allow that, we inject
a default if it is not available.

Bug: 157496890
Test: Simulated a device that doesn't support concurrent capture,
      reproduced the bug, applied the fix, verified.
Change-Id: I1e4adf9f3ccdc0f62cb9ca5e8c07df3c40a9d2cd
2020-06-09 16:05:19 -07:00
TreeHugger Robot
275248ddfe Merge "media: further resource cleanup for async release" into rvc-dev 2020-06-09 17:41:01 +00:00
Hyundo Moon
9b5e3923d1 Prevent abuse of MediaRoute2ProviderService#notifyRequestFailed()
The method can be called with a random requestId, or called multiple
times with the valid requestId. It can result unnecessary calls
to MediaRouter2Manager#onRequestFailed().

This CL resolves this problem.

Bug: 157873556
Test: Passes CTS and mediaroutertest
Change-Id: Ia7dd4ddafd532b9f23bf19491a0820d5a74f6a70
2020-06-09 19:12:30 +09:00