Skip to content
Commit 11ec828e authored by Sergey Nikolaienkov's avatar Sergey Nikolaienkov
Browse files

Make IOnAssociationsChangedListener.onAssociationsChanged() blocking

Make IOnAssociationsChangedListener.onAssociationsChanged() blocking
(not "oneway") to make sure that the clients of the
addOnAssociationsChangedListener() API (@SystemAPI guarded by a
"signature" permission) are able to prevent race conditions that may
arise if their own clients (applications) effectively get notified
about the changes before system services do.

This is safe for 2 reasons:
1. The addOnAssociationsChangedListener() API is only available to the
   system components (guarded by a "signature" permission).
   See android.permission.MANAGE_COMPANION_DEVICES.
2. On the Java side addOnAssociationsChangedListener() in CDM takes an
   Executor, and the proxy implementation of onAssociationsChanged()
   simply "posts" a job to it.
   See CompanionDeviceManager.OnAssociationsChangedListenerProxy class.

Bug: 214016641
Test: atest --iterations 10 CtsCompanionDeviceManagerCoreTestCases:AssociationsChangedListenerTest
Test: atest CtsCompanionDeviceManagerCoreTestCases
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases
Test: atest CtsOsTestCases:CompanionDeviceManagerTest
Change-Id: I7c664e9b9c848f8f0291ff46a56ff47bae7db346
parent bac69433
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment