How to set the default ringtones for Android calls and how to set the default ringtones for voice calls
1. Implementation of the default setting of Android incoming call ringtones andoird the default setting of incoming call ringtones is to modify the value of build/target/product/core.mk's ro.config.ringtoneas ro.config.ringtone?backroad.ogg, this music file must be in framework/base/data/sounds/android. add music files to MK. Framework/base/Media/Java/Android/Media/mediascanner. during class initialization in Java, the variable mdefaultringtonefilename = systemproperties for the name of the default ringtone will be set. get (default_ringtone_property_prefix + setting. system. ringtone); The mediascanner class will search for music files, which must be inserted into the database. During the search process, check whether it is the same as the set default ringtone. If it is the same, set it to the default ringtone .} Else if (ringtones & mwasemptypriortoscan &&! Mdefaultringtoneset ){
If (textutils. isempty (mdefaultringtonefilename) |
Doespathhavefilename (entry. mpath, mdefaultringtonefilename )){
Setsettingifnotset (settings. system. ringtone, tableuri, rowid );
Setprofilesettings (audioprofilemanager. type_ringtone, tableuri, rowid );
Mdefaultringtoneset = true;
}
When you set the voice to the connected voice, you must first add ro.config.videocall1_bentleydubs.ogg in core.mk. Add two new member variables to the framework/base/Media/Java/Android/Media/mediascanner. Java class.
Private Boolean mdefavidevideocallset;
Private string mdefaultvideocallfilename; Add the following code in the setdefaultringtonefilenames () method to initialize the name of the default ringtone File
Mdefaultvideocallfilename = systemproperties. Get (default_ringtone_property_prefix
+ Settings. system. video_call );
Add the following code to the endfile () method to set the default ringtone for a voice call} else if (ringtones & mwasemptypriortoscan &&! Mdefaultvideocallset ){
If (textutils. isempty (mdefavidevideocallfilename) |
Doespathhavefilename (entry. mpath, mdefavidevideocallfilename )){
Setsettingifnotset (settings. system. video_call, tableuri, rowid );
Setprofilesettings (audioprofilemanager. type_video_call, tableuri, rowid );
Mdefaultvideocallset = true;
}
}