[BUG]MTBF测试中出现WifiP2pService空指针异常

log

02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: WifiP2pService
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'void android.hardware.wifi.supplicant.V1_0.ISupplicant.listInterfaces(android.hardware.wifi.supplicant.V1_0.ISupplicant$listInterfacesCallback)' on a null object reference
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at com.android.server.wifi.p2p.SupplicantP2pIfaceHal.getIfaceV1_0(SupplicantP2pIfaceHal.java:456)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at com.android.server.wifi.p2p.SupplicantP2pIfaceHal.setupIface(SupplicantP2pIfaceHal.java:325)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at com.android.server.wifi.p2p.WifiP2pNative.setupInterface(WifiP2pNative.java:200)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at com.android.server.wifi.p2p.WifiP2pServiceImpl$P2pStateMachine$P2pDisabledState.processMessage(WifiP2pServiceImpl.java:1263)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:106)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:201)
02-14 07:53:16.494  1000  1415  1951 E AndroidRuntime:  at android.os.HandlerThread.run(HandlerThread.java:65)

解决方案

合入以下的patch

Subject: [PATCH] WIFI: fix WifiP2pService NullPointerException

NullPointerException happend in WifiP2pService.Add null pointer judgement to check if mISupplicent is null.
---

diff --git a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
index f551f10..8a0bb9c 100644
--- a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
+++ b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
@@ -451,6 +451,10 @@

     private ISupplicantIface getIfaceV1_0(@NonNull String ifaceName) {
         /** List all supplicant Ifaces */
+        if (mISupplicant == null) {
+            Log.e(TAG, "Got null ISupplicant service. Stopping supplicant HIDL startup");
+            return null;
+        }
         final ArrayList<ISupplicant.IfaceInfo> supplicantIfaces = new ArrayList();
         try {
             mISupplicant.listInterfaces((SupplicantStatus status,

剑气纵横三万里

“为什么要努力?” “想去的地方很远,想要的东西很贵,喜欢的人很优秀,父母的白发,朋友的约定,周围人的嘲笑,以及,天生傲骨。”

留下你的评论

*评论支持代码高亮<pre class="prettyprint linenums">代码</pre>

相关推荐

暂无内容!