成都创新互联网站制作重庆分公司

如何添加某设备至配对黑名单?

[SOLUTION]

10余年的石屏网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都营销网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整石屏建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“石屏网站设计”,“石屏网站推广”以来,每个客户项目都认真落实执行。

修改\frameworks\base\core\java\android\bluetooth\BluetoothDevice.java文件createBond(),
//added MTK, Replace the headset name here.
+++ public static final String BLACK_LIST_BOND_MOTO_S305 = "moto s305";
public boolean createBond() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device");
return false;
}
+++ //added MTK
+++ if(BLACK_LIST_BOND_MOTO_S305.equals(getAliasName())){
+++ if (DBG) Log.d(TAG, "Do not bond Mota S305 headset.");
+++ return false;
+++ }
+++ // added end
try {
if (DBG) Log.d(TAG, "createBond: " + this);
return sService.createBond(this);
} catch (RemoteException e) {Log.e(TAG, "", e);}
return false;
}
如此修改会弹出配对失败提示,
提示来自于\packages\apps\Settings\src\com\android\settings\bluetooth\BluetoothDevicePreference.java中,
private void pair() {
if (!mCachedDevice.startPairing()) {
Utils.showError(getContext(), mCachedDevice.getName(),
R.string.bluetooth_pairing_error_message);
}

}
如需修改弹框提示,可以在这里添加,也可不修改此处!
//added MTK, Replace the headset name here.
+++ public static final String BLACK_LIST_BOND_MOTO_S305 = "moto s305";
private void pair() {
if (!mCachedDevice.startPairing()) {
+++ //added MTK
+++ if(BLACK_LIST_BOND_MOTO_S305.equals(mCachedDevice.getName())){
+++ Utils.showError(getContext(), mCachedDevice.getName(),
+++ "Can not bond Mota S305");
+++ }else {
Utils.showError(getContext(), mCachedDevice.getName(),
R.string.bluetooth_pairing_error_message);
+++ }
+++ //added end
}

}


当前名称:如何添加某设备至配对黑名单?
新闻来源:http://cxhlcq.com/article/jchjih.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部