summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinhe <xinhe@google.com>2015-08-05 15:17:22 -0700
committerxinhe <xinhe@google.com>2015-08-05 15:17:22 -0700
commit9dc6bda43f0767a1ecb3f901d9be0f523e9463f1 (patch)
tree68208bfb27666f895e8a5ca1f70914d3e7d6759e
parent0cc09187b578a328f945cd58f0c030c4b713d37e (diff)
parentee0a0132ebb0d7e9baf42e778ea9c094966ffb14 (diff)
downloadandroid_frameworks_opt_net_wifi-9dc6bda43f0767a1ecb3f901d9be0f523e9463f1.tar.gz
android_frameworks_opt_net_wifi-9dc6bda43f0767a1ecb3f901d9be0f523e9463f1.tar.bz2
android_frameworks_opt_net_wifi-9dc6bda43f0767a1ecb3f901d9be0f523e9463f1.zip
resolved conflicts for merge of ee0a0132 to mnc-dr-dev
Change-Id: I61046edb56b9b54a759e4964762fa7b01d4eaba1
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java16
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java15
-rw-r--r--service/jni/com_android_server_wifi_WifiNative.cpp10
3 files changed, 34 insertions, 7 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index e952d8ddc..d762f4727 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1903,10 +1903,24 @@ public class WifiNative {
synchronized public static int [] getChannelsForBand(int band) {
synchronized (mLock) {
- return getChannelsForBandNative(sWlan0Index, band);
+ if (isHalStarted()) {
+ return getChannelsForBandNative(sWlan0Index, band);
+ } else {
+ return null;
+ }
}
}
+ private static native boolean isGetChannelsForBandSupportedNative();
+ synchronized public static boolean isGetChannelsForBandSupported(){
+ synchronized (mLock) {
+ if (isHalStarted()) {
+ return isGetChannelsForBandSupportedNative();
+ } else {
+ return false;
+ }
+ }
+ }
private static native boolean setDfsFlagNative(int iface, boolean dfsOn);
synchronized public static boolean setDfsFlag(boolean dfsOn) {
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 44968f893..aa1750c52 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -5279,14 +5279,21 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
if (config.apChannel == 0) {
config.apChannel = chooseApChannel(config.apBand);
if (config.apChannel == 0) {
- //fail to get available channel
- sendMessage(CMD_START_AP_FAILURE, WifiManager.SAP_START_FAILURE_NO_CHANNEL);
- return;
+ if(mWifiNative.isGetChannelsForBandSupported()) {
+ //fail to get available channel
+ sendMessage(CMD_START_AP_FAILURE, WifiManager.SAP_START_FAILURE_NO_CHANNEL);
+ return;
+ } else {
+ //for some old device, wifiHal may not be supportedget valid channels are not
+ //supported
+ config.apBand = 0;
+ config.apChannel = 6;
+ }
}
}
} else {
//for some old device, wifiHal may not be supported
- config.apChannel = 0;
+ config.apBand = 0;
config.apChannel = 6;
}
// Start hostapd on a separate thread
diff --git a/service/jni/com_android_server_wifi_WifiNative.cpp b/service/jni/com_android_server_wifi_WifiNative.cpp
index 567eac2c6..92bd3cd77 100644
--- a/service/jni/com_android_server_wifi_WifiNative.cpp
+++ b/service/jni/com_android_server_wifi_WifiNative.cpp
@@ -1363,6 +1363,10 @@ static jboolean android_net_wifi_setScanningMacOui(JNIEnv *env, jclass cls,
return hal_fn.wifi_set_scanning_mac_oui(handle, (byte *)bytes) == WIFI_SUCCESS;
}
+static jboolean android_net_wifi_is_get_channels_for_band_supported(JNIEnv *env, jclass cls){
+ return (hal_fn.wifi_get_valid_channels == wifi_get_valid_channels_stub);
+}
+
static jintArray android_net_wifi_getValidChannels(JNIEnv *env, jclass cls,
jint iface, jint band) {
@@ -2270,7 +2274,7 @@ static JNINativeMethod gWifiMethods[] = {
{ "setBssidBlacklistNative", "(II[Ljava/lang/String;)Z",
(void*)android_net_wifi_setBssidBlacklist},
{ "setSsidWhitelistNative", "(II[Ljava/lang/String;)Z",
- (void*)android_net_wifi_setSsidWhitelist},
+ (void*)android_net_wifi_setSsidWhitelist},
{"setLoggingEventHandlerNative", "(II)Z", (void *) android_net_wifi_set_log_handler},
{"resetLogHandlerNative", "(II)Z", (void *) android_net_wifi_reset_log_handler},
{ "startSendingOffloadedPacketNative", "(II[B[B[BI)I",
@@ -2280,7 +2284,9 @@ static JNINativeMethod gWifiMethods[] = {
{"startRssiMonitoringNative", "(IIBB)I",
(void*)android_net_wifi_start_rssi_monitoring_native},
{"stopRssiMonitoringNative", "(II)I",
- (void*)android_net_wifi_stop_rssi_monitoring_native}
+ (void*)android_net_wifi_stop_rssi_monitoring_native},
+ {"isGetChannelsForBandSupportedNative", "()Z",
+ (void*)android_net_wifi_is_get_channels_for_band_supported}
};
int register_android_net_wifi_WifiNative(JNIEnv* env) {