• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Android 修改WiFi热点的默认SSID和密码

互联网 diligentman 4天前 8次浏览

修改以下代码:
fraeworksbasewifijavaandroidnetwifi下面wifiApConfigStore.Java中的
loadApConfiguration()
{
.... ....
config.preSharedKey = in.readUTF(); =>修改为希望设置的字符串密码
.... ....
}

============================

git df frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java
diff --git a/frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java b/frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java
index ec9acac..d409e44 100644
--- a/frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java
+++ b/frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java
@@ -232,7 +232,7 @@ class WifiApConfigStore extends StateMachine {
         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);
+        config.preSharedKey = "12345678";//randomUUID.substring(0, 8) + randomUUID.substring(9,13);
         sendMessage(WifiStateMachine.CMD_SET_AP_CONFIG, config);
     }
}


5.1系统修改的地方:
diff --git a/frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiApConfigStore.java b/frameworks/opt/net/wifi/service/jav
old mode 100644
new mode 100755
index 19426e2..b0ebf64
--- a/frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiApConfigStore.java
+++ b/frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiApConfigStore.java
@@ -245,7 +245,8 @@ class WifiApConfigStore extends StateMachine {
         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);
+        // config.preSharedKey = randomUUID.substring(0, 8) + randomUUID.substring(9,13);
+               config.preSharedKey = "10101010";
         sendMessage(WifiStateMachine.CMD_SET_AP_CONFIG, config);
     }
 }


喜欢 (0)