From 231eea1a1d10e0e23b4a86241b2464c4c36cd7f1 Mon Sep 17 00:00:00 2001 From: lesl Date: Fri, 19 Jun 2020 17:47:13 +0800 Subject: wifi: Add new overlay to control reset channel config. The device might not support SAP channel customization (UI) or forced channel might not work in some countries. Add overlay to let OEM to decide to reset it during cloud restore. Note: Default will reset channel configuration Bug: 159325231 Test: atest FrameworksWifiTests Change-Id: Id9db5bca469a98c555223c26ad9b37ead7389f9e --- service/java/com/android/server/wifi/WifiApConfigStore.java | 10 ++++++++++ service/res/values/config.xml | 3 +++ service/res/values/overlayable.xml | 1 + 3 files changed, 14 insertions(+) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java index 4921f8c7d..961cbbd3b 100644 --- a/service/java/com/android/server/wifi/WifiApConfigStore.java +++ b/service/java/com/android/server/wifi/WifiApConfigStore.java @@ -183,6 +183,16 @@ public class WifiApConfigStore { SoftApConfiguration.SECURITY_TYPE_WPA2_PSK); Log.e(TAG, "Device doesn't support WPA3-SAE, reset config to WPA2"); } + + if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetChannelConfig)) { + // The device might not support customize channel or forced channel might not + // work in some countries. Need to reset it. + if (config.getChannel() != 0) { + // Add 2.4G by default + configBuilder.setBand(SoftApConfiguration.BAND_2GHZ | config.getBand()); + Log.i(TAG, "Reset SAP channel configuration"); + } + } mWifiMetrics.noteSoftApConfigReset(config, configBuilder.build()); return configBuilder.build(); } diff --git a/service/res/values/config.xml b/service/res/values/config.xml index ad454c10a..7e35eed19 100644 --- a/service/res/values/config.xml +++ b/service/res/values/config.xml @@ -137,6 +137,9 @@ 16 + + true + diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml index cab5bbfb4..bf96fde62 100644 --- a/service/res/values/overlayable.xml +++ b/service/res/values/overlayable.xml @@ -57,6 +57,7 @@ + -- cgit v1.2.3