summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author yinxu <yinxu@google.com> 2018-03-12 14:07:49 -0700
committer yinxu <yinxu@google.com> 2018-03-12 14:07:49 -0700
commitdb18cdae661b87ff2de3847947906da735f8d5eb (patch)
treecb620be2d8f8ffb3e55dad237b4b3b353245afa7
parentec174b28c40f21a4a3bb99b8785fa3022db74335 (diff)
Fix a bug when calling onError(int)
The lambda expression is executed on executor, so it is possible that the message has been updated. The correct way is to fetch the message.arg1 and use that value in the lamda expression. Bug:73750871 Test: Unit Test Change-Id: Id13f5fabf7eaad6970ab66a83a17aba7f1eebfce
-rw-r--r--telephony/java/android/telephony/TelephonyScanManager.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java
index 946cecfa261c..99e2db883e52 100644
--- a/telephony/java/android/telephony/TelephonyScanManager.java
+++ b/telephony/java/android/telephony/TelephonyScanManager.java
@@ -145,7 +145,8 @@ public final class TelephonyScanManager {
break;
case CALLBACK_SCAN_ERROR:
try {
- executor.execute(() -> callback.onError(message.arg1));
+ final int errorCode = message.arg1;
+ executor.execute(() -> callback.onError(errorCode));
} catch (Exception e) {
Rlog.e(TAG, "Exception in networkscan callback onError", e);
}