From 6f80049a4180591edff71369fd49053f7e457d35 Mon Sep 17 00:00:00 2001 From: Glen Kuhne Date: Fri, 12 May 2017 18:20:15 -0700 Subject: [PATCH] P2P: update WifiP2pServiceResponse creator WifiP2pServiceResponse.newInstance now receives the srcAddr and tlvs binary data directory directly from the hal iface callback. This fixes a bug introduced in O that broke serviceDiscoveryRequests. Bug: 38174469 Test: CtsVerifier Service Discovery Requester Test: frameworks/opt/net/wifi unit test Change-Id: I66739713292a19ec399358a1033fccb35e76b9cf --- .../wifi/p2p/nsd/WifiP2pServiceResponse.java | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java index a0b5a6e6bad93..1020fd2cd5077 100644 --- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java +++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java @@ -186,31 +186,23 @@ public class WifiP2pServiceResponse implements Parcelable { /** * Create the list of WifiP2pServiceResponse instance from supplicant event. * - *
The format is as follows.
-     * P2P-SERV-DISC-RESP <address> <update indicator> <response data>
-     * e.g) P2P-SERV-DISC-RESP 02:03:7f:11:62:da 1 0300000101
-     *
-     * @param supplicantEvent wpa_supplicant event string.
+     * @param srcAddr source address of the service response
+     * @param tlvsBin byte array containing the binary tlvs data
      * @return if parse failed, return null
      * @hide
      */
-    public static List newInstance(String supplicantEvent) {
+    public static List newInstance(String srcAddr, byte[] tlvsBin) {
+        //updateIndicator not used, and not passed up from supplicant
 
         List respList = new ArrayList();
-        String[] args = supplicantEvent.split(" ");
-        if (args.length != 4) {
-            return null;
-        }
         WifiP2pDevice dev = new WifiP2pDevice();
-        String srcAddr = args[1];
         dev.deviceAddress = srcAddr;
-        //String updateIndicator = args[2];//not used.
-        byte[] bin = hexStr2Bin(args[3]);
-        if (bin == null) {
+        if (tlvsBin == null) {
             return null;
         }
 
-        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bin));
+
+        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(tlvsBin));
         try {
             while (dis.available() > 0) {
                 /*