1.飞行模式下关闭蓝牙,不能再使用蓝牙。
在文件frameworks/base/packages/SettingsProvider/res/values/defaults.xml 下面一句中去掉bluetooth,即可实现。
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi</string>
2.蓝牙默认名字设置:BTMTK_ANDROID_DEFAULT_LOCAL_NAME "Zoom Camper Q2"
3.蓝牙名字的最大长度:private static final int BLUETOOTH_NAME_MAX_LENGTH_BYTES = 59 // 246;framework/driver support max length 59
4.蓝牙耳机接通挂断电话:packages/apps/Phone/src/com/android/phone/BluetoothHandfree.java
private void initializeHandsfreeAtParser() {
....................................
// Hang-up commandparser.register("+CHUP", new AtCommandHandler() {
@Override
public AtCommandResult handleActionCommand() {
sendURC("OK");
if (mCM.hasActiveRingingCall()) {
PhoneUtils.hangupRingingCall(mCM.getFirstActiveRingingCall());
}
else if (mCM.hasActiveFgCall()) {
PhoneUtils.hangupActiveCall(mCM.getActiveFgCall());
}
else if (mCM.hasActiveBgCall()) {
PhoneUtils.hangupHoldingCall(mCM.getFirstActiveBgCall());
}
return new AtCommandResult(AtCommandResult.UNSOLICITED);
}
});
.........................................................
}
在packages/apps/Bluetooth下面的AndroidManifest.xml中
<activity android:name=".opp.BluetoothOppLauncherActivity"
android:process="@string/process"
android:theme="@android:style/Theme.Dialog" android:label="@string/bt_share_picker_label">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="text/x-vcard" />
<data android:mimeType="text/plain" />
<data android:mimeType="text/html" />
<data android:mimeType="application/zip" />
<data android:mimeType="application/vnd.ms-excel" />
<data android:mimeType="application/msword" />
<data android:mimeType="application/vnd.ms-powerpoint" />
<data android:mimeType="application/pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="x-mixmedia/*" />
<data android:mimeType="text/x-vcard" />
</intent-filter>
<intent-filter>
<action android:name="android.btopp.intent.action.OPEN" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.android.btopp" />
</intent-filter>
</activity>
这是发送时的限制;
接收则是改ACCEPTABLE_SHARE_INBOUND_TYPES这个数组的定义