diff options
author | Steve Kondik <steve@cyngn.com> | 2015-11-16 19:29:13 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-16 19:29:13 -0800 |
commit | 8320596de5ba926fb1426bb891e1eceb8b671845 (patch) | |
tree | b713896efdfa3a2d164a3f23148faec13fdb9368 | |
parent | ef9e2cb0d8acbb42a8567bed643250f255aa739f (diff) | |
parent | 7a47c3eea9eabdfb88be73cf53d05f40efa0ec77 (diff) | |
download | android_frameworks_opt_telephony-8320596de5ba926fb1426bb891e1eceb8b671845.tar.gz android_frameworks_opt_telephony-8320596de5ba926fb1426bb891e1eceb8b671845.tar.bz2 android_frameworks_opt_telephony-8320596de5ba926fb1426bb891e1eceb8b671845.zip |
Merge branch 'LA.BF64.1.2.2_rb4.7' of git://codeaurora.org/platform/frameworks/opt/telephony into cm-13.0
Change-Id: Ib57c660c45b2896e4c1a7f3211ec5d6fbec0c5a5
21 files changed, 412 insertions, 38 deletions
diff --git a/resources/res/values-mcc460-mnc00/config.xml b/resources/res/values-mcc460-mnc00/config.xml index be7fa62a9..505588b1d 100644 --- a/resources/res/values-mcc460-mnc00/config.xml +++ b/resources/res/values-mcc460-mnc00/config.xml @@ -32,4 +32,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Configuration for sending and receiving Mms when mobile data is disabled.--> <bool name="config_enable_mms_with_mobile_data_off">true</bool> + <!-- To disable/enable call barring requests over IMS --> + <bool name="config_enable_callbarring_over_ims">true</bool> </resources> diff --git a/resources/res/values-mcc460-mnc02/config.xml b/resources/res/values-mcc460-mnc02/config.xml index be7fa62a9..505588b1d 100644 --- a/resources/res/values-mcc460-mnc02/config.xml +++ b/resources/res/values-mcc460-mnc02/config.xml @@ -32,4 +32,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Configuration for sending and receiving Mms when mobile data is disabled.--> <bool name="config_enable_mms_with_mobile_data_off">true</bool> + <!-- To disable/enable call barring requests over IMS --> + <bool name="config_enable_callbarring_over_ims">true</bool> </resources> diff --git a/resources/res/values-mcc460-mnc07/config.xml b/resources/res/values-mcc460-mnc07/config.xml index be7fa62a9..505588b1d 100644 --- a/resources/res/values-mcc460-mnc07/config.xml +++ b/resources/res/values-mcc460-mnc07/config.xml @@ -32,4 +32,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Configuration for sending and receiving Mms when mobile data is disabled.--> <bool name="config_enable_mms_with_mobile_data_off">true</bool> + <!-- To disable/enable call barring requests over IMS --> + <bool name="config_enable_callbarring_over_ims">true</bool> </resources> diff --git a/resources/res/values-mcc460-mnc08/config.xml b/resources/res/values-mcc460-mnc08/config.xml index be7fa62a9..505588b1d 100644 --- a/resources/res/values-mcc460-mnc08/config.xml +++ b/resources/res/values-mcc460-mnc08/config.xml @@ -32,4 +32,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Configuration for sending and receiving Mms when mobile data is disabled.--> <bool name="config_enable_mms_with_mobile_data_off">true</bool> + <!-- To disable/enable call barring requests over IMS --> + <bool name="config_enable_callbarring_over_ims">true</bool> </resources> diff --git a/resources/res/values/config.xml b/resources/res/values/config.xml index a7e1d304a..730ff9827 100644 --- a/resources/res/values/config.xml +++ b/resources/res/values/config.xml @@ -41,4 +41,11 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <bool name="config_enable_display_14digit_imei">false</bool> <!-- Controlling respond call via sms feature via config item --> <bool name="config_reject_call_via_sms_enabled">true</bool> + <!-- To disable/enable call barring requests over IMS --> + <bool name="config_enable_callbarring_over_ims">false</bool> + <!--The .jar file name which has the extended implementation + of telephony base classes.--> + <string name="telephony_plugin_jar_name" translatable="false"></string> + <!--Fully qualified class name of telephony extended plugin.--> + <string name="telephony_plugin_class_name" translatable="false"></string> </resources> diff --git a/src/java/com/android/internal/telephony/PhoneBase.java b/src/java/com/android/internal/telephony/PhoneBase.java index ddde32d67..07c4b5c2a 100644 --- a/src/java/com/android/internal/telephony/PhoneBase.java +++ b/src/java/com/android/internal/telephony/PhoneBase.java @@ -45,6 +45,7 @@ import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; import android.telephony.VoLteServiceState; import android.telephony.ModemActivityInfo; import android.text.TextUtils; @@ -179,8 +180,9 @@ public abstract class PhoneBase extends Handler implements Phone { protected static final int EVENT_SS = 36; protected static final int EVENT_CONFIG_LCE = 37; private static final int EVENT_CHECK_FOR_NETWORK_AUTOMATIC = 38; + protected static final int EVENT_GET_CALLFORWARDING_STATUS = 39; protected static final int EVENT_LAST = - EVENT_CHECK_FOR_NETWORK_AUTOMATIC; + EVENT_GET_CALLFORWARDING_STATUS; // For shared prefs. private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_"; @@ -196,6 +198,13 @@ public abstract class PhoneBase extends Handler implements Phone { // Key used to read/write the ID for storing the voice mail public static final String VM_ID = "vm_id_key"; + // Key used to read/write the SIM IMSI used for storing the imsi + public static final String SIM_IMSI = "sim_imsi_key"; + // Key used to read/write SIM IMSI used for storing the imsi + public static final String VM_SIM_IMSI = "vm_sim_imsi_key"; + // Key used to read/write if Call Forwarding is enabled + public static final String CF_ENABLED = "cf_enabled_key"; + // Key used to read/write "disable DNS server check" pref (used for testing) public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key"; @@ -1476,6 +1485,89 @@ public abstract class PhoneBase extends Handler implements Phone { } /** + * This method stores the CF_ENABLED flag in preferences + * @param enabled + */ + public void setCallForwardingPreference(boolean enabled) { + Rlog.d(LOG_TAG, "Set callforwarding info to perferences"); + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); + SharedPreferences.Editor edit = sp.edit(); + edit.putBoolean(CF_ENABLED + getSubId(), enabled); + edit.commit(); + + // set the sim imsi to be able to track when the sim card is changed. + setSimImsi(getSubscriberId()); + } + + public boolean getCallForwardingPreference() { + Rlog.d(LOG_TAG, "Get callforwarding info from perferences"); + + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); + boolean cf = false; + // Migrate CF enabled flag from phoneid based preference to subId based. + boolean needMigration = false; + String oldCfKey = null; + if (TelephonyManager.getDefault().isMultiSimEnabled()) { + if (!sp.contains(CF_ENABLED + getSubId()) && sp.contains(CF_ENABLED + mPhoneId)) { + oldCfKey = CF_ENABLED + mPhoneId; + needMigration = true; + } + } else { + if (!sp.contains(CF_ENABLED + getSubId()) && sp.contains(CF_ENABLED)) { + oldCfKey = CF_ENABLED; + needMigration = true; + } + } + if (needMigration) { + // Save cf flag based on subId and remove old preference + cf = sp.getBoolean(oldCfKey, false); + setCallForwardingPreference(cf); + SharedPreferences.Editor edit = sp.edit(); + edit.remove(oldCfKey); + edit.commit(); + return cf; + } + cf = sp.getBoolean(CF_ENABLED + getSubId(), false); + return cf; + } + + public String getSimImsi() { + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); + boolean needMigration = false; + String oldImsiKey = null; + if (TelephonyManager.getDefault().isMultiSimEnabled()) { + //Migrate sim_imsi value for msim + if (!sp.contains(SIM_IMSI + getSubId()) && sp.contains(VM_SIM_IMSI + mPhoneId)) { + oldImsiKey = VM_SIM_IMSI + mPhoneId; + needMigration = true; + } + } else { + //Migrate sim_imsi value for single sim + if (!sp.contains(SIM_IMSI + getSubId()) && sp.contains(VM_SIM_IMSI)) { + oldImsiKey = VM_SIM_IMSI; + needMigration = true; + } + } + if (needMigration) { + // Save imsi based on subId and remove old preference + String imsi = sp.getString(oldImsiKey, null); + setSimImsi(imsi); + SharedPreferences.Editor editor = sp.edit(); + editor.remove(oldImsiKey); + editor.commit(); + return imsi; + } + return sp.getString(SIM_IMSI + getSubId(), null); + } + + public void setSimImsi(String imsi) { + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); + SharedPreferences.Editor editor = sp.edit(); + editor.putString(SIM_IMSI + getSubId(), imsi); + editor.apply(); + } + + /** * Query the status of the CDMA roaming preference */ @Override diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java index 11a5299cb..a35b72de5 100644 --- a/src/java/com/android/internal/telephony/RIL.java +++ b/src/java/com/android/internal/telephony/RIL.java @@ -1521,7 +1521,7 @@ public class RIL extends BaseCommands implements CommandsInterface { response); rr.mParcel.writeInt(status); - rr.mParcel.writeString(pdu); + constructCdmaWriteSmsRilRequest(rr, IccUtils.hexStringToBytes(pdu)); if (RILJ_LOGV) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) @@ -1531,6 +1531,98 @@ public class RIL extends BaseCommands implements CommandsInterface { } /** + * Restructures PDU data so that it is consistent with RIL + * data structure. + * + * @param pdu The data to be written to the RUIM card. + */ + private void constructCdmaWriteSmsRilRequest(RILRequest rr, byte[] pdu) { + int address_nbr_of_digits; + int subaddr_nbr_of_digits; + int bearerDataLength; + ByteArrayInputStream bais = new ByteArrayInputStream(pdu); + DataInputStream dis = new DataInputStream(bais); + + try { + int teleServiceId = 0; + byte servicePresent = 0; + int serviceCategory = 0; + + int address_digit_mode = 0; + int address_nbr_mode = 0; + int address_ton = 0; + int address_nbr_plan = 0; + + int subaddressType = 0; + byte subaddr_odd = 0; + + teleServiceId = dis.readInt(); + rr.mParcel.writeInt(teleServiceId); + servicePresent = (byte) dis.readInt(); + rr.mParcel.writeByte(servicePresent); + serviceCategory = dis.readInt(); + rr.mParcel.writeInt(serviceCategory); + + address_digit_mode = dis.readByte(); + rr.mParcel.writeInt(address_digit_mode); + address_nbr_mode = dis.readByte(); + rr.mParcel.writeInt(address_nbr_mode); + address_ton = dis.readByte(); + rr.mParcel.writeInt(address_ton); + address_nbr_plan = dis.readByte(); + rr.mParcel.writeInt(address_nbr_plan); + + address_nbr_of_digits = dis.readByte(); + rr.mParcel.writeByte((byte) address_nbr_of_digits); + for (int i = 0; i < address_nbr_of_digits; i++) { + rr.mParcel.writeByte(dis.readByte()); // address_orig_bytes[i] + } + + // int + subaddressType = dis.readByte(); + rr.mParcel.writeInt(subaddressType); // subaddressType + subaddr_odd = (byte) dis.readByte(); + rr.mParcel.writeByte(subaddr_odd); // subaddr_odd + subaddr_nbr_of_digits = (byte) dis.readByte(); + rr.mParcel.writeByte((byte) subaddr_nbr_of_digits); + for (int i = 0; i < subaddr_nbr_of_digits; i++) { + rr.mParcel.writeByte(dis.readByte()); // subaddr_orig_bytes[i] + } + + bearerDataLength = dis.readByte() & 0xff; + rr.mParcel.writeInt(bearerDataLength); + for (int i = 0; i < bearerDataLength; i++) { + rr.mParcel.writeByte(dis.readByte()); // bearerData[i] + } + + riljLog(" teleServiceId=" + teleServiceId + " servicePresent=" + servicePresent + + " serviceCategory=" + serviceCategory + + " address_digit_mode=" + address_digit_mode + + " address_nbr_mode=" + address_nbr_mode + " address_ton=" + address_ton + + " address_nbr_plan=" + address_nbr_plan + + " address_nbr_of_digits=" + address_nbr_of_digits + + " subaddressType=" + subaddressType + " subaddr_odd= " + subaddr_odd + + " subaddr_nbr_of_digits=" + subaddr_nbr_of_digits + + " bearerDataLength=" + bearerDataLength); + } catch (IOException ex) { + if (RILJ_LOGD) riljLog("sendSmsCdma: conversion from input stream to object failed: " + + ex); + } finally { + try { + if (null != bais) { + bais.close(); + } + + if (null != dis) { + dis.close(); + } + } catch (IOException e) { + if (RILJ_LOGD) riljLog("sendSmsCdma: close input stream exception" + e); + } + } + } + + /** * Translates EF_SMS status bits to a status value compatible with * SMS AT commands. See TS 27.005 3.1. */ diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java index c1d369036..88f1c14d7 100644 --- a/src/java/com/android/internal/telephony/ServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java @@ -53,6 +53,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import com.android.internal.telephony.dataconnection.DcTrackerBase; +import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState; import com.android.internal.telephony.uicc.IccCardProxy; import com.android.internal.telephony.uicc.IccRecords; @@ -1172,4 +1173,28 @@ public abstract class ServiceStateTracker extends Handler { public final boolean isDeviceShuttingDown() { return mDeviceShuttingDown; } + + protected String maybeUpdateHDTagForSpn(boolean showSpn, String spn) { + if (!showSpn) return spn; + return maybeUpdateHDTag(spn); + } + + protected String maybeUpdateHDTagForPlmn(boolean showPlmn, String plmn) { + if (!showPlmn) return plmn; + return maybeUpdateHDTag(plmn); + } + + private String maybeUpdateHDTag(String networkName) { + if (mPhoneBase.getImsPhone() != null && + (((ImsPhone) mPhoneBase.getImsPhone()).isVolteEnabled() || + ((ImsPhone) mPhoneBase.getImsPhone()).isVideoCallEnabled())) { + String hdTag = mPhoneBase.getContext().getText( + com.android.internal.R.string.high_definition_tag).toString(); + String originalNwName = networkName.trim(); + networkName = String.format(hdTag, originalNwName); + Rlog.d(LOG_TAG, "maybeUpdateHDTag: networkName: " + networkName + + " original name: " + originalNwName); + } + return networkName; + } } diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java index 631c07d66..ec6a72170 100644 --- a/src/java/com/android/internal/telephony/SubscriptionController.java +++ b/src/java/com/android/internal/telephony/SubscriptionController.java @@ -22,6 +22,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -31,6 +32,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.UserHandle; +import android.preference.PreferenceManager; import android.provider.Settings; import android.telephony.RadioAccessFamily; import android.telephony.Rlog; @@ -1665,6 +1667,16 @@ public class SubscriptionController extends ISub.Stub { return retVal; } + public void removeStaleSubPreferences(String prefKey) { + List<SubscriptionInfo> subInfoList = getAllSubInfoList(mContext.getOpPackageName()); + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); + for (SubscriptionInfo subInfo : subInfoList) { + if (subInfo.getSimSlotIndex() == -1) { + sp.edit().remove(prefKey + subInfo.getSubscriptionId()).commit(); + } + } + } + /** * Get the SIM state for the slot idx * @return SIM state as the ordinal of {@See IccCardConstants.State} diff --git a/src/java/com/android/internal/telephony/TelephonyPluginDelegate.java b/src/java/com/android/internal/telephony/TelephonyPluginDelegate.java index 4a0555e12..89cf19804 100644 --- a/src/java/com/android/internal/telephony/TelephonyPluginDelegate.java +++ b/src/java/com/android/internal/telephony/TelephonyPluginDelegate.java @@ -32,6 +32,7 @@ import android.content.Context; import android.util.Log; import android.telephony.Rlog; +import com.android.internal.telephony.ConfigResourceUtil; import com.android.internal.telephony.dataconnection.DcTracker; import com.android.internal.telephony.dataconnection.DctController; import com.android.internal.telephony.TelephonyPluginBase; @@ -62,20 +63,26 @@ public class TelephonyPluginDelegate { public static void init(Context context) { if (sMe == null) { - String fullClsName = context.getResources() - .getString(R.string.telephony_plugin_class_name); - String libPath = context.getResources().getString(R.string.telephony_plugin_lib_path); + try { + final String dir = "/system/framework/"; + String jarName = ConfigResourceUtil.getStringValue( + context, "telephony_plugin_jar_name"); - PathClassLoader classLoader = new PathClassLoader(libPath, - ClassLoader.getSystemClassLoader()); - Rlog.d(LOG_TAG, "classLoader = " + classLoader); + String fullClsName = ConfigResourceUtil.getStringValue(context, + "telephony_plugin_class_name"); - if (fullClsName == null || fullClsName.length() == 0) { - Rlog.d(LOG_TAG, "No customized TelephonyPlugin available, fallback to default"); - fullClsName = "com.android.internal.telephony.DefaultTelephonyPlugin"; - } - Class<?> cls = null; - try { + String libPath = dir + jarName; + Rlog.d(LOG_TAG, "Extension = " +fullClsName + "@" + libPath); + + PathClassLoader classLoader = new PathClassLoader(libPath, + ClassLoader.getSystemClassLoader()); + Rlog.d(LOG_TAG, "classLoader = " + classLoader); + + if (fullClsName == null || fullClsName.length() == 0) { + Rlog.d(LOG_TAG, "No customized TelephonyPlugin available, fallback to default"); + fullClsName = "com.android.internal.telephony.DefaultTelephonyPlugin"; + } + Class<?> cls = null; cls = Class.forName(fullClsName, false, classLoader); Rlog.d(LOG_TAG, "cls = " + cls); Constructor custMethod = cls.getConstructor(); diff --git a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java index df3dabc65..6c0057e27 100644 --- a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java @@ -458,7 +458,8 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker { if (!hasBrandOverride && (mCi.getRadioState().isOn()) && (mPhone.isEriFileLoaded()) && (!isRatLte(mSS.getRilVoiceRadioTechnology()) || mPhone.getContext().getResources().getBoolean(com.android.internal.R. - bool.config_LTE_eri_for_network_name))) { + bool.config_LTE_eri_for_network_name)) && + !mIsSubscriptionFromRuim) { // Only when CDMA is in service, ERI will take effect String eriText = mSS.getOperatorAlphaLong(); // Now the CDMAPhone sees the new ServiceState so it can get the diff --git a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index 8dda44ac5..2d147080c 100644 --- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -605,6 +605,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { "of service, set plmn='" + plmn + "'"); } + plmn = maybeUpdateHDTagForPlmn(showPlmn, plmn); + if (mSubId != subId || !TextUtils.equals(plmn, mCurPlmn)) { // Allow A blank plmn, "" to set showPlmn to true. Previously, we // would set showPlmn to true only if plmn was not empty, i.e. was not diff --git a/src/java/com/android/internal/telephony/dataconnection/DcSwitchStateMachine.java b/src/java/com/android/internal/telephony/dataconnection/DcSwitchStateMachine.java index 66fc00099..554a3c8ba 100644 --- a/src/java/com/android/internal/telephony/dataconnection/DcSwitchStateMachine.java +++ b/src/java/com/android/internal/telephony/dataconnection/DcSwitchStateMachine.java @@ -33,6 +33,7 @@ import com.android.internal.telephony.SubscriptionController; import android.os.AsyncResult; import android.os.Message; import android.telephony.Rlog; +import android.telephony.ServiceState; public class DcSwitchStateMachine extends StateMachine { private static final boolean DBG = true; @@ -298,6 +299,16 @@ public class DcSwitchStateMachine extends StateMachine { } else { logd("EVENT_DATA_ALLOWED success"); mResponseMsg = null; + + /* If the data service state is IN_SERVICE then move to + * ATTACHED state. + */ + int dataState = mPhone.getServiceState().getDataRegState(); + if (dataState == ServiceState.STATE_IN_SERVICE) { + logd("AttachingState: Already attached, move to ATTACHED state"); + transitionTo(mAttachedState); + } + } } retVal = HANDLED; diff --git a/src/java/com/android/internal/telephony/dataconnection/DctController.java b/src/java/com/android/internal/telephony/dataconnection/DctController.java index d42444954..ee48bb567 100644 --- a/src/java/com/android/internal/telephony/dataconnection/DctController.java +++ b/src/java/com/android/internal/telephony/dataconnection/DctController.java @@ -417,24 +417,7 @@ public class DctController extends Handler { } } } else { - Phone phone = mPhones[activePhoneId].getActivePhone(); mDcSwitchAsyncChannel[activePhoneId].disconnectAll(); - if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) { - /* Traditionally modem reports data registered on CDMA sub even when it is - * non-dds because CDMA network does not have PS ATTACH/DETACH concept. - * - * So when CDMA sub becomes non-dds from dds the state-machine is expacting - * onDataConnectionDetached() call from serviceStateTracker. It would never - * happen since cdma SST did not notice change in registration during DDS - * switch. - * - * Hence we need to fake the DETACH to move/progress DcSwitchStateMachine. - */ - - logd("Active phone is CDMA, fake DETACH"); - mDcSwitchAsyncChannel[activePhoneId].notifyDataDetached(); - - } } } diff --git a/src/java/com/android/internal/telephony/gsm/GSMPhone.java b/src/java/com/android/internal/telephony/gsm/GSMPhone.java index 13d3210c2..63ce2935a 100755..100644 --- a/src/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/src/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -37,6 +37,7 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import com.android.internal.telephony.CallTracker; +import com.android.internal.telephony.ConfigResourceUtil; import android.text.TextUtils; import android.telephony.Rlog; @@ -70,6 +71,7 @@ import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.PhoneNotifier; import com.android.internal.telephony.PhoneProxy; import com.android.internal.telephony.PhoneSubInfo; +import com.android.internal.telephony.SubscriptionController; import com.android.internal.telephony.UUSInfo; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.test.SimulatedRadioControl; @@ -325,6 +327,17 @@ public class GSMPhone extends PhoneBase { setVoiceMessageCount(countVoiceMessages); } + public boolean getCallForwardingIndicator() { + boolean cf = false; + IccRecords r = mIccRecords.get(); + if (r != null && r.isCallForwardStatusStored()) { + cf = r.getVoiceCallForwardingFlag(); + } else { + cf = getCallForwardingPreference(); + } + return cf; + } + @Override public List<? extends MmiCode> getPendingMmiCodes() { @@ -1407,6 +1420,22 @@ public class GSMPhone extends PhoneBase { } } + /** + * Used to check if Call Forwarding status is present on sim card. If not, a message is + * sent so we can check if the CF status is stored as a Shared Preference. + */ + private void updateCallForwardStatus() { + if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "updateCallForwardStatus got sim records"); + IccRecords r = mIccRecords.get(); + if (r != null && r.isCallForwardStatusStored()) { + // The Sim card has the CF info + if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "Callforwarding info is present on sim"); + notifyCallForwardingIndicator(); + } else { + Message msg = obtainMessage(EVENT_GET_CALLFORWARDING_STATUS); + sendMessage(msg); + } + } private void onNetworkInitiatedUssd(GsmMmiCode mmi) { @@ -1531,11 +1560,16 @@ public class GSMPhone extends PhoneBase { String imsiFromSIM = getSubscriberId(); if (imsi != null && imsiFromSIM != null && !imsiFromSIM.equals(imsi)) { storeVoiceMailNumber(null); + setCallForwardingPreference(false); setVmSimImsi(null); + SubscriptionController controller = + SubscriptionController.getInstance(); + controller.removeStaleSubPreferences(CF_ENABLED); } mSimRecordsLoadedRegistrants.notifyRegistrants(); updateVoiceMail(); + updateCallForwardStatus(); break; case EVENT_GET_BASEBAND_VERSION_DONE: @@ -1615,6 +1649,7 @@ public class GSMPhone extends PhoneBase { Cfu cfu = (Cfu) ar.userObj; if (ar.exception == null && r != null) { r.setVoiceCallForwardingFlag(1, msg.arg1 == 1, cfu.mSetCfNumber); + setCallForwardingPreference(msg.arg1 == 1); } if (cfu.mOnComplete != null) { AsyncResult.forMessage(cfu.mOnComplete, ar.result, ar.exception); @@ -1687,6 +1722,11 @@ public class GSMPhone extends PhoneBase { mmi.processSsData(ar); break; + case EVENT_GET_CALLFORWARDING_STATUS: + if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "EVENT_GET_CALLFORWARDING_STATUS"); + notifyCallForwardingIndicator(); + break; + default: super.handleMessage(msg); } @@ -1780,6 +1820,7 @@ public class GSMPhone extends PhoneBase { } else { for (int i = 0, s = infos.length; i < s; i++) { if ((infos[i].serviceClass & SERVICE_CLASS_VOICE) != 0) { + setCallForwardingPreference(infos[i].status == 1); r.setVoiceCallForwardingFlag(1, (infos[i].status == 1), infos[i].number); // should only have the one @@ -2068,11 +2109,28 @@ public class GSMPhone extends PhoneBase { return false; } + private boolean isCallBarringFacilitySupportedOverImsPhone(String facility) { + ImsPhone imsPhone = mImsPhone; + return ConfigResourceUtil.getBooleanValue(getContext(), + "config_enable_callbarring_over_ims") && (facility != null) + && (facility.equals(CommandsInterface.CB_FACILITY_BAIC) + || facility.equals(CommandsInterface.CB_FACILITY_BAICr)) + && ((imsPhone != null) + && (imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE + || imsPhone.isUtEnabled())); + } + @Override public void getCallBarringOption(String facility, String password, Message onComplete) { if (isValidFacilityString(facility)) { - mCi.queryFacilityLock(facility, password, CommandsInterface.SERVICE_CLASS_NONE, - onComplete); + if (isCallBarringFacilitySupportedOverImsPhone(facility)) { + if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "Trying IMS PS get call barring"); + ImsPhone imsPhone = mImsPhone; + imsPhone.getCallBarring(facility, onComplete); + } else { + mCi.queryFacilityLock(facility, password, CommandsInterface.SERVICE_CLASS_NONE, + onComplete); + } } } @@ -2080,8 +2138,14 @@ public class GSMPhone extends PhoneBase { public void setCallBarringOption(String facility, boolean lockState, String password, Message onComplete) { if (isValidFacilityString(facility)) { - mCi.setFacilityLock(facility, lockState, password, - CommandsInterface.SERVICE_CLASS_VOICE, onComplete); + if (isCallBarringFacilitySupportedOverImsPhone(facility)) { + if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "Trying IMS PS set call barring"); + ImsPhone imsPhone = mImsPhone; + imsPhone.setCallBarring(facility, lockState, password, onComplete); + } else { + mCi.setFacilityLock(facility, lockState, password, + CommandsInterface.SERVICE_CLASS_VOICE, onComplete); + } } } diff --git a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java index 8bd1ec7c0..d539f7d89 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java +++ b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java @@ -1091,6 +1091,7 @@ public final class GsmMmiCode extends Handler implements MmiCode { boolean cffEnabled = (msg.arg2 == 1); if (mIccRecords != null) { mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled, mDialingNumber); + mPhone.setCallForwardingPreference(cffEnabled); } } @@ -1450,6 +1451,7 @@ public final class GsmMmiCode extends Handler implements MmiCode { boolean cffEnabled = (info.status == 1); if (mIccRecords != null) { mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled, info.number); + mPhone.setCallForwardingPreference(cffEnabled); } } @@ -1483,6 +1485,7 @@ public final class GsmMmiCode extends Handler implements MmiCode { // Set unconditional CFF in SIM to false if (mIccRecords != null) { + mPhone.setCallForwardingPreference(false); mIccRecords.setVoiceCallForwardingFlag(1, false, null); } } else { diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index ec8fd20af..dfe7614cb 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -661,6 +661,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker { if (subIds != null && subIds.length > 0) { subId = subIds[0]; } + spn = maybeUpdateHDTagForSpn(showSpn, spn); + plmn = maybeUpdateHDTagForPlmn(showPlmn, plmn); // Update SPN_STRINGS_UPDATED_ACTION IFF any value changes if (mSubId != subId || diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java index aaddcc50a..b86fed1dc 100644 --- a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java +++ b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java @@ -264,6 +264,34 @@ public class ImsPhone extends ImsPhoneBase { return mCT; } + public boolean getCallForwardingIndicator() { + boolean cf = false; + IccRecords r = getIccRecords(); + if (r != null && r.isCallForwardStatusStored()) { + cf = r.getVoiceCallForwardingFlag(); + } else { + cf = getCallForwardingPreference(); + } + return cf; + } + + /** + * Used to check if Call Forwarding status is present on sim card. If not, a message is + * sent so we can check if the CF status is stored as a Shared Preference. + */ + public void updateCallForwardStatus() { + Rlog.d(LOG_TAG, "updateCallForwardStatus"); + IccRecords r = getIccRecords(); + if (r != null && r.isCallForwardStatusStored()) { + // The Sim card has the CF info + Rlog.d(LOG_TAG, "Callforwarding info is present on sim"); + notifyCallForwardingIndicator(); + } else { + Message msg = obtainMessage(EVENT_GET_CALLFORWARDING_STATUS); + sendMessage(msg); + } + } + @Override public List<? extends ImsPhoneMmiCode> getPendingMmiCodes() { @@ -895,7 +923,7 @@ public class ImsPhone extends ImsPhoneBase { } /* package */ - void getCallBarring(String facility, Message onComplete) { + public void getCallBarring(String facility, Message onComplete) { if (DBG) Rlog.d(LOG_TAG, "getCallBarring facility=" + facility); Message resp; resp = obtainMessage(EVENT_GET_CALL_BARRING_DONE, onComplete); @@ -909,7 +937,8 @@ public class ImsPhone extends ImsPhoneBase { } /* package */ - void setCallBarring(String facility, boolean lockState, String password, Message onComplete) { + public void setCallBarring(String facility, boolean lockState, String password, + Message onComplete) { if (DBG) Rlog.d(LOG_TAG, "setCallBarring facility=" + facility + ", lockState=" + lockState); Message resp; @@ -1139,6 +1168,12 @@ public class ImsPhone extends ImsPhoneBase { } @Override + public String getSubscriberId() { + IccRecords r = getIccRecords(); + return (r != null) ? r.getIMSI() : null; + } + + @Override public int getPhoneId() { return mDefaultPhone.getPhoneId(); } @@ -1176,6 +1211,7 @@ public class ImsPhone extends ImsPhoneBase { for (int i = 0, s = infos.length; i < s; i++) { if (infos[i].mCondition == ImsUtInterface.CDIV_CF_UNCONDITIONAL) { if (r != null) { + setCallForwardingPreference(infos[i].mStatus == 1); r.setVoiceCallForwardingFlag(1, (infos[i].mStatus == 1), infos[i].mNumber); } @@ -1246,9 +1282,11 @@ public class ImsPhone extends ImsPhoneBase { IccRecords r = getIccRecords(); Cf cf = (Cf) ar.userObj; if (cf.mIsCfu && ar.exception == null && r != null) { + setCallForwardingPreference(msg.arg1 == 1); r.setVoiceCallForwardingFlag(1, msg.arg1 == 1, cf.mSetCfNumber); } sendResponse(cf.mOnComplete, null, ar.exception); + updateCallForwardStatus(); break; case EVENT_GET_CALL_FORWARD_DONE: @@ -1257,6 +1295,7 @@ public class ImsPhone extends ImsPhoneBase { cfInfos = handleCfQueryResult((ImsCallForwardInfo[])ar.result); } sendResponse((Message) ar.userObj, cfInfos, ar.exception); + updateCallForwardStatus(); break; case EVENT_GET_CALL_BARRING_DONE: @@ -1296,6 +1335,11 @@ public class ImsPhone extends ImsPhoneBase { updateDataServiceState(); break; + case EVENT_GET_CALLFORWARDING_STATUS: + if (DBG) Rlog.d(LOG_TAG, "EVENT_GET_CALLFORWARDING_STATUS"); + notifyCallForwardingIndicator(); + break; + default: super.handleMessage(msg); break; diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneMmiCode.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneMmiCode.java index 9004d19c0..660e0daed 100644 --- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneMmiCode.java +++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneMmiCode.java @@ -1050,10 +1050,12 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { boolean cffEnabled = (msg.arg2 == 1); if (mIccRecords != null) { mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled, mDialingNumber); + mPhone.setCallForwardingPreference(cffEnabled); } } onSetComplete(msg, ar); + mPhone.updateCallForwardStatus(); break; case EVENT_QUERY_CF_COMPLETE: @@ -1302,6 +1304,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { boolean cffEnabled = (info.status == 1); if (mIccRecords != null) { mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled, info.number); + Rlog.d(LOG_TAG, "makeCFQueryResultMessage cffEnabled = "+cffEnabled); + mPhone.setCallForwardingPreference(cffEnabled); } } @@ -1339,6 +1343,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { // Set unconditional CFF in SIM to false if (mIccRecords != null) { + mPhone.setCallForwardingPreference(false); mIccRecords.setVoiceCallForwardingFlag(1, false, null); } } else { diff --git a/src/java/com/android/internal/telephony/uicc/IccRecords.java b/src/java/com/android/internal/telephony/uicc/IccRecords.java index 23e1e3d07..fc86d11b4 100644 --- a/src/java/com/android/internal/telephony/uicc/IccRecords.java +++ b/src/java/com/android/internal/telephony/uicc/IccRecords.java @@ -653,6 +653,14 @@ public abstract class IccRecords extends Handler implements IccConstants { } /** + * Check if call forward info is stored on SIM + * @return true if call forward info is stored on SIM. + */ + public boolean isCallForwardStatusStored() { + return false; + } + + /** * Get the current Voice call forwarding flag for GSM/UMTS and the like SIMs * * @return true if enabled diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java index 3f961a6af..7beffe4f3 100644 --- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java +++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java @@ -500,6 +500,14 @@ public class SIMRecords extends IccRecords { /** * {@inheritDoc} */ + @Override + public boolean isCallForwardStatusStored() { + return (mEfCfis != null) || (mEfCff != null); + } + + /** + * {@inheritDoc} + */ @Override public boolean getVoiceCallForwardingFlag() { return mCallForwardingEnabled; |