Commit Graph

824 Commits

Author SHA1 Message Date
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
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
Hyundo Moon
f3ff3de37e Merge "Prevent abuse of MediaRoute2ProviderService#notifyRequestFailed()" into rvc-dev 2020-06-11 01:10:25 +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
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
TreeHugger Robot
e3767bdaae Merge "Ignore transfer to an unknown route" into rvc-dev 2020-06-08 11:34:35 +00: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
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
Hyundo Moon
0f78fc6ab8 Add bug numbers for TODOs in MediaRouter2 related classes
This CL adds bug nubmers for TODOs which are needed to resolve in
Android R timeframe.

Bug: 157875570
Test: Builds successfully
Change-Id: I8d5adcabb4ec42feabf38ac3cedcd63e9a5a9cf2
2020-06-01 17:40:08 +09:00
Kyunglyul Hyun
15cd47ed26 Merge "Make MediaRouter2Manager connect to the system ASAP" into rvc-dev 2020-05-12 06:22:06 +00:00
Kyunglyul Hyun
ccb9587ae1 Make MediaRouter2Manager connect to the system ASAP
With this CL, some methods such as getAllRoutes, getActiveSessions
can be used without registering a callback.

Bug: 155042836
Test: atest mediaroutertest
Change-Id: Iba38d73a95c1d184bc89ff91d128b00109029d0a
2020-05-12 13:21:30 +09:00
Charles Chen
5681f3e796 Merge "Add WindowMetricsHelper" into rvc-dev 2020-05-11 10:17:37 +00:00
Kyunglyul Hyun
45512bbd54 Filter selectable/deselectable routes
Only selected routes can be deselectable and not selected routes
can be selectable from this CL.

Bug: 154918270
Test: Manually and atest mediaroutertest
Change-Id: I2e66d814190b003c935b21a744d24fa2b5d2c7ac
2020-05-08 17:36:33 +09:00
Charles Chen
49f329ca66 Add WindowMetricsHelper
This metrics now is used for calculating the value reported by
Display#getSize. It could be extended to have more function later.

Also replace getCurrentMetrics usages to make them report
Display#getSize value.

Bug: 148904274
Test: atest WindowMetricsHelperTest

Change-Id: I182b6e63f7c28752eee22839cb9e69f073046c3f
2020-05-04 11:41:13 +08:00
James Wei
82062b99eb MTP: Fix MTP SD card issue
Modify MTP access path for SD card in accordance with Storage Permission change

Bug: 150188237

Test: atest MtpTests
Test: Manual test: MTP file browsing / copy on SD card
Change-Id: I7da699ca04844514827af18b0318c66d2a3fbc6e
2020-04-22 11:34:42 +08:00
James Wei
19ded228a3 MTP: Add MtpDatabase unit test
Add Thumbnail feature test cases

Bug: 117863715
Test: atest MtpTests
Change-Id: I5a09efef10df20e382a4c623481e048e7b35ff14
2020-04-22 03:20:02 +00:00
Kyunglyul Hyun
e66ac51ea3 Merge "Use session hints when create a session from MR2Manager" into rvc-dev 2020-04-21 11:17:38 +00:00
Kyunglyul Hyun
350d7b427e Clear routes when media router manager has no callback
This CL clears routes when the last callback of MediaRouter2Manager
is unregistered. By doing this, we can ensure
MediaRouter2Manager#getAvailableRoutes() returns correct routes
during at least a single callback is registered.

A test for the behavior is added as well.

This CL also fixed a bug that unregistering a callback from MediaRouter2
disconnects it when multiple callback is used.

Bug: 153515567
Test: atest mediaroutertest & cts test & manually
 using MediaRouter2Demo and Sample OutputSwitcher to see
 if forgotten BT device is correctly removed.
 (w/o this CL forgotten BT device remains)
Change-Id: I31a5001115f1f163c8971bbd906516551b860252
2020-04-21 14:58:31 +09:00
Kyunglyul Hyun
f0eb51bc40 Use session hints when create a session from MR2Manager
When MR2Manager requests to create a routing session, it should pass
session hints to the target provider.
This CL adds a logic that MR2Manager asks media router instance to
get session hints to be passed to the provider.

Bug: 152851868
Test: atest mediaroutertest
Change-Id: Ib421f61f663090c6ed95c8b1a2f7deeb80e5be16
2020-04-21 14:17:08 +09:00
Francois Gaffie
8650e2d23d AudioManager: Add functional tests for productstrategy/volumegroup
Test: adb shell am instrument -w -e class com.android.audiopolicytest.AudioManagerTest com.android.audiopolicytest
adb shell am instrument -w -e class com.android.audiopolicytest.AudioProductStrategyTest com.android.audiopolicytest
adb shell am instrument -w -e class com.android.audiopolicytest.AudioVolumeGroupTest com.android.audiopolicytest
adb shell am instrument -w -e class com.android.audiopolicytest.AudioVolumeGroupChangeHandlerTest com.android.audiopolicytest

