summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/ServiceState.java329
-rw-r--r--telephony/java/android/telephony/SubscriptionInfo.java13
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java30
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java115
-rw-r--r--telephony/java/com/android/ims/ImsReasonInfo.java4
-rw-r--r--telephony/java/com/android/internal/telephony/IMms.aidl34
-rw-r--r--telephony/java/com/android/internal/telephony/ISms.aidl11
-rwxr-xr-xtelephony/java/com/android/internal/telephony/ISub.aidl7
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl9
-rw-r--r--telephony/java/com/android/internal/telephony/IccCardConstants.java46
10 files changed, 438 insertions, 160 deletions
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 8c2a4eb..559a58c 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -167,10 +167,40 @@ public class ServiceState implements Parcelable {
private int mVoiceRegState = STATE_OUT_OF_SERVICE;
private int mDataRegState = STATE_OUT_OF_SERVICE;
- private boolean mRoaming;
- private String mOperatorAlphaLong;
- private String mOperatorAlphaShort;
- private String mOperatorNumeric;
+
+ /**
+ * Roaming type
+ * HOME : in home network
+ * @hide
+ */
+ public static final int ROAMING_TYPE_NOT_ROAMING = 0;
+ /**
+ * Roaming type
+ * UNKNOWN : in a roaming network, but we can not tell if it's domestic or international
+ * @hide
+ */
+ public static final int ROAMING_TYPE_UNKNOWN = 1;
+ /**
+ * Roaming type
+ * DOMESTIC : in domestic roaming network
+ * @hide
+ */
+ public static final int ROAMING_TYPE_DOMESTIC = 2;
+ /**
+ * Roaming type
+ * INTERNATIONAL : in international roaming network
+ * @hide
+ */
+ public static final int ROAMING_TYPE_INTERNATIONAL = 3;
+
+ private int mVoiceRoamingType;
+ private int mDataRoamingType;
+ private String mVoiceOperatorAlphaLong;
+ private String mVoiceOperatorAlphaShort;
+ private String mVoiceOperatorNumeric;
+ private String mDataOperatorAlphaLong;
+ private String mDataOperatorAlphaShort;
+ private String mDataOperatorNumeric;
private boolean mIsManualNetworkSelection;
private boolean mIsEmergencyOnly;
@@ -187,6 +217,29 @@ public class ServiceState implements Parcelable {
private int mCdmaEriIconMode;
/**
+ * get String description of roaming type
+ * @hide
+ */
+ public static final String getRoamingLogString(int roamingType) {
+ switch (roamingType) {
+ case ROAMING_TYPE_NOT_ROAMING:
+ return "home";
+
+ case ROAMING_TYPE_UNKNOWN:
+ return "roaming";
+
+ case ROAMING_TYPE_DOMESTIC:
+ return "Domestic Roaming";
+
+ case ROAMING_TYPE_INTERNATIONAL:
+ return "International Roaming";
+
+ default:
+ return "UNKNOWN";
+ }
+ }
+
+ /**
* Create a new ServiceState from a intent notifier Bundle
*
* This method is used by PhoneStateIntentReceiver and maybe by
@@ -221,10 +274,14 @@ public class ServiceState implements Parcelable {
protected void copyFrom(ServiceState s) {
mVoiceRegState = s.mVoiceRegState;
mDataRegState = s.mDataRegState;
- mRoaming = s.mRoaming;
- mOperatorAlphaLong = s.mOperatorAlphaLong;
- mOperatorAlphaShort = s.mOperatorAlphaShort;
- mOperatorNumeric = s.mOperatorNumeric;
+ mVoiceRoamingType = s.mVoiceRoamingType;
+ mDataRoamingType = s.mDataRoamingType;
+ mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong;
+ mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort;
+ mVoiceOperatorNumeric = s.mVoiceOperatorNumeric;
+ mDataOperatorAlphaLong = s.mDataOperatorAlphaLong;
+ mDataOperatorAlphaShort = s.mDataOperatorAlphaShort;
+ mDataOperatorNumeric = s.mDataOperatorNumeric;
mIsManualNetworkSelection = s.mIsManualNetworkSelection;
mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology;
mRilDataRadioTechnology = s.mRilDataRadioTechnology;
@@ -244,10 +301,14 @@ public class ServiceState implements Parcelable {
public ServiceState(Parcel in) {
mVoiceRegState = in.readInt();
mDataRegState = in.readInt();
- mRoaming = in.readInt() != 0;
- mOperatorAlphaLong = in.readString();
- mOperatorAlphaShort = in.readString();
- mOperatorNumeric = in.readString();
+ mVoiceRoamingType = in.readInt();
+ mDataRoamingType = in.readInt();
+ mVoiceOperatorAlphaLong = in.readString();
+ mVoiceOperatorAlphaShort = in.readString();
+ mVoiceOperatorNumeric = in.readString();
+ mDataOperatorAlphaLong = in.readString();
+ mDataOperatorAlphaShort = in.readString();
+ mDataOperatorNumeric = in.readString();
mIsManualNetworkSelection = in.readInt() != 0;
mRilVoiceRadioTechnology = in.readInt();
mRilDataRadioTechnology = in.readInt();
@@ -264,10 +325,14 @@ public class ServiceState implements Parcelable {
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mVoiceRegState);
out.writeInt(mDataRegState);
- out.writeInt(mRoaming ? 1 : 0);
- out.writeString(mOperatorAlphaLong);
- out.writeString(mOperatorAlphaShort);
- out.writeString(mOperatorNumeric);
+ out.writeInt(mVoiceRoamingType);
+ out.writeInt(mDataRoamingType);
+ out.writeString(mVoiceOperatorAlphaLong);
+ out.writeString(mVoiceOperatorAlphaShort);
+ out.writeString(mVoiceOperatorNumeric);
+ out.writeString(mDataOperatorAlphaLong);
+ out.writeString(mDataOperatorAlphaShort);
+ out.writeString(mDataOperatorNumeric);
out.writeInt(mIsManualNetworkSelection ? 1 : 0);
out.writeInt(mRilVoiceRadioTechnology);
out.writeInt(mRilDataRadioTechnology);
@@ -337,10 +402,45 @@ public class ServiceState implements Parcelable {
*
* @return true if TS 27.007 7.2 roaming is true
* and ONS is different from SPN
- *
*/
public boolean getRoaming() {
- return mRoaming;
+ return getVoiceRoaming() || getDataRoaming();
+ }
+
+ /**
+ * Get current voice network roaming status
+ * @return roaming status
+ * @hide
+ */
+ public boolean getVoiceRoaming() {
+ return mVoiceRoamingType != ROAMING_TYPE_NOT_ROAMING;
+ }
+
+ /**
+ * Get current voice network roaming type
+ * @return roaming type
+ * @hide
+ */
+ public int getVoiceRoamingType() {
+ return mVoiceRoamingType;
+ }
+
+ /**
+ * Get current data network roaming type
+ * @return roaming type
+ * @hide
+ */
+ public boolean getDataRoaming() {
+ return mDataRoamingType != ROAMING_TYPE_NOT_ROAMING;
+ }
+
+ /**
+ * Get current data network roaming type
+ * @return roaming type
+ * @hide
+ */
+ public int getDataRoamingType() {
+ return mDataRoamingType;
}
/**
@@ -387,7 +487,25 @@ public class ServiceState implements Parcelable {
* @return long name of operator, null if unregistered or unknown
*/
public String getOperatorAlphaLong() {
- return mOperatorAlphaLong;
+ return mVoiceOperatorAlphaLong;
+ }
+
+ /**
+ * Get current registered voice network operator name in long alphanumeric format.
+ * @return long name of operator
+ * @hide
+ */
+ public String getVoiceOperatorAlphaLong() {
+ return mVoiceOperatorAlphaLong;
+ }
+
+ /**
+ * Get current registered data network operator name in long alphanumeric format.
+ * @return long name of voice operator
+ * @hide
+ */
+ public String getDataOperatorAlphaLong() {
+ return mDataOperatorAlphaLong;
}
/**
@@ -398,7 +516,25 @@ public class ServiceState implements Parcelable {
* @return short name of operator, null if unregistered or unknown
*/
public String getOperatorAlphaShort() {
- return mOperatorAlphaShort;
+ return mVoiceOperatorAlphaShort;
+ }
+
+ /**
+ * Get current registered voice network operator name in short alphanumeric format.
+ * @return short name of operator, null if unregistered or unknown
+ * @hide
+ */
+ public String getVoiceOperatorAlphaShort() {
+ return mVoiceOperatorAlphaShort;
+ }
+
+ /**
+ * Get current registered data network operator name in short alphanumeric format.
+ * @return short name of operator, null if unregistered or unknown
+ * @hide
+ */
+ public String getDataOperatorAlphaShort() {
+ return mDataOperatorAlphaShort;
}
/**
@@ -414,7 +550,25 @@ public class ServiceState implements Parcelable {
* {@link com.android.internal.telephony.MccTable#countryCodeForMcc(int)}.
*/
public String getOperatorNumeric() {
- return mOperatorNumeric;
+ return mVoiceOperatorNumeric;
+ }
+
+ /**
+ * Get current registered voice network operator numeric id.
+ * @return numeric format of operator, null if unregistered or unknown
+ * @hide
+ */
+ public String getVoiceOperatorNumeric() {
+ return mVoiceOperatorNumeric;
+ }
+
+ /**
+ * Get current registered data network operator numeric id.
+ * @return numeric format of operator, null if unregistered or unknown
+ * @hide
+ */
+ public String getDataOperatorNumeric() {
+ return mDataOperatorNumeric;
}
/**
@@ -430,11 +584,15 @@ public class ServiceState implements Parcelable {
public int hashCode() {
return ((mVoiceRegState * 31)
+ (mDataRegState * 37)
- + (mRoaming ? 1 : 0)
+ + mVoiceRoamingType
+ + mDataRoamingType
+ (mIsManualNetworkSelection ? 1 : 0)
- + ((null == mOperatorAlphaLong) ? 0 : mOperatorAlphaLong.hashCode())
- + ((null == mOperatorAlphaShort) ? 0 : mOperatorAlphaShort.hashCode())
- + ((null == mOperatorNumeric) ? 0 : mOperatorNumeric.hashCode())
+ + ((null == mVoiceOperatorAlphaLong) ? 0 : mVoiceOperatorAlphaLong.hashCode())
+ + ((null == mVoiceOperatorAlphaShort) ? 0 : mVoiceOperatorAlphaShort.hashCode())
+ + ((null == mVoiceOperatorNumeric) ? 0 : mVoiceOperatorNumeric.hashCode())
+ + ((null == mDataOperatorAlphaLong) ? 0 : mDataOperatorAlphaLong.hashCode())
+ + ((null == mDataOperatorAlphaShort) ? 0 : mDataOperatorAlphaShort.hashCode())
+ + ((null == mDataOperatorNumeric) ? 0 : mDataOperatorNumeric.hashCode())
+ mCdmaRoamingIndicator
+ mCdmaDefaultRoamingIndicator
+ (mIsEmergencyOnly ? 1 : 0));
@@ -456,11 +614,15 @@ public class ServiceState implements Parcelable {
return (mVoiceRegState == s.mVoiceRegState
&& mDataRegState == s.mDataRegState
- && mRoaming == s.mRoaming
&& mIsManualNetworkSelection == s.mIsManualNetworkSelection
- && equalsHandlesNulls(mOperatorAlphaLong, s.mOperatorAlphaLong)
- && equalsHandlesNulls(mOperatorAlphaShort, s.mOperatorAlphaShort)
- && equalsHandlesNulls(mOperatorNumeric, s.mOperatorNumeric)
+ && mVoiceRoamingType == s.mVoiceRoamingType
+ && mDataRoamingType == s.mDataRoamingType
+ && equalsHandlesNulls(mVoiceOperatorAlphaLong, s.mVoiceOperatorAlphaLong)
+ && equalsHandlesNulls(mVoiceOperatorAlphaShort, s.mVoiceOperatorAlphaShort)
+ && equalsHandlesNulls(mVoiceOperatorNumeric, s.mVoiceOperatorNumeric)
+ && equalsHandlesNulls(mDataOperatorAlphaLong, s.mDataOperatorAlphaLong)
+ && equalsHandlesNulls(mDataOperatorAlphaShort, s.mDataOperatorAlphaShort)
+ && equalsHandlesNulls(mDataOperatorNumeric, s.mDataOperatorNumeric)
&& equalsHandlesNulls(mRilVoiceRadioTechnology, s.mRilVoiceRadioTechnology)
&& equalsHandlesNulls(mRilDataRadioTechnology, s.mRilDataRadioTechnology)
&& equalsHandlesNulls(mCssIndicator, s.mCssIndicator)
@@ -548,10 +710,17 @@ public class ServiceState implements Parcelable {
String radioTechnology = rilRadioTechnologyToString(mRilVoiceRadioTechnology);
String dataRadioTechnology = rilRadioTechnologyToString(mRilDataRadioTechnology);
- return (mVoiceRegState + " " + mDataRegState + " " + (mRoaming ? "roaming" : "home")
- + " " + mOperatorAlphaLong
- + " " + mOperatorAlphaShort
- + " " + mOperatorNumeric
+ return (mVoiceRegState + " " + mDataRegState
+ + " "
+ + "voice " + getRoamingLogString(mVoiceRoamingType)
+ + " "
+ + "data " + getRoamingLogString(mDataRoamingType)
+ + " " + mVoiceOperatorAlphaLong
+ + " " + mVoiceOperatorAlphaShort
+ + " " + mVoiceOperatorNumeric
+ + " " + mDataOperatorAlphaLong
+ + " " + mDataOperatorAlphaShort
+ + " " + mDataOperatorNumeric
+ " " + (mIsManualNetworkSelection ? "(manual)" : "")
+ " " + radioTechnology
+ " " + dataRadioTechnology
@@ -567,10 +736,14 @@ public class ServiceState implements Parcelable {
if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setNullState=" + state);
mVoiceRegState = state;
mDataRegState = state;
- mRoaming = false;
- mOperatorAlphaLong = null;
- mOperatorAlphaShort = null;
- mOperatorNumeric = null;
+ mVoiceRoamingType = ROAMING_TYPE_NOT_ROAMING;
+ mDataRoamingType = ROAMING_TYPE_NOT_ROAMING;
+ mVoiceOperatorAlphaLong = null;
+ mVoiceOperatorAlphaShort = null;
+ mVoiceOperatorNumeric = null;
+ mDataOperatorAlphaLong = null;
+ mDataOperatorAlphaShort = null;
+ mDataOperatorNumeric = null;
mIsManualNetworkSelection = false;
mRilVoiceRadioTechnology = 0;
mRilDataRadioTechnology = 0;
@@ -610,9 +783,29 @@ public class ServiceState implements Parcelable {
}
public void setRoaming(boolean roaming) {
- mRoaming = roaming;
+ mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING);
+ mDataRoamingType = mVoiceRoamingType;
}
+ /** @hide */
+ public void setVoiceRoaming(boolean roaming) {
+ mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING);
+ }
+
+ /** @hide */
+ public void setVoiceRoamingType(int type) {
+ mVoiceRoamingType = type;
+ }
+
+ /** @hide */
+ public void setDataRoaming(boolean dataRoaming) {
+ mDataRoamingType = (dataRoaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING);
+ }
+
+ /** @hide */
+ public void setDataRoamingType(int type) {
+ mDataRoamingType = type;
+ }
/**
* @hide
@@ -650,9 +843,26 @@ public class ServiceState implements Parcelable {
}
public void setOperatorName(String longName, String shortName, String numeric) {
- mOperatorAlphaLong = longName;
- mOperatorAlphaShort = shortName;
- mOperatorNumeric = numeric;
+ mVoiceOperatorAlphaLong = longName;
+ mVoiceOperatorAlphaShort = shortName;
+ mVoiceOperatorNumeric = numeric;
+ mDataOperatorAlphaLong = longName;
+ mDataOperatorAlphaShort = shortName;
+ mDataOperatorNumeric = numeric;
+ }
+
+ /** @hide */
+ public void setVoiceOperatorName(String longName, String shortName, String numeric) {
+ mVoiceOperatorAlphaLong = longName;
+ mVoiceOperatorAlphaShort = shortName;
+ mVoiceOperatorNumeric = numeric;
+ }
+
+ /** @hide */
+ public void setDataOperatorName(String longName, String shortName, String numeric) {
+ mDataOperatorAlphaLong = longName;
+ mDataOperatorAlphaShort = shortName;
+ mDataOperatorNumeric = numeric;
}
/**
@@ -662,7 +872,18 @@ public class ServiceState implements Parcelable {
* @hide
*/
public void setOperatorAlphaLong(String longName) {
- mOperatorAlphaLong = longName;
+ mVoiceOperatorAlphaLong = longName;
+ mDataOperatorAlphaLong = longName;
+ }
+
+ /** @hide */
+ public void setVoiceOperatorAlphaLong(String longName) {
+ mVoiceOperatorAlphaLong = longName;
+ }
+
+ /** @hide */
+ public void setDataOperatorAlphaLong(String longName) {
+ mDataOperatorAlphaLong = longName;
}
public void setIsManualSelection(boolean isManual) {
@@ -689,10 +910,14 @@ public class ServiceState implements Parcelable {
private void setFromNotifierBundle(Bundle m) {
mVoiceRegState = m.getInt("voiceRegState");
mDataRegState = m.getInt("dataRegState");
- mRoaming = m.getBoolean("roaming");
- mOperatorAlphaLong = m.getString("operator-alpha-long");
- mOperatorAlphaShort = m.getString("operator-alpha-short");
- mOperatorNumeric = m.getString("operator-numeric");
+ mVoiceRoamingType = m.getInt("voiceRoamingType");
+ mDataRoamingType = m.getInt("dataRoamingType");
+ mVoiceOperatorAlphaLong = m.getString("operator-alpha-long");
+ mVoiceOperatorAlphaShort = m.getString("operator-alpha-short");
+ mVoiceOperatorNumeric = m.getString("operator-numeric");
+ mDataOperatorAlphaLong = m.getString("data-operator-alpha-long");
+ mDataOperatorAlphaShort = m.getString("data-operator-alpha-short");
+ mDataOperatorNumeric = m.getString("data-operator-numeric");
mIsManualNetworkSelection = m.getBoolean("manual");
mRilVoiceRadioTechnology = m.getInt("radioTechnology");
mRilDataRadioTechnology = m.getInt("dataRadioTechnology");
@@ -713,10 +938,14 @@ public class ServiceState implements Parcelable {
public void fillInNotifierBundle(Bundle m) {
m.putInt("voiceRegState", mVoiceRegState);
m.putInt("dataRegState", mDataRegState);
- m.putBoolean("roaming", Boolean.valueOf(mRoaming));
- m.putString("operator-alpha-long", mOperatorAlphaLong);
- m.putString("operator-alpha-short", mOperatorAlphaShort);
- m.putString("operator-numeric", mOperatorNumeric);
+ m.putInt("voiceRoamingType", mVoiceRoamingType);
+ m.putInt("dataRoamingType", mDataRoamingType);
+ m.putString("operator-alpha-long", mVoiceOperatorAlphaLong);
+ m.putString("operator-alpha-short", mVoiceOperatorAlphaShort);
+ m.putString("operator-numeric", mVoiceOperatorNumeric);
+ m.putString("data-operator-alpha-long", mDataOperatorAlphaLong);
+ m.putString("data-operator-alpha-short", mDataOperatorAlphaShort);
+ m.putString("data-operator-numeric", mDataOperatorNumeric);
m.putBoolean("manual", Boolean.valueOf(mIsManualNetworkSelection));
m.putInt("radioTechnology", mRilVoiceRadioTechnology);
m.putInt("dataRadioTechnology", mRilDataRadioTechnology);
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index c8b782f..e57f9e3 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -27,6 +27,7 @@ import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.DisplayMetrics;
/**
* A Parcelable class for Subscription Information.
@@ -36,7 +37,7 @@ public class SubscriptionInfo implements Parcelable {
/**
* Size of text to render on the icon.
*/
- private static final int TEXT_SIZE = 22;
+ private static final int TEXT_SIZE = 16;
/**
* Subscription Identifier, this is a device unique number
@@ -197,10 +198,10 @@ public class SubscriptionInfo implements Parcelable {
public Bitmap createIconBitmap(Context context) {
int width = mIconBitmap.getWidth();
int height = mIconBitmap.getHeight();
+ DisplayMetrics metrics = context.getResources().getDisplayMetrics();
// Create a new bitmap of the same size because it will be modified.
- Bitmap workingBitmap = Bitmap.createBitmap(context.getResources().getDisplayMetrics(),
- width, height, mIconBitmap.getConfig());
+ Bitmap workingBitmap = Bitmap.createBitmap(metrics, width, height, mIconBitmap.getConfig());
Canvas canvas = new Canvas(workingBitmap);
Paint paint = new Paint();
@@ -214,8 +215,10 @@ public class SubscriptionInfo implements Parcelable {
paint.setAntiAlias(true);
paint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));
paint.setColor(Color.WHITE);
- paint.setTextSize(TEXT_SIZE);
- final String index = Integer.toString(mSimSlotIndex + 1);
+ // Set text size scaled by density
+ paint.setTextSize(TEXT_SIZE * metrics.density);
+ // Convert sim slot index to localized string
+ final String index = String.format("%d", mSimSlotIndex + 1);
final Rect textBound = new Rect();
paint.getTextBounds(index, 0, 1, textBound);
final float xOffset = (width / 2.f) - textBound.centerX();
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 40d2e77..abf1ead 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1103,5 +1103,35 @@ public class SubscriptionManager {
return Boolean.parseBoolean(TelephonyManager.getTelephonyProperty(phoneId,
TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null));
}
+
+ /**
+ * Returns a constant indicating the state of sim for the subscription.
+ *
+ * @param subId
+ *
+ * {@See TelephonyManager#SIM_STATE_UNKNOWN}
+ * {@See TelephonyManager#SIM_STATE_ABSENT}
+ * {@See TelephonyManager#SIM_STATE_PIN_REQUIRED}
+ * {@See TelephonyManager#SIM_STATE_PUK_REQUIRED}
+ * {@See TelephonyManager#SIM_STATE_NETWORK_LOCKED}
+ * {@See TelephonyManager#SIM_STATE_READY}
+ * {@See TelephonyManager#SIM_STATE_NOT_READY}
+ * {@See TelephonyManager#SIM_STATE_PERM_DISABLED}
+ * {@See TelephonyManager#SIM_STATE_CARD_IO_ERROR}
+ *
+ * {@hide}
+ */
+ public static int getSimStateForSubscriber(int subId) {
+ int simState;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ simState = iSub.getSimStateForSubscriber(subId);
+ } catch (RemoteException ex) {
+ simState = TelephonyManager.SIM_STATE_UNKNOWN;
+ }
+ logd("getSimStateForSubscriber: simState=" + simState + " subId=" + subId);
+ return simState;
+ }
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 53f1945..751e11b 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1416,10 +1416,14 @@ public class TelephonyManager {
//
//
- /** SIM card state: Unknown. Signifies that the SIM is in transition
- * between states. For example, when the user inputs the SIM pin
- * under PIN_REQUIRED state, a query for sim status returns
- * this state before turning to SIM_STATE_READY. */
+ /**
+ * SIM card state: Unknown. Signifies that the SIM is in transition
+ * between states. For example, when the user inputs the SIM pin
+ * under PIN_REQUIRED state, a query for sim status returns
+ * this state before turning to SIM_STATE_READY.
+ *
+ * These are the ordinal value of IccCardConstants.State.
+ */
public static final int SIM_STATE_UNKNOWN = 0;
/** SIM card state: no SIM card is available in the device */
public static final int SIM_STATE_ABSENT = 1;
@@ -1427,14 +1431,22 @@ public class TelephonyManager {
public static final int SIM_STATE_PIN_REQUIRED = 2;
/** SIM card state: Locked: requires the user's SIM PUK to unlock */
public static final int SIM_STATE_PUK_REQUIRED = 3;
- /** SIM card state: Locked: requries a network PIN to unlock */
+ /** SIM card state: Locked: requires a network PIN to unlock */
public static final int SIM_STATE_NETWORK_LOCKED = 4;
/** SIM card state: Ready */
public static final int SIM_STATE_READY = 5;
- /** SIM card state: SIM Card Error, Sim Card is present but faulty
+ /** SIM card state: SIM Card is NOT READY
+ *@hide
+ */
+ public static final int SIM_STATE_NOT_READY = 6;
+ /** SIM card state: SIM Card Error, permanently disabled
+ *@hide
+ */
+ public static final int SIM_STATE_PERM_DISABLED = 7;
+ /** SIM card state: SIM Card Error, present but faulty
*@hide
*/
- public static final int SIM_STATE_CARD_IO_ERROR = 6;
+ public static final int SIM_STATE_CARD_IO_ERROR = 8;
/**
* @return true if a ICC card is present
@@ -1464,8 +1476,7 @@ public class TelephonyManager {
}
/**
- * Returns a constant indicating the state of the
- * device SIM card.
+ * Returns a constant indicating the state of the default SIM card.
*
* @see #SIM_STATE_UNKNOWN
* @see #SIM_STATE_ABSENT
@@ -1473,6 +1484,8 @@ public class TelephonyManager {
* @see #SIM_STATE_PUK_REQUIRED
* @see #SIM_STATE_NETWORK_LOCKED
* @see #SIM_STATE_READY
+ * @see #SIM_STATE_NOT_READY
+ * @see #SIM_STATE_PERM_DISABLED
* @see #SIM_STATE_CARD_IO_ERROR
*/
public int getSimState() {
@@ -1480,10 +1493,9 @@ public class TelephonyManager {
}
/**
- * Returns a constant indicating the state of the
- * device SIM card in a slot.
+ * Returns a constant indicating the state of the device SIM card in a slot.
*
- * @param slotId
+ * @param slotIdx
*
* @see #SIM_STATE_UNKNOWN
* @see #SIM_STATE_ABSENT
@@ -1491,39 +1503,20 @@ public class TelephonyManager {
* @see #SIM_STATE_PUK_REQUIRED
* @see #SIM_STATE_NETWORK_LOCKED
* @see #SIM_STATE_READY
+ * @see #SIM_STATE_NOT_READY
+ * @see #SIM_STATE_PERM_DISABLED
+ * @see #SIM_STATE_CARD_IO_ERROR
*/
/** {@hide} */
- // FIXME the argument to pass is subId ??
- public int getSimState(int slotId) {
- int[] subId = SubscriptionManager.getSubId(slotId);
+ public int getSimState(int slotIdx) {
+ int[] subId = SubscriptionManager.getSubId(slotIdx);
if (subId == null || subId.length == 0) {
- return SIM_STATE_ABSENT;
- }
- // FIXME Do not use a property to determine SIM_STATE, call
- // appropriate method on some object.
- int phoneId = SubscriptionManager.getPhoneId(subId[0]);
- String prop = getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_SIM_STATE, "");
- if ("ABSENT".equals(prop)) {
- return SIM_STATE_ABSENT;
- }
- else if ("PIN_REQUIRED".equals(prop)) {
- return SIM_STATE_PIN_REQUIRED;
- }
- else if ("PUK_REQUIRED".equals(prop)) {
- return SIM_STATE_PUK_REQUIRED;
- }
- else if ("NETWORK_LOCKED".equals(prop)) {
- return SIM_STATE_NETWORK_LOCKED;
- }
- else if ("READY".equals(prop)) {
- return SIM_STATE_READY;
- }
- else if ("CARD_IO_ERROR".equals(prop)) {
- return SIM_STATE_CARD_IO_ERROR;
- }
- else {
+ Rlog.d(TAG, "getSimState:- empty subId return SIM_STATE_ABSENT");
return SIM_STATE_UNKNOWN;
}
+ int simState = SubscriptionManager.getSimStateForSubscriber(subId[0]);
+ Rlog.d(TAG, "getSimState: simState=" + simState + " slotIdx=" + slotIdx);
+ return simState;
}
/**
@@ -1535,7 +1528,7 @@ public class TelephonyManager {
* @see #getSimState
*/
public String getSimOperator() {
- int subId = mSubscriptionManager.getDefaultDataSubId();
+ int subId = SubscriptionManager.getDefaultDataSubId();
if (!SubscriptionManager.isUsableSubIdValue(subId)) {
subId = SubscriptionManager.getDefaultSmsSubId();
if (!SubscriptionManager.isUsableSubIdValue(subId)) {
@@ -2758,8 +2751,6 @@ public class TelephonyManager {
* @hide
*/
public static void setTelephonyProperty(int phoneId, String property, String value) {
- Rlog.d(TAG, "setTelephonyProperty property: " + property + " phoneId: " + phoneId +
- " value: " + value);
String propVal = "";
String p[] = null;
String prop = SystemProperties.get(property);
@@ -2773,7 +2764,8 @@ public class TelephonyManager {
}
if (!SubscriptionManager.isValidPhoneId(phoneId)) {
- Rlog.d(TAG, "setTelephonyProperty invalid phone id");
+ Rlog.d(TAG, "setTelephonyProperty: invalid phoneId=" + phoneId +
+ " property=" + property + " value: " + value + " prop=" + prop);
return;
}
@@ -2792,13 +2784,15 @@ public class TelephonyManager {
}
}
- // TODO: workaround for QC
- if (property.length() > SystemProperties.PROP_NAME_MAX || propVal.length() > SystemProperties.PROP_VALUE_MAX) {
- Rlog.d(TAG, "setTelephonyProperty length too long:" + property + ", " + propVal);
+ if (property.length() > SystemProperties.PROP_NAME_MAX
+ || propVal.length() > SystemProperties.PROP_VALUE_MAX) {
+ Rlog.d(TAG, "setTelephonyProperty: property to long phoneId=" + phoneId +
+ " property=" + property + " value: " + value + " propVal=" + propVal);
return;
}
- Rlog.d(TAG, "setTelephonyProperty property=" + property + " propVal=" + propVal);
+ Rlog.d(TAG, "setTelephonyProperty: success phoneId=" + phoneId +
+ " property=" + property + " value: " + value + " propVal=" + propVal);
SystemProperties.set(property, propVal);
}
@@ -2904,13 +2898,16 @@ public class TelephonyManager {
propVal = values[phoneId];
}
}
+ Rlog.d(TAG, "getTelephonyProperty: return propVal='" + propVal + "' phoneId=" + phoneId
+ + " property='" + property + "' defaultVal='" + defaultVal + "' prop=" + prop);
return propVal == null ? defaultVal : propVal;
}
/** @hide */
public int getSimCount() {
+ // FIXME Need to get it from Telephony Dev Controller when that gets implemented!
+ // and then this method shouldn't be used at all!
if(isMultiSimEnabled()) {
- //FIXME Need to get it from Telephony Devcontroller
return 2;
} else {
return 1;
@@ -3087,6 +3084,26 @@ public class TelephonyManager {
}
/**
+ * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
+ * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
+ * tethering.
+ *
+ * @return 0: Not required. 1: required. 2: Not set.
+ * @hide
+ */
+ public int getTetherApnRequired() {
+ try {
+ return getITelephony().getTetherApnRequired();
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "hasMatchedTetherApnSetting RemoteException", ex);
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "hasMatchedTetherApnSetting NPE", ex);
+ }
+ return 2;
+ }
+
+
+ /**
* Values used to return status for hasCarrierPrivileges call.
*/
/** @hide */
diff --git a/telephony/java/com/android/ims/ImsReasonInfo.java b/telephony/java/com/android/ims/ImsReasonInfo.java
index 2ab9648..2482249 100644
--- a/telephony/java/com/android/ims/ImsReasonInfo.java
+++ b/telephony/java/com/android/ims/ImsReasonInfo.java
@@ -195,6 +195,10 @@ public class ImsReasonInfo implements Parcelable {
public static final int CODE_USER_IGNORE = 503;
// User declines an incoming call
public static final int CODE_USER_DECLINE = 504;
+ // Device declines/ends a call due to low battery
+ public static final int CODE_LOW_BATTERY = 505;
+ // Device declines call due to blacklisted call ID
+ public static final int CODE_BLACKLISTED_CALL_ID = 506;
// IMS -> Telephony
// The call is terminated by the network or remote user
public static final int CODE_USER_TERMINATED_BY_REMOTE = 510;
diff --git a/telephony/java/com/android/internal/telephony/IMms.aidl b/telephony/java/com/android/internal/telephony/IMms.aidl
index 0322499..49ac400 100644
--- a/telephony/java/com/android/internal/telephony/IMms.aidl
+++ b/telephony/java/com/android/internal/telephony/IMms.aidl
@@ -61,40 +61,6 @@ interface IMms {
in PendingIntent downloadedIntent);
/**
- * Update the status of a pending (send-by-IP) MMS message handled by the carrier app.
- * If the carrier app fails to send this message, it may be resent via carrier network
- * depending on the status code.
- *
- * The caller should have carrier privileges.
- * @see android.telephony.TelephonyManager.hasCarrierPrivileges
- *
- * @param messageRef the reference number of the MMS message.
- * @param pdu non-empty (contains the SendConf PDU) if the message was sent successfully,
- * otherwise, this param should be null.
- * @param status send status. It can be Activity.RESULT_OK or one of the MMS error codes.
- * If status is Activity.RESULT_OK, the MMS was sent successfully.
- * If status is MMS_ERROR_RETRY, this message would be resent via carrier
- * network. The message will not be resent for other MMS error statuses.
- */
- void updateMmsSendStatus(int messageRef, in byte[] pdu, in int status);
-
- /**
- * Update the status of a pending (download-by-IP) MMS message handled by the carrier app.
- * If the carrier app fails to download this message, it may be re-downloaded via carrier
- * network depending on the status code.
- *
- * The caller should have carrier privileges.
- * @see android.telephony.TelephonyManager.hasCarrierPrivileges
- *
- * @param messageRef the reference number of the MMS message.
- * @param status download status. It can be Activity.RESULT_OK or one of the MMS error codes.
- * If status is Activity.RESULT_OK, the MMS was downloaded successfully.
- * If status is MMS_ERROR_RETRY, this message would be re-downloaded via carrier
- * network. The message will not be re-downloaded for other MMS error statuses.
- */
- void updateMmsDownloadStatus(int messageRef, in int status);
-
- /**
* Get carrier-dependent configuration values.
*
* @param subId the SIM id
diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl
index 15fa340..6fdf121 100644
--- a/telephony/java/com/android/internal/telephony/ISms.aidl
+++ b/telephony/java/com/android/internal/telephony/ISms.aidl
@@ -224,17 +224,6 @@ interface ISms {
void injectSmsPdu(in byte[] pdu, String format, in PendingIntent receivedIntent);
/**
- * Update the status of a pending (send-by-IP) SMS message and resend by PSTN if necessary.
- * This outbound message was handled by the carrier app. If the carrier app fails to send
- * this message, it would be resent by PSTN.
- *
- * @param messageRef the reference number of the SMS message.
- * @param success True if and only if the message was sent successfully. If its value is
- * false, this message should be resent via PSTN.
- */
- void updateSmsSendStatus(int messageRef, boolean success);
-
- /**
* Send a multi-part text based SMS.
*
* @param destinationAddress the address to send the message to
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index ca82083..acbc0aa 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -164,4 +164,11 @@ interface ISub {
void clearDefaultsForInactiveSubIds();
int[] getActiveSubIdList();
+
+ /**
+ * Get the SIM state for the subscriber
+ * @return SIM state as the ordinal of IccCardConstants.State
+ */
+ int getSimStateForSubscriber(int subId);
+
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 0a50d54..bf7f332 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -657,6 +657,15 @@ interface ITelephony {
int getPreferredNetworkType();
/**
+ * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
+ * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
+ * tethering.
+ *
+ * @return 0: Not required. 1: required. 2: Not set.
+ */
+ int getTetherApnRequired();
+
+ /**
* Set the preferred network type.
* Used for device configuration by some CDMA operators.
*
diff --git a/telephony/java/com/android/internal/telephony/IccCardConstants.java b/telephony/java/com/android/internal/telephony/IccCardConstants.java
index 8029713..c1e2518 100644
--- a/telephony/java/com/android/internal/telephony/IccCardConstants.java
+++ b/telephony/java/com/android/internal/telephony/IccCardConstants.java
@@ -15,12 +15,14 @@
*/
package com.android.internal.telephony;
+import android.telephony.TelephonyManager;
+
/**
* {@hide}
*/
public class IccCardConstants {
- /* The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
+ /* The extra data for broadcasting intent INTENT_ICC_STATE_CHANGE */
public static final String INTENT_KEY_ICC_STATE = "ss";
/* UNKNOWN means the ICC state is unknown */
public static final String INTENT_VALUE_ICC_UNKNOWN = "UNKNOWN";
@@ -32,13 +34,17 @@ public class IccCardConstants {
static public final String INTENT_VALUE_ICC_CARD_IO_ERROR = "CARD_IO_ERROR";
/* LOCKED means ICC is locked by pin or by network */
public static final String INTENT_VALUE_ICC_LOCKED = "LOCKED";
+ //TODO: we can remove this state in the future if Bug 18489776 analysis
+ //#42's first race condition is resolved
+ /* INTERNAL LOCKED means ICC is locked by pin or by network */
+ public static final String INTENT_VALUE_ICC_INTERNAL_LOCKED = "INTERNAL_LOCKED";
/* READY means ICC is ready to access */
public static final String INTENT_VALUE_ICC_READY = "READY";
/* IMSI means ICC IMSI is ready in property */
public static final String INTENT_VALUE_ICC_IMSI = "IMSI";
/* LOADED means all ICC records, including IMSI, are loaded */
public static final String INTENT_VALUE_ICC_LOADED = "LOADED";
- /* The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
+ /* The extra data for broadcasting intent INTENT_ICC_STATE_CHANGE */
public static final String INTENT_KEY_LOCKED_REASON = "reason";
/* PIN means ICC is locked on PIN1 */
public static final String INTENT_VALUE_LOCKED_ON_PIN = "PIN";
@@ -56,17 +62,19 @@ public class IccCardConstants {
* UNKNOWN is a transient state, for example, after user inputs ICC pin under
* PIN_REQUIRED state, the query for ICC status returns UNKNOWN before it
* turns to READY
+ *
+ * The ordinal values much match {@link TelephonyManager#SIM_STATE_UNKNOWN} ...
*/
public enum State {
- UNKNOWN,
- ABSENT,
- PIN_REQUIRED,
- PUK_REQUIRED,
- NETWORK_LOCKED,
- READY,
- NOT_READY,
- PERM_DISABLED,
- CARD_IO_ERROR;
+ UNKNOWN, /** ordinal(0) == {@See TelephonyManager#SIM_STATE_UNKNOWN} */
+ ABSENT, /** ordinal(1) == {@See TelephonyManager#SIM_STATE_ABSENT} */
+ PIN_REQUIRED, /** ordinal(2) == {@See TelephonyManager#SIM_STATE_PIN_REQUIRED} */
+ PUK_REQUIRED, /** ordinal(3) == {@See TelephonyManager#SIM_STATE_PUK_REQUIRED} */
+ NETWORK_LOCKED, /** ordinal(4) == {@See TelephonyManager#SIM_STATE_NETWORK_LOCKED} */
+ READY, /** ordinal(5) == {@See TelephonyManager#SIM_STATE_READY} */
+ NOT_READY, /** ordinal(6) == {@See TelephonyManager#SIM_STATE_NOT_READY} */
+ PERM_DISABLED, /** ordinal(7) == {@See TelephonyManager#SIM_STATE_PERM_DISABLED} */
+ CARD_IO_ERROR; /** ordinal(8) == {@See TelephonyManager#SIM_STATE_CARD_IO_ERROR} */
public boolean isPinLocked() {
return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED));
@@ -77,5 +85,21 @@ public class IccCardConstants {
|| (this == NETWORK_LOCKED) || (this == READY)
|| (this == PERM_DISABLED) || (this == CARD_IO_ERROR));
}
+
+ public static State intToState(int state) throws IllegalArgumentException {
+ switch(state) {
+ case 0: return UNKNOWN;
+ case 1: return ABSENT;
+ case 2: return PIN_REQUIRED;
+ case 3: return PUK_REQUIRED;
+ case 4: return NETWORK_LOCKED;
+ case 5: return READY;
+ case 6: return NOT_READY;
+ case 7: return PERM_DISABLED;
+ case 8: return CARD_IO_ERROR;
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
}
}