Android WIFI热点默认安全性的修改方法

修改文件:

frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java


相关代码片段:

private void setDefaultApConfiguration() {
    WifiConfiguration config = new WifiConfiguration();
    config.SSID = mContext.getString(R.string.wifi_tether_configure_ssid_default);
    config.allowedKeyManagement.set(KeyMgmt.WPA2_PSK);
    String randomUUID = UUID.randomUUID().toString();
    //first 12 chars from xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
    config.preSharedKey = randomUUID.substring(0, 8) + randomUUID.substring(9,13);
    sendMessage(WifiStateMachine.CMD_SET_AP_CONFIG, config);
}

修改位置:

config.allowedKeyManagement.set(KeyMgmt.WPA2_PSK);

修改方法:

KeyMgmt.NONE
KeyMgmt.WPA_EAP
KeyMgmt.WPA_PSK
KeyMgmt.WPA2_PSK


备注:如果需要创建默认不需要密码的热点,改成KeyMgmt.NONE

你可能感兴趣的:(android,wifi,安全性,默认值)