Remove VoicePhone interface
VoicePhone interface was not a generic voice phone. It was a partial
implementation of an ImsPhone (i.e. served no added-value purpose but
confused functionality). Removed.
Change-Id: Ida5d0fb2b09dcc6ec295ddd7a03f2cf6536b840b
Conflicts:
CleanSpec.mk
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 2f407a4..9caa0ad 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -48,6 +48,7 @@
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java
index 637b6eb..6385ca2 100644
--- a/src/java/com/android/internal/telephony/CallManager.java
+++ b/src/java/com/android/internal/telephony/CallManager.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony;
+import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.sip.SipPhone;
import android.content.Context;
@@ -244,7 +245,7 @@
private Phone getPhone(long subId) {
Phone p = null;
for (Phone phone : mPhones) {
- if (phone.getSubId() == subId && !(phone instanceof VoicePhone)) {
+ if (phone.getSubId() == subId && !(phone instanceof ImsPhone)) {
p = phone;
break;
}
@@ -428,7 +429,7 @@
phone.getPhoneName() + " " + phone + ")");
}
- Phone vPhone = basePhone.getVoicePhone();
+ Phone vPhone = basePhone.getImsPhone();
if (vPhone != null) {
unregisterPhone(vPhone);
}
@@ -949,7 +950,7 @@
// Manipulation between IMS phone and its owner
// will be treated in GSM/CDMA phone.
- Phone vPhone = basePhone.getVoicePhone();
+ Phone vPhone = basePhone.getImsPhone();
if (activePhone != basePhone
&& (vPhone == null || vPhone != activePhone)) {
if (hasBgCall) {
diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java
index fb4a40c..5adf32f 100644
--- a/src/java/com/android/internal/telephony/Phone.java
+++ b/src/java/com/android/internal/telephony/Phone.java
@@ -1792,14 +1792,14 @@
public void setImsRegistrationState(boolean registered);
/**
- * Return an instance of a ImsPhone phone
- * @return an interface of a ImsPhone phone
+ * Return the ImsPhone phone co-managed with this phone
+ * @return an instance of an ImsPhone phone
*/
- Phone getVoicePhone();
+ Phone getImsPhone();
/**
- * Return the service state of mVoicePhone if it is STATE_IN_SERVICE
+ * Return the service state of mImsPhone if it is STATE_IN_SERVICE
* otherwise return the current voice service state
*/
- int getVoiceServiceState();
+ int getVoicePhoneServiceState();
}
diff --git a/src/java/com/android/internal/telephony/PhoneBase.java b/src/java/com/android/internal/telephony/PhoneBase.java
index f08df14..5d9e334 100644
--- a/src/java/com/android/internal/telephony/PhoneBase.java
+++ b/src/java/com/android/internal/telephony/PhoneBase.java
@@ -46,6 +46,7 @@
import com.android.ims.ImsManager;
import com.android.internal.R;
import com.android.internal.telephony.dataconnection.DcTrackerBase;
+import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccFileHandler;
@@ -84,10 +85,10 @@
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_UP)) {
mImsServiceReady = true;
- updateVoicePhone();
+ updateImsPhone();
} else if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_DOWN)) {
mImsServiceReady = false;
- updateVoicePhone();
+ updateImsPhone();
}
}
};
@@ -187,7 +188,7 @@
protected int mPhoneId;
protected boolean mImsServiceReady = false;
- protected Phone mVoicePhone = null;
+ protected ImsPhone mImsPhone = null;
@Override
public String getPhoneName() {
@@ -396,9 +397,9 @@
mTelephonyTester.dispose();
}
- if (mVoicePhone != null) {
- ((VoicePhone)mVoicePhone).unregisterForSilentRedial(this);
- mVoicePhone.dispose();
+ if (mImsPhone != null) {
+ mImsPhone.unregisterForSilentRedial(this);
+ mImsPhone.dispose();
}
}
}
@@ -412,9 +413,9 @@
mDcTracker = null;
mUiccController = null;
- if (mVoicePhone != null) {
- mVoicePhone.removeReferences();
- mVoicePhone = null;
+ if (mImsPhone != null) {
+ mImsPhone.removeReferences();
+ mImsPhone = null;
}
}
@@ -506,18 +507,18 @@
switch(state) {
case VoLteServiceState.HANDOVER_STARTED:
srvccState = Call.SrvccState.STARTED;
- if (mVoicePhone != null) {
- conn = ((VoicePhone)mVoicePhone).getHandoverConnection();
+ if (mImsPhone != null) {
+ conn = mImsPhone.getHandoverConnection();
} else {
- Rlog.d(LOG_TAG, "HANDOVER_STARTED: mVoicePhone null");
+ Rlog.d(LOG_TAG, "HANDOVER_STARTED: mImsPhone null");
}
break;
case VoLteServiceState.HANDOVER_COMPLETED:
srvccState = Call.SrvccState.COMPLETED;
- if (mVoicePhone != null) {
- ((VoicePhone) mVoicePhone).notifySrvccState(srvccState);
+ if (mImsPhone != null) {
+ mImsPhone.notifySrvccState(srvccState);
} else {
- Rlog.d(LOG_TAG, "HANDOVER_COMPLETED: mVoicePhone null");
+ Rlog.d(LOG_TAG, "HANDOVER_COMPLETED: mImsPhone null");
}
break;
case VoLteServiceState.HANDOVER_FAILED:
@@ -1700,26 +1701,26 @@
* Return an instance of a IMS phone
*/
@Override
- public Phone getVoicePhone() {
- return mVoicePhone;
+ public Phone getImsPhone() {
+ return mImsPhone;
}
- protected void updateVoicePhone() {
- Rlog.d(LOG_TAG, "updateVoicePhone"
+ protected void updateImsPhone() {
+ Rlog.d(LOG_TAG, "updateImsPhone"
+ " mImsServiceReady=" + mImsServiceReady);
- if (mImsServiceReady && (mVoicePhone == null)) {
- mVoicePhone = PhoneFactory.makeImsPhone(mNotifier, this);
- CallManager.getInstance().registerPhone(mVoicePhone);
- ((VoicePhone)mVoicePhone).registerForSilentRedial(
+ if (mImsServiceReady && (mImsPhone == null)) {
+ mImsPhone = PhoneFactory.makeImsPhone(mNotifier, this);
+ CallManager.getInstance().registerPhone(mImsPhone);
+ mImsPhone.registerForSilentRedial(
this, EVENT_INITIATE_SILENT_REDIAL, null);
- } else if (!mImsServiceReady && (mVoicePhone != null)) {
- CallManager.getInstance().unregisterPhone(mVoicePhone);
- ((VoicePhone)mVoicePhone).unregisterForSilentRedial(this);
+ } else if (!mImsServiceReady && (mImsPhone != null)) {
+ CallManager.getInstance().unregisterPhone(mImsPhone);
+ mImsPhone.unregisterForSilentRedial(this);
- mVoicePhone.dispose();
- mVoicePhone.removeReferences();
- mVoicePhone = null;
+ mImsPhone.dispose();
+ mImsPhone.removeReferences();
+ mImsPhone = null;
}
}
@@ -1788,13 +1789,13 @@
}
/**
- * Return the service state of mVoicePhone if it is STATE_IN_SERVICE
+ * Return the service state of mImsPhone if it is STATE_IN_SERVICE
* otherwise return the current voice service state
*/
@Override
- public int getVoiceServiceState() {
- if (mVoicePhone != null
- && mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) {
+ public int getVoicePhoneServiceState() {
+ if (mImsPhone != null
+ && mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) {
return ServiceState.STATE_IN_SERVICE;
}
return getServiceState().getState();
diff --git a/src/java/com/android/internal/telephony/PhoneFactory.java b/src/java/com/android/internal/telephony/PhoneFactory.java
index 5d20052..1fca196 100644
--- a/src/java/com/android/internal/telephony/PhoneFactory.java
+++ b/src/java/com/android/internal/telephony/PhoneFactory.java
@@ -33,6 +33,7 @@
import com.android.internal.telephony.cdma.CDMAPhone;
import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
import com.android.internal.telephony.gsm.GSMPhone;
+import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.sip.SipPhone;
import com.android.internal.telephony.sip.SipPhoneFactory;
import com.android.internal.telephony.uicc.UiccController;
@@ -503,7 +504,7 @@
* Makes a {@link ImsPhone} object.
* @return the {@code ImsPhone} object or null if the exception occured
*/
- public static Phone makeImsPhone(PhoneNotifier phoneNotifier, Phone defaultPhone) {
+ public static ImsPhone makeImsPhone(PhoneNotifier phoneNotifier, Phone defaultPhone) {
return ImsPhoneFactory.makePhone(sContext, phoneNotifier, defaultPhone);
}
}
diff --git a/src/java/com/android/internal/telephony/PhoneProxy.java b/src/java/com/android/internal/telephony/PhoneProxy.java
index 1651d85..fefa905 100644
--- a/src/java/com/android/internal/telephony/PhoneProxy.java
+++ b/src/java/com/android/internal/telephony/PhoneProxy.java
@@ -37,16 +37,13 @@
import com.android.internal.telephony.cdma.CDMAPhone;
import com.android.internal.telephony.gsm.GSMPhone;
-import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.cdma.CDMALTEPhone;
-import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.uicc.IccCardProxy;
import com.android.internal.telephony.uicc.IccFileHandler;
import com.android.internal.telephony.uicc.IsimRecords;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UsimServiceTable;
-import com.android.internal.telephony.CallManager;
import java.util.List;
@@ -1354,12 +1351,12 @@
}
@Override
- public Phone getVoicePhone() {
+ public Phone getImsPhone() {
return null;
}
@Override
- public int getVoiceServiceState() {
- return mActivePhone.getVoiceServiceState();
+ public int getVoicePhoneServiceState() {
+ return mActivePhone.getVoicePhoneServiceState();
}
}
diff --git a/src/java/com/android/internal/telephony/VoicePhone.java b/src/java/com/android/internal/telephony/VoicePhone.java
deleted file mode 100644
index 2589f00..0000000
--- a/src/java/com/android/internal/telephony/VoicePhone.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import android.os.Handler;
-import android.os.RegistrantList;
-
-/**
- * Internal interface used to control the IMS phone from GSM/CDMA Phone
- *
- * {@hide}
- *
- */
-public interface VoicePhone {
-
- public static final String CS_FALLBACK = "cs_fallback";
-
- Connection getHandoverConnection();
-
- void notifySrvccState(Call.SrvccState state);
-
- // To redial through GSM or CDMA when dialing IMS call fails
- void registerForSilentRedial(Handler h, int what, Object obj);
- void unregisterForSilentRedial(Handler h);
-}
diff --git a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 37eed63..f377ec9 100644
--- a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -63,8 +63,8 @@
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
-import com.android.internal.telephony.VoicePhone;
import com.android.internal.telephony.dataconnection.DcTracker;
+import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.uicc.IccException;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.RuimRecords;
@@ -385,16 +385,16 @@
@Override
public Connection
dial (String dialString) throws CallStateException {
- if ( mVoicePhone != null
- && ((mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE
+ if ( mImsPhone != null
+ && ((mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE
&& !PhoneNumberUtils.isEmergencyNumber(dialString))
|| (PhoneNumberUtils.isEmergencyNumber(dialString)
&& mContext.getResources().getBoolean(
com.android.internal.R.bool.useImsAlwaysForEmergencyCall))) ) {
try {
- return mVoicePhone.dial(dialString);
+ return mImsPhone.dial(dialString);
} catch (CallStateException e) {
- if (!VoicePhone.CS_FALLBACK.equals(e.getMessage())) {
+ if (!ImsPhone.CS_FALLBACK.equals(e.getMessage())) {
CallStateException ce = new CallStateException(e.getMessage());
ce.setStackTrace(e.getStackTrace());
throw ce;
@@ -1163,8 +1163,8 @@
case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:{
Rlog.d(LOG_TAG, "Event EVENT_RADIO_OFF_OR_NOT_AVAILABLE Received");
- if (mVoicePhone != null) {
- mVoicePhone.getServiceState().setStateOff();
+ if (mImsPhone != null) {
+ mImsPhone.getServiceState().setStateOff();
}
}
break;
@@ -1172,8 +1172,8 @@
case EVENT_RADIO_ON:{
Rlog.d(LOG_TAG, "Event EVENT_RADIO_ON Received");
handleCdmaSubscriptionSource(mCdmaSSM.getCdmaSubscriptionSource());
- if (mVoicePhone != null) {
- mVoicePhone.getServiceState().setStateOutOfService();
+ if (mImsPhone != null) {
+ mImsPhone.getServiceState().setStateOutOfService();
}
}
break;
diff --git a/src/java/com/android/internal/telephony/gsm/GSMPhone.java b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
index b68a790..0913e57 100644
--- a/src/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -73,7 +73,7 @@
import android.telephony.SubscriptionManager;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
-import com.android.internal.telephony.VoicePhone;
+import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.IccVmNotSupportedException;
@@ -722,9 +722,9 @@
@Override
public boolean handleInCallMmiCommands(String dialString) throws CallStateException {
- if (mVoicePhone != null
- && mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) {
- return mVoicePhone.handleInCallMmiCommands(dialString);
+ if (mImsPhone != null
+ && mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) {
+ return mImsPhone.handleInCallMmiCommands(dialString);
}
if (!isInCall()) {
@@ -784,16 +784,16 @@
@Override
public Connection
dial (String dialString, UUSInfo uusInfo) throws CallStateException {
- if ( mVoicePhone != null
- && ((mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE
+ if ( mImsPhone != null
+ && ((mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE
&& !PhoneNumberUtils.isEmergencyNumber(dialString))
|| (PhoneNumberUtils.isEmergencyNumber(dialString)
&& mContext.getResources().getBoolean(
com.android.internal.R.bool.useImsAlwaysForEmergencyCall))) ) {
try {
- return mVoicePhone.dial(dialString);
+ return mImsPhone.dial(dialString);
} catch (CallStateException e) {
- if (!VoicePhone.CS_FALLBACK.equals(e.getMessage())) {
+ if (!ImsPhone.CS_FALLBACK.equals(e.getMessage())) {
CallStateException ce = new CallStateException(e.getMessage());
ce.setStackTrace(e.getStackTrace());
throw ce;
@@ -1073,9 +1073,9 @@
@Override
public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
- if ((mVoicePhone != null)
- && (mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
- mVoicePhone.getCallForwardingOption(commandInterfaceCFReason, onComplete);
+ if ((mImsPhone != null)
+ && (mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
+ mImsPhone.getCallForwardingOption(commandInterfaceCFReason, onComplete);
return;
}
@@ -1097,9 +1097,9 @@
String dialingNumber,
int timerSeconds,
Message onComplete) {
- if ((mVoicePhone != null)
- && (mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
- mVoicePhone.setCallForwardingOption(commandInterfaceCFAction,
+ if ((mImsPhone != null)
+ && (mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
+ mImsPhone.setCallForwardingOption(commandInterfaceCFAction,
commandInterfaceCFReason, dialingNumber, timerSeconds, onComplete);
return;
}
@@ -1138,9 +1138,9 @@
@Override
public void getCallWaiting(Message onComplete) {
- if ((mVoicePhone != null)
- && (mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
- mVoicePhone.getCallWaiting(onComplete);
+ if ((mImsPhone != null)
+ && (mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
+ mImsPhone.getCallWaiting(onComplete);
return;
}
@@ -1151,9 +1151,9 @@
@Override
public void setCallWaiting(boolean enable, Message onComplete) {
- if ((mVoicePhone != null)
- && (mVoicePhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
- mVoicePhone.setCallWaiting(enable, onComplete);
+ if ((mImsPhone != null)
+ && (mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
+ mImsPhone.setCallWaiting(enable, onComplete);
return;
}
@@ -1333,8 +1333,8 @@
break;
case EVENT_RADIO_ON:
- if (mVoicePhone != null) {
- mVoicePhone.getServiceState().setStateOutOfService();
+ if (mImsPhone != null) {
+ mImsPhone.getServiceState().setStateOutOfService();
}
break;
@@ -1413,8 +1413,8 @@
mPendingMMIs.get(i).onUssdFinishedError();
}
}
- if (mVoicePhone != null) {
- mVoicePhone.getServiceState().setStateOff();
+ if (mImsPhone != null) {
+ mImsPhone.getServiceState().setStateOff();
}
break;
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
index b889117..912e65d 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
@@ -68,7 +68,6 @@
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.Subscription;
-import com.android.internal.telephony.VoicePhone;
import com.android.internal.telephony.uicc.IccRecords;
import java.util.ArrayList;
@@ -77,7 +76,7 @@
/**
* {@hide}
*/
-public class ImsPhone extends ImsPhoneBase implements VoicePhone {
+public class ImsPhone extends ImsPhoneBase {
private static final String LOG_TAG = "ImsPhone";
private static final boolean DBG = true;
private static final boolean VDBG = false; // STOPSHIP if true
@@ -87,6 +86,8 @@
protected static final int EVENT_SET_CALL_WAITING_DONE = EVENT_LAST + 3;
protected static final int EVENT_GET_CALL_WAITING_DONE = EVENT_LAST + 4;
+ public static final String CS_FALLBACK = "cs_fallback";
+
// Instance Variables
PhoneBase mDefaultPhone;
ImsPhoneCallTracker mCT;
@@ -438,7 +439,7 @@
} else if (!mmi.isSupportedOverImsPhone()) {
// If the mmi is not supported by IMS service,
// try to initiate dialing with default phone
- throw new CallStateException(VoicePhone.CS_FALLBACK);
+ throw new CallStateException(CS_FALLBACK);
} else {
mPendingMMIs.add(mmi);
mMmiRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));
@@ -854,7 +855,6 @@
}
}
- @Override
public ImsPhoneConnection getHandoverConnection() {
// handover for single foreground call
ImsPhoneConnection conn = getForegroundCall().getHandoverConnection();
@@ -872,7 +872,6 @@
return conn;
}
- @Override
public void notifySrvccState(Call.SrvccState state) {
mCT.notifySrvccState(state);
}
@@ -886,12 +885,10 @@
}
}
- @Override
public void registerForSilentRedial(Handler h, int what, Object obj) {
mSilentRedialRegistrants.addUnique(h, what, obj);
}
- @Override
public void unregisterForSilentRedial(Handler h) {
mSilentRedialRegistrants.remove(h);
}
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneFactory.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneFactory.java
index 6bb5ac9..9f81a69 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneFactory.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneFactory.java
@@ -34,7 +34,7 @@
* object
* @return the {@code ImsPhone} object
*/
- public static Phone makePhone(Context context,
+ public static ImsPhone makePhone(Context context,
PhoneNotifier phoneNotifier, Phone defaultPhone) {
try {