From 72aa15de5bb974c95db67f8d631f0e10007903fc Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Tue, 25 Feb 2014 17:18:52 -0500 Subject: add actions to the incoming call notification Bug: 12605720 Change-Id: Ic3593da8693e9fd51e9d3d87aa3ede770aa598cc --- .../src/com/android/incallui/InCallPresenter.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'InCallUI/src/com/android/incallui/InCallPresenter.java') diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index e4967aa36..31e8d752b 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -363,6 +363,41 @@ public class InCallPresenter implements CallList.Listener { } } + /** + * Answers any incoming call. + */ + public void answerIncomingCall(Context context) { + // 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) { + StatusBarNotifier.clearInCallNotification(context); + return; + } + + Call call = mCallList.getIncomingCall(); + if (call != null) { + CallCommandClient.getInstance().answerCall(call.getCallId()); + showInCall(false); + } + } + + /** + * Declines any incoming call. + */ + public void declineIncomingCall(Context context) { + // 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) { + StatusBarNotifier.clearInCallNotification(context); + return; + } + + Call call = mCallList.getIncomingCall(); + if (call != null) { + CallCommandClient.getInstance().rejectCall(call, false, null); + } + } + /** * Returns true if the incall app is the foreground application. */ -- cgit v1.2.3