From b535b50eaf0ee9ce06db3b422825b0e7002ad51e Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Mon, 17 Apr 2023 20:41:31 +0000 Subject: [PATCH] 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 --- telephony/java/android/telephony/TelephonyScanManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java index 19f2a9bc67a3f..b7617099bae35 100644 --- a/telephony/java/android/telephony/TelephonyScanManager.java +++ b/telephony/java/android/telephony/TelephonyScanManager.java @@ -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;