From facff288cfbdfcfd9281a64fa05a78532acf3d90 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Wed, 28 Aug 2013 00:05:33 -0700 Subject: Adding implementation for bringToForeground. Add implementation for CallHandlerService's new method, bring to foreground. When called, the incallui determines if we have an active call and the activity is not currently in the foreground. If both those are true, then we bring up the existing InCallUI. bug:10313347 Change-Id: Ic70cd7f1c5701992580626458c8d459a8ece7d9c --- InCallUI/src/com/android/incallui/CallHandlerService.java | 13 ++++++++++++- InCallUI/src/com/android/incallui/InCallPresenter.java | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'InCallUI') diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java index 76237e106..ca749aa46 100644 --- a/InCallUI/src/com/android/incallui/CallHandlerService.java +++ b/InCallUI/src/com/android/incallui/CallHandlerService.java @@ -44,8 +44,9 @@ public class CallHandlerService extends Service { private static final int ON_AUDIO_MODE = 4; private static final int ON_SUPPORTED_AUDIO_MODE = 5; private static final int ON_DISCONNECT_CALL = 6; + private static final int ON_BRING_TO_FOREGROUND = 7; - private static final int LARGEST_MSG_ID = ON_DISCONNECT_CALL; + private static final int LARGEST_MSG_ID = ON_BRING_TO_FOREGROUND; private CallList mCallList; @@ -175,6 +176,11 @@ public class CallHandlerService extends Service { Log.e(TAG, "Error processing onSupportedAudioModeChange() call.", e); } } + + @Override + public void bringToForeground() { + mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_BRING_TO_FOREGROUND)); + } }; /** @@ -222,6 +228,11 @@ public class CallHandlerService extends Service { case ON_SUPPORTED_AUDIO_MODE: mAudioModeProvider.onSupportedAudioModeChange(msg.arg1); break; + case ON_BRING_TO_FOREGROUND: + if (mInCallPresenter != null) { + mInCallPresenter.bringToForeground(); + } + break; default: break; } diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 11f930852..cc3dcb2c1 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -238,6 +238,21 @@ public class InCallPresenter implements CallList.Listener { } } + /** + * Brings the app into the foreground if possible. + */ + public void bringToForeground() { + // Before we bring the incall UI to the foreground, we check to see if: + // 1. there is an activity + // 2. the activity is not already in the foreground + // 3. We are in a state where we want to show the incall ui + if (mInCallActivity != null && + !mInCallActivity.isForegroundActivity() && + mInCallState != InCallState.HIDDEN) { + showInCall(); + } + } + /** * When the state of in-call changes, this is the first method to get called. It determines if * the UI needs to be started or finished depending on the new state and does it. -- cgit v1.2.3