summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-08-28 00:05:33 -0700
committerSantos Cordon <santoscordon@google.com>2013-08-28 14:31:56 -0700
commitfacff288cfbdfcfd9281a64fa05a78532acf3d90 (patch)
tree8920225cbf70a8de1617d6fdd152f094456f8489
parent97a92ad531caa86a9a40d13960452a8f0cbccdec (diff)
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
-rw-r--r--InCallUI/src/com/android/incallui/CallHandlerService.java13
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java15
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.
*/