Commit Graph

174 Commits

Author SHA1 Message Date
TreeHugger Robot
0f44e20e0b Merge "Add VDM.createVirtualDisplay" 2021-12-20 19:30:42 +00:00
Maurice Lam
24219576af Add VDM.createVirtualDisplay
Add the association ID parameter in VDM, and use that to generate the
label for the virtual display name. The association ID check is
currently commented out because the API for companion apps to get the
association ID from CDM is not submitted yet.

Bug: 194949534
Test: Manual
CTS-Coverage-Bug: 204606917
Change-Id: I4d1207fc57a59c8d5b00cc200d507685e7e7a702
2021-12-16 13:51:43 -08:00
Bernardo Rufino
3d10fb4b83 Merge "Migrate unsafe parcel APIs in framework-minus-apex" 2021-12-15 19:15:58 +00:00
Bernardo Rufino
90bb3709dc Migrate unsafe parcel APIs in framework-minus-apex
Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Test: TH passes
Change-Id: I11a27b9bdab7959ee86e90aa1e1cbebd7aaf883c
2021-12-15 18:21:38 +00:00
Sergey Nikolaienkov
9a2b8a1607 Update CMD association flow.
Adapt CDM Association flow for new associate() API, which supports
self-managed associations.
Add support for new device profiles: APP_STREAMING and
AUTOMOTIVE_PROJECTION.
Start CDM discovery service only after UI is visible.
Lift "one request at a time" limitation (remove
AssociationRequestsProcessor.mRequest field).

Bug: 194301022
Bug: 208307075
Test: atest CtsCompanionDevicesTestCases:AssociateTest
Test: atest CtsCompanionDevicesTestCases:AssociateSelfManagedTest
Test: atest CtsCompanionDevicesTestCases
Change-Id: I6cb796c375421f101e87ad436111996495eb74d9
2021-12-14 14:25:18 +01:00
Christine Franks
c74e2e0ee7 Merge "Remote input interfaces, events, and injection" 2021-12-10 23:38:02 +00:00
Evan Chen
8e06c9bd06 Merge "Add @TestApi onBindCompanionDeviceService()" 2021-12-10 23:33:05 +00:00
Evan Chen
4698bcf084 Companion App Manages Connectivity State Interfaces
Created two new APIs in CompanionDeviceManager:
notifyDeviceAppeared and notifyDeviceDisappeared for
companion apps report connectivity.

Create a new callback method for user to override when
device is connected and disconnected

Bug: 199435613
Test: atest CtsCompanionDevicesTestCases

Change-Id: I6884d085cf810fdd42466d620e888b07367c9b94
2021-12-10 20:18:19 +00:00
Christine Franks
c4cf03b162 Remote input interfaces, events, and injection
Bug: 204081582
CTS-Coverage-Bug: 208247880
Test: atest FrameworksServicesTests:VirtualDeviceManagerServiceTest
and atest FrameworksCoreTests:android.hardware.input

Change-Id: Ic10e62b0d95d563aed59ed9bb8caba6d506176b7
2021-12-10 10:17:31 -08:00
Sergey Nikolaienkov
468648bf93 Add @TestApi onBindCompanionDeviceService()
Add onBindCompanionDeviceService() method to CompanionDeviceService,
which is invoked from onBind(). This allows to track the state of
incoming Binder connection in CTS tests, which was not possible before,
since onBind() method in CompanionDeviceService is final.

Bug: 199435613
Test: atest CtsCompanionDevicesTestCases:SelfPresenceReportingTest
Test: atest CtsCompanionDevicesTestCases
Change-Id: I37cd3be15ed41b466ef9c6cead781299fd82356e
2021-12-09 09:11:20 +01:00
TreeHugger Robot
af3c874edb Merge "Add Sergey as CDM owner" 2021-12-08 09:09:25 +00:00
Evan Chen
c024a8fbb2 Add Sergey as CDM owner
Fix: 209615419
Test: make
Ignore-AOSP-First: Add ownership internally
Change-Id: I706b9a55b9c3516804c57234977059c6a29da983
2021-12-07 17:34:46 +00:00
Maurice Lam
927893a700 Add association ID parameter to createVirtualDevice
Bug: 194949534
Test: Manual, CTS to be added in b/204606917
Change-Id: I10327e650e87e0e1fa75c61082a8e4f0364031c1
2021-12-06 11:24:45 -08:00
Sergey Nikolaienkov
663df81619 Add public getters to AssociationRequest
Bug: 207638232
Bug: 208422682
Test: make
Test: atest CtsCompanionDevicesTestCases:AssociationRequestBuilderTest
Test: atest CtsCompanionDevicesTestCases
Change-Id: I08db7413ab9c622402ca1bce32c8b1eb5a9cc81e
2021-12-02 09:44:56 +00:00
Sergey Nikolaienkov
f0bf40dcb8 Make MAC address String in AssociationInfo upper-case
Bug: 208363320
Test: atest CtsCompanionDevicesTestCases
Change-Id: I75ada431abedec6aad572fec1c0e121ff238a134
2021-11-30 09:05:40 +01:00
Sergey Nikolaienkov
74a54c9fce Refresh CompanionDeviceManager's API surface
Make the AssociationInfo and DeviceId classes public.

Deprecate the existing public associate() method that take a callback
based on onDeviceFound(), and introduce a new one that takes an
AssociationRequestCallback.

Deprecate the existing public disassociate() method that takes a MAC
address, and introduce another one that takes an associationId.

Deprecate the existing public getAssociations() method that returns a
list of MAC addresses, and introduce a new public method
getMyAssociations() that retuns a list of AssociationInfo objects.

Introduce new system API to retrieve list of all associations for a
user: getAllAssociations().

Introduce new system APIs for monitoring changes to the existing
associations: OnAssociationsChangedListener interface, and
add(remove)OnAssociationsChangedListener() methods.

Bug: 194301022
Test: atest CompanionDeviceManagerTest
Test: atest BluetoothInstrumentationTests
Test: atest SettingsRoboTests:NotificationBackendTest
Change-Id: Ic0235db29b26ed1a427c71edb2eb0df76fa4dc4c
2021-11-24 14:48:29 +01:00
Sergey Nikolaienkov
3c8b0b82de Add explicit MAC address and display name fields
Replace List<List>mDeviceIds field in AssociationInfo with explicit
MacAddress mDeviceMacAddress and CharSequence mDeviceDisplayName fields.

Bug: 194301022
Test: atest CompanionDeviceManagerTest
Test: atest FrameworksUiServicesTests:NotificationManagerServiceTest
Change-Id: Ie8ae1c1154d3b53b1df8d612f116b514c99dc95c
2021-11-23 17:43:19 +01:00
TreeHugger Robot
5d39efecbd Merge "Create DEVICE_PROFILE_AUTOMOTIVE_PROJECTION" 2021-11-10 21:55:57 +00:00
Evan Chen
f674c23d03 Create DEVICE_PROFILE_AUTOMOTIVE_PROJECTION
Create DEVICE_PROFILE_AUTOMOTIVE_PROJECTION profile and
corresponding REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION
permission with protection_level: "internal|role"
Also add a logic that to skip the prompt if the role is not held
by system.

Test: make
bug: 203459457
Change-Id: I2644f7ed079b0e272f0cc8f4d6e580de49c59064
2021-11-10 19:06:27 +00:00
Guojing Yuan
a89c648752 Merge "Fix CDM memory leak for activity context" into sc-v2-dev am: 6ebf85244c am: 8e2c2f1b3f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16201030

Change-Id: Ia9d2edd4be1cdac0247649a95261ba2f063df7e8
2021-11-08 19:49:03 +00:00
Guojing Yuan
8e2c2f1b3f Merge "Fix CDM memory leak for activity context" into sc-v2-dev am: 6ebf85244c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16201030

Change-Id: I014c3c708a8fd6a88445a87492efd6111e75d1e3
2021-11-08 19:20:48 +00:00
Guojing Yuan
f0a3736644 Fix CDM memory leak for activity context
Fix: 195968760

Test: N/A
Change-Id: Ibbba40a64cd20ecc11e287c2bfd3afdb179a7a52
2021-11-05 20:09:22 +00:00
Evan Chen
0a76831174 Merge "Make sure sendresult after association was created" into sc-v2-dev am: e1211c6726
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16132112

Change-Id: I57376842363715ca36596d814a06f28acc8e9b54
2021-11-01 20:52:57 +00:00
Evan Chen
404168a4f0 Make sure sendresult after association was created
Add a new method to send activity result in
CompanionDeviceDiscoveryService and make sure
CDMService to call it before addAssociation.

