我是靠谱客的博主 俏皮皮带,最近开发中收集的这篇文章主要介绍【Qualcomm高通音频】在设备没有听筒时,如何强制开启免提通话模式?,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

由于类似平板、贩卖机、车载等产品定义上都没有听筒这种音频设备,因此会经常遇到这样一个需求:强制免提。

以下是修改diff,请参考。

如果只是APK修改的话,可以参考:

diff --git a/packages/services/Telecomm/src/com/android/server/telecom/CallAudioManager.java b/packages/services/Telecomm/src/com/android/server/telecom/CallAudioManager.java
index 78a92eb..b87ffbb 100644
--- a/packages/services/Telecomm/src/com/android/server/telecom/CallAudioManager.java
+++ b/packages/services/Telecomm/src/com/android/server/telecom/CallAudioManager.java
@@ -379,7 +379,12 @@ public class CallAudioManager extends CallsManagerListenerBase {
      * @param route The new audio route to use. See {@link CallAudioState}.
      */
     void setAudioRoute(int route) {
-        Log.v(this, "setAudioRoute, route: %s", CallAudioState.audioRouteToString(route));
+        Log.v(this, "setAudioRoute,before Changed route: %s", CallAudioState.audioRouteToString(route));
+        if(CallAudioState.ROUTE_EARPIECE == route || CallAudioState.ROUTE_WIRED_OR_EARPIECE  == route){
+	    route = CallAudioState.ROUTE_SPEAKER;
+	}
+        Log.v(this, "setAudioRoute,after Changed route: %s", CallAudioState.audioRouteToString(route));
         switch (route) {
             case CallAudioState.ROUTE_BLUETOOTH:
                 mCallAudioRouteStateMachine.sendMessageWithSessionInfo(

如果想一劳永逸的话,可以参考,以高通8953平台代码为例:

diff --git a/hardware/qcom/audio/configs/msm8953/audio_policy_configuration.xml b/hardware/qcom/audio/configs/msm8953/audio_policy_configuration.xml
old mode 100644
new mode 100755
index ea4b140..e016954
--- a/hardware/qcom/audio/configs/msm8953/audio_policy_configuration.xml
+++ b/hardware/qcom/audio/configs/msm8953/audio_policy_configuration.xml
@@ -49,7 +49,6 @@
         <!-- Primary Audio HAL -->
         <module name="primary" halVersion="2.0">
             <attachedDevices>
-                <item>Earpiece</item>
                 <item>Speaker</item>
                 <item>Telephony Tx</item>
                 <item>Built-In Mic</item>
@@ -171,10 +170,6 @@

             <devicePorts>
                 <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
-                <devicePort tagName="Earpiece" type="AUDIO_DEVICE_OUT_EARPIECE" role="sink">
-                   <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                            samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
-                </devicePort>
                 <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address="">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
@@ -255,8 +250,6 @@
             </devicePorts>
             <!-- route declaration, i.e. list all available sources for a given sink -->
             <routes>
-                <route type="mix" sink="Earpiece"
-                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
                 <route type="mix" sink="Speaker"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
                 <route type="mix" sink="Wired Headset"

 

最后

以上就是俏皮皮带为你收集整理的【Qualcomm高通音频】在设备没有听筒时,如何强制开启免提通话模式?的全部内容,希望文章能够帮你解决【Qualcomm高通音频】在设备没有听筒时,如何强制开启免提通话模式?所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部