简体   繁体   English

OnePlus 5无法通过Audiomanager在通话模式下启动扬声器

[英]OnePlus 5 can't start speaker in call mode via audiomanager

I tried to set the device audio to speaker in call mode. 我试图在通话模式下将设备音频设置为扬声器。
Its working on most of the devices I checked. 它在我检查过的大多数设备上都能正常工作。

I purchased the OnePlus5 device and its not working on it. 我购买了OnePlus5设备,但无法在其上运行。

final AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.stopBluetoothSco();
audioManager.setBluetoothScoOn(false);
audioManager.setSpeakerphoneOn(true);

And when i checked the result is false: 当我检查结果为假时:

audioManager.isSpeakerphoneOn() // return false

As i can see in the logcat when i set speaker from the native dialer they are use some different objects to set the speaker: 正如我在logcat中看到的那样,当我从本机拨号器设置扬声器时,它们正在使用一些不同的对象来设置扬声器:

08-14 09:53:39.778 1562-2928/? I/Telecom: CallAudioRouteStateMachine: Message received: USER_SWITCH_SPEAKER=1104, arg1=0: ICA.sAR->CARSM.pM_USER_SWITCH_SPEAKER@COs_0
08-14 09:53:39.778 836-14835/? D/AudioPolicyManagerCustom: getOutputForDevice() returns output 13 flag 2
08-14 09:53:39.778 1562-2928/? I/Telecom: Event: Call TC@22: AUDIO_ROUTE, Leaving state ActiveEarpieceRoute: ICA.sAR->CARSM.pM_USER_SWITCH_SPEAKER@COs_0
08-14 09:53:39.778 1562-2928/? I/Telecom: Event: Call TC@22: AUDIO_ROUTE, Entering state ActiveSpeakerRoute: ICA.sAR->CARSM.pM_USER_SWITCH_SPEAKER@COs_0
08-14 09:53:39.778 836-1095/? D/APM_AudioPolicyManager: startOutput() output 13, stream 1, session 25
08-14 09:53:39.778 1562-2928/? I/Telecom: CallAudioRouteStateMachine: turning speaker phone true: ICA.sAR->CARSM.pM_USER_SWITCH_SPEAKER@COs_0
08-14 09:53:39.778 836-1095/? D/AudioPolicyManagerCustom: getNewOutputDevice() selected device 1
08-14 09:53:39.778 836-1095/? D/APM_AudioPolicyManager: setOutputDevice() device 0001 delayMs 0
08-14 09:53:39.779 836-1095/? D/APM_AudioPolicyManager: startOutput()--
08-14 09:53:39.779 1562-2928/? V/AudioManager: Elem: dalvik.system.VMStack.getThreadStackTrace(Native Method)
08-14 09:53:39.779 1562-2928/? V/AudioManager: Elem: java.lang.Thread.getStackTrace(Thread.java:1566)
08-14 09:53:39.779 1562-2928/? V/AudioManager: Elem: android.media.AudioManager.setSpeakerphoneOn(AudioManager.java:1286)
08-14 09:53:39.779 1562-2928/? V/AudioManager: Elem: com.android.server.telecom.CallAudioRouteStateMachine.setSpeakerphoneOn(CallAudioRouteStateMachine.java:1353)
08-14 09:53:39.779 1562-2795/? D/VibratorService: timeout: 0, startTime: 6699313, pattern: [0, 10], vibrateIntensity: Middle, repeat: -1, usageHint: 13, uid: 1001, opPkg: com.android.incallui

                                                  [ 08-14 09:53:39.780  1562: 8387 E/         ]
                                                  Vibrator on  : 10

添加<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AudioManager MODE_IN_CALL干扰 - AudioManager MODE_IN_CALL interferences Android:无法在 AudioManager.MODE_IN_COMMUNICATION 中使用蓝牙 - Android: can't use Bluetooth in AudioManager.MODE_IN_COMMUNICATION Audiomanager 扬声器不工作 - Audiomanager Speaker not working 我调用了 audiomanager.setMode(MODE_IN_CALL) 方法,我的耳机不再工作了 - I call the method audiomanager.setMode(MODE_IN_CALL) and my earphone doens't work anymore 无法使用OnePlus 2调试应用程序 - Can't debug applications using OnePlus 2 警报设置时自动启动扬声器通话 - Call start With speaker automatically on alarm setting 当应用程序被杀并且处于优化电池模式时,不会收到FCM消息 OnePlus 5t | OnePlus 6 | 错误广播意图回调:result = CANCELLED - Not receiving FCM messages when app is killed and in Optimised battery mode| OnePlus 5t |OnePlus 6 | Error broadcast intent callback: result=CANCELLED 无法以无头模式启动模拟器 - Can't start emulator in headless mode 无法在onePlus3 OxygenOs 3.2.8中查看错误日志 - Can't watch error logs in onePlus3 OxygenOs 3.2.8 华硕fonepad7,Android Audiomanager不能使用setMode() - Asus fonepad7, Android Audiomanager can't use setMode()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM