JB2之后自行添加耳机图标后显示异常

2017-12-13  本文已影响10人  RTThread小师弟

[DESCRIPTION]

默认JB2(包含)之后的的code是不支持耳机图标显示的,如果自己加了图标在缓慢插入或是插入时限显示三段又显示四段最后图标消失请使用此方法

[SOLUTION]

对于您的问题请在复现问题时在全全插入耳机的状态下帮忙在adb shell 中输入cat

/sys/class/switch/h2w/state

1)如果这个值在发生问题时为0或2

请打开调试项给出一份问题复现的log,并提交eService

我们accdet.c中有一个宏DEBUG_THREAD请查看它是否为1,如果不是1请定义为1.

开机以后手机连接adb cd /sys/bus/platform/drivers/Accdet_Driver echo 1 >

dump_register echo 1 >start_debug,以上命令可以在本次开机期间每隔500ms在log中打

印一次与accdet寄存器所有相关的值,请在此时复现问题并告知问题的实际操作。提交eService时

一起上传

2)如果这个值是1

请更改以下文件并验证这样的修改是否能够修复该问题

请更改WireDACcessoryManager.java

(php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\services\java\com\android\server)

private void setDeviceStateLocked(int heADSet,

int headsetState, int prevHeadsetState, String headsetName) {

if ((headsetState & headset) != (prevHeadsetState & headset)) {

int device;

int state;

if ((headsetState & headset) != 0) {

state = 1;

} else {

state = 0;

}

if (headset == BIT_HEADSET) {

device = AudioManager.DEVICE_OUT_WIRED_HEADSET;

} else if (headset == BIT_HEADSET_NO_MIC){

device = AudioManager.DEVICE_OUT_WIRED_HEADPHONE;

} else if (headset == BIT_USB_HEADSET_ANLG) {

device = AudioManager.DEVICE_OUT_ANLG_DOCK_HEADSET;

} else if (headset == BIT_USB_HEADSET_DGTL) {

device = AudioManager.DEVICE_OUT_DGTL_DOCK_HEADSET;

} else if (headset == BIT_HDMI_AUDIO) {

device = AudioManager.DEVICE_OUT_AUX_DIGITAL;

} else {

Slog.e(TAG, "setDeviceState() invalid headset type: "+headset);

return;

}

if (LOG)

Slog.v(TAG, "device "+headsetName+((state == 1) ? " connected" : "

disconnected"));

mAudioManager.setWiredDeviceConnectionState(device, state, headsetName);

//Add start

if(prevHeadsetState == BIT_HEADSET_NO_MIC && headsetState == BIT_HEADSET

&& state == 0) {

try {

Thread.sleep(100);

//

mAudioManager.setWiredDeviceConnectionState(AudioManager.DEVICE_OUT_WIRED_

HEADSET, 1, headsetName);

} catch (InterruptedException e) {

// Ingore

}

}

//Add End

illegal_state = getIllegalHeadset();

if(49 == illegal_state) {

mHandler.postDelayed(new Runnable(){

public void run(){

illegal_state = getIllegalHeadset();

if(49 == illegal_state){

Slog.d(TAG, "show illegal Headset msg+++++++++++++");

showheadsetToast();

illegal_state = 0;

}else{

Slog.d(TAG, "don't show illegal Headset msg+++++++++++++");

illegal_state = 0;

}

}

},1000);

//illegal_state = 0;

}

}

来源:一牛网论坛

上一篇下一篇

猜你喜欢

热点阅读