diff options
Diffstat (limited to 'InCallUI/src')
6 files changed, 27 insertions, 19 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java index 7462b12e6..db441237f 100644 --- a/InCallUI/src/com/android/incallui/AnswerFragment.java +++ b/InCallUI/src/com/android/incallui/AnswerFragment.java @@ -322,8 +322,8 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente } @Override - public void onAnswer() { - getPresenter().onAnswer(); + public void onAnswer(int videoState) { + getPresenter().onAnswer(videoState); } @Override diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 86594545b..746e6434c 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -126,13 +126,13 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> } } - public void onAnswer() { + public void onAnswer(int videoState) { if (mCallId == null) { return; } Log.d(this, "onAnswer " + mCallId); - TelecommAdapter.getInstance().answerCall(mCall.getId()); + TelecommAdapter.getInstance().answerCall(mCall.getId(), videoState); } /** diff --git a/InCallUI/src/com/android/incallui/GlowPadWrapper.java b/InCallUI/src/com/android/incallui/GlowPadWrapper.java index 28ccb956c..77e074498 100644 --- a/InCallUI/src/com/android/incallui/GlowPadWrapper.java +++ b/InCallUI/src/com/android/incallui/GlowPadWrapper.java @@ -19,6 +19,7 @@ package com.android.incallui; import android.content.Context; import android.os.Handler; import android.os.Message; +import android.telecomm.VideoCallProfile; import android.util.AttributeSet; import android.view.View; @@ -111,7 +112,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger final int resId = getResourceIdForTarget(target); switch (resId) { case R.drawable.ic_lockscreen_answer: - mAnswerListener.onAnswer(); + mAnswerListener.onAnswer(VideoCallProfile.VIDEO_STATE_AUDIO_ONLY); mTargetTriggered = true; break; case R.drawable.ic_lockscreen_decline: @@ -122,6 +123,10 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger mAnswerListener.onText(); mTargetTriggered = true; break; + case R.drawable.ic_videocam: + mAnswerListener.onAnswer(VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL); + mTargetTriggered = true; + break; default: // Code should never reach here. Log.e(this, "Trigger detected on unhandled resource. Skipping."); @@ -143,7 +148,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger } public interface AnswerListener { - void onAnswer(); + void onAnswer(int videoState); void onDecline(); void onText(); } diff --git a/InCallUI/src/com/android/incallui/InCallApp.java b/InCallUI/src/com/android/incallui/InCallApp.java index 77fac7f53..0894fb45a 100644 --- a/InCallUI/src/com/android/incallui/InCallApp.java +++ b/InCallUI/src/com/android/incallui/InCallApp.java @@ -21,6 +21,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; +import android.telecomm.VideoCallProfile; /** * Top-level Application class for the InCall app. @@ -57,7 +58,6 @@ public class InCallApp extends Application { * Accepts broadcast Intents which will be prepared by {@link StatusBarNotifier} and thus * sent from framework's notification mechanism (which is outside Phone context). * This should be visible from outside, but shouldn't be in "exported" state. - * */ public static class NotificationBroadcastReceiver extends BroadcastReceiver { @Override @@ -66,13 +66,14 @@ public class InCallApp extends Application { Log.i(this, "Broadcast from Notification: " + action); // TODO: Commands of this nature should exist in the CallList. - if (action.equals(ACTION_DECLINE_INCOMING_CALL)) { - InCallPresenter.getInstance().declineIncomingCall(context); + if (action.equals(ACTION_ANSWER_VIDEO_INCOMING_CALL)) { + InCallPresenter.getInstance().answerIncomingCall( + context, VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL); } else if (action.equals(ACTION_ANSWER_VOICE_INCOMING_CALL)) { - InCallPresenter.getInstance().answerIncomingCall(context); - } else if (action.equals(ACTION_ANSWER_VIDEO_INCOMING_CALL)) { - //TODO: Answer as a video call here instead of an audio call. - InCallPresenter.getInstance().answerIncomingCall(context); + InCallPresenter.getInstance().answerIncomingCall( + context, VideoCallProfile.VIDEO_STATE_AUDIO_ONLY); + } else if (action.equals(ACTION_DECLINE_INCOMING_CALL)) { + InCallPresenter.getInstance().declineIncomingCall(context); } else if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) { InCallPresenter.getInstance().hangUpOngoingCall(context); } diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 5965a950a..4fece2206 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.telecomm.CallCapabilities; import android.telecomm.Phone; import android.telecomm.PhoneAccount; +import android.telecomm.VideoCallProfile; import com.google.common.base.Preconditions; import com.google.common.collect.Sets; @@ -418,7 +419,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { /** * Answers any incoming call. */ - public void answerIncomingCall(Context context) { + public void answerIncomingCall(Context context, int videoState) { // By the time we receive this intent, we could be shut down and call list // could be null. Bail in those cases. if (mCallList == null) { @@ -428,8 +429,8 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { Call call = mCallList.getIncomingCall(); if (call != null) { - TelecommAdapter.getInstance().answerCall(call.getId()); - showInCall(false, false /* newOutgoingCall */); + TelecommAdapter.getInstance().answerCall(call.getId(), videoState); + showInCall(false, false/* newOutgoingCall */); } } @@ -531,7 +532,8 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { // (1) Attempt to answer a call if (incomingCall != null) { - TelecommAdapter.getInstance().answerCall(incomingCall.getId()); + TelecommAdapter.getInstance().answerCall( + incomingCall.getId(), VideoCallProfile.VIDEO_STATE_AUDIO_ONLY); return true; } diff --git a/InCallUI/src/com/android/incallui/TelecommAdapter.java b/InCallUI/src/com/android/incallui/TelecommAdapter.java index 745931cfe..11ddc42b2 100644 --- a/InCallUI/src/com/android/incallui/TelecommAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java @@ -63,9 +63,9 @@ final class TelecommAdapter implements InCallPhoneListener { return CallList.getInstance().getCallById(callId).getTelecommCall(); } - void answerCall(String callId) { + void answerCall(String callId, int videoState) { if (mPhone != null) { - getTelecommCallById(callId).answer(); + getTelecommCallById(callId).answer(videoState); } else { Log.e(this, "error answerCall, mPhone is null"); } |