Loading src/java/android/provider/Telephony.java +12 −0 Original line number Diff line number Diff line Loading @@ -1164,6 +1164,18 @@ public final class Telephony { for (int i = 0; i < pduCount; i++) { byte[] pdu = (byte[]) pdus[i]; msgs[i] = SmsMessage.createFromPdu(pdu, format); // If the originating address is null on our message // then the format for SmsMessage createFromPdu is likely // incorrect. SmsMessage createFromPdu(the new method) // takes in a format parameter that it gets from the Tracker // however, on some of our legacy devices using a legacy ril, // since that format is derived by getting voice tech, // we can get a bad format and no valid members. // Thus we introduce a hack that utilizes the deprecated // SmsMessage.createFromPdu if we get a null originating address. if (msgs[i].getOriginatingAddress() == null) { msgs[i] = SmsMessage.createFromPdu(pdu); } String originatingAddress = msgs[i].getOriginatingAddress(); if (!TextUtils.isEmpty(originatingAddress)) { String normalized = normalizeDigitsOnly(originatingAddress); Loading src/java/com/android/internal/telephony/uicc/RuimRecords.java +13 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.internal.telephony.MccTable; import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState; import com.android.internal.telephony.uicc.UICCConfig; /** Loading Loading @@ -253,6 +254,18 @@ public final class RuimRecords extends IccRecords { return null; } if (SystemProperties.getBoolean("ro.telephony.get_imsi_from_sim", false)) { String imsi = mParentApp.getUICCConfig().getImsi(); int mnclength = mParentApp.getUICCConfig().getMncLength(); // If we are LTE over CDMA (Verizon), then pull the correct info from SIMRecords if (imsi != null) { log("Overriding with Operator Numeric: " + imsi.substring(0, 3 + mnclength)); return imsi.substring(0, 3 + mnclength); } } if (mMncLength != UNINITIALIZED && mMncLength != UNKNOWN) { // Length = length of MCC + length of MNC // length of mcc = 3 (3GPP2 C.S0005 - Section 2.3) Loading src/java/com/android/internal/telephony/uicc/SIMRecords.java +14 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.internal.telephony.MccTable; import com.android.internal.telephony.SmsConstants; import com.android.internal.telephony.gsm.SimTlv; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.UICCConfig; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -240,6 +241,8 @@ public class SIMRecords extends IccRecords { setSystemProperty(PROPERTY_APN_SIM_OPERATOR_NUMERIC, null); setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, null); setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null); mParentApp.getUICCConfig().setImsi(mImsi); mParentApp.getUICCConfig().setMncLength(mMncLength); // recordsRequested is set to false indicating that the SIM // read requests made so far are not valid. This is set to Loading Loading @@ -660,6 +663,14 @@ public class SIMRecords extends IccRecords { } } mParentApp.getUICCConfig().setImsi(mImsi); if (mMncLength == UNKNOWN || mMncLength == UNINITIALIZED) { // We need to default to something that seems common mParentApp.getUICCConfig().setMncLength(3); } else { mParentApp.getUICCConfig().setMncLength(mMncLength); } if (mMncLength != UNKNOWN && mMncLength != UNINITIALIZED) { // finally have both the imsi and the mncLength and can parse the imsi properly MccTable.updateMccMncConfiguration(mContext, Loading Loading @@ -872,7 +883,10 @@ public class SIMRecords extends IccRecords { if (mMncLength == 0xf) { mMncLength = UNKNOWN; } else { mParentApp.getUICCConfig().setMncLength(mMncLength); } } finally { if (((mMncLength == UNINITIALIZED) || (mMncLength == UNKNOWN) || (mMncLength == 2)) && ((mImsi != null) && (mImsi.length() >= 6))) { Loading src/java/com/android/internal/telephony/uicc/UICCConfig.java 0 → 100644 +87 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The CyanogenMod 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.uicc; import android.content.Context; import android.content.SharedPreferences; import android.telephony.Rlog; /** * A class that stores various UICC Settings/values. * @hide */ public final class UICCConfig { private final String PREFERENCE_NAME = "UICCConfig"; private final String TAG = "UICCConfig"; private final boolean LOG_DEBUG = false; private String mImsi; private int mMncLength; /** * A method to get the stored Imsi. * @hide */ public String getImsi() { if (mImsi == null) { logd("Getting IMSI: null"); } else { logd("Getting IMSI: " + mImsi); } return mImsi; } /** * A method to set the stored Imsi. * @hide */ public void setImsi(String lImsi) { logd("Setting IMSI: " + lImsi); mImsi = lImsi; } /** * A method to get the stored MncLength. * @hide */ public int getMncLength() { logd("Getting MncLength: " + Integer.toString(mMncLength)); return mMncLength; } /** * A method to set the stored MncLength. * @hide */ public void setMncLength(int lMncLength) { logd("Setting MncLength: " + Integer.toString(lMncLength)); mMncLength = lMncLength; } private void logd(String sLog) { if (LOG_DEBUG) { Rlog.d(TAG, sLog); } } private void loge(String sLog) { Rlog.e(TAG, sLog); } } No newline at end of file src/java/com/android/internal/telephony/uicc/UiccCard.java +8 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class UiccCard { protected CatService mCatService; private boolean mDestroyed = false; //set to true once this card is commanded to be disposed of. private RadioState mLastRadioState = RadioState.RADIO_UNAVAILABLE; private UICCConfig mUICCConfig = null; private RegistrantList mAbsentRegistrants = new RegistrantList(); Loading @@ -100,6 +101,7 @@ public class UiccCard { } mCatService = null; mUiccApplications = null; mUICCConfig = null; } } Loading @@ -118,6 +120,8 @@ public class UiccCard { mContext = c; mCi = ci; //update applications if (mUICCConfig == null) mUICCConfig = new UICCConfig(); if (DBG) log(ics.mApplications.length + " applications"); for ( int i = 0; i < mUiccApplications.length; i++) { if (mUiccApplications[i] == null) { Loading Loading @@ -374,6 +378,10 @@ public class UiccCard { return count; } public UICCConfig getUICCConfig() { return mUICCConfig; } void onRefresh(IccRefreshResponse refreshResponse){ for ( int i = 0; i < mUiccApplications.length; i++) { if (mUiccApplications[i] != null) { Loading Loading
src/java/android/provider/Telephony.java +12 −0 Original line number Diff line number Diff line Loading @@ -1164,6 +1164,18 @@ public final class Telephony { for (int i = 0; i < pduCount; i++) { byte[] pdu = (byte[]) pdus[i]; msgs[i] = SmsMessage.createFromPdu(pdu, format); // If the originating address is null on our message // then the format for SmsMessage createFromPdu is likely // incorrect. SmsMessage createFromPdu(the new method) // takes in a format parameter that it gets from the Tracker // however, on some of our legacy devices using a legacy ril, // since that format is derived by getting voice tech, // we can get a bad format and no valid members. // Thus we introduce a hack that utilizes the deprecated // SmsMessage.createFromPdu if we get a null originating address. if (msgs[i].getOriginatingAddress() == null) { msgs[i] = SmsMessage.createFromPdu(pdu); } String originatingAddress = msgs[i].getOriginatingAddress(); if (!TextUtils.isEmpty(originatingAddress)) { String normalized = normalizeDigitsOnly(originatingAddress); Loading
src/java/com/android/internal/telephony/uicc/RuimRecords.java +13 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.internal.telephony.MccTable; import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState; import com.android.internal.telephony.uicc.UICCConfig; /** Loading Loading @@ -253,6 +254,18 @@ public final class RuimRecords extends IccRecords { return null; } if (SystemProperties.getBoolean("ro.telephony.get_imsi_from_sim", false)) { String imsi = mParentApp.getUICCConfig().getImsi(); int mnclength = mParentApp.getUICCConfig().getMncLength(); // If we are LTE over CDMA (Verizon), then pull the correct info from SIMRecords if (imsi != null) { log("Overriding with Operator Numeric: " + imsi.substring(0, 3 + mnclength)); return imsi.substring(0, 3 + mnclength); } } if (mMncLength != UNINITIALIZED && mMncLength != UNKNOWN) { // Length = length of MCC + length of MNC // length of mcc = 3 (3GPP2 C.S0005 - Section 2.3) Loading
src/java/com/android/internal/telephony/uicc/SIMRecords.java +14 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.internal.telephony.MccTable; import com.android.internal.telephony.SmsConstants; import com.android.internal.telephony.gsm.SimTlv; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.UICCConfig; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -240,6 +241,8 @@ public class SIMRecords extends IccRecords { setSystemProperty(PROPERTY_APN_SIM_OPERATOR_NUMERIC, null); setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, null); setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null); mParentApp.getUICCConfig().setImsi(mImsi); mParentApp.getUICCConfig().setMncLength(mMncLength); // recordsRequested is set to false indicating that the SIM // read requests made so far are not valid. This is set to Loading Loading @@ -660,6 +663,14 @@ public class SIMRecords extends IccRecords { } } mParentApp.getUICCConfig().setImsi(mImsi); if (mMncLength == UNKNOWN || mMncLength == UNINITIALIZED) { // We need to default to something that seems common mParentApp.getUICCConfig().setMncLength(3); } else { mParentApp.getUICCConfig().setMncLength(mMncLength); } if (mMncLength != UNKNOWN && mMncLength != UNINITIALIZED) { // finally have both the imsi and the mncLength and can parse the imsi properly MccTable.updateMccMncConfiguration(mContext, Loading Loading @@ -872,7 +883,10 @@ public class SIMRecords extends IccRecords { if (mMncLength == 0xf) { mMncLength = UNKNOWN; } else { mParentApp.getUICCConfig().setMncLength(mMncLength); } } finally { if (((mMncLength == UNINITIALIZED) || (mMncLength == UNKNOWN) || (mMncLength == 2)) && ((mImsi != null) && (mImsi.length() >= 6))) { Loading
src/java/com/android/internal/telephony/uicc/UICCConfig.java 0 → 100644 +87 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The CyanogenMod 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.uicc; import android.content.Context; import android.content.SharedPreferences; import android.telephony.Rlog; /** * A class that stores various UICC Settings/values. * @hide */ public final class UICCConfig { private final String PREFERENCE_NAME = "UICCConfig"; private final String TAG = "UICCConfig"; private final boolean LOG_DEBUG = false; private String mImsi; private int mMncLength; /** * A method to get the stored Imsi. * @hide */ public String getImsi() { if (mImsi == null) { logd("Getting IMSI: null"); } else { logd("Getting IMSI: " + mImsi); } return mImsi; } /** * A method to set the stored Imsi. * @hide */ public void setImsi(String lImsi) { logd("Setting IMSI: " + lImsi); mImsi = lImsi; } /** * A method to get the stored MncLength. * @hide */ public int getMncLength() { logd("Getting MncLength: " + Integer.toString(mMncLength)); return mMncLength; } /** * A method to set the stored MncLength. * @hide */ public void setMncLength(int lMncLength) { logd("Setting MncLength: " + Integer.toString(lMncLength)); mMncLength = lMncLength; } private void logd(String sLog) { if (LOG_DEBUG) { Rlog.d(TAG, sLog); } } private void loge(String sLog) { Rlog.e(TAG, sLog); } } No newline at end of file
src/java/com/android/internal/telephony/uicc/UiccCard.java +8 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class UiccCard { protected CatService mCatService; private boolean mDestroyed = false; //set to true once this card is commanded to be disposed of. private RadioState mLastRadioState = RadioState.RADIO_UNAVAILABLE; private UICCConfig mUICCConfig = null; private RegistrantList mAbsentRegistrants = new RegistrantList(); Loading @@ -100,6 +101,7 @@ public class UiccCard { } mCatService = null; mUiccApplications = null; mUICCConfig = null; } } Loading @@ -118,6 +120,8 @@ public class UiccCard { mContext = c; mCi = ci; //update applications if (mUICCConfig == null) mUICCConfig = new UICCConfig(); if (DBG) log(ics.mApplications.length + " applications"); for ( int i = 0; i < mUiccApplications.length; i++) { if (mUiccApplications[i] == null) { Loading Loading @@ -374,6 +378,10 @@ public class UiccCard { return count; } public UICCConfig getUICCConfig() { return mUICCConfig; } void onRefresh(IccRefreshResponse refreshResponse){ for ( int i = 0; i < mUiccApplications.length; i++) { if (mUiccApplications[i] != null) { Loading