Android 修改WiFi熱點的默認SSID和(hé)密碼
發表時間:2020-10-19
發布人:葵宇科技
浏覽次數:74
修改以下(xià)代碼:
fraeworks\base\wifi\java\android\net\wifi下(xià)面wifiApConfigStore.Java中(zhōng)的
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);
}
}