diff options
author | Andrew Lee <anwlee@google.com> | 2014-07-17 20:19:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-17 02:40:09 +0000 |
commit | 32de2bc7c323d647be0098eaadd0086150704681 (patch) | |
tree | 998ef0d5cb00216c6c2e24e0c5a8b62ad46d9bb1 | |
parent | 0e84b83f23af354872b64fc1d1d77d22d825c71c (diff) | |
parent | e73e7037eb47895e96320594daeabd0ddaebf3b3 (diff) |
Merge "Hook up answering as video call." into lmp-dev
14 files changed, 27 insertions, 19 deletions
diff --git a/InCallUI/res/drawable-ldrtl-hdpi/ic_lockscreen_answer_activated.png b/InCallUI/res/drawable-ldrtl-hdpi/ic_lockscreen_answer_activated.png Binary files differdeleted file mode 100644 index f1deb759b..000000000 --- a/InCallUI/res/drawable-ldrtl-hdpi/ic_lockscreen_answer_activated.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-hdpi/stat_sys_phone_call_on_hold.png b/InCallUI/res/drawable-ldrtl-hdpi/stat_sys_phone_call_on_hold.png Binary files differdeleted file mode 100644 index 18de2480e..000000000 --- a/InCallUI/res/drawable-ldrtl-hdpi/stat_sys_phone_call_on_hold.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-mdpi/ic_lockscreen_answer_activated.png b/InCallUI/res/drawable-ldrtl-mdpi/ic_lockscreen_answer_activated.png Binary files differdeleted file mode 100644 index 3d68ff923..000000000 --- a/InCallUI/res/drawable-ldrtl-mdpi/ic_lockscreen_answer_activated.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-mdpi/stat_sys_phone_call_on_hold.png b/InCallUI/res/drawable-ldrtl-mdpi/stat_sys_phone_call_on_hold.png Binary files differdeleted file mode 100644 index 60f665d0c..000000000 --- a/InCallUI/res/drawable-ldrtl-mdpi/stat_sys_phone_call_on_hold.png +++ /dev/null diff --git a/InCallUI/res/drawable-ldrtl-xhdpi/ic_lockscreen_answer_activated.png b/InCallUI/res/drawable-ldrtl-xhdpi/ic_lockscreen_answer_activated.png Binary files differdeleted file mode 100644 index 1acdc5991..000000000 --- a/InCallUI/res/drawable-ldrtl-xhdpi/ic_lockscreen_answer_activated.png +++ /dev/null diff --git a/InCallUI/res/drawable-mdpi/ic_lockscreen_answer_activated.png b/InCallUI/res/drawable-mdpi/ic_lockscreen_answer_activated.png Binary files differdeleted file mode 100644 index 6a78f817e..000000000 --- a/InCallUI/res/drawable-mdpi/ic_lockscreen_answer_activated.png +++ /dev/null diff --git a/InCallUI/res/drawable-xhdpi/ic_lockscreen_answer_activated.png b/InCallUI/res/drawable-xhdpi/ic_lockscreen_answer_activated.png Binary files differdeleted file mode 100644 index cd6a6abb2..000000000 --- a/InCallUI/res/drawable-xhdpi/ic_lockscreen_answer_activated.png +++ /dev/null diff --git a/InCallUI/res/drawable-xxhdpi/ic_lockscreen_answer_activated.png b/InCallUI/res/drawable-xxhdpi/ic_lockscreen_answer_activated.png Binary files differdeleted file mode 100644 index 173b54c66..000000000 --- a/InCallUI/res/drawable-xxhdpi/ic_lockscreen_answer_activated.png +++ /dev/null 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 83d21b83f..1cd9751d7 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; @@ -437,7 +438,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) { @@ -447,8 +448,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 */); } } @@ -550,7 +551,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"); } |