立即注册
查看: 1064|回复: 0

[MTK软件经验分享] 11B1132版本,播放音乐或视频时,来短信无短信铃声

已绑定手机
已实名认证
发表于 2019-5-30 19:03:37 | 显示全部楼层 |阅读模式 来自 广东省深圳市
目前NMGR设计是背景如果在播放音乐,会直接播放 beep sound (DTMF tone).
若客户想要改为pause/resume 的方式,NMGR需要修改,
请修改
plutommi\Framework\Notification\NotificationSrc\Notification.c 文件,
1.新增变量
static MMI_BOOL need_resume_bk_play = MMI_FALSE;
2.
void mmi_frm_nmgr_control_end(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_FW_TRC_G1_FRM, TRC_MMI_FRM_NMGR_CONTROL_SND_END, noti_tone_id);
if (!(g_nmgr_block_tone_vib & MMI_FRM_NMGR_SOUND))
{
if (noti_tone_id != NONE_TONE)
{
srv_prof_stop_tone(noti_tone_id);
noti_tone_id = NONE_TONE;
}
else if (dtmf_id != NONE_TONE)
{
srv_prof_stop_tone(dtmf_id);
dtmf_id = NONE_TONE;
}
}
if (!(g_nmgr_block_tone_vib & MMI_FRM_NMGR_VIB))
{
if (nmgr_is_playing_vibrator())
{
srv_vibrator_post_req(VIB_PATTERN_1, PLAY_STOP);
vib_on = MMI_FALSE;
}
}
}
修改为如下:
void mmi_frm_nmgr_control_end(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_FW_TRC_G1_FRM, TRC_MMI_FRM_NMGR_CONTROL_SND_END, noti_tone_id);
if (!(g_nmgr_block_tone_vib & MMI_FRM_NMGR_SOUND))
{
if (noti_tone_id != NONE_TONE)
{
srv_prof_stop_tone(noti_tone_id);
noti_tone_id = NONE_TONE;
//add begin
if (need_resume_bk_play == MMI_TRUE)
{
mdi_audio_resume_background_play();
need_resume_bk_play = MMI_FALSE;
}
//add end
}
else if (dtmf_id != NONE_TONE)
{
srv_prof_stop_tone(dtmf_id);
dtmf_id = NONE_TONE;
}
}
if (!(g_nmgr_block_tone_vib & MMI_FRM_NMGR_VIB))
{
if (nmgr_is_playing_vibrator())
{
srv_vibrator_post_req(VIB_PATTERN_1, PLAY_STOP);
vib_on = MMI_FALSE;
}
}
}
3.
nmgr_sound_callback 修改为:
static srv_prof_ret nmgr_sound_callback(srv_prof_ret result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if(result == SRV_PROF_RET_TRY_TO_RECOVER)
{
return SRV_PROF_RET_YES;
}
noti_tone_id = NONE_TONE;
if (need_resume_bk_play == MMI_TRUE)
{
mdi_audio_resume_background_play();
need_resume_bk_play = MMI_FALSE;
}
return SRV_PROF_RET_SUCCESS;
}
4.新增is_need_to_suspend_bg_play function 定义,
static MMI_BOOL is_need_to_suspend_bg_play(mmi_scenario_id noti_scen_id)
{
if (noti_scen_id == MMI_SCENARIO_ID_NEW_SMS ||
noti_scen_id == MMI_SCENARIO_ID_NEW_mms ||
noti_scen_id == MMI_SCENARIO_ID_WAP_PUSH ||
noti_scen_id == MMI_SCENARIO_ID_REMINDER_OTHER)
{
return MMI_TRUE;
}
return MMI_FALSE;
}
5. control_sound 修改为:
static void control_sound(mmi_scenario_id noti_scen_id, srv_prof_tone_enum tone_id,
mmi_noti_attr_beha_enum behavior, mmi_nmgr_behavior_enum action, MMI_BOOL display_scrn)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_prof_ret snd_result;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (behavior == MMI_NOTI_SND_BEHA_NO_PLAY)
{
#ifdef MMI_NOTI_MGR_UT
play_sound = MMI_FALSE;
snd_action = action;
play_sound_id = tone_id;
#endif /* MMI_NOTI_MGR_UT */
return;
}
else
{
#ifdef MMI_NOTI_MGR_UT
play_sound = MMI_TRUE;
snd_action = action;
play_sound_id = tone_id;
#endif /* MMI_NOTI_MGR_UT */
}
if (action == MMI_BEHAVIOR_SND_CUSTOM)
{
INVOKE_CUSTOM_SOUND(noti_scen_id);
}
else
{
MMI_Assert(action == MMI_BEHAVIOR_SND_PROFILE || action == MMI_BEHAVIOR_SND_SUBTLE ||
action == MMI_BEHAVIOR_SND_SOFTNOTE);
if (!srv_prof_if_can_ring())
{
return;
}
if (tone_id == SRV_PROF_TONE_NONE)
{
return;
}
//add begin
if (is_need_to_suspend_bg_play(noti_scen_id) == MMI_TRUE)
{
mdi_audio_suspend_background_play();
need_resume_bk_play = MMI_TRUE;
}
//add end
。。。
}

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

合作/建议

TEL: 19168984579

工作时间:
周一到周五 9:00-11:30 13:30-19:30
  • 扫一扫关注公众号
  • 扫一扫打开小程序
Copyright © 2013-2024 一牛网 版权所有 All Rights Reserved. 帮助中心|隐私声明|联系我们|手机版|粤ICP备13053961号|营业执照|EDI证
在本版发帖搜索
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表