Fixing Google Voice to work with new incallui
We were not previously storing and sending the gateway information to
the UI. This change consolidates Call gateway functionality from
InCallUiState and PhoneUtils into a new class CallGatewayManager. It is
responsible for storing a mapping from the call's connection to the
gateway used to make that connection. It also adds gateway packagename
and number to the Call object sent to the UI so that it can show UI
appropriately.
bug: 10393622
Change-Id: Ic5a0b068475bcab60e8cc96470273e36005ccc2e
diff --git a/src/com/android/phone/CallController.java b/src/com/android/phone/CallController.java
index 7b889de..1b19d9a 100644
--- a/src/com/android/phone/CallController.java
+++ b/src/com/android/phone/CallController.java
@@ -20,6 +20,7 @@
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyCapabilities;
+import com.android.phone.CallGatewayManager.RawGatewayInfo;
import com.android.phone.Constants.CallStatusCode;
import com.android.phone.InCallUiState.InCallScreenMode;
import com.android.phone.OtaUtils.CdmaOtaScreenState;
@@ -69,9 +70,10 @@
/** The singleton CallController instance. */
private static CallController sInstance;
- private PhoneGlobals mApp;
- private CallManager mCM;
- private CallLogger mCallLogger;
+ final private PhoneGlobals mApp;
+ final private CallManager mCM;
+ final private CallLogger mCallLogger;
+ final private CallGatewayManager mCallGatewayManager;
/** Helper object for emergency calls in some rare use cases. Created lazily. */
private EmergencyCallHelper mEmergencyCallHelper;
@@ -102,10 +104,11 @@
* PhoneApp's public "callController" field, which is why there's no
* getInstance() method here.
*/
- /* package */ static CallController init(PhoneGlobals app, CallLogger callLogger) {
+ /* package */ static CallController init(PhoneGlobals app, CallLogger callLogger,
+ CallGatewayManager callGatewayManager) {
synchronized (CallController.class) {
if (sInstance == null) {
- sInstance = new CallController(app, callLogger);
+ sInstance = new CallController(app, callLogger, callGatewayManager);
} else {
Log.wtf(TAG, "init() called multiple times! sInstance = " + sInstance);
}
@@ -117,11 +120,13 @@
* Private constructor (this is a singleton).
* @see init()
*/
- private CallController(PhoneGlobals app, CallLogger callLogger) {
+ private CallController(PhoneGlobals app, CallLogger callLogger,
+ CallGatewayManager callGatewayManager) {
if (DBG) log("CallController constructor: app = " + app);
mApp = app;
mCM = app.mCM;
mCallLogger = callLogger;
+ mCallGatewayManager = callGatewayManager;
}
@Override
@@ -243,15 +248,6 @@
// by the PhoneUtils phone state change handler.)
mApp.setRestoreMuteOnInCallResume(false);
- // If a provider is used, extract the info to build the
- // overlay and route the call. The overlay will be
- // displayed when the InCallScreen becomes visible.
- if (PhoneUtils.hasPhoneProviderExtras(intent)) {
- inCallUiState.setProviderInfo(intent);
- } else {
- inCallUiState.clearProviderInfo();
- }
-
CallStatusCode status = placeCallInternal(intent);
switch (status) {
@@ -477,6 +473,9 @@
// phone number to use for the outgoing call.
Uri contactUri = intent.getData();
+ // If a gateway is used, extract the data here and pass that into placeCall.
+ final RawGatewayInfo rawGatewayInfo = mCallGatewayManager.getRawGatewayInfo(intent, number);
+
// Watch out: PhoneUtils.placeCall() returns one of the
// CALL_STATUS_* constants, not a CallStatusCode enum value.
int callStatus = PhoneUtils.placeCall(mApp,
@@ -484,7 +483,8 @@
number,
contactUri,
(isEmergencyNumber || isEmergencyIntent),
- inCallUiState.providerGatewayUri);
+ rawGatewayInfo,
+ mCallGatewayManager);
switch (callStatus) {
case PhoneUtils.CALL_STATUS_DIALED: