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