Android in music player set a song for incoming call ringtone, setting does not work

Source: Internet
Author: User

Audioprofile, situational mode, multi-card settings ringtones
The system turns on Multi_ringtone_support. Go to menu--music--song list--long press a song select Set as Phone ringtone, prompt has been set successfully, but into the settings in the profile view, is still the default ringtone. The ringtone is also the default ringtone after the call.
Modify:
Audioprofileservice.java
Mringtoneobserver = new Contentobserver (new Handler ()) function
Case General:
Case Outdoor:
if (Mext.shouldsyncgeneralringtonetooutdoor ()) {
If ringtone have been changed and the active profile are general
or outdoor profile, synchronize the current system ringtone
to both profiles.
if (Ispassivechange && (!mresetflag)) {
String Generalkey = Mpredefinedkeys.get (Scenario.GENERAL.ordinal ());
String Outdoorkey = Mpredefinedkeys.get (Scenario.OUTDOOR.ordinal ());
Getprofilestate (Generalkey, msimid). Mringerstream = Systemuri;
Getprofilestate (Outdoorkey, msimid). Mringerstream = Systemuri;
Persistringtoneuritodatabase (Generalkey, Audioprofilemanager.type_ringtone, Msimid, SystemUri);
Persistringtoneuritodatabase (Outdoorkey, Audioprofilemanager.type_ringtone, Msimid, SystemUri);
LOG.D (TAG, "Ringtone changed by other apps in Non-silent"
+ "profile, synchronize to active profile:new uri =" + Systemuri);
} else {
LOG.D (TAG, "Ringtone changed by itself, do nothing!");
}
Break
}
Change to look like this
Case General:
Case Outdoor:
if (Mext.shouldsyncgeneralringtonetooutdoor ()) {
If ringtone have been changed and the active profile are general
or outdoor profile, synchronize the current system ringtone
to both profiles.
if (Ispassivechange && (!mresetflag)) {
M:for Setringtoneformprofile or from 3rd app
if (Featureoption.mtk_multisim_ringtone_support) {
Add to get selected SIM ID
list<siminfo> simlist = siminfo.getinsertedsimlist (Mcontext);
int simnum = Simlist.size ();
LOG.D (TAG, "simlist.size () = =" + Simnum);
Long simid =-1;
for (int i = 0; i < Simnum; i++) {
Simid = Simlist.get (i). Msimid;

String Generalkey = Mpredefinedkeys.get (Scenario.GENERAL.ordinal ());
String Outdoorkey = Mpredefinedkeys.get (Scenario.OUTDOOR.ordinal ());
Getprofilestate (Generalkey, simid). Mringerstream = Systemuri;
Getprofilestate (Outdoorkey, simid). Mringerstream = Systemuri;
Persistringtoneuritodatabase (Generalkey, Audioprofilemanager.type_ringtone, Simid, SystemUri);
Persistringtoneuritodatabase (Outdoorkey, Audioprofilemanager.type_ringtone, Simid, SystemUri);
LOG.D (TAG, "Ringtone changed by other apps in Non-silent"
+ "profile, synchronize to active profile:new uri =" + Systemuri);
LOG.D (TAG, "Mringtoneobserver simid" + simid);
}
}else {
String Generalkey = Mpredefinedkeys.get (Scenario.GENERAL.ordinal ());
String Outdoorkey = Mpredefinedkeys.get (Scenario.OUTDOOR.ordinal ());
Getprofilestate (Generalkey, msimid). Mringerstream = Systemuri;
Getprofilestate (Outdoorkey, msimid). Mringerstream = Systemuri;
Persistringtoneuritodatabase (Generalkey, Audioprofilemanager.type_ringtone, Msimid, SystemUri);
Persistringtoneuritodatabase (Outdoorkey, Audioprofilemanager.type_ringtone, Msimid, SystemUri);
LOG.D (TAG, "Ringtone changed by other apps in Non-silent"
+ "profile, synchronize to active profile:new uri =" + Systemuri);
}

} else {
LOG.D (TAG, "Ringtone changed by itself, do nothing!");
}
Break
}
Similarly, the custom case should also be handled
Case CUSTOM:
if (Ispassivechange && (!mresetflag)) {
Activestate.mringerstream = Systemuri;
Persistringtoneuritodatabase (Mactiveprofilekey,audioprofilemanager.type_ringtone,msimid,systemuri);
LOG.D (...);
} else {
LOG.D (...);
}
Break
Switch
Case CUSTOM:
if (Ispassivechange && (!mresetflag)) {
if (Featureoption.mtk_multisim_ringtone_support) {
Add to get selected SIM ID
list<siminfo> simlist = siminfo.getinsertedsimlist (Mcontext);
int simnum = Simlist.size ();
LOG.D (TAG, "simlist.size () = =" + Simnum);
Long simid =-1;
for (int i = 0; i < Simnum; i++) {
Simid = Simlist.get (i). Msimid;
Persistringtoneuritodatabase (Mactiveprofilekey,audioprofilemanager.type_ringtone, SimId,systemUri);
}
} else {
Activestate.mringerstream = Systemuri;
Persistringtoneuritodatabase (Mactiveprofilekey,audioprofilemanager.type_ringtone,msimid,systemuri);
LOG.D (...);
}
} else {
LOG.D (...);
}
Break

Android in music player set a song for incoming call ringtone, setting does not work

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.