I have a rooted phone accepting incoming phone calls using the adb command:
adb shell service call phone 5
After a call starts, I have noticed that the phone speaker turns on automatically, and I've seen this with 2 different devices. I also tried to turn the speaker off using AudioManager after the call started, but it seems to not be working. Here is the code to turn off the speaker during a call:
AudioManager audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setSpeakerphoneOn(false);
Can someone tell me why my speaker turns on when a call has been accepted by adb and is there any other command(adb) which I can run in parallel to turn off the speaker?