mt6735 L版本打开双卡铃声后,情景模式中设置来电铃声,添加“无...
时间:10-02
整理:3721RD
点击:
[Audio Profile]L版本打开双卡铃声后,情景模式中设置来电铃声,添加“无”选项之后不能保存状态
[DESCRIPTION]
本文描述L版本,打开双卡铃声的宏 mtk_MULTISIM_RINGTONE 之后,情景模式中设置来电铃声,添加“无”选项之后不能保存状态。
如果没有打开双卡铃声,可直接按照FAQ12741即可(KK、L版本均可)。
打开双卡铃声的宏,合入FAQ12741之后,会存在问题:SIM1可以保存,SIM2不可以保存。
[SOLUTION]
先按照
ID: FAQ12741
[Audio Profile]情景模式中设置来电铃声,添加“无”选项之后不能保存状态
合入之后,再继续进行下面的合入:
1.telecomm下面的 ringer.java
import android.media.RingtoneManager.java
startRingingOrCallWaiting(){
...
AudioProfileManager audioProfileMgr =
(AudioProfileManager)mContext.getSystEMService(Context.AUDIO_PROFILE_SERVI
CE);
Uri ringtoneUri =
audioProfileMgr.getRingtoneUri(audioProfileMgr.getActiveProfileKey(),
AudioProfileManager.TYPE_RINGTONE, subId);
boolean
isSilentRingUri=audioProfileMgr.isSilentNotificationUri(audioProfileMgr.ge
tActiveProfileKey(), AudioProfileManager.TYPE_RINGTONE, subId);
if (isSilentRingUri){ //modify for FAQ12741
ringtoneUri = Uri.parse(SILENT_NOTIFICATION_URI);
}
if(false==isSilentRingUri && -
1==RingtoneManager.validRingtoneUri(mContext, ringtoneUri)){
ringtoneUri =
audioProfileMgr.getDefaultRingtone(AudioProfileManager.TYPE_RINGTONE);
}
Log.d(this, "subscriber id: "+subId+" ringtoneUri: "+ringtoneUri);
Uri contactRingtoneUri = foregroundCall.getRingtone();
mRingtonePlayer.play(contactRingtoneUri == null ? ringtoneUri :
contactRingtoneUri);
...
}
如果没有validRingtoneUri的话(版本不一样),就请更换为isRingtoneExist(),并且在调用的地方相应的返回值用== false来判断
2. AudioProfileManager.java里面增加如下函数:
public boolean isSilentNotificationUri(String profileKey, int callType,
long simId){//modify for FAQ12741
if (profileKey == null) {
Log.e(TAG, "getDefaultRingtoneUriWithSIM with null profile key!");
return false;
}
IAudioProfileService service = getService();
try {
return service.isSilentNotificationUri(profileKey, callType, simId);
} catch (RemoteException e) {
Log.e(TAG, "Dead object in isSilentNotificationUri", e);
return false;
}
}
3. AudioProfileService.java增加如下函数:
public boolean isSilentNotificationUri(String profileKey, int callType,
long simId){ //modify for FAQ12741
Uri customRingtoneUri = Settings.System.DEFAULT_RINGTONE_URI;
if (null == profileKey) {
Log.d(TAG, "getRingtoneUri with null profile key!");
return false;
}
switch (callType) {
case AudioProfileManager.TYPE_RINGTONE:
customRingtoneUri = getProfileState(profileKey, simId).mRingerStream;
break;
case AudioProfileManager.TYPE_VIDEO_CALL:
customRingtoneUri = getProfileState(profileKey, simId).mVideoCallStream;
break;
case AudioProfileManager.TYPE_SIP_CALL:
customRingtoneUri = getProfileState(profileKey, simId).mSIPCallStream;
break;
default:
Log.e(TAG, "isSilentNotificationUri with unsupport type!");
return false;
}
Log.e(TAG, "isSilentNotificationUri: profileKey = " + profileKey + ", type
= " + callType + ", uri = " + customRingtoneUri + ", simId = " + simId);
if (SILENT_NOTIFICATION_URI.equals(customRingtoneUri)) {
return true;
}
return false;
}
4. 在iAudioProfileService.aidl文件里将该函数定义加上
boolean isSilentNotificationUri(String profileKey, int callType, long
simId);
5. AsyncRingtonePlayer.java
(1)定义
public static final String SILENT_NOTIFICATION_URI =
"com.mediatek.uri.silent_notificaton";
(2) 修改 handlePlay()如下
private void handlePlay(Uri ringtoneUri) {
// don't bother with any of this if there is an EVENT_STOP waiting.
if (mHandler.hasMessages(EVENT_STOP)) {
return;
}
ThreadUtil.checkNotOnMainThread();
Log.i(this, "Play ringtone.");
//modify for FAQ12741 start
if(SILENT_NOTIFICATION_URI.equals(ringtoneUri.toString())){
Log.i(this, "ringtone uri is SILENT_NOTIFICATION_URI.");
handleStop();
return;
}
//modify for FAQ12741 end
if (mRingtone == null) {
mRingtone = getRingtone(ringtoneUri);
// Cancel everything if there is no ringtone.
if (mRingtone == null) {
handleStop();
return;
}
}
handleRepeat();
}
6.RingtonePickerActivity.java
onPrepareListView(){
...
if (mHasSilentItem) {
mSilentPos = addSilentItem(listView);
// The 'Silent' item should use a null Uri
if (mExistingUri == null|| mExistingUri.equals(SILENT_NOTIFICATION_URI)) {
// modify forFAQ12741
mCLIckedPos = mSilentPos;
}
}
...
}
完成之后, 需要先make update-api, 然后再 build
[DESCRIPTION]
本文描述L版本,打开双卡铃声的宏 mtk_MULTISIM_RINGTONE 之后,情景模式中设置来电铃声,添加“无”选项之后不能保存状态。
如果没有打开双卡铃声,可直接按照FAQ12741即可(KK、L版本均可)。
打开双卡铃声的宏,合入FAQ12741之后,会存在问题:SIM1可以保存,SIM2不可以保存。
[SOLUTION]
先按照
ID: FAQ12741
[Audio Profile]情景模式中设置来电铃声,添加“无”选项之后不能保存状态
合入之后,再继续进行下面的合入:
1.telecomm下面的 ringer.java
import android.media.RingtoneManager.java
startRingingOrCallWaiting(){
...
AudioProfileManager audioProfileMgr =
(AudioProfileManager)mContext.getSystEMService(Context.AUDIO_PROFILE_SERVI
CE);
Uri ringtoneUri =
audioProfileMgr.getRingtoneUri(audioProfileMgr.getActiveProfileKey(),
AudioProfileManager.TYPE_RINGTONE, subId);
boolean
isSilentRingUri=audioProfileMgr.isSilentNotificationUri(audioProfileMgr.ge
tActiveProfileKey(), AudioProfileManager.TYPE_RINGTONE, subId);
if (isSilentRingUri){ //modify for FAQ12741
ringtoneUri = Uri.parse(SILENT_NOTIFICATION_URI);
}
if(false==isSilentRingUri && -
1==RingtoneManager.validRingtoneUri(mContext, ringtoneUri)){
ringtoneUri =
audioProfileMgr.getDefaultRingtone(AudioProfileManager.TYPE_RINGTONE);
}
Log.d(this, "subscriber id: "+subId+" ringtoneUri: "+ringtoneUri);
Uri contactRingtoneUri = foregroundCall.getRingtone();
mRingtonePlayer.play(contactRingtoneUri == null ? ringtoneUri :
contactRingtoneUri);
...
}
如果没有validRingtoneUri的话(版本不一样),就请更换为isRingtoneExist(),并且在调用的地方相应的返回值用== false来判断
2. AudioProfileManager.java里面增加如下函数:
public boolean isSilentNotificationUri(String profileKey, int callType,
long simId){//modify for FAQ12741
if (profileKey == null) {
Log.e(TAG, "getDefaultRingtoneUriWithSIM with null profile key!");
return false;
}
IAudioProfileService service = getService();
try {
return service.isSilentNotificationUri(profileKey, callType, simId);
} catch (RemoteException e) {
Log.e(TAG, "Dead object in isSilentNotificationUri", e);
return false;
}
}
3. AudioProfileService.java增加如下函数:
public boolean isSilentNotificationUri(String profileKey, int callType,
long simId){ //modify for FAQ12741
Uri customRingtoneUri = Settings.System.DEFAULT_RINGTONE_URI;
if (null == profileKey) {
Log.d(TAG, "getRingtoneUri with null profile key!");
return false;
}
switch (callType) {
case AudioProfileManager.TYPE_RINGTONE:
customRingtoneUri = getProfileState(profileKey, simId).mRingerStream;
break;
case AudioProfileManager.TYPE_VIDEO_CALL:
customRingtoneUri = getProfileState(profileKey, simId).mVideoCallStream;
break;
case AudioProfileManager.TYPE_SIP_CALL:
customRingtoneUri = getProfileState(profileKey, simId).mSIPCallStream;
break;
default:
Log.e(TAG, "isSilentNotificationUri with unsupport type!");
return false;
}
Log.e(TAG, "isSilentNotificationUri: profileKey = " + profileKey + ", type
= " + callType + ", uri = " + customRingtoneUri + ", simId = " + simId);
if (SILENT_NOTIFICATION_URI.equals(customRingtoneUri)) {
return true;
}
return false;
}
4. 在iAudioProfileService.aidl文件里将该函数定义加上
boolean isSilentNotificationUri(String profileKey, int callType, long
simId);
5. AsyncRingtonePlayer.java
(1)定义
public static final String SILENT_NOTIFICATION_URI =
"com.mediatek.uri.silent_notificaton";
(2) 修改 handlePlay()如下
private void handlePlay(Uri ringtoneUri) {
// don't bother with any of this if there is an EVENT_STOP waiting.
if (mHandler.hasMessages(EVENT_STOP)) {
return;
}
ThreadUtil.checkNotOnMainThread();
Log.i(this, "Play ringtone.");
//modify for FAQ12741 start
if(SILENT_NOTIFICATION_URI.equals(ringtoneUri.toString())){
Log.i(this, "ringtone uri is SILENT_NOTIFICATION_URI.");
handleStop();
return;
}
//modify for FAQ12741 end
if (mRingtone == null) {
mRingtone = getRingtone(ringtoneUri);
// Cancel everything if there is no ringtone.
if (mRingtone == null) {
handleStop();
return;
}
}
handleRepeat();
}
6.RingtonePickerActivity.java
onPrepareListView(){
...
if (mHasSilentItem) {
mSilentPos = addSilentItem(listView);
// The 'Silent' item should use a null Uri
if (mExistingUri == null|| mExistingUri.equals(SILENT_NOTIFICATION_URI)) {
// modify forFAQ12741
mCLIckedPos = mSilentPos;
}
}
...
}
完成之后, 需要先make update-api, 然后再 build