How does Android set the default ringtone for video calls?

Source: Internet
Author: User

 

 

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 )){
....
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.