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