Fix race conditions in HubEndpoint
The current logic is error-prone because it's possible that mServiceToken becomes null between null checks and calling the interface. Instead, this CL modfiies the logic such that mServiceToken is never nullified, and we rely on the service implementation's error handling (IllegalStateException, as noted in the javadocs). For callbacks, it's always possible to hit this race condition if we were still handling a previously invoked callback before the endpoint was unregistered, in which case we log a warning. Bug: 378974199 Flag: android.chre.flags.offload_implementation Test: Tests pass Change-Id: Ic2c9eeb1684caddacbcdfb4bdc431afa5b663c36
Loading
Please register or sign in to comment