平台: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!
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系統本來就這樣做的。如果不是做什麼特別的“
客制化”,這就是正常的。