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

修改以下代码:
fraeworks\base\wifi\java\android\net\wifi下面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);
     }
 }

展开阅读全文
©️2020 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值