Remove stale connections to DataLoaders.

Bug: 263449831
Fixes: 263449831
Test: atest service.incremental_test
Change-Id: Ia3da6ca047c46807cbd72ef797bb4b300c38efb3
This commit is contained in:
Alex Buynytskyy
2023-02-08 21:24:01 -08:00
parent da5de14a55
commit 96cac56f51

View File

@@ -2816,6 +2816,12 @@ bool IncrementalService::DataLoaderStub::fsmStep() {
binder::Status IncrementalService::DataLoaderStub::onStatusChanged(MountId mountId, int newStatus) {
if (!isValid()) {
if (newStatus == IDataLoaderStatusListener::DATA_LOADER_BOUND) {
// Async "bound" came to already destroyed stub.
// Unbind immediately to avoid invalid stub sitting around in DataLoaderManagerService.
mService.mDataLoaderManager->unbindFromDataLoader(mountId);
return binder::Status::ok();
}
return binder::Status::
fromServiceSpecificError(-EINVAL, "onStatusChange came to invalid DataLoaderStub");
}