Programmatically disable WiredHeadset

I have an HTC Hero with a serious problem. He thinks that a headset / headphone is connected. I sent it to HTC and they said that there is water damage, so no corrections.

I tried toggleheadset, toggleheadset2. I strengthened my device and installed Android 2.1 ROM. Now I found out that AudioManager.setRouting and .setWiredHeadsetOn (bool) are deprecated and subsequently deleted.

I read a post somewhere about how you can create a wrapper for the AudioSystem class, since setRouting is still available there. I still could not figure out how to do this, since the AudioSystem class is hidden in the SDK, and the code uses its own functions.

Does anyone know a way to create and implement a shell for AudioSystem or another way to disconnect a headset?

I also cleaned the headset port, so there is no dust or anything sending false signals to the system board.

Any help would be greatly appreciated.

+3
source share

Source: https://habr.com/ru/post/1745959/


All Articles