【Audio】耳机错误/频繁插入造成的无法识别
现象:
原因:
解决方法:
Defect Description:
Plugging the headphone automatically triggered the volume and the emergence of searchGoogle and other interfaces.
Expected Behavior:
Nointerface had been triggered when the headphone plugging. It can be normally used Glossary:
3 sections of the earphone —— headphone
4 sections of the earphone —— handset
Analysis
The original in the logs:
……
01-01 08:53:47.936 1911 1911 V WiredAccessoryManager: headsetName: connected
01-01 08:53:47.937 1911 1911 V WiredAccessoryManager: headsetName: disconnected
……
01-01 08:53:48.147 1911 1911 V WiredAccessoryManager: headsetName: disconnected
……
01-01 08:53:49.067 1911 1911 V WiredAccessoryManager: headsetName: connected
……
01-01 08:53:50.880 1911 1911 V WiredAccessoryManager: headsetName: connected
01-01 08:53:50.882 1911 1911 V WiredAccessoryManager: headsetName: disconnected
Fromthe log, there were 8 times plug-pulling events in 3 seconds. It’s notartificial processing.
From the log, the handset hasbeen identified, but it has been led into the thread of events: found, plugged, pulled out, plugged, pulled out and so on.
It’s very low probability of issue recurrence with the right headphone following with the local feedback. Combined with the hardware test, when the headphone had been in non-complete plugging and swaying the jack, the issue appears and log is beencaught.
It has been frequentlyreported the events of earphone plugging in a shorttime, andbe similar to the log from the local feedback by analyzing therepetition appearance.
As the similar issue to otherdevices with similar hardware, when the handset plugging the front threesection and the last one with frequently plug-pull, the Google search pop-upsautomatically.
Root Cause
This is because of the handset of OMTP and CTIA, the third or fourth section in jack and socket is GND. If repeated this plugging, it will causefrequent short circuit in hardwarein short time, to be the abnormal voltage andcurrent.
Be identified as Google searchbutton to report, the headphone , the last section is GND, so repeatedly plugging, then it may causesuch issue. Of course, poor contact or jack does not match theheadset may also cause a similar situation.
Because this issue belongs to short circuit in the hardware, can not be avoided and eliminated. Software can do the corresponding processing and optimization to reduce the recurrence probability.
Conclusion
The optimization schemeis as follows:
Increase the reporteddetection time of earphone plugging event, from 0.25s to 2s. And when it hasbeen set to 2s, if the voltage is notstable, then the event will beignored and do not report.
For non-supported handset (OMTP), the direct feedback show fail, no longer continuouslydetect in the code.