- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
JB2之后自行添加耳机图标后显示异常
录入:edatop.com 点击:
[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;
}
}
}
默认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;
}
}
}
谢谢分享
顶起来
感谢各位支持
申明:网友回复良莠不齐,仅供参考。如需专业帮助,请学习易迪拓培训专家讲授的ADS视频培训课程。
上一篇:L版本APPIOT常见问题总结(对比机可以复现)
下一篇:如何修改默认小时制
ADS培训课程推荐详情>>
国内最全面、最专业的Agilent ADS培训课程,可以帮助您从零开始,全面系统学习ADS设计应用【More..】
- Agilent ADS教学培训课程套装
- 两周学会ADS2011、ADS2013视频教程
- ADS2012、ADS2013射频电路设计详解
- ADS高低阻抗线微带滤波器设计培训教程
- ADS混频器仿真分析实例视频培训课程
- ADS Momentum电磁仿真设计视频课程
- ADS射频电路与通信系统设计高级培训
- ADS Layout和电磁仿真设计培训视频
- ADS Workspace and Simulators Training Course
- ADS Circuit Simulation Training Course
- ADS Layout and EM Simulation Training Course
- Agilent ADS 内部原版培训教材合集