Bug: 136121584

Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
Change-Id: Ia7e92ff37ff9c5e51bc2b5fe54b15c6338868b23
2020-04-14 12:48:24 -07:00
Kyunglyul Hyun
f064dcae8e Call MediaRouter2Manager#onTransferred
Call MediaRouter2Manager#onTransferred to notify
whether transfer is succeeded or failed.

Bug: 151396145
Test: atest mediaroutertest
Change-Id: I4331c80d03c61b5a722a8be404c979d3fcfa23f1
2020-04-01 22:38:06 +09:00
Andrii Kulian
0be1d67b68 Report bounds instead of size in WindowMetrics
Use case: Jetpack WM will use them to get the location of windows on
screen and compute the display feature positions in window coordinate
space.

Bug: 150908045
Test: atest FrameworksCoreTests:WindowMetricsTest
Test: atest CtsWindowManagerDeviceTestCases:WindowMetricsTests
Change-Id: Ia08950cd5df35971408e8b17bb27d97d29d0ab9b
Exempt-From-Owner-Approval: API change
2020-03-24 17:05:50 +08:00
Kyunglyul Hyun
f4552af502 MediaRouter: Rename methods in TransferCallback
Bug: 151455138
Test: cts test and atest mediaroutertest
Change-Id: I2bfc5c6c4ac6730d1a7162cd9516092ec64d16e7
2020-03-20 23:25:11 +09:00
Hyundo Moon
1c888e2dbb Rename SampleMediaRoute2ProviderService to StubMediaRoute2ProviderService
Bug: 151538499
Test: atest mediaroutertest
Change-Id: I1467acf7482ac5421b800281e367353f08358eab
2020-03-15 19:52:05 +09:00
Philip P. Moltmann
12ac3f406f Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 19:26:10 +00:00
TreeHugger Robot
abb2d5847d Merge "Camera: Add new hidden API for camera open/close callback" into rvc-dev 2020-03-10 23:27:46 +00:00
Shuzhen Wang
6d76d3b1f6 Camera: Add new hidden API for camera open/close callback
The hidden API is used by SystemUI process to adjust the system UI based
on when a certain camera is opened or closed.

Test: Manually observe callbacks in SystemUI when running camera CTS
Bug: 150540299
Change-Id: I04cae782d96f0e32be8ef588dcd328f84b32887a
2020-03-10 09:35:50 -07:00
Hyundo Moon
f8e49f4bf7 Put requestId first in notifySessionCreated() arguments
For consistency, this CL applies the same changes also to the
internal methods.

Bug: 150922531
Test: CTS and mediaroutertest (Passed except already failing methods)
Change-Id: Iac0ab78464b16212cb3ad46519f5892e8d1b69d9
2020-03-06 23:33:56 +09:00
Kyunglyul Hyun
2dd6d27d4a Merge "Fix RoutingSessionInfo route ID issue" into rvc-dev 2020-03-06 11:27:36 +00:00
TreeHugger Robot
531bb231d8 Merge "Merge notifySessionCreationFailed into notifyRequestFailed" into rvc-dev 2020-03-06 06:52:21 +00:00
Kyunglyul Hyun
5219072963 Fix RoutingSessionInfo route ID issue
In the previous CL, we relied on MediaRouterUtils.getOriginalId()
that returns a wrong ID when it has no provider ID but the separator.

Resolve the issue by resetting route ID in Builder class.

Bug: 150666870
Bug: 150751854
Test: cts test realted to MediaRouter2
Change-Id: Ib17cdc8385308ccadad79e117fcfede72b8af6b5
2020-03-06 13:54:45 +09:00
Hyundo Moon
7c2059c999 Merge notifySessionCreationFailed into notifyRequestFailed
Bug: 150582958
Test: Ran CTS and mediaroutertest
Change-Id: Ica95c7619d85565d49f238b46d3043358c94a37f
2020-03-05 23:10:46 +09:00
Kyunglyul Hyun
fe58399597 MediaRouter2: Fix routes IDs in RoutingSessionInfo
This CL fixes the issue that RoutingSessionInfo#getSelectedRoutes
return improper route IDs when it is recreated.

To ensure provider ID related feature, another test is added.
Since RoutingSessionInfo#setProviderId is a hidden method, the test
is not added to CTS.

The reason for moving "updating route ID logic" into Builder is from
considering use cases.
The original ID of the route is only checked when the provider ID is
set and a route is added to or removed from a RoutingSessionInfo,
which is very rare case.

This CL also fixes the issue that didn't release the previous routing
session when transfer.

Bug: 150666870
Bug: 150751854

Test: atest mediaroutertest
Change-Id: Ic05c11ebf43562b44214eb661c8b9c106f1c9d3e
2020-03-04 20:49:44 +09:00
Kyunglyul Hyun
a3365d7537 MediaRouter: Cleanup MediaRouter2Manager APIs
As a following CL, RoutingController will be removed.
Instead, MediaRouter2Manager will use RoutingSesionInfo.
This CL adds necessary methods for that.

Added Callback#onTransferred and #onTransferFailed.

