本文基于Android5.1代码
修改蓝牙默认名称的4种方法
方法一:
vendor\mediatek\proprietary\frameworks\base\custom\custom.conf
# [usage]
# format-> m.n=v
# m -> module definition, support wildcards
# p -> property name, used as key, case sensitive
# v -> property value
#
# [example]
# mms.UserAgent = Android 4.0/Release 01.05.2012
# bluetooth.HostName = BtDevice
# *.UAProfileURL = http://www.google.com/UAProf.xml
#
# [notice]
# CR/LF used as only delimiter of each configuaration items, both LINUX/MAC/DOS format supported
# character set: ASCII, encoding type: UTF8
#browser.UserAgent = Athens15_TD/V2 Linux/3.0.13 Android/4.0 Release/02.15.2012 Browser/AppleWebKit534.30 Mobile Safari/534.30 System/Android 4.0.1;
browser.UAProfileURL = http://218.249.47.94/Xianghe/MTK_Phone_KK_UAprofile.xml
mms.UserAgent = Android-Mms/0.1
mms.UAProfileURL = http://www.google.com/oha/rdf/ua-profile-kila.xml
http_streaming.UserAgent = stagefright/1.2 (Linux;Android @ro.build.version.release )
rtsp_streaming.UserAgent = stagefright/1.2 (Linux;Android @ro.build.version.release )
#http_streaming.UAProfileURL = http://218.249.47.94/Xianghe/MTK_Athens15_UAProfile.xml
#rtsp_streaming.UAProfileURL = http://218.249.47.94/Xianghe/MTK_Athens15_UAProfile.xml
dm.Manufacturer = Aguri
dm.Model = RV750 EU
bluetooth.HostName = AGR750 //修改默认蓝牙名称
fmtransmitter.RDSValue = Mediatek
wlan.SSID = AGR750 //修改默认wifi名称
方法二:
external\bluetooth\bluedroid\btif\src\btif_dm.c
btif_default_local_name[]数组为null
static char btif_default_local_name[DEFAULT_LOCAL_NAME_MAX+1] = {'\0'};
//修改为需要客制化的名称,例如:AGR750
static char btif_default_local_name[DEFAULT_LOCAL_NAME_MAX+1] = "AGR750";
方法三:
前提条件:
btif_default_local_name[] 数组的默认定义为空(也就是方法二中的数组)
static char btif_default_local_name[DEFAULT_LOCAL_NAME_MAX+1] = {'\0'};
修改device\generic\common\bluetooth\bdroid_buildcfg.h文件中de中的的蓝牙名宏M_DEF_LOCAL_NAME
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
#define BTM_DEF_LOCAL_NAME "" //修改默认蓝牙名 例:"AGR750"
#endif
方法四:(最为繁琐)
前提条件:
(1) btif_default_local_name[] 数组的默认定义为空(也就是方法二数组)
static char btif_default_local_name[DEFAULT_LOCAL_NAME_MAX+1] = {'\0'};
(2) external\libnfc-nci\src\include\bt_target.h或 external\bluetooth\bluedroid\include\bt_target.h
文件中蓝牙名称宏定义BTM_DEF_LOCAL_NAME为空
#ifndef BTM_DEF_LOCAL_NAME
#define BTM_DEF_LOCAL_NAME ""
#endif
(3) device\generic\common\bluetooth\bdroid_buildcfg.h文件中的蓝牙名宏M_DEF_LOCAL_NAME(参考方法三)
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
#define BTM_DEF_LOCAL_NAME "" //修改默认蓝牙名 例:"AGR750"
#endif
修改方法:
满足上面的前提条件,此时默认的蓝牙名称会读取 ro.product.model 属性值作为蓝牙默认名称;
在文件external\bluetooth\bluedroid\btif\src\btif_dm.c中已定义:
#define PROPERTY_PRODUCT_MODEL "ro.product.model"
在通过vendor\mediatek\proprietary\frameworks\base\custom\custom.conf(方法一)中
bluetooth.HostName =@ro.product.model // @来指定默认蓝牙
该property值得设置在:device\mediatek\common\custom.conf 文件中 bluetooth.HostName =@ro.product.model
ro.product.model定义:build\tools\buildinfo.sh中 echo "ro.product.model= AGR750 "
以上就是修改蓝牙默认名称所有方法。尤其方法四最为繁琐、最接地气,你试试看看,O(∩_∩)O哈哈~