Android S 默认WIFi 热点名称

Android 12 带GMS的项目wifi热点名称被mainline掉了

如果要修改热点名称可以参考如下3种方法

1. 使用RRO Overlay 

google介绍文档Wi-Fi  |  Android 开源项目  |  Android Open Source Project

修改方法就是创建个RRO覆盖,但是这种改法显示的热点后面会默认带数字,例如Android_1234

vendor/mediatek/proprietary/packages / overlay/vendor/WifiResOverlay/AndroidManifest.xml

diff --git a/WifiResOverlay/AndroidManifest.xml b/WifiResOverlay/AndroidManifest.xml
index 5c611ad..4532038 100644
--- a/WifiResOverlay/AndroidManifest.xml
+++ b/WifiResOverlay/AndroidManifest.xml
@@ -17,13 +17,13 @@
 
 
     
     
+      android:priority="10"/>
 
diff --git a/WifiResOverlay/res/values/config.xml b/WifiResOverlay/res/values/config.xml
index 32355fa..f5dd0f4 100644
--- a/WifiResOverlay/res/values/config.xml
+++ b/WifiResOverlay/res/values/config.xml
@@ -19,6 +19,8 @@
 
 
 
+    ywysh

第二种方法

在MtkSettings里添加个Receiver接收开机广播

首次开机的时候直接重新设置热点名称

    WifiManager mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    final SoftApConfiguration config = mWifiManager.getSoftApConfiguration();
    String mSSID = SystemProperties.get("ro.product.model");
    mWifiManager.setSoftApConfiguration(
        new SoftApConfiguration.Builder(config).setSsid(mSSID).build());    

第三种方法

去掉wifi mainline模块,不会影响CTS

device / mediatek/system/common/device.mk

MAINLINE_INCLUDE_WIFI_MODULE := false

            # FBE is mandatory for Q new launching device
            # Mainline partner build config - updatable APEX
            # MAINLINE_INCLUDE_WIFI_MODULE = true
            # add by songhui for disable wifi mainline
            PRODUCT_SYSTEM_PROPERTIES += ro.apex.updatable=true
            MAINLINE_INCLUDE_WIFI_MODULE := false
            MAINLINE_COMPRESS_APEX_ART := true
            MAINLINE_COMPRESS_APEX_MEDIAPROVIDER := true

packages / modules/Wifi/service/java/com/android/server/wifi/WifiApConfigStore.java

    private SoftApConfiguration getDefaultApConfiguration() {
        SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder();
        configBuilder.setBand(generateDefaultBand(mContext));
        //configBuilder.setSsid(mContext.getResources().getString(
        //        R.string.wifi_tether_configure_ssid_default) + "_" + getRandomIntForDefaultSsid());
        //wifi热点名称
        + configBuilder.setSsid(SystemProperties.get("ro.product.model"));
        if (ApConfigUtil.isWpa3SaeSupported(mContext)) {
            configBuilder.setPassphrase(generatePassword(),

packages / modules/Wifi/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java

        private String getPersistedDeviceName() {
            String deviceName = mSettingsConfigStore.get(WIFI_P2P_DEVICE_NAME);
            if (null != deviceName) return deviceName;
            logd("the default device name: " + prefix + postfix);
           - //return prefix + postfix; //wifi直连名字
           + return SystemProperties.get("ro.product.model");
        }

你可能感兴趣的:(android,android,studio,webview)