summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorGlen Kuhne <kuh@google.com>2017-04-28 13:03:39 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-04-28 13:03:39 +0000
commitbcf40a0404cb6a490d7c1b30f1b2b1f10cea9569 (patch)
tree55e2eeca2656e9406e0a97691b3742a37753531c /service
parent2126bf5dda0f3fc55932a0558d959bed7f4ab7b8 (diff)
parentbb65f9709f0e32e0b592e547815538247cf6e169 (diff)
Merge "P2P: Modify loadGroups & fix NPE" into oc-dev
am: bb65f9709f Change-Id: I45933768aea19a5afcbfebe9df34cf7ff98ebcd9
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java46
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java1
2 files changed, 23 insertions, 24 deletions
diff --git a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
index fc63894b8..6f4543edb 100644
--- a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
+++ b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
@@ -1471,23 +1471,19 @@ public class SupplicantP2pIfaceHal {
* @return true, if operation was successful.
*/
public boolean startWpsPbc(String groupIfName, String bssid) {
- if (TextUtils.isEmpty(groupIfName)) return false;
+ if (TextUtils.isEmpty(groupIfName)) {
+ Log.e(TAG, "Group name required when requesting WPS PBC. Got (" + groupIfName + ")");
+ return false;
+ }
synchronized (mLock) {
if (!checkSupplicantP2pIfaceAndLogFailure("startWpsPbc")) return false;
- if (groupIfName == null) {
- Log.e(TAG, "Group name required when requesting WPS PBC.");
- return false;
- }
-
// Null values should be fine, since bssid can be empty.
byte[] macAddress = null;
- if (bssid != null) {
- try {
- macAddress = NativeUtil.macAddressToByteArray(bssid);
- } catch (Exception e) {
- Log.e(TAG, "Could not parse BSSID.", e);
- return false;
- }
+ try {
+ macAddress = NativeUtil.macAddressToByteArray(bssid);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not parse BSSID.", e);
+ return false;
}
SupplicantResult<Void> result = new SupplicantResult(
@@ -1556,13 +1552,11 @@ public class SupplicantP2pIfaceHal {
// Null values should be fine, since bssid can be empty.
byte[] macAddress = null;
- if (bssid != null) {
- try {
- macAddress = NativeUtil.macAddressToByteArray(bssid);
- } catch (Exception e) {
- Log.e(TAG, "Could not parse BSSID.", e);
- return null;
- }
+ try {
+ macAddress = NativeUtil.macAddressToByteArray(bssid);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not parse BSSID.", e);
+ return null;
}
SupplicantResult<String> result = new SupplicantResult(
@@ -1746,8 +1740,9 @@ public class SupplicantP2pIfaceHal {
}
/**
- * Populate list of available networks or update existing list.
+ * Get the persistent group list from wpa_supplicant's p2p mgmt interface
*
+ * @param groups WifiP2pGroupList to store persistent groups in
* @return true, if list has been modified.
*/
public boolean loadGroups(WifiP2pGroupList groups) {
@@ -1774,8 +1769,10 @@ public class SupplicantP2pIfaceHal {
Log.e(TAG, "ISupplicantP2pIface exception: " + e);
supplicantServiceDiedHandler();
}
- if (!resultIsCurrent.isSuccess() || !resultIsCurrent.getResult()) {
- Log.i(TAG, "Skipping non current network");
+ /** Skip the current network, if we're somehow getting networks from the p2p GO
+ interface, instead of p2p mgmt interface*/
+ if (!resultIsCurrent.isSuccess() || resultIsCurrent.getResult()) {
+ Log.i(TAG, "Skipping current network");
continue;
}
@@ -1796,7 +1793,8 @@ public class SupplicantP2pIfaceHal {
}
if (resultSsid.isSuccess() && resultSsid.getResult() != null
&& !resultSsid.getResult().isEmpty()) {
- group.setNetworkName(NativeUtil.encodeSsid(resultSsid.getResult()));
+ group.setNetworkName(NativeUtil.removeEnclosingQuotes(
+ NativeUtil.encodeSsid(resultSsid.getResult())));
}
SupplicantResult<byte[]> resultBssid =
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
index 0c7a91d1c..623a2f0c3 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -2364,6 +2364,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
pw.println("mWifiP2pInfo " + mWifiP2pInfo);
pw.println("mGroup " + mGroup);
pw.println("mSavedPeerConfig " + mSavedPeerConfig);
+ pw.println("mGroups" + mGroups);
pw.println();
}