I tested this on my Mi 6 (Sagit) with Lineage OS ROM installed.
-
adb shellinto your android device andsuto get root shell. -
Go to
/data/misc/apexdata/com.android.wifi. You'll see two files:WifiConfigStore.xmlandWifiConfigStoreSoftAp.xml. The later one is for wifi hotspot and we'll only Edit theWifiConfigStore.xml. -
Insert contents below in
entry.xmlinto<NetworkList>entry. ReplaceMY_WIFI_SSID,MY_IDENTITY,MY_PASSWORDto the real one.