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 @@
 <!-- Simple app to demonstrate how OEM's can customize the various overlays exposed by
      the wifi stack -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.wifi.resources.overlay"
+    package="com.mediatek.wifi.resources.overlay"
     android:versionCode="1"
     android:versionName="1.0">
     <application android:hasCode="false" />
     <overlay
-      android:targetPackage="com.android.wifi.resources"
+      android:targetPackage="com.google.android.wifi.resources"
       android:targetName="WifiCustomization"
       android:isStatic="true"
-      android:priority="0"/>
+      android:priority="10"/>
 </manifest>
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 @@
 <!-- Overrides the default value of the specified config values when this sample app is installed -->
 <resources>
 
+    <string name="wifi_tether_configure_ssid_default" translatable="false">ywysh</string>

第二种方法

在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");
        }

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值