平台:S5PC110 S5PV210
系统:android2.3 android2.3.4
android电话呼入时,电话铃音提示,按音量加/减键、power键时,铃音没了。bug list 上又多了这一个BUG。(首先说明这个问题不用解,android就这样做的)
1,内核程序分析,在音频解码芯片里打印出的信息是,音频关掉了。
[ 431.795859] rt5625:enterrt5625_hifi_pcm_shutdown
2,再看一下 logcat发现有点不对。貌似就正常关闭呀。
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing:
Silence ringer!
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
[ 306.485911] rt5625:enter rt5625_hifi_pcm_shutdown
D/AudioHardware( 67): AudioHardware pcm playback is going to standby.
V/AudioHardware( 67): closeMixer_l() mMixerOpenCnt: 1
D/AudioHardware( 67): closePcmOut_l() mPcmOpenCnt: 1
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
[ 306.485911] rt5625:enter rt5625_hifi_pcm_shutdown
D/AudioHardware( 67): AudioHardware pcm playback is going to standby.
V/AudioHardware( 67): closeMixer_l() mMixerOpenCnt: 1
D/AudioHardware( 67): closePcmOut_l() mPcmOpenCnt: 1
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
I/WindowManager( 90): interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!
3,看下关于 呼入电话 铃音 与 按键的关系吧。
在android2.3.4_GB_T34H\frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManager.java中
// Handle special keys.
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP: {
if (down) {
ITelephony telephonyService = getTelephonyService();
if (telephonyService != null) {
try {
if (telephonyService.isRinging()) {
// If an incoming call is ringing, either VOLUME key means
// "silence ringer". We handle these keys here, rather than
// in the InCallScreen, to make sure we'll respond to them
// even if the InCallScreen hasn't come to the foreground yet.
// Look for the DOWN event here, to agree with the "fallback"
// behavior in the InCallScreen.
Log.i(TAG, "interceptKeyBeforeQueueing:"
+ " VOLUME key-down while ringing: Silence ringer!");
// Silence the ringer. (It's safe to call this
// even if the ringer has already been silenced.)
telephonyService.silenceRinger();//这里就是铃音没有的原因了
// And *don't* pass this key thru to the current activity
// (which is probably the InCallScreen.)
result &= ~ACTION_PASS_TO_USER;
break;
}
if (telephonyService.isOffhook()
&& (result & ACTION_PASS_TO_USER) == 0) {
// If we are in call but we decided not to pass the key to
// the application, handle the volume change here.
handleVolumeKey(AudioManager.STREAM_VOICE_CALL, keyCode);
break;
}
} catch (RemoteException ex) {
Log.w(TAG, "ITelephony threw RemoteException", ex);
}
}
if (isMusicActive() && (result & ACTION_PASS_TO_USER) == 0) {
// If music is playing but we decided not to pass the key to the
// application, handle the volume change here.
handleVolumeKey(AudioManager.STREAM_MUSIC, keyCode);
break;
}
}
break;
}
4,找几台机器验证一下吧
在同事那里找了几部手机,三星、LG、HTC、P1000,试了一下,都是这样。那就是正常现象了,白折腾了一段时间,看了半天代码。
当你的BUG List上有这个问题让你去解的时候,跟别人说这是正常的,android系统本来就这样做的。如果不是做什么特别的“客制化”,这就是正常的。