diff options
-rw-r--r-- | InCallUI/src/com/android/incallui/CallHandlerService.java | 13 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 15 |
2 files changed, 27 insertions, 1 deletions
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 @@ -239,6 +239,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. */ |