Return with error logs instead of exception for unexpected nsi

The network scan info will be removed when the scan is stopped
or cancelled. In this case, race condition would happen if ril
returns the scan result at the same time.

Bug: 277162146
Test: make
Test: atest CtsTelephonyTestCases FrameworksTelephonyTests
Change-Id: I1fc42a10ea17baa5a020164d2d8eb425e9b97029
This commit is contained in:
Hui Wang
2023-04-17 20:41:31 +00:00
parent 39760864b8
commit b535b50eaf

View File

@@ -153,8 +153,9 @@ public final class TelephonyScanManager {
nsi = mScanInfo.get(message.arg2);
}
if (nsi == null) {
throw new RuntimeException(
"Failed to find NetworkScanInfo with id " + message.arg2);
Rlog.e(TAG, "Unexpceted message " + message.what
+ " as there is no NetworkScanInfo with id " + message.arg2);
return;
}
final NetworkScanCallback callback = nsi.mCallback;