微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > mt6735 如何分别配置视频铃声的卡1卡2默认铃声

mt6735 如何分别配置视频铃声的卡1卡2默认铃声

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]
按照 FAQ08273[Audio Profile]如何设置视频来电的默认铃声, 可以设置视频来电的默认铃声;
按照 FAQ09288 [Audio Profile]在合入双卡铃声设置后,如何分别配置卡1卡2的默认铃声, 可以分别配置语音来电铃声的卡1卡2的默认铃声; 但是怎么配置视频来电铃声的卡1卡2默认铃声呢?
[SOLUTION]
按照此FAQ修改的前提是,务必已经按照 FAQ09288 修改,并且编译通过,然后,进行下述修改:
1,alps\build\target\product\core.mk:
设置系统属性“ro.config.ringtone_SIM2”(原来的ro.config.ringtone给卡1用):
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=Proxima.ogg \
ro.config.alARM_alert=Alarm_Classic.ogg \
ro.config.ringtone=Backroad.ogg\
ro.config.ringtone_sim2=Carina.ogg\
ro.config.video_call=Draco.ogg\
ro.config.video_call_sim2=Eridani.ogg

2,php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/base/core/java/android/provider/Settings.java中:
添加卡2的铃声属性字段RINGTONE_SIM2,这个值与前面在core.mk中定义的属性的最后一个字段相同,如您定义为“ro.config.ringtone_sim2”,
则RINGTONE_SIM2为“RINGTONE_SIM2 = "ringtone_sim2",假设您定义的属性为“ro.config.ringtone_sim_id_2”
则对应的RINGTONE_SIM2="ringtone_sim_id_2",参考标有//add this line为添加的部分:
public static final String VIDEO_CALL = "video_call";
public static final String VIDEO_CALL_SIM2 = "video_call_sim2";//add this line

3,alps\frameworks\base\media\java\android\media\RintoneManager.java:
1),添加SIM2的type,参考//add this line为添加的部分:
public static final int TYPE_VIDEO_CALL = 8;
public static final int TYPE_SIP_CALL = 16;
public static final int TYPE_RINGTONE_SIM2 = 32;//add this line
public static final int TYPE_VIDEO_CALL_SIM2 = 64;//add this line
public static final String KEY_DEFAULT_RINGTONE_SIM2 =
"mtk_audioprofile_default_ringtone_sim2";
public static final String KEY_DEFAULT_VIDEO_CALL_SIM2 =
"mtk_audioprofile_default_video_call_sim2";//add this line

2) 返回获取的sim2的uri,参考//add this line为添加的部分:
public static Uri getDefaultRingtoneUri(Context context, int type) {
...
switch (type) {
case TYPE_VIDEO_CALL:
uriString = Settings.System.getString(resolver, KEY_DEFAULT_VIDEO_CALL);
break;
case TYPE_VIDEO_CALL_SIM2://add this line
uriString = Settings.System.getString(resolver,
KEY_DEFAULT_VIDEO_CALL_SIM2);//add this line
break;//add this line

4,alps\frameworks\base\media\java\android\media\MediaScanner.java中:
1),添加读取到的卡2 的默认铃声相关定义:
private boolean mDefaultVideoCallSet; //add
private boolean mDefaultVideoCallSim2Set; //add
private String mDefaultVideocallFilename; //add
private String mDefaultVideocallSim2Filename; //add
private static final String VIDEOCALL_SET = "videocall_set"; //add
private static final String VIDEOCALL_SIM2_SET = "videocall_sim2_set";
//add

2),将core.mk中定义的sim2 铃声的名字读出来,参考//add this line为添加的部
分:
private void setDefaultRingtoneFileNames() {
mDefaultVideocallFilename =
SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.VIDEO_CALL);//add this line
mDefaultVideocallSim2Filename =
SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.VIDEO_CALL_SIM2);//add this line
...
}

