mt6735 使用震动喇叭,在 home界面通过音量键调音量,结果调的是媒...
时间:10-02
整理:3721RD
点击:
[Audio Driver]使用震动喇叭,在home界面通过音量键调音量,结果调的是媒体音量而不是来电铃声的音量
[DESCRIPTION]
问题:使用震动喇叭,打开mtk_VIBSPK_SUPPORT,通过音量键在home界面调节音量,经常出现按一下没有提示音的情况,观察音量图标,发现调的是media的音量等级,而不是ring的音量等级。进入setting,把震动关掉,此问题就不再复现。只要是在震动的时候去home见面调音量键,就可以必现这个问题。
[SOLUTION]
原因:这是因为震动的时候会播放一个silence,stream type用的是music,当在home界面调音量的时候,会去底层get stream type,如果此时在震动,则会get到music的stream type,所以会变成调节的是media的音量等级。
解法:请做以下修改(以下修改处以"AAAA"标识):
1)修改/alps/system/core/include/system/audio.h
/*Audiostreamtypes*/
typedefenum{
AUDIO_STREAM_DEFAULT=-1,
AUDIO_STREAM_VOICE_CALL=0,
AUDIO_STREAM_SYSTEM=1,
AUDIO_STREAM_RING=2,
AUDIO_STREAM_MUSIC=3,
AUDIO_STREAM_ALARM=4,
AUDIO_STREAM_NOTIFICATION=5,
AUDIO_STREAM_bluetooth_SCO=6,
AUDIO_STREAM_ENFORCED_AUDIBLE=7,/*Soundsthatcannotbemutedbyuserandmustberoutedtospeaker*/
AUDIO_STREAM_DTMF=8,
AUDIO_STREAM_TTS=9,
//#ifdefMTK_AUDIO
AUDIO_STREAM_FM=10,
AUDIO_STREAM_MATV=11,
AUDIO_STREAM_BOOT=12,//onlyusedforbootanimationandoutputfROMspeakerandheADSet
AUDIO_STREAM_VIBSPK=13,//AAAA,此处新增一个这种streamtype
//#endif
AUDIO_STREAM_CNT,
AUDIO_STREAM_MAX=AUDIO_STREAM_CNT-1,
}audio_stream_type_t;
2)修改/alps/hardware/libhardware_legacy/include/hardware_legacy/AudioSystemLegacy.h
classAudioSystem{
public:
#if1
enumstream_type{
DEFAULT=-1,
VOICE_CALL=0,
SYSTEM=1,
RING=2,
MUSIC=3,
ALARM=4,
NOTIFICATION=5,
BLUETOOTH_SCO=6,
ENFORCED_AUDIBLE=7,//Soundsthatcannotbemutedbyuserandmustberoutedtospeaker
DTMF=8,
TTS=9,
//#ifndefandroid_DEFAULT_CODE
#if1
FM=10,
MATV=11,
BOOT=12,//onlyusedforbootanimationandoutputfromspeakerandheadset
VIBSPK=13,//AAAA,此处新增一个这种streamtype
#endif
NUM_STREAM_TYPES
};
3)修改/alps/mediatek/platform/common/hardware/audio/AudioMTKPolicyManager.cpp
AudioMTKPolicyManager::routing_strategyAudioMTKPolicyManager::getStrategy(
AudioSystem::stream_typestream){
//streamtostrategymapping
switch(stream){
caseAudioSystem::VOICE_CALL:
caseAudioSystem::BLUETOOTH_SCO:
returnSTRATEGY_PHONE;
caseAudioSystem::RING:
caseAudioSystem::ALARM:
returnSTRATEGY_SONIFICATION;
caseAudioSystem::NOTIFICATION:
returnSTRATEGY_SONIFICATION_RESPECTFUL;
caseAudioSystem:TMF:
returnSTRATEGY_DTMF;
#ifdefMTK_AUDIO
//FManDMATVstrategy
caseAudioSystem::FM:
#ifdefFM_ANALOG_IN_SUPPORT
returnSTRATEGY_PROPRIETARY_ANLG;#else
returnSTRATEGY_PROPRIETARY_DGTL;#endif
caseAudioSystem::MATV:
#ifdefMATV_AUDIO_SUPPORT
if(matv_use_analog_input==1)
returnSTRATEGY_PROPRIETARY_ANLG_V2;
else
returnSTRATEGY_PROPRIETARY_DGTL_V2;#endif
#endif//#ifndefANDROID_DEFAULT_CODE
default:
//ALOGE("unknownstreamtype");
caseAudioSystem::SYSTEM:
//NOTE:SYSTEMStreamusesMEDIAstrategybecausemutingmusicandswitchingoutputs
//whilekeyCLIcksareplayedproducesapoorresult
caseAudioSystem::TTS:
caseAudioSystem::MUSIC:
#ifdefMTK_AUDIO
caseAudioSystem::BOOT:
caseAudioSystem::VIBSPK://AAAA,添加此处
#endif
returnSTRATEGY_MEDIA;
caseAudioSystem::ENFORCED_AUDIBLE:
returnSTRATEGY_ENFORCED_AUDIBLE;
}
}
constAudioMTKPolicyManager::VolumeCurvePoint
*AudioMTKPolicyManager::sVolumeProfiles[AUDIO_STREAM_CNT]
[AudioMTKPolicyManager::DEVICE_CATEGORY_CNT]={
。
{
//AUDIO_STREAM_ATV
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{
//AUDIO_STREAM_BOOT
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{//AAAA,添加以下
//AUDIO_STREAM_VIBSPK
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
}//AAAA,添加以上
#endif
};
4)修改/alps/mediatek/platform/common/hardware/audio/AudioPolicyManagerBase.cpp
修改/alps/hardware/libhardware_legacy/audio/AudioPolicyManagerBase.cpp
constAudioPolicyManagerBase::VolumeCurvePoint
*AudioPolicyManagerBase::sVolumeProfiles[AUDIO_STREAM_CNT]
[AudioPolicyManagerBase::DEVICE_CATEGORY_CNT]={
。
{
//AUDIO_STREAM_ATV
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{
//AUDIO_STREAM_BOOT
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{//AUDIO_STREAM_VIBSPK//AAAA,添加以下
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},//AAAA,添加以上
};
5)修改/alps/mediatek/protect-bsp/php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/av/media/liBMTkplayer/VibSpkAudioPlayer.cpp
VibSpkAudioPlayer*VibSpkAudioPlayer::getInstance(){
if(VibSpkAudioPlayerInstance==NULL)
{
SXLOGD("GetInstance,Constructor\n");
VibSpkAudioPlayerInstance=newVibSpkAudioPlayer(AUDIO_STREAM_VIBSPK,0,false);//AAAA,修改此处
//VibSpkAudioPlayerInstance=newVibSpkAudioPlayer(AUDIO_STREAM_NOTIFICATION,0,false);
SXLOGD("GetInstance,Constructordone\n");
}
returnVibSpkAudioPlayerInstance;
}
如果以上修改OK的话,请申请patch:ALPS00845976
[DESCRIPTION]
问题:使用震动喇叭,打开mtk_VIBSPK_SUPPORT,通过音量键在home界面调节音量,经常出现按一下没有提示音的情况,观察音量图标,发现调的是media的音量等级,而不是ring的音量等级。进入setting,把震动关掉,此问题就不再复现。只要是在震动的时候去home见面调音量键,就可以必现这个问题。
[SOLUTION]
原因:这是因为震动的时候会播放一个silence,stream type用的是music,当在home界面调音量的时候,会去底层get stream type,如果此时在震动,则会get到music的stream type,所以会变成调节的是media的音量等级。
解法:请做以下修改(以下修改处以"AAAA"标识):
1)修改/alps/system/core/include/system/audio.h
/*Audiostreamtypes*/
typedefenum{
AUDIO_STREAM_DEFAULT=-1,
AUDIO_STREAM_VOICE_CALL=0,
AUDIO_STREAM_SYSTEM=1,
AUDIO_STREAM_RING=2,
AUDIO_STREAM_MUSIC=3,
AUDIO_STREAM_ALARM=4,
AUDIO_STREAM_NOTIFICATION=5,
AUDIO_STREAM_bluetooth_SCO=6,
AUDIO_STREAM_ENFORCED_AUDIBLE=7,/*Soundsthatcannotbemutedbyuserandmustberoutedtospeaker*/
AUDIO_STREAM_DTMF=8,
AUDIO_STREAM_TTS=9,
//#ifdefMTK_AUDIO
AUDIO_STREAM_FM=10,
AUDIO_STREAM_MATV=11,
AUDIO_STREAM_BOOT=12,//onlyusedforbootanimationandoutputfROMspeakerandheADSet
AUDIO_STREAM_VIBSPK=13,//AAAA,此处新增一个这种streamtype
//#endif
AUDIO_STREAM_CNT,
AUDIO_STREAM_MAX=AUDIO_STREAM_CNT-1,
}audio_stream_type_t;
2)修改/alps/hardware/libhardware_legacy/include/hardware_legacy/AudioSystemLegacy.h
classAudioSystem{
public:
#if1
enumstream_type{
DEFAULT=-1,
VOICE_CALL=0,
SYSTEM=1,
RING=2,
MUSIC=3,
ALARM=4,
NOTIFICATION=5,
BLUETOOTH_SCO=6,
ENFORCED_AUDIBLE=7,//Soundsthatcannotbemutedbyuserandmustberoutedtospeaker
DTMF=8,
TTS=9,
//#ifndefandroid_DEFAULT_CODE
#if1
FM=10,
MATV=11,
BOOT=12,//onlyusedforbootanimationandoutputfromspeakerandheadset
VIBSPK=13,//AAAA,此处新增一个这种streamtype
#endif
NUM_STREAM_TYPES
};
3)修改/alps/mediatek/platform/common/hardware/audio/AudioMTKPolicyManager.cpp
AudioMTKPolicyManager::routing_strategyAudioMTKPolicyManager::getStrategy(
AudioSystem::stream_typestream){
//streamtostrategymapping
switch(stream){
caseAudioSystem::VOICE_CALL:
caseAudioSystem::BLUETOOTH_SCO:
returnSTRATEGY_PHONE;
caseAudioSystem::RING:
caseAudioSystem::ALARM:
returnSTRATEGY_SONIFICATION;
caseAudioSystem::NOTIFICATION:
returnSTRATEGY_SONIFICATION_RESPECTFUL;
caseAudioSystem:TMF:
returnSTRATEGY_DTMF;
#ifdefMTK_AUDIO
//FManDMATVstrategy
caseAudioSystem::FM:
#ifdefFM_ANALOG_IN_SUPPORT
returnSTRATEGY_PROPRIETARY_ANLG;#else
returnSTRATEGY_PROPRIETARY_DGTL;#endif
caseAudioSystem::MATV:
#ifdefMATV_AUDIO_SUPPORT
if(matv_use_analog_input==1)
returnSTRATEGY_PROPRIETARY_ANLG_V2;
else
returnSTRATEGY_PROPRIETARY_DGTL_V2;#endif
#endif//#ifndefANDROID_DEFAULT_CODE
default:
//ALOGE("unknownstreamtype");
caseAudioSystem::SYSTEM:
//NOTE:SYSTEMStreamusesMEDIAstrategybecausemutingmusicandswitchingoutputs
//whilekeyCLIcksareplayedproducesapoorresult
caseAudioSystem::TTS:
caseAudioSystem::MUSIC:
#ifdefMTK_AUDIO
caseAudioSystem::BOOT:
caseAudioSystem::VIBSPK://AAAA,添加此处
#endif
returnSTRATEGY_MEDIA;
caseAudioSystem::ENFORCED_AUDIBLE:
returnSTRATEGY_ENFORCED_AUDIBLE;
}
}
constAudioMTKPolicyManager::VolumeCurvePoint
*AudioMTKPolicyManager::sVolumeProfiles[AUDIO_STREAM_CNT]
[AudioMTKPolicyManager::DEVICE_CATEGORY_CNT]={
。
{
//AUDIO_STREAM_ATV
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{
//AUDIO_STREAM_BOOT
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{//AAAA,添加以下
//AUDIO_STREAM_VIBSPK
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
}//AAAA,添加以上
#endif
};
4)修改/alps/mediatek/platform/common/hardware/audio/AudioPolicyManagerBase.cpp
修改/alps/hardware/libhardware_legacy/audio/AudioPolicyManagerBase.cpp
constAudioPolicyManagerBase::VolumeCurvePoint
*AudioPolicyManagerBase::sVolumeProfiles[AUDIO_STREAM_CNT]
[AudioPolicyManagerBase::DEVICE_CATEGORY_CNT]={
。
{
//AUDIO_STREAM_ATV
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{
//AUDIO_STREAM_BOOT
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},
{//AUDIO_STREAM_VIBSPK//AAAA,添加以下
sDefaultMediaVolumeCurve,//DEVICE_CATEGORY_HEADSET
sSpeakerMediaVolumeCurve,//DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve//DEVICE_CATEGORY_EARPIECE
},//AAAA,添加以上
};
5)修改/alps/mediatek/protect-bsp/php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/av/media/liBMTkplayer/VibSpkAudioPlayer.cpp
VibSpkAudioPlayer*VibSpkAudioPlayer::getInstance(){
if(VibSpkAudioPlayerInstance==NULL)
{
SXLOGD("GetInstance,Constructor\n");
VibSpkAudioPlayerInstance=newVibSpkAudioPlayer(AUDIO_STREAM_VIBSPK,0,false);//AAAA,修改此处
//VibSpkAudioPlayerInstance=newVibSpkAudioPlayer(AUDIO_STREAM_NOTIFICATION,0,false);
SXLOGD("GetInstance,Constructordone\n");
}
returnVibSpkAudioPlayerInstance;
}
如果以上修改OK的话,请申请patch:ALPS00845976