Android蓝牙设备名修改

如果是标准的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 可能需要FQ才能访问)里,    在类似 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 Project

3. *

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 at

7. *

8. *      http://www.apache.org/licenses/LICENSE-2.0

9. *

10. * Unless required by applicable law or agreed to in writing, software

11. * 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 and

14. * limitations under the License.

15. */

16.

17.#ifndef _BDROID_BUILDCFG_H

18.#define _BDROID_BUILDCFG_H

19.

20.#define BTM_DEF_LOCAL_NAME "Nexus 7"


综上所说,可以仿官网作法,也可以直接在external/bluetooth/bluedroid/include/bt_target.h 修改,
把#define BTM_DEF_LOCAL_NAME      "" 定义为你想要的名字。 重新编译系统后,记得要清掉用户数据,不然很可能Settings.apk显示的蓝牙名字可能是旧的。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值