Fix race condition between VDM and ProxyManager when registering a proxy
Exo may register a proxy before VDM begins tracking the streamed,
but after this app's AccessibilityManagerClient is created in AMS.
This race conditions means the app is not notified that
it is proxied, since VDM#getDevicesForUid will not return the proxy
device id when called.
Add a AppsOnVirtualDeviceListener to the ProxyManager. If the running
apps are changed on any virtual device, force notifying the apps if
any of these belong to a proxied device. We add `forceUpdate` since the
last and current client state may be the same (no proxy connections
have changed) in this case.
Also move any apps that are no longer proxied back to the default device
if needed when updating the client device ids, since Exo will use the
same device and launch activities on the same display. (We were
previously resetting clients only when a device id
had no registered proxies, but Exo should be able to keep the proxy
registered)
Bug: 286587811
Test: manual with Exo, atest ProxyManagerTest, atest
AccessibilityDisplayProxyTest
Change-Id: I1a1b600c9e71d7baf1f9647475ac63580f7f01c2
4 files changed