Commit Graph

8932 Commits

Author SHA1 Message Date
TreeHugger Robot
4b23ea8b74 Merge "Fix CryptoInfo.toString" into rvc-dev 2020-06-24 16:58:11 +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
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
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
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
Hyundo Moon
5aacc569c7 Merge "MediaRouter2: Add missing synchronized(sRouterLock) block" into rvc-dev 2020-06-09 06:40:51 +00:00
TreeHugger Robot
2950ebf07d Merge "Add MediaRouterManager.Callback#onSessionReleased" into rvc-dev 2020-06-09 06:10:19 +00:00
Kyunglyul Hyun
fe7b5b125b Add MediaRouterManager.Callback#onSessionReleased
Add the callback to let MediaRouter2Manager get notified
of released sessions.
A test is also added to check if the manager is aware of
a released session when the session is released from the
media router.

Bug: 157872573
Test: atest mediaroutertest
Change-Id: Ifb96b23ed61cc15f5015c453727a487c3b09a92b
2020-06-09 13:13:30 +09:00
Hayden Gomes
50980050a6 Merge "Adding lock to sendEventFromNative" into rvc-dev 2020-06-08 16:02:49 +00:00
TreeHugger Robot
e3767bdaae Merge "Ignore transfer to an unknown route" into rvc-dev 2020-06-08 11:34:35 +00:00
TreeHugger Robot
6b1cfced63 Merge "Notify a failure on transfer timeout" into rvc-dev 2020-06-08 11:34:13 +00:00
Hyundo Moon
23a9e17874 MediaRouter2: Add missing synchronized(sRouterLock) block
Bug: 157873496
Test: Builds successfully
Change-Id: I87882c642bcdd93a2fedd9ad2c6c5dc54eada598
2020-06-08 15:48:56 +09:00
Hyundo Moon
ebb7ae6679 Merge "MediaRouter2: Sync routes when first RouteCallback is registered" into rvc-dev 2020-06-08 06:07:31 +00:00
Hayden Gomes
14e3bd0c3e Adding lock to sendEventFromNative
Eliminate potential race condition for postEventFromNative.

Fixes: 157755647
Test: atest com.android.car where race condition was hit
Change-Id: I5d11f8769d2c09a6a630332db447302e06a5869b
2020-06-05 10:15:42 -07:00
Kyunglyul Hyun
8df5fb6e7d Notify a failure on transfer timeout
When a transfer is ignored by the provider.
It is handled as a failure by MediaRouter2Manager.

A test is added for timeout, which takes 30 seconds.

Bug: 157875723
Test: atest mediaroutertest
Change-Id: I3f0ec77551309c96f8f589057800082f6121d4e2
2020-06-05 18:22:42 +09:00
Hyundo Moon
bc63327359 MediaRouter2: Sync routes when first RouteCallback is registered
Bug: 149526397
Test: Passed CTS and mediaroutertest
      Also checked logs that DEFAULT_ROUTE is not added.
Change-Id: Icc0a5f2ea8f93fd7baba132a9bd4a1f9d798bba9
2020-06-05 17:38:04 +09:00
Automerger Merge Worker
7daf2ca947 Merge "Merge "Fix TvRecordingClient api issues" am: cce2ca958e am: f7cbbae9e4" into rvc-dev-plus-aosp am: 14bd7ccbb0 am: f9061f953d am: 4276a00208
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/972628

Bug: 134042967

Change-Id: Ib3ca9467b68563383fef4dbc0f11b0f4aa8fd111
(cherry picked from commit 69244518dd)
2020-06-05 05:01:31 +00:00
Henry Fang
084e7473fb Merge changes I9f8ce2e5,I3142b073 into rvc-dev
* changes:
  Add the metrics for status of open cas session
  Add the metrics for DVR status
2020-06-04 17:18:14 +00:00
Kyunglyul Hyun
0eadc17150 Merge "Fix MediaRoute2ProviderService TODOs" into rvc-dev 2020-06-04 07:05:29 +00:00
Henry Fang
fd40c07abe Add the metrics for status of open cas session
Metrics review request:  b/155199791
Metrics design review is updated at https://eldar.corp.google.com/assessments/937523088/drafts/927800491

bug: 154661158
Test: Manual
Change-Id: I9f8ce2e52289130f9fb39a368240676c1792c154
2020-06-03 12:38:03 -07:00
Henry Fang
1ae85bb287 Add the metrics for DVR status
Metrics review request:  b/155199791
Metrics design review is updated at https://eldar.corp.google.com/assessments/937523088/drafts/927800491

bug: 154661158
Test: Manual
Change-Id: I3142b0737f7469a79a526281b75a06d3dbf97483
2020-06-03 12:31:00 -07:00
Kyunglyul Hyun
a3be2de6ec Ignore transfer to an unknown route
This CL ignores attempts to transfer to unknown route in
MediaRouter2Manager.
This CL also fixes wrong acquisition of locks when getXXXRoutes.

Bug: 157875504
Test: atest mediaroutertest
Change-Id: Ic3415844551c672b42d19d9744d7538a9d7df7c3
2020-06-03 18:04:18 +09:00
Jing Ji
322b748b8d Merge "Update docs for MediaProjectionManager.getMediaProjection" into rvc-dev 2020-06-02 19:12:49 +00:00
Jing Ji
fd7b013f71 Update docs for MediaProjectionManager.getMediaProjection
It actually needs the foregroud service to be the type "mediaProjection"

Bug: 157265923
Test: m -j ds-docs-java
Change-Id: Ia5aab928be1755e3117432bdec423e88f997c55b
2020-06-02 10:39:46 -07:00
Kyunglyul Hyun
d344655969 Fix MediaRoute2ProviderService TODOs
This CL ignores requests that contain unknown session IDs and
make sure sequence of binder calls are aligned with notifySession
Created/Updated/Released.

Bug: 157873546
Bug: 157873487
Test: Run CTS and atest mediarouter test
Change-Id: Ie31e2fca8160093cf54886180e67d40865a35d6d
2020-06-02 17:32:57 +09:00
Hyundo Moon
5c8f3b20d5 Merge "Add bug numbers for TODOs in MediaRouter2 related classes" into rvc-dev 2020-06-02 08:16:58 +00:00