Android蓝牙设备名修改
发布日期:2021-09-27 14:12:53 浏览次数:6 分类:技术文章

本文共 1866 字,大约阅读时间需要 6 分钟。

如果是标准的android 4.4系统,只要定义宏 BTM_DEF_LOCAL_NAME (从明显,蓝牙模块默认名)的值即可。 在源码根目录的external/bluetooth/bluedroid/bluedroid/main/bte_conf.c 可以看到有以下代码 local_device_default_name = BTM_DEF_LOCAL_NAME;    如果没有定义该宏 ,根据external/bluetooth/bluedroid/btif/src/btif_dm.c 文件中   btif_get_default_local_name函数会去用ro.product.model属性值作为蓝牙名字。从google官方的源码Code Review网站(https://android.googlesource.com/?format=HTML 可能需要翻墙才能访问)里,    在类似 device等仓库中,device/asus/deb  device/asus/flo  device/asus/flo-kernel  device/asus/grouper Files specific to Nexus 7 device/asus/tilapia  device/common  device/generic/armv7-a  device/generic/armv7-a-neon  device/generic/art  device/generic/common 。。。。。。。。。。。例如  device/lge/hammerhead(https://android.googlesource.com/device/asus/grouper/+/android-4.4.2_r2/bluetooth/bdroid_buildcfg.h) ,里面的bluetooth/bdroid_buildcfg.h 会有类似以下blob: 6bb11fb967ee5e4ee0e955dcfbe6e0cddca111d9 [file history] [blame]1./*2. * Copyright (C) 2012 The Android Open Source Project3. *4. * Licensed under the Apache License, Version 2.0 (the "License");5. * you may not use this file except in compliance with the License.6. * You may obtain a copy of the License at7. *8. *      http://www.apache.org/licenses/LICENSE-2.09. *10. * Unless required by applicable law or agreed to in writing, software11. * distributed under the License is distributed on an "AS IS" BASIS,12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13. * See the License for the specific language governing permissions and14. * limitations under the License.15. */16.17.#ifndef _BDROID_BUILDCFG_H18.#define _BDROID_BUILDCFG_H19.20.#define BTM_DEF_LOCAL_NAME "Nexus 7"综上所说,可以仿官网作法,也可以直接在external/bluetooth/bluedroid/include/bt_target.h 修改,把#define BTM_DEF_LOCAL_NAME      "" 定义为你想要的名字。 重新编译系统后,记得要清掉用户数据,不然很可能Settings.apk显示的蓝牙名字可能是旧的。

 

转载于:https://www.cnblogs.com/MMLoveMeMM/articles/4186415.html

转载地址:https://blog.csdn.net/FLY_THINK2012/article/details/101840984 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Android 笔试---二分法查找
下一篇:StringTokenizer类的使用

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月17日 10时20分04秒