3),添加isSim2Ringtone来区别设置的是sim1还是sim2,然后将扫描到的文件名和上
面读到的sim2默认铃声文件名对比,如果是sim2 的ringtone,则设置sim2默认值。
参考注有"//add this line"或" //start modify"和"//end modify"包含的地方:
private Uri endFile(FileEntry entry, boolean ringtones, boolean
notifications,
boolean alarms, boolean music, boolean podcasts){
boolean isVideoCall = false; //add this line;
boolean isVoiceCall = false; //add this line, in case the video call and
voice call have same ringtone;
boolean isSim2Ringtone = false; //add this line
boolean isSim2VideoCall = false;//add this line
.....
if (notifications &&((mWasEmptyPrioRTOScan && !mDefaultNotificationSet) ||
doesSettingEmpty(NOTIFICATION_SET))) {
....
//start modify
} else if (ringtones && ((mWasEmptyPriorToScan &&
(!mDefaultRingtoneSet||!mDefaultRingtoneSim2Set || !mDefaultVideoCallSet||
!mDefaultVideoCallSim2Set)) ||
doesSettingEmpty(RINGTONE_SET)||doesSettingEmpty(RINGTONE_SIM2_SET)||doesS
ettingEmpty(VIDEOCALL_SET)||doesSettingEmpty(VIDEOCALL_SIM2_SET))) {
if (TextUtils.isEmpty(mDefaultRingtoneFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultRingtoneFilename)) {
needToSetSettings = true;
isVoiceCall = true; //add this line
/// M: Adds log to debug setting ringtones.
Xlog.v(TAG, "endFile: needToSetRingtone=true.");
}
else if(TextUtils.isEmpty(mDefaultRingtoneSim2Filename) ||
doesPathHaveFilename(entry.mPath, mDefaultRingtoneSim2Filename))
{
needToSetSettings = true;
isSim2Ringtone = true;
isVoiceCall = true; //add this line
Xlog.v(TAG, "endFile: needToSetRingtone=true.sim2 default ringtone");
}
else if(TextUtils.isEmpty(mDefaultVideocallFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultVideocallFilename))
{
needToSetSettings = true;
isVideoCall = true; //add this line
Xlog.v(TAG, "endFile: needToSetRingtone=true.videocall default ringtone");
}
else if(TextUtils.isEmpty(mDefaultVideocallSim2Filename) ||
doesPathHaveFilename(entry.mPath, mDefaultVideocallSim2Filename))
{
needToSetSettings = true;
isSim2VideoCall = true;
isVideoCall = true; //add this line
Xlog.v(TAG, "endFile: needToSetRingtone=true.videocall sim2 default
ringtone");
}
//end modify
} else if (alarms && ((mWasEmptyPriorToScan && !mDefaultAlarmSet) ||
doesSettingEmpty(ALARM_SET))) {
...
}
...
if(needToSetSettings) {
if (notifications && doesSettingEmpty(NOTIFICATION_SET)) {
.....
//start modify
} else if (ringtones &&
(doesSettingEmpty(RINGTONE_SET)||doesSettingEmpty(RINGTONE_SIM2_SET)||does
SettingEmpty(VIDEOCALL_SET)||doesSettingEmpty(VIDEOCALL_SIM2_SET))){
if(isVoiceCall){ //add
if(!isSim2Ringtone)
{
setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId);
setSettingIfNotSet(Settings.System.SIP_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_RINGTONE, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_SIP_CALL, tableUri, rowId);
mDefaultRingtoneSet = true;
setSettingFlag(RINGTONE_SET);
Xlog.v(TAG, "endFile: set ringtone. uri=" + tableUri + ", rowId=" +
rowId);
}else
{
setSettingIfNotSet(Settings.System.RINGTONE_SIM2, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_RINGTONE_SIM2, tableUri, rowId);
mDefaultRingtoneSim2Set = true;
setSettingFlag(RINGTONE_SIM2_SET);
Xlog.v(TAG, "endFile: set sim2 ringtone. uri=" + tableUri + ", rowId=" +
rowId);
}
}
if(isVideoCall){ //add
if(!isSim2VideoCall){
setSettingIfNotSet(Settings.System.VIDEO_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL, tableUri, rowId);
mDefaultVideoCallSet = true;
setSettingFlag(VIDEOCALL_SET);
Xlog.v(TAG, "ddd endFile: set video ringtone. uri=" + tableUri + ",
rowId=" + rowId);
}else{
setSettingIfNotSet(Settings.System.VIDEO_CALL_SIM2, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL_SIM2, tableUri, rowId);
mDefaultVideoCallSim2Set = true;
setSettingFlag(VIDEOCALL_SIM2_SET);
Xlog.v(TAG, "ddd endFile: set video sim2 ringtone. uri=" + tableUri + ",
rowId=" + rowId);
}
}
//end modify
}else if (alarms && doesSettingEmpty(ALARM_SET)) {
....
}

4),添加设置sim2铃声,参考//start modify 和//end modify的地方:
private void setProfileSettings(int type, Uri uri, long rowId) {
if(type == RingtoneManager.TYPE_NOTIFICATION) {
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_NOTIFICATION, uri, rowId);
} else if(type == RingtoneManager.TYPE_RINGTONE) {
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_RINGTONE, uri, rowId);
//start modify
} else if(type ==RingtoneManager.TYPE_RINGTONE_SIM2){
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_RINGTONE_SIM2, uri, rowId);
//end modify
} else if(type == RingtoneManager.TYPE_VIDEO_CALL) {
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_VIDEO_CALL, uri, rowId);
//start modify
} else if(type ==RingtoneManager.TYPE_VIDEO_CALL_SIM2){
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_VIDEO_CALL_SIM2, uri,
rowId);
//end modify
} else if(type == RingtoneManager.TYPE_SIP_CALL) {
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_SIP_CALL, uri, rowId);
} else if(type == RingtoneManager.TYPE_ALARM) {
setSettingIfNotSet(RingtoneManager.KEY_DEFAULT_ALARM, uri, rowId);
}
}

