Ensure that ScanInfo is cached before callbacks fire
Fixes a regression that was introduced in aosp/1312940. There is a critical section in requestNetworkScan after the scanId has been generated and before the ScanInfo is added to the cache. If during this time a callback fires on a separate thread, it will not yet find the ScanInfo record, and due to strict checking, this causes a RuntimeException. This CL re-expands the synchronized block to cover the critical section, and clarifies a little bounds checking. Note: this change is not ideal. This means that all callbacks for all scans will be blocked while a request for a new scan is being made, which was the motivation behind the change that introduced this regression. But, a narrow performance hit is better than a crash, and it's not worth the complexity of a bigger fix. Bug: 200634560 Test: compilation Change-Id: I4670da109256170121ceb6d8fbad0efda310335f
Loading
Please register or sign in to comment