当前位置:   article > 正文

Android 11 固定wifi热点名和密码_安卓11以上:wifi热点信息 :"getsoftapconfiguration

安卓11以上:wifi热点信息 :"getsoftapconfiguration

Android 11 固定wifi热点名和密码的路径和早期版本也有不同,Android 11 固定wifi热点名和密码的路径方法如下:

1.固定wifi热点名
a.去掉热点明后的SSID

--- 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
@@ -273,9 +273,11 @@ public class WifiApConfigStore {
     private SoftApConfiguration getDefaultApConfiguration() {
         SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder();
         configBuilder.setBand(SoftApConfiguration.BAND_2GHZ);
-        configBuilder.setSsid(mContext.getResources().getString(
-                R.string.wifi_tether_configure_ssid_default) + "_" + getRandomIntForDefaultSsid());
-        if (ApConfigUtil.isWpa3SaeSupported(mContext)) {
+//        configBuilder.setSsid(mContext.getResources().getString(
+//                R.string.wifi_tether_configure_ssid_default) + "_" + getRandomIntForDefaultSsid());
+        configBuilder.setSsid(mContext.getResources().getString(R.string.wifi_tether_configure_ssid_default));
+
+       if (ApConfigUtil.isWpa3SaeSupported(mContext)) {
             configBuilder.setPassphrase(generatePassword(),
                     SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION);
         } else {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

b,在config文件中更改自己想要的热点名

--- a/frameworks/opt/net/wifi/service/res/values/config.xml
+++ b/frameworks/opt/net/wifi/service/res/values/config.xml
@@ -275,7 +275,7 @@
     <string name="config_wifi_tcp_buffers" translatable="false">524288,1048576,2097152,262144,524288,1048576</string>

     <!-- Do not translate. Default access point SSID used for tethering -->
-    <string name="wifi_tether_configure_ssid_default" translatable="false">AndroidAP</string>
+    <string name="wifi_tether_configure_ssid_default" translatable="false">WiFIHotspot</string>
     <!-- Do not translate. Default access point SSID used for local only hotspot -->
     <string name="wifi_localhotspot_configure_ssid_default" translatable="false">AndroidShare</string>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2.固定wifi密码

--- a/frameworks/base/wifi/java/android/net/wifi/SoftApConfiguration.java
+++ b/frameworks/base/wifi/java/android/net/wifi/SoftApConfiguration.java
@@ -255,7 +255,7 @@ public final class SoftApConfiguration implements Parcelable {
             @NonNull List<MacAddress> blockedList, @NonNull List<MacAddress> allowedList) {
         mSsid = ssid;
         mBssid = bssid;
-        mPassphrase = passphrase;
+        mPassphrase = "12345678";//passphrase;
         mHiddenSsid = hiddenSsid;
         mBand = band;
         mChannel = channel;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号