Add overlay to enable NIAP mode by default
Bug: 225145748
Test: atest com.android.server.wifi
Updated-Overlayable: TRUE
Change-Id: I25d1ec1247776574e72635ca7e489642fcdb9895
diff --git a/service/ServiceWifiResources/res/values/config.xml b/service/ServiceWifiResources/res/values/config.xml
index d98e1ce..a0900e4 100644
--- a/service/ServiceWifiResources/res/values/config.xml
+++ b/service/ServiceWifiResources/res/values/config.xml
@@ -1118,4 +1118,6 @@
disable of power save to avoid the high latency when chip is in power save mode as part of
handling the HAL API setLatencyMode(). -->
<bool translatable="false" name ="config_wifiLowLatencyLockDisableChipPowerSave">true</bool>
+ <!-- Boolean indicating whether NIAP mode is enabled by default for Wi-Fi. -->
+ <bool translatable="false" name="config_wifiNiapModeEnabled">false</bool>
</resources>
diff --git a/service/ServiceWifiResources/res/values/overlayable.xml b/service/ServiceWifiResources/res/values/overlayable.xml
index 41cef9e..a085ea7 100644
--- a/service/ServiceWifiResources/res/values/overlayable.xml
+++ b/service/ServiceWifiResources/res/values/overlayable.xml
@@ -307,7 +307,7 @@
<item type="integer" name="config_wifiDtimMultiplierMulticastLockEnabled" />
<item type="bool" name="config_wifiAwareOffloadingFirmwareHandlePriority" />
<item type="bool" name="config_wifiLowLatencyLockDisableChipPowerSave" />
-
+ <item type="bool" name="config_wifiNiapModeEnabled" />
<!-- Params from config.xml that can be overlayed -->
<!-- Params from strings.xml that can be overlayed -->
diff --git a/service/java/com/android/server/wifi/FrameworkFacade.java b/service/java/com/android/server/wifi/FrameworkFacade.java
index e810150..60bad79 100644
--- a/service/java/com/android/server/wifi/FrameworkFacade.java
+++ b/service/java/com/android/server/wifi/FrameworkFacade.java
@@ -47,6 +47,8 @@
import android.util.Log;
import android.widget.Toast;
+import com.android.wifi.resources.R;
+
import java.util.List;
import java.util.NoSuchElementException;
@@ -164,6 +166,10 @@
* Returns whether the device is in NIAP mode or not.
*/
public boolean isNiapModeOn(Context context) {
+ boolean isNiapModeEnabled = context.getResources().getBoolean(
+ R.bool.config_wifiNiapModeEnabled);
+ if (isNiapModeEnabled) return true;
+
DevicePolicyManager devicePolicyManager =
context.getSystemService(DevicePolicyManager.class);
if (devicePolicyManager == null