Bug: 203418937
Test: Test: CTS Verifier test: Companion Device Service Test, Companion Device
Test and cts test: atest CtsOsTestCases:android.os.cts.CompanionDeviceManagerTest
Change-Id: Ied7d705934418869287a8be6cd44abe3b806db00
Merged-In: Ied7d705934418869287a8be6cd44abe3b806db00
2021-11-01 19:22:58 +00:00
Evan Chen
3c6f68dc70 Merge "Make sure sendresult after association was created" 2021-11-01 16:12:01 +00:00
Evan Chen
4e5370409d Make sure sendresult after association was created
Add a new method to send activity result in
CompanionDeviceDiscoveryService and make sure
CDMService to call it before addAssociation.

Bug: 203418937
Test: atest CtsOsTestCases:android.os.cts.CompanionDeviceManagerTest
Change-Id: Ied7d705934418869287a8be6cd44abe3b806db00
2021-10-28 17:17:02 +00:00
TreeHugger Robot
9585133077 Merge "Rename CDM's Association class AssociationInfo" 2021-10-27 21:18:22 +00:00
Sergey Nikolaienkov
c0ab6713d1 Rename CDM's Association class AssociationInfo
First step in making the Association(Info) class a part of the public
API surface.

Bug: 194301022
Test: make
Change-Id: Ib1544ef7da471ae9fee1b9a9fabb01653454e277
2021-10-27 08:56:48 +02:00
Maurice Lam
771c72a607 Create VirtualDeviceManager
CTS-Coverage-Bug: 194949534
Bug: 194949534
Test: ag/15781910
Change-Id: I06d245d91827390de99b9ff3e514af4294a11476
2021-10-26 20:41:00 -07:00
Sergey Nikolaienkov
c6cc9a7662 Merge "Annotate DEVICE_PROFILE_APP_STREAMING with @RequiresPermission" 2021-10-21 21:03:47 +00:00
Sergey Nikolaienkov
1723617188 Give CDM Associations real IDs
Generate unique IDs for Association records. Whenever a new ID is update
and persist first available ID to the disk.

Bug: 197933995
Test: make, flash
Test: atest android.os.cts.CompanionDeviceManagerTest
Change-Id: I127d219d08e4b8f1e8e0e6b434b063512a502565
2021-10-21 11:42:28 +02:00
Sergey Nikolaienkov
c540bea644 Implement extensible device ID in CDM
Introduce android.companion.DeviceId class.
Refactor Association class to store the list of DeviceId objects instead
of a single MAC address String.
Fix CDMService to work with the updated Association class.

Bug: 197933995
Test: make
Change-Id: I43ce12178d6ccdcfd9832bf2a78d00acae431f94
2021-10-21 09:22:37 +02:00
Sergey Nikolaienkov
733c434789 Annotate DEVICE_PROFILE_APP_STREAMING with @RequiresPermission
Bug: 202245486
Test: make
Change-Id: I098f548792347c1afb8e0e91c978bd0ed1143efa
2021-10-20 09:49:27 +02:00
Sergey Nikolaienkov
97d4a5a32c Merge "Introduce DEVICE_PROFILE_APP_STREAMING" 2021-10-19 17:23:49 +00:00
Treehugger Robot
71d1f6b377 Merge "Removed Bluetooh ScanFilter hidden API usage." am: fdc344e6b6 am: c6c95a9eac am: d352c35c43 am: 18f8336084 am: 1c281a84f7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1845060

Change-Id: I49dbcd98de47f015c0004183fe1e5dc50307aa88
2021-10-19 15:56:28 +00:00
Treehugger Robot
fdc344e6b6 Merge "Removed Bluetooh ScanFilter hidden API usage." 2021-10-19 14:41:30 +00:00
Sergey Nikolaienkov
269cb1d724 Introduce DEVICE_PROFILE_APP_STREAMING
Introducing DEVICE_PROFILE_APP_STREAMING to CDM and a  corresponding
signature|privileged permission -
REQUEST_COMPANION_PROFILE_APP_STREAMING.

