diff --git a/dom/wifi/WifiUtils.cpp b/dom/wifi/WifiUtils.cpp index 283aecb1a8ad..539a81dbe96f 100644 --- a/dom/wifi/WifiUtils.cpp +++ b/dom/wifi/WifiUtils.cpp @@ -5,6 +5,7 @@ #include "WifiUtils.h" #include #include +#include #include "prinit.h" #include "js/CharacterEncoding.h" #include "NetUtils.h" @@ -34,6 +35,14 @@ GetSharedLibrary() return sWifiLib; } +static bool +GetWifiP2pSupported() +{ + char propP2pSupported[PROPERTY_VALUE_MAX]; + property_get("ro.moz.wifi.p2p_supported", propP2pSupported, "0"); + return (0 == strcmp(propP2pSupported, "1")); +} + // This is the same algorithm as in InflateUTF8StringToBuffer with Copy and // while ignoring invalids. // https://mxr.mozilla.org/mozilla-central/source/js/src/vm/CharacterEncoding.cpp#231 @@ -276,7 +285,7 @@ bool WpaSupplicant::ExecuteCommand(CommandOptions aOptions, } else if (aOptions.mCmd.EqualsLiteral("unload_driver")) { aResult.mStatus = mImpl->do_wifi_unload_driver(); } else if (aOptions.mCmd.EqualsLiteral("start_supplicant")) { - aResult.mStatus = mImpl->do_wifi_start_supplicant(0); + aResult.mStatus = mImpl->do_wifi_start_supplicant(GetWifiP2pSupported() ? 1 : 0); } else if (aOptions.mCmd.EqualsLiteral("stop_supplicant")) { aResult.mStatus = mImpl->do_wifi_stop_supplicant(); } else if (aOptions.mCmd.EqualsLiteral("connect_to_supplicant")) {