wifinative.java_怎么把WiFi热点设置为5GHZ

此更新修复了在5GHz频段配置SoftAp时,如果无法设置国家代码导致的错误。当设置失败且AP配置为5GHz时,会记录错误日志并返回通用错误。同时,如果获取5GHz频道不支持,代码会设定默认频道为153。
摘要由CSDN通过智能技术生成

diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java

index 2dfb754..3e60ede 100644

--- a/service/java/com/android/server/wifi/SoftApManager.java

+++ b/service/java/com/android/server/wifi/SoftApManager.java

@@ -137,12 +137,13 @@ public class SoftApManager {

* Country code is mandatory for 5GHz band, return an error if failed to set

* country code when AP is configured for 5GHz band.

*/

-            if (!mWifiNative.setCountryCodeHal(mCountryCode.toUpperCase(Locale.ROOT))

+

+            /*if (!mWifiNative.setCountryCodeHal(mCountryCode.toUpperCase(Locale.ROOT))

&& config.apBand == WifiConfiguration.AP_BAND_5GHZ) {

Log.e(TAG, "Failed to set country code, required for setting up "

+ "soft ap in 5GHz");

return ERROR_GENERIC;

-            }

+            }*/

}

try {

diff --git a/service/java/com/android/server/wifi/util/ApConfigUtil.java b/service/java/com/android/server/wifi/util/ApConfigUtil.java

index 7bbbc03..0e12f06 100644

--- a/service/java/com/android/server/wifi/util/ApConfigUtil.java

+++ b/service/java/com/android/server/wifi/util/ApConfigUtil.java

@@ -133,15 +133,14 @@ public class ApConfigUtil {

config.apBand, allowed2GChannels,

wifiNative.getChannelsForBand(WifiScanner.WIFI_BAND_5_GHZ));

if (config.apChannel == -1) {

-                if (wifiNative.isGetChannelsForBandSupported()) {

-                    /* We're not able to get channel when it is supported by HAL. */

-                    Log.e(TAG, "Failed to get available channel.");

-                    return ERROR_NO_CHANNEL;

-                }

-

/* Use the default for HAL without get channel support. */

-                config.apBand = DEFAULT_AP_BAND;

-                config.apChannel = DEFAULT_AP_CHANNEL;

+                if (config.apBand == WifiConfiguration.AP_BAND_5GHZ) {

+                        Log.e(TAG, "kernel not support,set to chanel 153");

+                        config.apChannel = 153;

+                } else {

+                        config.apBand = DEFAULT_AP_BAND;

+                        config.apChannel = DEFAULT_AP_CHANNEL;

+                }

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值