Android 修改WLAN直连的设备名称
最近接到客户需求想要修改WLAN直连的设备名称,具体修改参考如下:
/packages/modules/Wifi/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
在getPersistedDeviceName方法中作如下修改:
// We use the 4 digits of the ANDROID_ID to have a friendly
// default that has low likelihood of collision with a peer
String id = mFrameworkFacade.getSecureStringSetting(mContext,
Settings.Secure.ANDROID_ID);
postfix = id.substring(0, 4);
}
logd("the default device name: " + prefix + postfix);
- return prefix + postfix;
+ return "the default device name";
重新编译验证,修改生效,WLAN直连的设备名称已经改为 the default device name