Merge "Telephony: Remove SimCard and RuimCard"
This commit is contained in:
@@ -44,7 +44,7 @@ import com.android.internal.R;
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public abstract class IccCard {
|
||||
public class IccCard {
|
||||
protected String mLogTag;
|
||||
protected boolean mDbg;
|
||||
|
||||
@@ -68,6 +68,10 @@ public abstract class IccCard {
|
||||
private boolean mIccFdnEnabled = false; // Default to disabled.
|
||||
// Will be updated when SIM_READY.
|
||||
|
||||
/* Parameter is3gpp's values to be passed to constructor */
|
||||
public final static boolean CARD_IS_3GPP = true;
|
||||
public final static boolean CARD_IS_NOT_3GPP = false;
|
||||
|
||||
|
||||
/* The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
|
||||
static public final String INTENT_KEY_ICC_STATE = "ss";
|
||||
@@ -162,8 +166,11 @@ public abstract class IccCard {
|
||||
return State.UNKNOWN;
|
||||
}
|
||||
|
||||
public IccCard(PhoneBase phone, String logTag, Boolean dbg) {
|
||||
public IccCard(PhoneBase phone, String logTag, Boolean is3gpp, Boolean dbg) {
|
||||
mPhone = phone;
|
||||
this.is3gpp = is3gpp;
|
||||
mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(mPhone.getContext(),
|
||||
mPhone.mCM, mHandler, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
|
||||
mPhone.mCM.registerForOffOrNotAvailable(mHandler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
mPhone.mCM.registerForOn(mHandler, EVENT_RADIO_ON, null);
|
||||
mPhone.mCM.registerForIccStatusChanged(mHandler, EVENT_ICC_STATUS_CHANGED, null);
|
||||
@@ -175,6 +182,7 @@ public abstract class IccCard {
|
||||
mPhone.mCM.unregisterForIccStatusChanged(mHandler);
|
||||
mPhone.mCM.unregisterForOffOrNotAvailable(mHandler);
|
||||
mPhone.mCM.unregisterForOn(mHandler);
|
||||
mCdmaSSM.dispose(mHandler);
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
@@ -447,7 +455,9 @@ public abstract class IccCard {
|
||||
* yet available
|
||||
*
|
||||
*/
|
||||
public abstract String getServiceProviderName();
|
||||
public String getServiceProviderName () {
|
||||
return mPhone.mIccRecords.getServiceProviderName();
|
||||
}
|
||||
|
||||
protected void updateStateProperty() {
|
||||
mPhone.setSystemProperty(TelephonyProperties.PROPERTY_SIM_STATE, getState().toString());
|
||||
@@ -912,7 +922,13 @@ public abstract class IccCard {
|
||||
Log.d(mLogTag, "[IccCard] " + msg);
|
||||
}
|
||||
|
||||
protected abstract int getCurrentApplicationIndex();
|
||||
protected int getCurrentApplicationIndex() {
|
||||
if (is3gpp) {
|
||||
return mIccCardStatus.getGsmUmtsSubscriptionAppIndex();
|
||||
} else {
|
||||
return mIccCardStatus.getCdmaSubscriptionAppIndex();
|
||||
}
|
||||
}
|
||||
|
||||
public String getAid() {
|
||||
String aid = "";
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.internal.telephony.gsm.UsimServiceTable;
|
||||
import com.android.internal.telephony.ims.IsimRecords;
|
||||
import com.android.internal.telephony.test.SimulatedRadioControl;
|
||||
import com.android.internal.telephony.gsm.SIMRecords;
|
||||
import com.android.internal.telephony.gsm.SimCard;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ import android.provider.Telephony;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.OperatorInfo;
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.PhoneNotifier;
|
||||
import com.android.internal.telephony.PhoneProxy;
|
||||
import com.android.internal.telephony.SMSDispatcher;
|
||||
import com.android.internal.telephony.gsm.GsmSMSDispatcher;
|
||||
import com.android.internal.telephony.gsm.SimCard;
|
||||
import com.android.internal.telephony.ims.IsimRecords;
|
||||
|
||||
public class CDMALTEPhone extends CDMAPhone {
|
||||
@@ -79,7 +79,7 @@ public class CDMALTEPhone extends CDMAPhone {
|
||||
|
||||
@Override
|
||||
protected void initSstIcc() {
|
||||
mIccCard = new SimCard(this, LOG_TAG, DBG);
|
||||
mIccCard = new IccCard(this, LOG_TAG, IccCard.CARD_IS_3GPP, DBG);
|
||||
mIccRecords = new CdmaLteUiccRecords(this);
|
||||
mIccFileHandler = new CdmaLteUiccFileHandler(this);
|
||||
// CdmaLteServiceStateTracker registers with IccCard to know
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.android.internal.telephony.CallTracker;
|
||||
import com.android.internal.telephony.CommandException;
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.Connection;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.IccException;
|
||||
import com.android.internal.telephony.IccFileHandler;
|
||||
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
|
||||
@@ -148,7 +149,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
}
|
||||
|
||||
protected void initSstIcc() {
|
||||
mIccCard = new RuimCard(this, LOG_TAG, DBG);
|
||||
mIccCard = new IccCard(this, LOG_TAG, IccCard.CARD_IS_NOT_3GPP, DBG);
|
||||
mIccRecords = new RuimRecords(this);
|
||||
mIccFileHandler = new RuimFileHandler(this);
|
||||
// CdmaServiceStateTracker registers with IccCard to know
|
||||
|
||||
@@ -432,7 +432,7 @@ public class CdmaConnection extends Connection {
|
||||
return DisconnectCause.OUT_OF_SERVICE;
|
||||
} else if (phone.mCdmaSubscriptionSource ==
|
||||
CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM
|
||||
&& phone.getIccCard().getState() != RuimCard.State.READY) {
|
||||
&& phone.getIccCard().getState() != IccCard.State.READY) {
|
||||
return DisconnectCause.ICC_ERROR;
|
||||
} else if (causeCode==CallFailCause.NORMAL_CLEARING) {
|
||||
return DisconnectCause.NORMAL;
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 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.cdma;
|
||||
|
||||
import com.android.internal.telephony.IccCard;
|
||||
|
||||
/**
|
||||
* Note: this class shares common code with SimCard, consider a base class to minimize code
|
||||
* duplication.
|
||||
* {@hide}
|
||||
*/
|
||||
public final class RuimCard extends IccCard {
|
||||
|
||||
RuimCard(CDMAPhone phone, String LOG_TAG, boolean dbg) {
|
||||
super(phone, LOG_TAG, dbg);
|
||||
is3gpp = false;
|
||||
mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(mPhone.getContext(),
|
||||
mPhone.mCM, mHandler, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
|
||||
|
||||
updateStateProperty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
mCdmaSSM.dispose(mHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServiceProviderName () {
|
||||
return mPhone.mIccRecords.getServiceProviderName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getCurrentApplicationIndex() {
|
||||
if (mIccCardStatus == null) {
|
||||
return -1;
|
||||
}
|
||||
return mIccCardStatus.getCdmaSubscriptionAppIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import com.android.internal.telephony.AdnRecordCache;
|
||||
import com.android.internal.telephony.AdnRecordLoader;
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.IccRefreshResponse;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.TelephonyProperties;
|
||||
import com.android.internal.telephony.cdma.RuimCard;
|
||||
import com.android.internal.telephony.MccTable;
|
||||
|
||||
// can't be used since VoiceMailConstants is not public
|
||||
@@ -346,7 +346,7 @@ public final class RuimRecords extends IccRecords {
|
||||
recordsLoadedRegistrants.notifyRegistrants(
|
||||
new AsyncResult(null, null, null));
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
RuimCard.INTENT_VALUE_ICC_LOADED, null);
|
||||
IccCard.INTENT_VALUE_ICC_LOADED, null);
|
||||
}
|
||||
|
||||
private void onRuimReady() {
|
||||
@@ -355,7 +355,7 @@ public final class RuimRecords extends IccRecords {
|
||||
*/
|
||||
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
RuimCard.INTENT_VALUE_ICC_READY, null);
|
||||
IccCard.INTENT_VALUE_ICC_READY, null);
|
||||
|
||||
fetchRuimRecords();
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.android.internal.telephony.CallForwardInfo;
|
||||
import com.android.internal.telephony.CallStateException;
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.Connection;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.IccFileHandler;
|
||||
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
|
||||
import com.android.internal.telephony.IccSmsInterfaceManager;
|
||||
@@ -135,7 +136,7 @@ public class GSMPhone extends PhoneBase {
|
||||
}
|
||||
|
||||
mCM.setPhoneType(Phone.PHONE_TYPE_GSM);
|
||||
mIccCard = new SimCard(this, LOG_TAG, true);
|
||||
mIccCard = new IccCard(this, LOG_TAG, IccCard.CARD_IS_3GPP, true);
|
||||
mCT = new GsmCallTracker(this);
|
||||
mSST = new GsmServiceStateTracker (this);
|
||||
mSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
|
||||
|
||||
@@ -370,7 +370,7 @@ public class GsmConnection extends Connection {
|
||||
} else if (serviceState == ServiceState.STATE_OUT_OF_SERVICE
|
||||
|| serviceState == ServiceState.STATE_EMERGENCY_ONLY ) {
|
||||
return DisconnectCause.OUT_OF_SERVICE;
|
||||
} else if (phone.getIccCard().getState() != SimCard.State.READY) {
|
||||
} else if (phone.getIccCard().getState() != IccCard.State.READY) {
|
||||
return DisconnectCause.ICC_ERROR;
|
||||
} else if (causeCode == CallFailCause.ERROR_UNSPECIFIED) {
|
||||
if (phone.mSST.mRestrictedState.isCsRestricted()) {
|
||||
|
||||
@@ -765,7 +765,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
|
||||
// invalid length
|
||||
handlePasswordError(com.android.internal.R.string.invalidPin);
|
||||
} else if (sc.equals(SC_PIN) &&
|
||||
phone.mIccCard.getState() == SimCard.State.PUK_REQUIRED ) {
|
||||
phone.mIccCard.getState() == IccCard.State.PUK_REQUIRED ) {
|
||||
// Sim is puk-locked
|
||||
handlePasswordError(com.android.internal.R.string.needPuk);
|
||||
} else {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.android.internal.telephony.AdnRecordCache;
|
||||
import com.android.internal.telephony.AdnRecordLoader;
|
||||
import com.android.internal.telephony.BaseCommands;
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.IccFileHandler;
|
||||
import com.android.internal.telephony.IccRecords;
|
||||
import com.android.internal.telephony.IccUtils;
|
||||
@@ -583,7 +584,7 @@ public class SIMRecords extends IccRecords {
|
||||
MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
|
||||
}
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
SimCard.INTENT_VALUE_ICC_IMSI, null);
|
||||
IccCard.INTENT_VALUE_ICC_IMSI, null);
|
||||
break;
|
||||
|
||||
case EVENT_GET_MBI_DONE:
|
||||
@@ -1275,7 +1276,7 @@ public class SIMRecords extends IccRecords {
|
||||
recordsLoadedRegistrants.notifyRegistrants(
|
||||
new AsyncResult(null, null, null));
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
SimCard.INTENT_VALUE_ICC_LOADED, null);
|
||||
IccCard.INTENT_VALUE_ICC_LOADED, null);
|
||||
}
|
||||
|
||||
//***** Private methods
|
||||
@@ -1300,7 +1301,7 @@ public class SIMRecords extends IccRecords {
|
||||
READY is sent before IMSI ready
|
||||
*/
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
SimCard.INTENT_VALUE_ICC_READY, null);
|
||||
IccCard.INTENT_VALUE_ICC_READY, null);
|
||||
|
||||
fetchSimRecords();
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 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.gsm;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.PhoneBase;
|
||||
import com.android.internal.telephony.TelephonyProperties;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public final class SimCard extends IccCard {
|
||||
|
||||
public SimCard(PhoneBase phone, String logTag, Boolean dbg) {
|
||||
super(phone, logTag, dbg);
|
||||
updateStateProperty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServiceProviderName () {
|
||||
return mPhone.mIccRecords.getServiceProviderName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getCurrentApplicationIndex() {
|
||||
if (mIccCardStatus == null) {
|
||||
return -1;
|
||||
}
|
||||
return mIccCardStatus.getGsmUmtsSubscriptionAppIndex();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user