Bug: 150571233
Test: atest mediaroutertest
Change-Id: If2c23c483f80b6c93a14d1f1f93dfc40463ede1a
2020-03-02 15:02:09 +09:00
Hyundo Moon
899535c9ff Make MediaRouter2 callback classes as abstract
This is per API review.

Bug: 149912538
Test: Ran CTS and atest mediaroutertest
Change-Id: Id52bb7b06da4f414099607b1bde781005e47ded3
2020-02-28 18:27:42 +09:00
Kyunglyul Hyun
ce6a9dc061 Merge "MediaRouter: Define route type" 2020-02-21 02:36:00 +00:00
Hyundo Moon
d882109319 Merge "Add MediaRoute2ProviderService#notifyRequestFailed" 2020-02-21 00:21:46 +00:00
Kyunglyul Hyun
8828c891e0 MediaRouter: Define route type
Change deviceType to type and define more types.
TYPE_GROUP is also added to classify static group routes.

Device type for the default route is set from now

Bug: 149677159
Test: cts test and atest mediaroutertest
Change-Id: I0626efe7b6160f22fe69a0b75368ee1a67d8768c
2020-02-20 21:32:54 +09:00
Kyunglyul Hyun
f55befbfbe MediaRouter2: Fix test bug
Two set of preferred features could be the same in a different order.
Test: atest mediaroutertest
Bug: 149887171

Change-Id: I10f6878ad42cf49f2337d2d69f884038b144df45
2020-02-20 19:59:10 +09:00
Hyundo Moon
0fa60e880b Add MediaRoute2ProviderService#notifyRequestFailed
Bug: 146616547
Test: atest mediaroutertest and CTS
Change-Id: I2b2b95bf0fec070ab24f51bba0c58221e5495460
2020-02-20 17:33:22 +09:00
TreeHugger Robot
7b9eaf2f78 Merge "Tuner Java API: minor changes per API review feedback" 2020-02-19 04:51:07 +00:00
Kyunglyul Hyun
96e4893dbe Merge "MediaRouter2: Clean up APIs" 2020-02-18 02:18:14 +00:00
shubang
c090b6db71 Tuner Java API: minor changes per API review feedback
The feedback is b/149341923

Bug: 149341923
Test: make;
Change-Id: I54f98b2531c73f341ff49d29878e6e30d9d4b105
2020-02-17 16:29:45 -08:00
Ivan Chiang
f5dd8c7faa Merge "Fix isDocumentMimeType issue in MediaFile" 2020-02-17 12:34:08 +00:00
Kyunglyul Hyun
c24317d85e MediaRouter: fix manager test bug
There was a bug that waitAndGetRoutesWithManager returnes
a wrong list of routes that doesn't match the given features.

Test: atest mediaroutertest
Change-Id: Ibd01ba9d20fd5fa922d268998e10b497a88a3b45
2020-02-17 18:11:17 +09:00
Kyunglyul Hyun
3729e9f910 MediaRouter2: Clean up APIs
Rename APIS related to RoutingController.
Specifically,
- requestCreateController is changed to transferTo, which is the only
way to "transfer" that may or may not create a controller.
- ControllerCallback is split into TransferCallback and
(new) ControllerCallback.
- onControllerCreated and onControllerReleased is merged into
onTransferred(old, new)

Rename APIS related to RoutingController.

Bug: 149185558
Test: atest android.media.cts.MediaRoute2InfoTest
  && atest android.media.cts.MediaRouter2Test
  && atest android.media.cts.RouteDiscoveryPreferenceTest
  && atest android.media.cts.RoutingSessionInfoTest
  && atest android.media.cts.MediaRoute2ProviderServiceTest
  && atest mediaroutertest

Change-Id: I348581be7c0b8537da22da3bc81e2ca31e16203f
2020-02-17 16:56:01 +09:00
Kyunglyul Hyun
c943f212a5 MediaRouter2: Remove sendControlRequest
Unused sendControlRequest is removed.
According to that, MediaRouter2ManagerTest is a little bit
modified.

Bug: 145487522
Test: atest cts realted to media router 2
Change-Id: I3c2c5d1c2c67a3398a45bb2fab4e90dcf90f627e
2020-02-17 14:02:48 +09:00
Ivan Chiang
9d0bd71ea9 Fix isDocumentMimeType issue in MediaFile
Bug: 149077289
Test: atest MediaFileTest
Change-Id: I541c32d7e44b852999dd1aefa531e7cd88978bc9
2020-02-17 10:42:59 +08:00
Kyunglyul Hyun
6e0c08b396 MediaRouter2: s/transferrable/transferable/g
It was s/[tT]ransferrable/$1ransferable/g though.

Bug: 149534504
Test: build & atest mr2 related tests
Change-Id: I7b6cbb51993a5f1673e39f590d65e057d9474315
2020-02-14 15:44:18 +09:00
Hyundo Moon
71416f5af6 Merge "Rename MediaRouterManagerTest to MediaRouter2ManagerTest" 2020-02-14 04:37:32 +00:00