Bug: 202245486
Test: make
Change-Id: I6116662ba2bb97d8e88a5df1cba3ff47a8b9c6c7
2021-10-18 19:01:55 +00:00
Etienne Ruffieux
9aeb446826 Removed Bluetooh ScanFilter hidden API usage.
Replaced hidden API usage in Companion by public
methods.

Tag: #feature
Bug: 200202917
Test: atest CompanionTests
Change-Id: Ifc7cdcbf40e23d1c8870e4dcd44772dcae55120a
2021-10-07 14:55:27 +00:00
Guojing Yuan
2c32e79586 Rename CDM receiveMessage to dispatchMessage
Fix: 200940347

Test: N/A
Change-Id: Iea73ff7a2820f8b7711e105fc604a2e0b8901fc7
2021-09-27 22:56:45 +00:00
TreeHugger Robot
b9705468d0 Merge "Add CDM data transfer interfaces" 2021-09-22 23:13:18 +00:00
Guojing Yuan
6aea80689d Add CDM data transfer interfaces
Design: go/cdm-data-transfer-dd

Fix: 198485833

Test: N/A
Change-Id: I37fd8b84ceea671e76332042761d3f99f7090b98
2021-09-22 19:45:13 +00:00
Sergey Nikolaienkov
d183299d75 Do not create Associtions in CompanionDeviceDiscoveryService
Since and T Associations objects will have the ID feilds. These IDs
must be unique, and will be assigned by the CdmService. To make this
possible all new Associations objects (records) should be created by the
CdmService. At the moment, however, CompanionDeviceDiscoveryService also
creates Associations objects.
Change ICompanionDeviceDiscoveryService interface, so that when it
discovers a device reports back to the CdmService only the mac address
of the device, instead of a fully constructed Association object.
CdmService will take the address and creates an Association itself.

Bug: 197933995
Test: make
Change-Id: I4af928a7bc1c690bc7c3c7c50ec896884e10e3bd
2021-09-10 11:59:18 +00:00
Sergey Nikolaienkov
451502fa0a Move off the deprecated Settings in CDM
Do not use Settings.Secure.ENABLED_NOTIFICATION_LISTENERS in
CompanionDeviceManager.

Deprecate CompanionDeviceManager(Service).hasNotificationAccess()
methods.

Bug: 198562936
Test: make
Change-Id: I6924edee1b8d0b7409ce62349717017d1a52c610
2021-09-02 08:21:01 +00:00
TreeHugger Robot
f3fe4c2acc Merge "Change Owner" into sc-dev am: 5629eccbbc am: 73579f4d19
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15027119

Change-Id: I47b6a50f75ad7ef75ced3d0100ac3336f9160f81
2021-06-24 18:21:58 +00:00
Evan Chen
08c4c64157 Change Owner
Change Owner from Eugene to the people who are currently working
with CDM.
Better to change the owner file under sc-dev first since there's
no owner file in AOSP.
Source of truth: /core/java/android/companion/OWNERS
Fix: 191984480
Change-Id: I737246128ca25e5efe2bdf59361a83cd6dc54c6b
2021-06-24 17:48:40 +00:00
TreeHugger Robot
0a1762022f Merge "Update associate API by adding certificate param" into sc-dev am: 06cd94a6de am: 9e7f3ba32a am: 6a290ccf9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14686826

Change-Id: I27cb2f5a9107fb36420778fd2ab7ee6283d4857b
2021-05-24 21:54:25 +00:00
Guojing Yuan
cc4ffc849b Update associate API by adding certificate param
Fix: 184264581

Test: N/A
Change-Id: Ie28a2e68826744c0f020113d1b85b5a4b2d54c7f
2021-05-24 18:04:27 +00:00
Evan Chen
ad6ef1c7aa Merge "Allow skipping CDM dialog for same-oem" into sc-dev 2021-05-21 00:29:50 +00:00
Evan Chen
3da90a86a8 Merge "Allow skipping CDM dialog for same-oem" 2021-05-20 22:23:15 +00:00
Eugene Susla
8f935b73c3 Allow skipping CDM dialog for same-oem
Used SHA256 from ADK to make the determination

Test: Manual
Bug: 165951651
Change-Id: I5ed42d1e67d5abaaaf24989b54dd8e95f04621e9
Merged-In: I5ed42d1e67d5abaaaf24989b54dd8e95f04621e9
2021-05-20 22:22:54 +00:00