最近在调试Android13系统,测试发现蓝牙连接手机等设备以后,手机通过蓝牙分享图片等文件时,Android13系统不会弹出接收的通知提示。
抓取log分析发现log中有个:
BtOppTransfer: Invalid SDP, ignoring!
这个log是由于蓝牙连接超过上层 SDP 规定的时间,SDP规定的超时时间是11秒。将 SDP 超时时间设置为 15 s即可解决这个问题。
--- a/packages/modules/Bluetooth/android/app/src/com/android/bluetooth/sdp/SdpManager.java
+++ b/packages/modules/Bluetooth/android/app/src/com/android/bluetooth/sdp/SdpManager.java
@@ -60,7 +60,7 @@ public class SdpManager {static final Object TRACKER_LOCK = new Object();/* The timeout to wait for reply from native. Should never fire. */
- private static final int SDP_INTENT_DELAY = 11000;
+ private static final int SDP_INTENT_DELAY = 15000;private static final int MESSAGE_SDP_INTENT = 2;// We need a reference to the adapter service, to be able to send intents