Bug 811635 - Part 5: Start wpa_supplicant with proper 'p2pSupported' flag. r=vchang

This commit is contained in:
Henry Chang 2013-12-19 12:12:39 +08:00
parent e206b964d5
commit 11c0c5f59c

View File

@ -5,6 +5,7 @@
#include "WifiUtils.h"
#include <dlfcn.h>
#include <errno.h>
#include <cutils/properties.h>
#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")) {