diff options
author | Suresh Koleti <skolet@codeaurora.org> | 2015-04-08 19:20:44 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-04-20 02:56:50 -0700 |
commit | 8996015c6059fa665817a92896439e1e8a4f6ecc (patch) | |
tree | 766ff2fc9acce1431acfb96e238a234ed298d151 | |
parent | 5e29dc5fc7726356803d130d643d2103182e59fe (diff) | |
download | packages_apps_InCallUI-8996015c6059fa665817a92896439e1e8a4f6ecc.tar.gz packages_apps_InCallUI-8996015c6059fa665817a92896439e1e8a4f6ecc.tar.bz2 packages_apps_InCallUI-8996015c6059fa665817a92896439e1e8a4f6ecc.zip |
IMS-VT: Show Accept for upgrade request in notification area
Show Accept for upgrade request in notification area.
- Accept will accept the upgrade request with same call type we received.
- Showing More option only if received bi-directional upgrade request.
Change-Id: I17107c4ac68bf2327369b418cbc543f2022d4b33
CRs-Fixed: 820001
-rw-r--r-- | src/com/android/incallui/InCallApp.java | 6 | ||||
-rw-r--r-- | src/com/android/incallui/InCallPresenter.java | 13 | ||||
-rw-r--r-- | src/com/android/incallui/StatusBarNotifier.java | 20 |
3 files changed, 35 insertions, 4 deletions
diff --git a/src/com/android/incallui/InCallApp.java b/src/com/android/incallui/InCallApp.java index a0bdd43a..a87f5407 100644 --- a/src/com/android/incallui/InCallApp.java +++ b/src/com/android/incallui/InCallApp.java @@ -83,9 +83,9 @@ public class InCallApp extends Application { } else if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) { InCallPresenter.getInstance().hangUpOngoingCall(context); } else if (action.equals(ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST)) { - //TODO: Change calltype after adding support for TX and RX - InCallPresenter.getInstance().acceptUpgradeRequest( - VideoProfile.VideoState.BIDIRECTIONAL, context); + InCallPresenter inCallPresenter = InCallPresenter.getInstance(); + inCallPresenter.acceptUpgradeRequest(context); + inCallPresenter.bringToForeground(false); } else if (action.equals(ACTION_DECLINE_VIDEO_UPGRADE_REQUEST)) { InCallPresenter.getInstance().declineUpgradeRequest(context); } diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index 07704c6f..1adc7193 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -625,6 +625,19 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } } + public void acceptUpgradeRequest(Context context) { + if (mCallList != null) { + Call call = mCallList.getVideoUpgradeRequestCall(); + if (call != null) { + acceptUpgradeRequest(call.getModifyToVideoState(), context); + } else { + Log.e(this, "acceptUpgradeRequest Call is null"); + } + } else { + Log.e(this, " acceptUpgradeRequest mCallList is empty"); + } + } + public void declineUpgradeRequest(Context context) { Log.d(this, " declineUpgradeRequest"); // Bail if we have been shut down and the call list is null. diff --git a/src/com/android/incallui/StatusBarNotifier.java b/src/com/android/incallui/StatusBarNotifier.java index 7647bb49..40ad090b 100644 --- a/src/com/android/incallui/StatusBarNotifier.java +++ b/src/com/android/incallui/StatusBarNotifier.java @@ -31,6 +31,7 @@ import android.os.Handler; import android.os.Message; import android.telecom.PhoneAccount; import android.telecom.PhoneCapabilities; +import android.telecom.VideoProfile; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; @@ -330,7 +331,10 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { if (isVideoUpgradeRequest) { builder.setUsesChronometer(false); addDismissUpgradeRequestAction(builder); - addMoreAction(builder); + addAcceptUpgradeRequestAction(builder); + if (isMoreOptionRequired(call)) { + addMoreAction(builder); + } } else { createIncomingCallNotification(call, state, builder); } @@ -346,6 +350,11 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { mIsShowingNotification = true; } + static private boolean isMoreOptionRequired(Call call) { + return VideoProfile.VideoState.isAudioOnly(call.getVideoState()) && + VideoProfile.VideoState.isBidirectional(call.getModifyToVideoState()); + } + private void createIncomingCallNotification( Call call, int state, Notification.Builder builder) { if (state == Call.State.ACTIVE) { @@ -597,6 +606,15 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { answerVoicePendingIntent); } + private void addAcceptUpgradeRequestAction(Notification.Builder builder) { + Log.i(this, "Will show \"accept\" video action in the incoming call Notification"); + + PendingIntent acceptVideoPendingIntent = createNotificationPendingIntent( + mContext, InCallApp.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST); + builder.addAction(0, mContext.getText(R.string.notification_action_accept), + acceptVideoPendingIntent); + } + private void addDismissUpgradeRequestAction(Notification.Builder builder) { Log.i(this, "Will show \"dismiss\" action in the incoming call Notification"); |