aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrint E. Kriebel <bekit@cyngn.com>2014-12-23 15:31:42 -0800
committerBrint E. Kriebel <bekit@cyngn.com>2014-12-23 15:31:42 -0800
commitb2542e1d9e552279657c40777fd055bbea3b22fb (patch)
treee758e2b4e468a0039c4a330081fc399ff3bb2073
parent6ff09a47a5f29a4efc47c988fbd05b8dc16ac9ae (diff)
parent9e20514b298ee1cdf909084c9d1a56e8663d132a (diff)
downloadandroid_frameworks_opt_telephony-b2542e1d9e552279657c40777fd055bbea3b22fb.tar.gz
android_frameworks_opt_telephony-b2542e1d9e552279657c40777fd055bbea3b22fb.tar.bz2
android_frameworks_opt_telephony-b2542e1d9e552279657c40777fd055bbea3b22fb.zip
-rwxr-xr-xsrc/java/android/provider/Telephony.java12
-rw-r--r--src/java/com/android/internal/telephony/uicc/RuimRecords.java13
-rw-r--r--src/java/com/android/internal/telephony/uicc/SIMRecords.java14
-rw-r--r--src/java/com/android/internal/telephony/uicc/UICCConfig.java87
-rw-r--r--src/java/com/android/internal/telephony/uicc/UiccCard.java8
-rw-r--r--src/java/com/android/internal/telephony/uicc/UiccCardApplication.java5
6 files changed, 139 insertions, 0 deletions
diff --git a/src/java/android/provider/Telephony.java b/src/java/android/provider/Telephony.java
index b76c5f11a..46780156f 100755
--- a/src/java/android/provider/Telephony.java
+++ b/src/java/android/provider/Telephony.java
@@ -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);
diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
index 7da53d4e5..2e77d864e 100644
--- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
@@ -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;
/**
@@ -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)
diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
index 88181ba27..4cf5c93c3 100644
--- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
@@ -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;
@@ -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
@@ -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,
@@ -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))) {
diff --git a/src/java/com/android/internal/telephony/uicc/UICCConfig.java b/src/java/com/android/internal/telephony/uicc/UICCConfig.java
new file mode 100644
index 000000000..768ec14b4
--- /dev/null
+++ b/src/java/com/android/internal/telephony/uicc/UICCConfig.java
@@ -0,0 +1,87 @@
+/*
+ * 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
diff --git a/src/java/com/android/internal/telephony/uicc/UiccCard.java b/src/java/com/android/internal/telephony/uicc/UiccCard.java
index 359658c7d..7d603f1e8 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -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();
@@ -100,6 +101,7 @@ public class UiccCard {
}
mCatService = null;
mUiccApplications = null;
+ mUICCConfig = null;
}
}
@@ -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) {
@@ -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) {
diff --git a/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java b/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java
index f94a5924a..69fab91e9 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java
@@ -29,6 +29,7 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState;
import com.android.internal.telephony.uicc.IccCardStatus.PinState;
+import com.android.internal.telephony.uicc.UICCConfig;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -904,6 +905,10 @@ public class UiccCardApplication {
}
}
+ public UICCConfig getUICCConfig() {
+ return mUiccCard.getUICCConfig();
+ }
+
private void log(String msg) {
Rlog.d(LOG_TAG, msg);
}