Merge "Fix incoming callback and binding issues." into klp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index aad9143..3f8a2b9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -154,7 +154,8 @@
android:theme="@style/OutgoingCallBroadcasterTheme"
android:permission="android.permission.CALL_PHONE"
android:screenOrientation="nosensor"
- android:configChanges="orientation|screenSize|keyboardHidden">
+ android:configChanges="orientation|screenSize|keyboardHidden"
+ android:excludeFromRecents="true">
<!-- CALL action intent filters, for the various ways
of initiating an outgoing call. -->
<intent-filter>
diff --git a/common/src/com/android/services/telephony/common/ICallHandlerService.aidl b/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
index cf2e0b2..ccf30b0 100644
--- a/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
+++ b/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
@@ -62,4 +62,9 @@
* {@see AudioMode}
*/
void onSupportedAudioModeChange(in int modeMask);
+
+ /**
+ * Called when the system wants to bring the in-call UI into the foreground.
+ */
+ void bringToForeground();
}
diff --git a/src/com/android/phone/CallHandlerServiceProxy.java b/src/com/android/phone/CallHandlerServiceProxy.java
index 75bb26c..27a99fd 100644
--- a/src/com/android/phone/CallHandlerServiceProxy.java
+++ b/src/com/android/phone/CallHandlerServiceProxy.java
@@ -232,6 +232,18 @@
;
+ public void bringToForeground() {
+ // only support this call if the service is already connected.
+ if (mCallHandlerService != null && mCallModeler.hasLiveCall()) {
+ try {
+ if (DBG) Log.d(TAG, "bringToForeground");
+ mCallHandlerService.bringToForeground();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Exception handling bringToForeground", e);
+ }
+ }
+ }
+
/**
* Sets up the connection with ICallHandlerService
*/
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 165ae67..42f7f8c 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -430,8 +430,6 @@
// status bar icons and control other status bar behavior.
notificationMgr = NotificationMgr.init(this);
- phoneMgr = PhoneInterfaceManager.init(this, phone);
-
mHandler.sendEmptyMessage(EVENT_START_SIP_SERVICE);
int phoneType = phone.getPhoneType();
@@ -525,6 +523,8 @@
callHandlerServiceProxy = new CallHandlerServiceProxy(this, callModeler,
callCommandService, audioRouter);
+ phoneMgr = PhoneInterfaceManager.init(this, phone, callHandlerServiceProxy);
+
// Create the CallNotifer singleton, which handles
// asynchronous events from the telephony layer (like
// launching the incoming-call UI when an incoming call comes
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index c65c4f8..c37fe07 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -72,6 +72,7 @@
CallManager mCM;
AppOpsManager mAppOps;
MainThreadHandler mMainThreadHandler;
+ CallHandlerServiceProxy mCallHandlerService;
/**
* A request object for use with {@link MainThreadHandler}. Requesters should wait() on the
@@ -218,10 +219,11 @@
* Initialize the singleton PhoneInterfaceManager instance.
* This is only done once, at startup, from PhoneApp.onCreate().
*/
- /* package */ static PhoneInterfaceManager init(PhoneGlobals app, Phone phone) {
+ /* package */ static PhoneInterfaceManager init(PhoneGlobals app, Phone phone,
+ CallHandlerServiceProxy callHandlerService) {
synchronized (PhoneInterfaceManager.class) {
if (sInstance == null) {
- sInstance = new PhoneInterfaceManager(app, phone);
+ sInstance = new PhoneInterfaceManager(app, phone, callHandlerService);
} else {
Log.wtf(LOG_TAG, "init() called multiple times! sInstance = " + sInstance);
}
@@ -230,12 +232,14 @@
}
/** Private constructor; @see init() */
- private PhoneInterfaceManager(PhoneGlobals app, Phone phone) {
+ private PhoneInterfaceManager(PhoneGlobals app, Phone phone,
+ CallHandlerServiceProxy callHandlerService) {
mApp = app;
mPhone = phone;
mCM = PhoneGlobals.getInstance().mCM;
mAppOps = (AppOpsManager)app.getSystemService(Context.APP_OPS_SERVICE);
mMainThreadHandler = new MainThreadHandler();
+ mCallHandlerService = callHandlerService;
publish();
}
@@ -303,26 +307,10 @@
}
// If the phone isn't idle then go to the in-call screen
long callingId = Binder.clearCallingIdentity();
- try {
- Intent intent;
- if (specifyInitialDialpadState) {
- intent = PhoneGlobals.createInCallIntent(initialDialpadState);
- } else {
- intent = PhoneGlobals.createInCallIntent();
- }
- try {
- //mApp.startActivity(intent);
- } catch (ActivityNotFoundException e) {
- // It's possible that the in-call UI might not exist
- // (like on non-voice-capable devices), although we
- // shouldn't be trying to bring up the InCallScreen on
- // devices like that in the first place!
- Log.w(LOG_TAG, "showCallScreenInternal: "
- + "transition to InCallScreen failed; intent = " + intent);
- }
- } finally {
- Binder.restoreCallingIdentity(callingId);
- }
+
+ mCallHandlerService.bringToForeground();
+
+ Binder.restoreCallingIdentity(callingId);
return true;
}