【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 @@
         
         
             
-                Earpiece
                 Speaker
                 Telephony Tx
                 Built-In Mic
@@ -171,10 +170,6 @@

             
                 
-                
-                   
-                
                 
                     
@@ -255,8 +250,6 @@
             
             
             
-                
                 
                 

 

你可能感兴趣的:(子类_ADUIO)