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