IMS Modify Call send request 发出升级视频请求

upgrade/downgrade 升降级,其实就是ModifyCall

流程图


界面入手

packages/apps/InCallUI

packages/apps/InCallUI/src/com/android/incallui/CallButtonFragment.Java

CallButtonFragment.java onClick()

case R.id.changeToVideoButton:

   if (call == null) {

       Log.i(this, "Call was null");

       return;

   }

   if (getResources().getBoolean(R.bool.config_regional_number_patterns_video_call) && //默认为false

       !CallUtil.isVideoCallNumValid(call.getNumber())) {

       Toast.makeText(this.getActivity(),

               R.string.toast_change_video_call_failed, Toast.LENGTH_LONG).show();

       return;

   }

   getPresenter().changeToVideoClicked();//切换为视频通话,实际是ModifyCall 后面可以看到调用

   break;

packages/apps/InCallUI/src/com/android/incallui/CallButtonPresenter.java

changeToVideoClicked()

本来还有一个changeToVoiceClick()的,不过没有使用。

public void changeToVideoClicked() {

   final Context context = getUi().getContext();

   if (QtiCallUtils.useExt(context)) {
  //为true,可以看下面的代码断

       QtiCallUtils.displayModifyCallOptions(mCall, context);//这里

       return;

   }



   VideoCall videoCall = mCall.getVideoCall();

   if (videoCall == null) {

       return;

   }

   int currVideoState = mCall.getVideoState();

   int currUnpausedVideoState = CallUtils.getUnPausedVideoState(currVideoState);

   currUnpausedVideoState |= VideoProfile.STATE_BIDIRECTIONAL;



   VideoProfile videoProfile = new VideoProfile(currUnpausedVideoState);

   videoCall.sendSessionModifyRequest(videoProfile);

   mCall.setSessionModificationState(Call.SessionModificationState.WAITING_FOR_RESPONSE);

}

packages/apps/InCallUI/src/com/android/incallui/QtiCallUtils.java

QtiCallUtils.java

/**

* Checks the boolean flag in config file to figure out if we are going to use Qti extension or

* not

*/

public static boolean useExt(Context context) {

   if (context == null) {

       Log.w(context, "Context is null...");

   }

   return context != null && context.getResources().getBoolean(R.bool.video_call_use_ext); //默认为true

}

displayModifyCallOptions() 显示选项(早先是在overflow menu中有个modify call选项,点击后弹出4个选项供选择)

/**

* The function is called when Modify Call button gets pressed. The function creates and

* displays modify call options.

*/

public static void displayModifyCallOptions(final Call call, final Context context) {

   if (call == null) {

       Log.d(LOG_TAG, "Can't display modify call options. Call is null");

       return;

   }



   if (isTtyEnabled(context)) {

       Log.w(LOG_TAG, "Call session modification is allo
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值