diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-02-19 23:19:00 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-02-19 23:19:00 +0000 |
commit | b153f05320437fa2fc3c0d86e8e4516ab2df7ef8 (patch) | |
tree | ff6a389527243a73b7ca03c26a44de81fb274314 | |
parent | 027af27f27f49ca8e29daf94ddab739b2f5b1b45 (diff) | |
parent | 3f15b59b752825ea18b5f132299d44cfeb04f4d6 (diff) | |
download | ims-b153f05320437fa2fc3c0d86e8e4516ab2df7ef8.tar.gz |
Merge "IMS: Explicit Call transfer APIS." am: 5b30d4c662 am: 04fe1c5732 am: 3f15b59b75
Change-Id: I1810395c9f7c79e812c8869273523e431dd66788
-rwxr-xr-x[-rw-r--r--] | src/java/com/android/ims/ImsCall.java | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/java/com/android/ims/ImsCall.java b/src/java/com/android/ims/ImsCall.java index 54260740..f61e734b 100644..100755 --- a/src/java/com/android/ims/ImsCall.java +++ b/src/java/com/android/ims/ImsCall.java @@ -488,6 +488,17 @@ public class ImsCall implements ICall { } /** + * Notifies the result of transfer request. + * + * @param imsCall ImsCall object + */ + public void onCallSessionTransferred(ImsCall imsCall) { + } + + public void onCallSessionTransferFailed(ImsCall imsCall, ImsReasonInfo reasonInfo) { + } + + /** * Called when the call quality has changed. * * @param imsCall ImsCall object @@ -1254,6 +1265,56 @@ public class ImsCall implements ICall { } } + /** + * Transfers a call. + * + * @param number number to be transferred to. + * @param isConfirmationRequired indicates blind or assured transfer. + * @throws ImsException if the IMS service fails to transfer the call. + */ + public void transfer(String number, boolean isConfirmationRequired) throws ImsException { + logi("transfer :: session=" + mSession + ", number=" + Rlog.pii(TAG, number) + + ", isConfirmationRequired=" + isConfirmationRequired); + + synchronized(mLockObj) { + if (mSession == null) { + throw new ImsException("No call to transfer", + ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED); + } + + try { + mSession.transfer(number, isConfirmationRequired); + } catch (Throwable t) { + loge("transfer :: ", t); + throw new ImsException("transfer()", t, 0); + } + } + } + + /** + * Transfers a call to another ongoing call. + * + * @param transferToImsCall the other ongoing call to which this call will be transferred. + * @throws ImsException if the IMS service fails to transfer the call. + */ + public void consultativeTransfer(ImsCall transferToImsCall) throws ImsException { + logi("consultativeTransfer :: session=" + mSession + ", other call=" + transferToImsCall); + + synchronized(mLockObj) { + if (mSession == null) { + throw new ImsException("No call to transfer", + ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED); + } + + try { + mSession.transfer(transferToImsCall.getSession()); + } catch (Throwable t) { + loge("consultativeTransfer :: ", t); + throw new ImsException("consultativeTransfer()", t, 0); + } + } + } + public void terminate(int reason, int overrideReason) { logi("terminate :: reason=" + reason + " ; overrideReason=" + overrideReason); mOverrideReason = overrideReason; @@ -3240,6 +3301,40 @@ public class ImsCall implements ICall { } @Override + public void callSessionTransferred(ImsCallSession session) { + ImsCall.Listener listener; + + synchronized(ImsCall.this) { + listener = mListener; + } + + if (listener != null) { + try { + listener.onCallSessionTransferred(ImsCall.this); + } catch (Throwable t) { + loge("callSessionTransferred:: ", t); + } + } + } + + @Override + public void callSessionTransferFailed(ImsCallSession session, ImsReasonInfo reasonInfo) { + ImsCall.Listener listener; + + synchronized(ImsCall.this) { + listener = mListener; + } + + if (listener != null) { + try { + listener.onCallSessionTransferFailed(ImsCall.this, reasonInfo); + } catch (Throwable t) { + loge("callSessionTransferFailed:: ", t); + } + } + } + + @Override public void callQualityChanged(CallQuality callQuality) { ImsCall.Listener listener; |