標籤:android io ar java for sp on log cti
AudioProfile,情景模式,多卡設定鈴聲
系統開啟Multi_ringtone_support。進入菜單--音樂--歌曲列表--長按一首歌曲選擇設為手機鈴聲,提示已成功設定,但是進入設定中情景模式查看,仍然是預設鈴聲。打電話後鈴聲還為預設鈴聲。
修改:
AudioProfileService.java
mRingtoneObserver = new ContentObserver(new Handler())函數裡面的
case GENERAL:
case OUTDOOR:
if (mExt.shouldSyncGeneralRingtoneToOutdoor()) {
// If ringtone has been changed and the active profile is 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 app in non-silent "
+ "profile, synchronize to active profile: new uri = " + systemUri);
} else {
Log.d(TAG, "Ringtone changed by itself, do nothing!");
}
break;
}
改為如下的樣子
case GENERAL:
case OUTDOOR:
if (mExt.shouldSyncGeneralRingtoneToOutdoor()) {
// If ringtone has been changed and the active profile is 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 app 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 app in non-silent "
+ "profile, synchronize to active profile: new uri = " + systemUri);
}
} else {
Log.d(TAG, "Ringtone changed by itself, do nothing!");
}
break;
}
同樣的,對於custom case 也要處理
Case CUSTOM:
if (isPassiveChange && (!mResetFlag )){
activeState.mRingerStream = systemUri;
persistRingtoneUriToDatabase(mActiveProfileKey,AudioProfileManager.TYPE_RINGTONE,mSimId,systemUri);
Log.d(…);
} else {
Log.d(…);
}
break;
改為,
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 在音樂播放器中設定一首歌曲為來電鈴聲,設定不起作用