mt6735 如何设置视频来电的默认铃声
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
背景:
原始设计语音来电铃声和视频来电铃声是一起设置的。即设置的默认铃声同时是语音来电和视频来电的铃声。
只想单独设置视频来电的默认铃声。
参考原先来电铃声的设置机制,给视频来电铃声单独设置属性写默认的铃声名称,然后在文件扫描时,判断扫描到的文件是设置的默认视频铃声的文件名,则在 database 中填写视频来电的键值为此铃声;
PS:被设置的铃声首先要存在于系统中,关于如何添加系统铃声请参考”FAQ06323[Audio Profile]如何添加以及删减特定的默认通知铃声,如何设置默认铃声”;
[SOLUTION]
1,添加Video Call默认铃声的属性:
alps\build\target\product\core.mk中添加“ro.config.video_call”:
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=Proxima.ogg \
ro.config.alARM_alert=Alarm_Classic.ogg \
ro.config.ringtone=Backroad.ogg \
ro.config.video_call=VideocallRt.ogg
2,添加对扫描到文件的判断是否是默认Vide Call的默认铃声:
alps\php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\media\java\android\media\mediascanner.java:
1),添加成员变量用做后面的判断:
private String mDefaultRingtoneFilename;
private String mDefaultVideocallFilename;
private boolean mDefaultRingtoneSet;
private boolean mDefaultVideoCallSet;
private static final String RINGTONE_SET = "ringtone_set";
private static final String VIDEOCALL_SET = "videocall_set";
2):添加读取video call默认铃声的系统属性:
private void setDefaultRingtoneFileNames() {
mDefaultRingtoneFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.RINGTONE);
mDefaultVideocallFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.VIDEO_CALL);//add this line
...
}
3):添加对扫描到的文件是否是视频来电默认铃声的判断:
参考标有//start modify”和//end modify”中间包含的为添加整段code,"//add this line"和”Modify this line"为添加添加的语句和修改的语句。
并请留意“else if (ringtones && doesSettingEmpty(RINGTONE_SET)&&!videocall) {”中要一定注释掉对VideoCall的设置:
private Uri endFile(){
boolean isVideoCall = false; //add this line;
boolean isVoiceCall = false; //add this line, in case the video call and voice call
have same ringtone;
.....
if (notifications &&((mWasEmptyPrioRTOScan && !mDefaultNotificationSet) ||
doesSettingEmpty(NOTIFICATION_SET))) {
....
//start modify
} else if(ringtones && ((mWasEmptyPriorToScan &&
(!mDefaultRingtoneSet||!mDefaultVideoCallSet)) ||doesSettingEmpty(RINGTONE_SET)||
doesSettingEmpty(VIDEOCALL_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.");
}
if (TextUtils.isEmpty(mDefaultVideocallFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultVideocallFilename)) {
needToSetSettings = true;
isVideoCall = true;
/// M: Adds log to debug setting ringtones.
Xlog.v(TAG, "endFile: needToSetRingtone=true.");
}
} else if (alarms && ((mWasEmptyPriorToScan && !mDefaultAlarmSet) ||
doesSettingEmpty(ALARM_SET))) {
...
}
...
if(needToSetSettings) {
if (notifications && doesSettingEmpty(NOTIFICATION_SET)) {
.....
//start modify
} else if (ringtones &&
(doesSettingEmpty(RINGTONE_SET)||doesSettingEmpty(VIDEOCALL_SET)) {
if(isVideoCall ){
setSettingIfNotSet(Settings.System.VIDEO_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL, tableUri, rowId);
mDefaultVideoCallSet = true;
setSettingFlag(VIDEOCALL_SET);
}
if(isVoiceCall ){
setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId);
// setSettingIfNotSet(Settings.System.VIDEO_CALL, tableUri, rowId); //modify this line
setSettingIfNotSet(Settings.System.SIP_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_RINGTONE, tableUri, rowId);
// setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL, tableUri, rowId);//modify this
line
setProfileSettings(RingtoneManager.TYPE_SIP_CALL, tableUri, rowId);
mDefaultRingtoneSet = true;
setSettingFlag(RINGTONE_SET);
}
Xlog.v(TAG, "endFile: set ringtone. uri=" + tableUri + ", rowId=" + rowId);
//end modify
}else if (alarms && doesSettingEmpty(ALARM_SET)) {
....
}
背景:
原始设计语音来电铃声和视频来电铃声是一起设置的。即设置的默认铃声同时是语音来电和视频来电的铃声。
只想单独设置视频来电的默认铃声。
参考原先来电铃声的设置机制,给视频来电铃声单独设置属性写默认的铃声名称,然后在文件扫描时,判断扫描到的文件是设置的默认视频铃声的文件名,则在 database 中填写视频来电的键值为此铃声;
PS:被设置的铃声首先要存在于系统中,关于如何添加系统铃声请参考”FAQ06323[Audio Profile]如何添加以及删减特定的默认通知铃声,如何设置默认铃声”;
[SOLUTION]
1,添加Video Call默认铃声的属性:
alps\build\target\product\core.mk中添加“ro.config.video_call”:
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=Proxima.ogg \
ro.config.alARM_alert=Alarm_Classic.ogg \
ro.config.ringtone=Backroad.ogg \
ro.config.video_call=VideocallRt.ogg
2,添加对扫描到文件的判断是否是默认Vide Call的默认铃声:
alps\php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\media\java\android\media\mediascanner.java:
1),添加成员变量用做后面的判断:
private String mDefaultRingtoneFilename;
private String mDefaultVideocallFilename;
private boolean mDefaultRingtoneSet;
private boolean mDefaultVideoCallSet;
private static final String RINGTONE_SET = "ringtone_set";
private static final String VIDEOCALL_SET = "videocall_set";
2):添加读取video call默认铃声的系统属性:
private void setDefaultRingtoneFileNames() {
mDefaultRingtoneFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.RINGTONE);
mDefaultVideocallFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.VIDEO_CALL);//add this line
...
}
3):添加对扫描到的文件是否是视频来电默认铃声的判断:
参考标有//start modify”和//end modify”中间包含的为添加整段code,"//add this line"和”Modify this line"为添加添加的语句和修改的语句。
并请留意“else if (ringtones && doesSettingEmpty(RINGTONE_SET)&&!videocall) {”中要一定注释掉对VideoCall的设置:
private Uri endFile(){
boolean isVideoCall = false; //add this line;
boolean isVoiceCall = false; //add this line, in case the video call and voice call
have same ringtone;
.....
if (notifications &&((mWasEmptyPrioRTOScan && !mDefaultNotificationSet) ||
doesSettingEmpty(NOTIFICATION_SET))) {
....
//start modify
} else if(ringtones && ((mWasEmptyPriorToScan &&
(!mDefaultRingtoneSet||!mDefaultVideoCallSet)) ||doesSettingEmpty(RINGTONE_SET)||
doesSettingEmpty(VIDEOCALL_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.");
}
if (TextUtils.isEmpty(mDefaultVideocallFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultVideocallFilename)) {
needToSetSettings = true;
isVideoCall = true;
/// M: Adds log to debug setting ringtones.
Xlog.v(TAG, "endFile: needToSetRingtone=true.");
}
} else if (alarms && ((mWasEmptyPriorToScan && !mDefaultAlarmSet) ||
doesSettingEmpty(ALARM_SET))) {
...
}
...
if(needToSetSettings) {
if (notifications && doesSettingEmpty(NOTIFICATION_SET)) {
.....
//start modify
} else if (ringtones &&
(doesSettingEmpty(RINGTONE_SET)||doesSettingEmpty(VIDEOCALL_SET)) {
if(isVideoCall ){
setSettingIfNotSet(Settings.System.VIDEO_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL, tableUri, rowId);
mDefaultVideoCallSet = true;
setSettingFlag(VIDEOCALL_SET);
}
if(isVoiceCall ){
setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId);
// setSettingIfNotSet(Settings.System.VIDEO_CALL, tableUri, rowId); //modify this line
setSettingIfNotSet(Settings.System.SIP_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_RINGTONE, tableUri, rowId);
// setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL, tableUri, rowId);//modify this
line
setProfileSettings(RingtoneManager.TYPE_SIP_CALL, tableUri, rowId);
mDefaultRingtoneSet = true;
setSettingFlag(RINGTONE_SET);
}
Xlog.v(TAG, "endFile: set ringtone. uri=" + tableUri + ", rowId=" + rowId);
//end modify
}else if (alarms && doesSettingEmpty(ALARM_SET)) {
....
}