5alps\mediatek\frameworks\base\media\audio\java\com\mediatek\audioprofile\AudioProfileService.java:
1)定义给sim2 video call ringtone用的index,同时修改ringtone type的个数,由原来的5改成6,参考注有“//modify this line”和“//add this line”的地方
// mDefaultRingtone index
private static final int DEFAULT_RINGTONE_TYPE_CONUT = 6;//modify this
line
private static final int DEFAULT_RINGER_INDEX =
ProfileSettings.ringer_stream.ordinal();
private static final int DEFAULT_NOTIFICATION_INDEX =
ProfileSettings.notification_stream.ordinal();
private static final int DEFAULT_VIDEOCALL_INDEX =
ProfileSettings.videocall_Stream.ordinal();
private static final int DEFAULT_SIPCALL_INDEX =
ProfileSettings.sipcall_Stream.ordinal();
private static final int DEFAULT_RINGER_SIM2_INDEX =
ProfileSettings.ringer_sim2_stream.ordinal();//add this line
private static final int DEFAULT_VIDEOCALL_SIM2_INDEX =
ProfileSettings.videocall_sim2_stream.ordinal();//add this line

2)情景模式读铃声默认值时,添加读取sim2的默认值,参考//start modify和//end modify之间的修改:
private void readDefaultRingtones() {
....
// mDefaultRingtone[3] sip ringtone
uriString = Settings.System.getString(mContentResolver,
AudioProfileManager.KEY_DEFAULT_SIP_CALL);
uri = (uriString == null ? null : Uri.parse(uriString));
mDefaultRingtone.set(DEFAULT_SIPCALL_INDEX, uri);
//start modify
// mDefaultRingtone[4] vioce ringtone sim2
uriString = Settings.System.getString(mContentResolver,
AudioProfileManager.KEY_DEFAULT_RINGTONE_SIM2);
uri = (uriString == null ? null : Uri.parse(uriString));
mDefaultRingtone.set(DEFAULT_RINGER_SIM2_INDEX , uri);
//end modify
//start modify
// mDefaultRingtone[5] vioce videocall sim2
uriString = Settings.System.getString(mContentResolver,
AudioProfileManager.KEY_DEFAULT_VIDEO_CALL_SIM2);
uri = (uriString == null ? null : Uri.parse(uriString));
mDefaultRingtone.set(DEFAULT_VIDEOCALL_SIM2_INDEX , uri);
//end modify

3)import android.provider.Telephony.SIMInfo;
private void readPersistedSettings(String profileKey, long simId) {
...
//start modify
Uri videoCallUri;
if(slotId ==1)
videoCallUri = getPersistedValue(name,
initValues,mDefaultRingtone.get(DEFAULT_VIDEOCALL_SIM2_INDEX));
else
videoCallUri = getPersistedValue(name,
initValues,mDefaultRingtone.get(DEFAULT_VIDEOCALL_INDEX));
//end modify
name = AudioProfileManager.getStreamUriKey(profileKey,
AudioProfileManager.TYPE_NOTIFICATION);
Uri notificationUri = getPersistedValue(name, initValues,
mDefaultRingtone.get(DEFAULT_NOTIFICATION_INDEX));
...
}

6,alps\mediatek\frameworks\base\media\audio\java\com\mediatek\audioprofil
e\AudioProfileManager.java:
1) public static final String KEY_DEFAULT_VIDEO_CALL_SIM2 =
"mtk_audioprofile_default_video_call_sim2";//add this line

2) public enum ProfileSettings {
ringer_stream, notification_stream, videocall_Stream,
sipcall_Stream,ringer_sim2_stream, videocall_sim2_stream,//add this line
ringer_volume, notification_volume, alarm_volume,
vibration_enabled, DTMFtone_enabled, soundeffect_enbled,
hapticfeedback_enabled,
lockscreensound_enabled
}
修改思路与语音来电铃声大致相同。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top