Fix occasional crash in VirtualDeviceManagerService
If a VirtualDevice is closed very soon after an Activity is displayed on one of its VirtualDisplays, we can get a crash in VirtualDeviceManagerService because a late call to notifyRunningAppsChanged just after the close both leaves mVirtualDevices and mAppsOnVirtualDevices out of sync about whether the device still exists, and also dispatches the onAppsOnVirtualDeviceChanged to listeners via the LocalService where listeners may try and get the device that's already been removed. This problem happens occasionally when running CTS tests where we are often tearing down a VirtualDevice at the end of a test just after starting an Activity and verifying something, but is likely rare in regular device usage. Bug: 265825399 Test: atest VirtualDeviceManagerServiceTest Change-Id: I11f3d85a9ed81a57cebd561bd0ba3c28d75f520b
Loading
Please register or sign in to comment