diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2013-11-26 16:46:05 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-11-26 16:46:05 -0800 |
commit | 28f9f00d1d96468ab173a7d251d0a7ffb8ab346b (patch) | |
tree | 7fa7041131c557ea23605685d1d36f88cceffaa6 /src/com | |
parent | 5f05d9959d8d9006ffaf7c0c812d4b7aea59eedd (diff) | |
parent | 6660c44470ec862cccd8501781c82d95740d2b2d (diff) | |
download | packages_apps_InCallUI-28f9f00d1d96468ab173a7d251d0a7ffb8ab346b.tar.gz packages_apps_InCallUI-28f9f00d1d96468ab173a7d251d0a7ffb8ab346b.tar.bz2 packages_apps_InCallUI-28f9f00d1d96468ab173a7d251d0a7ffb8ab346b.zip |
Merge "IMS-VT: Enable modify call functionality on InCallUI"
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/incallui/CallCommandClient.java | 6 | ||||
-rw-r--r-- | src/com/android/incallui/CallHandlerService.java | 16 | ||||
-rw-r--r-- | src/com/android/incallui/CallUtils.java | 15 | ||||
-rw-r--r-- | src/com/android/incallui/InCallActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/incallui/InCallPresenter.java | 41 |
5 files changed, 57 insertions, 27 deletions
diff --git a/src/com/android/incallui/CallCommandClient.java b/src/com/android/incallui/CallCommandClient.java index 7505626f..c6b1910d 100644 --- a/src/com/android/incallui/CallCommandClient.java +++ b/src/com/android/incallui/CallCommandClient.java @@ -259,14 +259,14 @@ public class CallCommandClient { } } - public void modifyCallInitiate(int callId) { + public void modifyCallInitiate(int callId, int callType) { if (mCommandService == null) { Log.e(this, "Cannot modifyCall(); CallCommandService == null"); return; } try { - Log.v(this, "modifyCall() "); - mCommandService.modifyCallInitiate(callId); + Log.v(this, "modifyCall(), callId=" + callId + " callType=" + callType); + mCommandService.modifyCallInitiate(callId, callType); } catch (RemoteException e) { Log.e(this, "Error on modifyCall()."); } diff --git a/src/com/android/incallui/CallHandlerService.java b/src/com/android/incallui/CallHandlerService.java index 237e1234..7a206317 100644 --- a/src/com/android/incallui/CallHandlerService.java +++ b/src/com/android/incallui/CallHandlerService.java @@ -247,6 +247,19 @@ public class CallHandlerService extends Service { mAudioModeProvider = null; } + public void doModifyCall(Call call) { + Log.d(TAG, "doModifyCall: Call:" + call); + if (call != null && mInCallPresenter != null && mCallList != null) { + Log.d(TAG, "doModifyCall: Updating CallList:" + mCallList.getCall(call.getCallId())); + mCallList.onUpdate(call); + mInCallPresenter.onModifyCallRequest(call); + } else { + Log.e(TAG, "doModifyCall: isCallValid=" + (call != null)); + Log.e(TAG, "doModifyCall: isInCallPresenterValid=" + (mInCallPresenter != null)); + Log.e(TAG, "doModifyCall: isCallListValid=" + (mCallList != null)); + } + } + /** * Handles messages from the service so that they get executed on the main thread, where they * can interact with UI. @@ -323,6 +336,9 @@ public class CallHandlerService extends Service { doStop(); break; case ON_UNSOL_CALLMODIFY: + Call call = (Call) msg.obj; + Log.i(TAG, "ON_UNSOL_CALLMODIFY: Call=" + call); + doModifyCall(call); break; case ON_ACTIVE_SUB_CHANGE: Log.i(TAG, "ON_ACTIVE_SUB_CHANGE: " + msg.obj); diff --git a/src/com/android/incallui/CallUtils.java b/src/com/android/incallui/CallUtils.java index 0afcfcd3..bcf942b8 100644 --- a/src/com/android/incallui/CallUtils.java +++ b/src/com/android/incallui/CallUtils.java @@ -51,10 +51,17 @@ public class CallUtils { } public static boolean hasCallModifyFailed(Call call) { - final CallDetails cd = getCallModifyDetails(call); - return cd != null && cd.getErrorInfo() != null - && (Integer.parseInt(cd.getErrorInfo()) == 0); - + final CallDetails modifyCallDetails = getCallModifyDetails(call); + boolean hasError = false; + try { + if (modifyCallDetails != null && modifyCallDetails.getErrorInfo() != null) { + hasError = !modifyCallDetails.getErrorInfo().isEmpty() + && Integer.parseInt(modifyCallDetails.getErrorInfo()) != 0; + } + } catch (Exception e) { + hasError = true; + } + return hasError; } private static CallDetails getCallDetails(Call call) { diff --git a/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index 80692f32..7760153a 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/src/com/android/incallui/InCallActivity.java @@ -457,13 +457,13 @@ public class InCallActivity extends Activity { public void onClick(DialogInterface dialog, int item) { Toast.makeText(getApplicationContext(), items.get(item), Toast.LENGTH_SHORT).show(); final int selCallType = itemToCallType.get(item); - Log.d("Videocall", - "ModifyCall called: upgrade to " + CallUtils.fromCallType(selCallType)); + log("Videocall: ModifyCall: upgrade/downgrade to " + + CallUtils.fromCallType(selCallType)); InCallPresenter.getInstance().sendModifyCallRequest(callId, selCallType); dialog.dismiss(); } }; - int currCallType = CallUtils.getCallType( CallList.getInstance().getCall(callId)); + int currCallType = CallUtils.getCallType(CallList.getInstance().getCall(callId)); int index = itemToCallType.indexOf(currCallType); builder.setSingleChoiceItems(items.toArray(new CharSequence[0]), index, listener); alert = builder.create(); diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index d17e3e47..fa0bc34e 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -32,6 +32,7 @@ import android.content.ActivityNotFoundException; import com.android.services.telephony.common.Call; import com.android.services.telephony.common.Call.Capabilities; +import com.android.services.telephony.common.CallDetails; import com.google.common.collect.Lists; import java.util.ArrayList; @@ -173,12 +174,20 @@ public class InCallPresenter implements CallList.Listener { /** * Sends modify call request to the other party. + * * @param callId id of the call to modify. * @param callType Proposed call type. */ public void sendModifyCallRequest(int callId, int callType) { - log("VideoCall: Sending modify call request. callId=" + callId + " callType=" + callType); - // CallCommandClient.getInstance().modifyCall(callId, callType); + log("VideoCall: Sending modify call request, callId=" + callId + " callType=" + callType); + Call call = CallList.getInstance().getCall(callId); + if (call != null && call.getCallModifyDetails() != null) { + CallDetails cd = call.getCallModifyDetails(); + cd.setCallType(callType); + CallCommandClient.getInstance().modifyCallInitiate(callId, callType); + } else { + loge("VideoCall: Sending modify call request failed: call=" + call); + } } /** @@ -189,26 +198,24 @@ public class InCallPresenter implements CallList.Listener { */ public void modifyCallConfirm(boolean accept, Call call) { log("VideoCall: ModifyCallConfirm: accept=" + accept + " call=" + call); - final int callId = call.getCallId(); - int callType = accept ? CallUtils.getProposedCallType(call) : CallUtils.getCallType(call); - // CallCommandClient.getInstance().modifyCallConfirm(call.getCallId(), callType); + CallCommandClient.getInstance().modifyCallConfirm(accept, call.getCallId()); } /** * Handles modify call request and shows dialog to user for accepting or * rejecting the modify call */ - public void onModifyCallRequest(int callId) { - final Call call = CallList.getInstance().getCall(callId); - if (call != null) { - - final int currCallType = CallUtils.getCallType(call); - final int proposedCallType = CallUtils.getProposedCallType(call); - final boolean error = CallUtils.hasCallModifyFailed(call); + public void onModifyCallRequest(Call call) { + Preconditions.checkNotNull(call); + final int callId = call.getCallId(); + final int currCallType = CallUtils.getCallType(call); + final int proposedCallType = CallUtils.getProposedCallType(call); + final boolean error = CallUtils.hasCallModifyFailed(call); - log("VideoCall onMoifyCallRequest: CallId = " + callId + " currCallType= " - + currCallType - + " proposedCallType= " + proposedCallType + " error=" + error); + log("VideoCall onMoifyCallRequest: CallId =" + callId + " currCallType=" + + currCallType + + " proposedCallType= " + proposedCallType + " error=" + error); + try { if (isUserConsentRequired(proposedCallType, currCallType)) { if (mInCallActivity != null) { mInCallActivity.displayModifyCallConsentDialog(call); @@ -216,8 +223,8 @@ public class InCallPresenter implements CallList.Listener { Log.e(this, "VideoCall: onMoifyCallRequest: InCallActivity is null."); } } - } else { - loge("onModifyCallRequest: Can't find call with callId="+callId); + } catch (ArrayIndexOutOfBoundsException e) { + Log.e(this, "VideoCall: onModifyCallRequest failed. ", e); } } |