WiFi hotspot with hidden SSID on LineageOS

If you want to hide the SSID of your AP, one way to do that is to patch frameworks/opt/net/wifi/service/java/com/android/server/wifi/SoftApManager.java file in LineageOS sources:

diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index d4a1ea508..8083481a1 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -138,6 +138,9 @@ public class SoftApManager implements ActiveModeManager {

         // Make a copy of configuration for updating AP band and channel.
         WifiConfiguration localConfig = new WifiConfiguration(config);
+
+       // Hide SSID
+       localConfig.hiddenSSID = true;

         int result = ApConfigUtil.updateApChannelConfig(
                 mWifiNative, mCountryCode,

Then rebuild LineageOS for your device and flash update from recovery.

Update from 2021: LineageOS 18.1

Same file, slightly different change.

diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index b321a78a1..03323c99c 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -406,6 +406,9 @@ public class SoftApManager implements ActiveModeManager {
         // Make a copy of configuration for updating AP band and channel.
         SoftApConfiguration.Builder localConfigBuilder = new SoftApConfiguration.Builder(config);

+        // Do not broadcast SSID
+        localConfigBuilder.setHiddenSsid(true);
+
         boolean acsEnabled = mCurrentSoftApCapability.areFeaturesSupported(
                 SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD);
If you have any comments, contact me by email.