diff options
author | Santos Cordon <santoscordon@google.com> | 2014-02-19 02:31:30 -0800 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-02-28 09:46:35 -0800 |
commit | e553d43bc397e769a8ad416e3a4f9515d6da8eba (patch) | |
tree | aa2de61797a77be5b8ddc510e4bbc4e3093818ad /src/com/android/incallui/AnswerPresenter.java | |
parent | 65ece2267bcdf2520241eb2cbec7c41200b46611 (diff) | |
download | packages_apps_InCallUI-e553d43bc397e769a8ad416e3a4f9515d6da8eba.tar.gz packages_apps_InCallUI-e553d43bc397e769a8ad416e3a4f9515d6da8eba.tar.bz2 packages_apps_InCallUI-e553d43bc397e769a8ad416e3a4f9515d6da8eba.zip |
InCall UI changes for incoming Telecomm calls.
1. Send commands back to Telecomm when user hits answer/reject
2. Appropriately map Telecomm call states to in-call call states for
call updates sent from Telecomm.
3. Use the working version of CallList.onUpdate(). The one we were using
previously wasn't running in old code and didn't do everything
necessary for supporting the incoming call screen. Added a TODO to
remove it completely later.
Change-Id: I0f1c330a5a68c4004d3102fbab6f20a51a8b029a
Diffstat (limited to 'src/com/android/incallui/AnswerPresenter.java')
-rw-r--r-- | src/com/android/incallui/AnswerPresenter.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/com/android/incallui/AnswerPresenter.java b/src/com/android/incallui/AnswerPresenter.java index dd4deeb6..66469234 100644 --- a/src/com/android/incallui/AnswerPresenter.java +++ b/src/com/android/incallui/AnswerPresenter.java @@ -16,6 +16,9 @@ package com.android.incallui; +import android.os.RemoteException; +import android.telecomm.IInCallAdapter; + import com.android.services.telephony.common.Call; import java.util.ArrayList; @@ -126,12 +129,48 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> Log.d(this, "onAnswer " + mCallId); CallCommandClient.getInstance().answerCall(mCallId); + + // TODO(santoscordon): Need a TelecommAdapter wrapper object so that we dont have to check + // for null like this everywhere. + IInCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter(); + if (telecommAdapter != null) { + // TODO(santoscordon): Remove translator by using only String-based IDs in all of the + // in-call app. + String callId = CallInfoTranslator.getTelecommCallId(mCall); + if (callId != null) { + // TODO(santoscordon): TelecommAdapter wrapper would also eliminate much of this + // try-catch code. + try { + Log.i(this, "Answering the call: " + callId); + telecommAdapter.answerCall(callId); + } catch (RemoteException e) { + Log.e(this, "Failed to send answer command.", e); + } + } + } } + /** + * TODO(santoscordon): We are using reject and decline interchangeably. We should settle on + * reject since it seems to be more prevalent. + */ public void onDecline() { Log.d(this, "onDecline " + mCallId); CallCommandClient.getInstance().rejectCall(mCall, false, null); + + IInCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter(); + if (telecommAdapter != null) { + String callId = CallInfoTranslator.getTelecommCallId(mCall); + if (callId != null) { + try { + Log.i(this, "Rejecting the call: " + callId); + telecommAdapter.rejectCall(callId); + } catch (RemoteException e) { + Log.e(this, "Failed to send reject command.", e); + } + } + } } public void onText() { |