本文基於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 [email protected] // @來指定默認藍牙
該property值得設置在:device\mediatek\common\custom.conf 文件中 bluetooth.HostName [email protected]
ro.product.model定義:build\tools\buildinfo.sh中 echo "ro.product.model= AGR750 "
以上就是修改藍牙默認名稱所有方法。尤其方法四最爲繁瑣、最接地氣,你試試看看,O(∩_∩)O哈哈~