summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2016-03-18 13:03:32 -0700
committerNingyuan Wang <nywang@google.com>2016-03-22 12:09:48 -0700
commitc6ccad1ec19b0a53266962237774422b156ea726 (patch)
treecebdfc2a1f455f4c9d2be945521ce61687a921a3
parent1cba41b5c3a5d96f3f10596afef6159caaff97e4 (diff)
Remove hardcoded 'p2p0' from WifiNative
WifiNative should get the p2p interface name from SystemProperties instead hard-coded name. BUG=27383938 TEST= cts & unit tests & manual test Change-Id: I25a4280ee14252d01e4582ced90c1b456e4babb2
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 04be72fd7..9b28a4f14 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -109,13 +109,14 @@ public class WifiNative {
* Singleton WifiNative instances
*/
private static WifiNative wlanNativeInterface =
- new WifiNative(SystemProperties.get("wifi.interface", "wlan0"));
+ new WifiNative(SystemProperties.get("wifi.interface", "wlan0"), true);
public static WifiNative getWlanNativeInterface() {
return wlanNativeInterface;
}
- //STOPSHIP: get interface name from native side
- private static WifiNative p2pNativeInterface = new WifiNative("p2p0");
+ private static WifiNative p2pNativeInterface =
+ // commands for p2p0 interface don't need prefix
+ new WifiNative(SystemProperties.get("wifi.direct.interface", "p2p0"), false);
public static WifiNative getP2pNativeInterface() {
return p2pNativeInterface;
}
@@ -134,14 +135,14 @@ public class WifiNative {
}
}
- private WifiNative(String interfaceName) {
+ private WifiNative(String interfaceName,
+ boolean requiresPrefix) {
mInterfaceName = interfaceName;
mTAG = "WifiNative-" + interfaceName;
- if (!interfaceName.equals("p2p0")) {
+ if (requiresPrefix) {
mInterfacePrefix = "IFNAME=" + interfaceName + " ";
} else {
- // commands for p2p0 interface don't need prefix
mInterfacePrefix = "";
}
}