Android WIFI-概率性不能自连
1.连上wifi时同步保存wifi密码,避免连上wifi后马上断电重启由于密码没保存导致不能自动重连wifi
packages/modules/Wifi/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java
@@ -66,6 +66,7 @@ import com.android.server.wifi.WifiNative.SupplicantDeathEventHandler;
import com.android.server.wifi.util.GeneralUtil.Mutable;
import com.android.server.wifi.util.NativeUtil;+import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
@@ -977,10 +978,22 @@ public class SupplicantStaIfaceHal {
}
return null;
}
+ fileSync();
return new Pair(network, new WifiConfiguration(config));
}
}+ private void fileSync() {
+ Runtime runtime = Runtime.getRuntime();
+ try {
+ runtime.exec("sync");
+ Log.i(TAG, "saveConfig fileSync() successfu