高通 android 7.0 插入蓝牙耳机,声音变的最大!

    高通 插入蓝牙耳机之后,声音变的很大!尝试了,苹果,MTK等等机器都是这样,

后分析,发现这个是 耳机发的广播MESSAGE_VOLUME_CHANGED: volume=104 ctype=15 自带的音量数据,

我们能处理就是,在获取到广播之后,对声音过大的时候,判断,然后设置一个小点的值!

 

Line 5738: 01-02 04:39:45.018  8373  8419 V Avrcp   : MESSAGE_VOLUME_CHANGED: volume=24 ctype=15
    Line 5739: 01-02 04:39:45.019  8373  8419 V Avrcp   : event for device address 1C:52:16:63:EB:99
    Line 5746: 01-02 04:39:45.019  8373  8419 I Avrcp   : device found at index 0
    Line 5747: 01-02 04:39:45.019  8373  8419 V Avrcp   : Volume Index = 3
    Line 5748: 01-02 04:39:45.023  8373  8419 E Avrcp   : percent volume changed: 18%

 

    Line 8228: 01-02 04:40:25.607  8373  8419 V Avrcp   : MESSAGE_VOLUME_CHANGED: volume=104 ctype=15
    Line 8229: 01-02 04:40:25.607  8373  8419 V Avrcp   : event for device address 1C:52:16:63:EB:99
    Line 8230: 01-02 04:40:25.608  8373  8419 I Avrcp   : device found at index 0
    Line 8231: 01-02 04:40:25.608  8373  8419 V Avrcp   : Volume Index = 12
    Line 8242: 01-02 04:40:25.616  8373  8419 E Avrcp   : percent volume changed: 81%

 

高通代码,其实代码已经有了这个功能,但是没有进去,后面分析deviceFeatures[deviceIndex].mAbsVolThreshold 是这个值默认为0导致的,后面把这个初始值改成7,问题解决。

mAbsVolThreshold = 7; // 修改这个初始值

 if (deviceFeatures[deviceIndex].mInitialRemoteVolume == -1) {
                    deviceFeatures[deviceIndex].mInitialRemoteVolume = absVol;
                    if (deviceFeatures[deviceIndex].mAbsVolThreshold > 0 &&
                        deviceFeatures[deviceIndex].mAbsVolThreshold < 
                        mAudioStreamMax &&
                        volIndex > deviceFeatures[deviceIndex].mAbsVolThreshold) {
                        if (DEBUG) Log.v(TAG, "remote inital volume too high " + volIndex + ">" +
                            deviceFeatures[deviceIndex].mAbsVolThreshold);
                        Message msg1 = mHandler.obtainMessage(MESSAGE_SET_ABSOLUTE_VOLUME,
                            deviceFeatures[deviceIndex].mAbsVolThreshold , 0);
                        mHandler.sendMessage(msg1);
                        deviceFeatures[deviceIndex].mRemoteVolume = absVol;
                        deviceFeatures[deviceIndex].mLocalVolume = volIndex;
                        break;
                    }
                }

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值