Background:The original design of the voice call ringtone and video call ringtone are set together. That is, the Set Default ringtones are both voice calls and video calls.
Requirements:You only need to set the default ringtone for a video call.
Implementation ideas:Refer to the setting mechanism of the original incoming call ringtone, and set the attribute for the video incoming call ringtone separately to write the default ringtone name. Then, during file scanning, if the scanned file is the name of the default video ringtone, enter the video call key value in the database as the ringtone. PS: the preset ringtone must first exist in the system, for how to add system ringtones, see "FAQ06323 [Audio Profile] how to add and delete specific default notification ringtones and how to set default ringtones ";
1. Add the attributes of the default Video Call ringtone:Add "ro. config. video_call" to alpsuild argetproductcore. mk ":
PRODUCT_PROPERTY_OVERRIDES: =
Ro.config.icationication_sound?proxima.ogg
Ro.config.alarm_alertw.alarm_classic.ogg
Ro.config.ringtone?backroad.ogg
Ro.config.video_call=VideocallRt.ogg
2. Add the default ringtone for checking whether the scanned file is the default Vide Call:Alpsrameworksasemediajavaandroidmediamediascanner. java:
1) Add member variables for subsequent judgment:
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): add the system attribute for reading the default video call ringtone: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): adds a judgment on whether the scanned file is the default ringtone of a video call:Refer to the steps marked with "// start modify" and "// end modify" to add the entire code segment, // add this line and "Modify this line" are the added and modified statements. Please note that "else if (ringtones & doesSettingEmpty (RINGTONE_SET )&&! Videocall) {"must comment out the VideoCall settings:
Private Uri endFile (){
Boolean videocall = false; // add this line
.....
If (notifications & (mWasEmptyPriorToScan &&! Mdefanotifnotificationset) |
DoesSettingEmpty (icationication_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;
/// M: Adds log to debug setting ringtones.
Xlog. v (TAG, endFile: needToSetRingtone = true .);
} If (TextUtils. isEmpty (mdefavidevideocallfilename) |
DoesPathHaveFilename (entry. mPath, mdefavidevideocallfilename) {needToSetSettings = true;
Videocall = 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 (events & doesSettingEmpty (icationication_set )){
... // Start modify
} Else if (ringtones & (doesSettingEmpty (RINGTONE_SET) | doesSettingEmpty (VIDEOCALL_SET) {if (videocall) {setSettingIfNotSet (Settings. system. VIDEO_CALL, tableUri, rowId); setProfileSettings (RingtoneManager. TYPE_VIDEO_CALL, tableUri, rowId );
MDefaultVideoCallSet = true;
SetSettingFlag (VIDEOCALL_SET );
} Else {
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 )){
....
}