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

We use 'ro.moz.wifi.p2p_supported' to determine if p2p is supported.
This commit is contained in:
Henry Chang 2013-10-29 16:42:37 +08:00
Родитель 8ba8195b75
Коммит 200b1f45f3
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -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")) {