summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/DisconnectCause.java42
-rw-r--r--telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java1
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java130
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java14
-rw-r--r--telephony/java/android/telephony/RadioAccessFamily.aidl19
-rw-r--r--telephony/java/android/telephony/RadioAccessFamily.java151
-rw-r--r--telephony/java/android/telephony/ServiceState.java348
-rw-r--r--telephony/java/android/telephony/SignalStrength.java28
-rw-r--r--telephony/java/android/telephony/SubInfoRecord.java167
-rwxr-xr-xtelephony/java/android/telephony/SubscriptionInfo.aidl (renamed from telephony/java/android/telephony/SubInfoRecord.aidl)2
-rw-r--r--telephony/java/android/telephony/SubscriptionInfo.java340
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java634
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java626
-rw-r--r--telephony/java/com/android/ims/ImsCallProfile.java19
-rw-r--r--telephony/java/com/android/ims/ImsConferenceState.java28
-rw-r--r--telephony/java/com/android/ims/ImsReasonInfo.java4
-rw-r--r--telephony/java/com/android/ims/ImsStreamMediaProfile.java16
-rw-r--r--telephony/java/com/android/ims/internal/IImsCallSession.aidl36
-rw-r--r--telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl15
-rw-r--r--telephony/java/com/android/ims/internal/IImsConfig.aidl8
-rw-r--r--telephony/java/com/android/ims/internal/IImsService.aidl15
-rw-r--r--telephony/java/com/android/internal/telephony/CallerInfo.java8
-rw-r--r--telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java6
-rw-r--r--telephony/java/com/android/internal/telephony/DcParamObject.java58
-rw-r--r--telephony/java/com/android/internal/telephony/DctConstants.java2
-rw-r--r--telephony/java/com/android/internal/telephony/IMms.aidl42
-rw-r--r--telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl22
-rw-r--r--telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl35
-rw-r--r--telephony/java/com/android/internal/telephony/ISms.aidl140
-rwxr-xr-xtelephony/java/com/android/internal/telephony/ISub.aidl132
-rw-r--r--telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl24
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl150
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl30
-rw-r--r--telephony/java/com/android/internal/telephony/IccCardConstants.java46
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneConstants.java6
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java22
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyIntents.java53
37 files changed, 2375 insertions, 1044 deletions
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index 6fe10dc..674777e 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -160,11 +160,43 @@ public class DisconnectCause {
*/
public static final int OUTGOING_CANCELED = 44;
+ /**
+ * The call, which was an IMS call, disconnected because it merged with another call.
+ */
+ public static final int IMS_MERGED_SUCCESSFULLY = 45;
+
+ /**
+ * Stk Call Control modified DIAL request to USSD request.
+ * {@hide}
+ */
+ public static final int DIAL_MODIFIED_TO_USSD = 46;
+ /**
+ * Stk Call Control modified DIAL request to SS request.
+ * {@hide}
+ */
+ public static final int DIAL_MODIFIED_TO_SS = 47;
+ /**
+ * Stk Call Control modified DIAL request to DIAL with modified data.
+ * {@hide}
+ */
+ public static final int DIAL_MODIFIED_TO_DIAL = 48;
+
+ //*********************************************************************************************
+ // When adding a disconnect type:
+ // 1) Please assign the new type the next id value below.
+ // 2) Increment the next id value below to a new value.
+ // 3) Update MAXIMUM_VALID_VALUE to the new disconnect type.
+ // 4) Update toString() with the newly added disconnect type.
+ // 5) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause.
+ //
+ // NextId: 49
+ //*********************************************************************************************
+
/** Smallest valid value for call disconnect codes. */
public static final int MINIMUM_VALID_VALUE = NOT_DISCONNECTED;
/** Largest valid value for call disconnect codes. */
- public static final int MAXIMUM_VALID_VALUE = OUTGOING_CANCELED;
+ public static final int MAXIMUM_VALID_VALUE = DIAL_MODIFIED_TO_DIAL;
/** Private constructor to avoid class instantiation. */
private DisconnectCause() {
@@ -256,12 +288,20 @@ public class DisconnectCause {
return "CDMA_CALL_LOST";
case EXITED_ECM:
return "EXITED_ECM";
+ case DIAL_MODIFIED_TO_USSD:
+ return "DIAL_MODIFIED_TO_USSD";
+ case DIAL_MODIFIED_TO_SS:
+ return "DIAL_MODIFIED_TO_SS";
+ case DIAL_MODIFIED_TO_DIAL:
+ return "DIAL_MODIFIED_TO_DIAL";
case ERROR_UNSPECIFIED:
return "ERROR_UNSPECIFIED";
case OUTGOING_FAILURE:
return "OUTGOING_FAILURE";
case OUTGOING_CANCELED:
return "OUTGOING_CANCELED";
+ case IMS_MERGED_SUCCESSFULLY:
+ return "IMS_MERGED_SUCCESSFULLY";
default:
return "INVALID: " + cause;
}
diff --git a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
index 438b572..f7dee99 100644
--- a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
+++ b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
@@ -117,6 +117,7 @@ public class PhoneNumberFormattingTextWatcher implements TextWatcher {
}
mSelfChange = false;
}
+ PhoneNumberUtils.ttsSpanAsPhoneNumber(s, 0, s.length());
}
/**
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 30799f8..0844232 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -31,9 +31,11 @@ import android.os.SystemProperties;
import android.provider.Contacts;
import android.provider.ContactsContract;
import android.text.Editable;
+import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.telephony.Rlog;
+import android.text.style.TtsSpan;
import android.util.SparseIntArray;
import static com.android.internal.telephony.PhoneConstants.SUBSCRIPTION_KEY;
@@ -976,6 +978,8 @@ public class PhoneNumberUtils
return 0xc;
} else if (c == WILD) {
return 0xd;
+ } else if (c == WAIT) {
+ return 0xe;
} else {
throw new RuntimeException ("invalid char for BCD " + c);
}
@@ -1568,7 +1572,7 @@ public class PhoneNumberUtils
* listed in the RIL / SIM, otherwise return false.
* @hide
*/
- public static boolean isEmergencyNumber(long subId, String number) {
+ public static boolean isEmergencyNumber(int subId, String number) {
// Return true only if the specified number *exactly* matches
// one of the emergency numbers listed by the RIL / SIM.
return isEmergencyNumberInternal(subId, number, true /* useExactMatch */);
@@ -1618,7 +1622,7 @@ public class PhoneNumberUtils
* same digits as any of those emergency numbers.
* @hide
*/
- public static boolean isPotentialEmergencyNumber(long subId, String number) {
+ public static boolean isPotentialEmergencyNumber(int subId, String number) {
// Check against the emergency numbers listed by the RIL / SIM,
// and *don't* require an exact match.
return isEmergencyNumberInternal(subId, number, false /* useExactMatch */);
@@ -1667,7 +1671,7 @@ public class PhoneNumberUtils
* @return true if the number is in the list of emergency numbers
* listed in the RIL / sim, otherwise return false.
*/
- private static boolean isEmergencyNumberInternal(long subId, String number,
+ private static boolean isEmergencyNumberInternal(int subId, String number,
boolean useExactMatch) {
return isEmergencyNumberInternal(subId, number, null, useExactMatch);
}
@@ -1696,7 +1700,7 @@ public class PhoneNumberUtils
* otherwise false
* @hide
*/
- public static boolean isEmergencyNumber(long subId, String number, String defaultCountryIso) {
+ public static boolean isEmergencyNumber(int subId, String number, String defaultCountryIso) {
return isEmergencyNumberInternal(subId, number,
defaultCountryIso,
true /* useExactMatch */);
@@ -1748,7 +1752,7 @@ public class PhoneNumberUtils
* any of those emergency numbers.
* @hide
*/
- public static boolean isPotentialEmergencyNumber(long subId, String number,
+ public static boolean isPotentialEmergencyNumber(int subId, String number,
String defaultCountryIso) {
return isEmergencyNumberInternal(subId, number,
defaultCountryIso,
@@ -1792,7 +1796,7 @@ public class PhoneNumberUtils
* @return true if the number is an emergency number for the specified country.
* @hide
*/
- private static boolean isEmergencyNumberInternal(long subId, String number,
+ private static boolean isEmergencyNumberInternal(int subId, String number,
String defaultCountryIso,
boolean useExactMatch) {
// If the number passed in is null, just return false:
@@ -1813,23 +1817,31 @@ public class PhoneNumberUtils
// to the list.
number = extractNetworkPortionAlt(number);
- String numbers = "";
+ Rlog.d(LOG_TAG, "subId:" + subId + ", number: " + number + ", defaultCountryIso:" +
+ ((defaultCountryIso == null) ? "NULL" : defaultCountryIso));
+
+ String emergencyNumbers = "";
int slotId = SubscriptionManager.getSlotId(subId);
- // retrieve the list of emergency numbers
- // check read-write ecclist property first
- String ecclist = (slotId <= 0) ? "ril.ecclist" : ("ril.ecclist" + slotId);
- numbers = SystemProperties.get(ecclist);
+ if (slotId >= 0) {
+ // retrieve the list of emergency numbers
+ // check read-write ecclist property first
+ String ecclist = (slotId == 0) ? "ril.ecclist" : ("ril.ecclist" + slotId);
+
+ emergencyNumbers = SystemProperties.get(ecclist, "");
+ }
- if (TextUtils.isEmpty(numbers)) {
+ Rlog.d(LOG_TAG, "slotId:" + slotId + ", emergencyNumbers: " + emergencyNumbers);
+
+ if (TextUtils.isEmpty(emergencyNumbers)) {
// then read-only ecclist property since old RIL only uses this
- numbers = SystemProperties.get("ro.ril.ecclist");
+ emergencyNumbers = SystemProperties.get("ro.ril.ecclist");
}
- if (!TextUtils.isEmpty(numbers)) {
+ if (!TextUtils.isEmpty(emergencyNumbers)) {
// searches through the comma-separated list for a match,
// return true if one is found.
- for (String emergencyNum : numbers.split(",")) {
+ for (String emergencyNum : emergencyNumbers.split(",")) {
// It is not possible to append additional digits to an emergency number to dial
// the number in Brazil - it won't connect.
if (useExactMatch || "BR".equalsIgnoreCase(defaultCountryIso)) {
@@ -1849,6 +1861,23 @@ public class PhoneNumberUtils
Rlog.d(LOG_TAG, "System property doesn't provide any emergency numbers."
+ " Use embedded logic for determining ones.");
+ // If slot id is invalid, means that there is no sim card.
+ // According spec 3GPP TS22.101, the following numbers should be
+ // ECC numbers when SIM/USIM is not present.
+ emergencyNumbers = ((slotId < 0) ? "112,911,000,08,110,118,119,999" : "112,911");
+
+ for (String emergencyNum : emergencyNumbers.split(",")) {
+ if (useExactMatch) {
+ if (number.equals(emergencyNum)) {
+ return true;
+ }
+ } else {
+ if (number.startsWith(emergencyNum)) {
+ return true;
+ }
+ }
+ }
+
// No ecclist system property, so use our own list.
if (defaultCountryIso != null) {
ShortNumberUtil util = new ShortNumberUtil();
@@ -1857,13 +1886,9 @@ public class PhoneNumberUtils
} else {
return util.connectsToEmergencyNumber(number, defaultCountryIso);
}
- } else {
- if (useExactMatch) {
- return (number.equals("112") || number.equals("911"));
- } else {
- return (number.startsWith("112") || number.startsWith("911"));
- }
}
+
+ return false;
}
/**
@@ -1888,7 +1913,7 @@ public class PhoneNumberUtils
* is currently in.
* @hide
*/
- public static boolean isLocalEmergencyNumber(Context context, long subId, String number) {
+ public static boolean isLocalEmergencyNumber(Context context, int subId, String number) {
return isLocalEmergencyNumberInternal(subId, number,
context,
true /* useExactMatch */);
@@ -1942,7 +1967,7 @@ public class PhoneNumberUtils
*
* @hide
*/
- public static boolean isPotentialLocalEmergencyNumber(Context context, long subId,
+ public static boolean isPotentialLocalEmergencyNumber(Context context, int subId,
String number) {
return isLocalEmergencyNumberInternal(subId, number,
context,
@@ -1991,7 +2016,7 @@ public class PhoneNumberUtils
* local country, based on the CountryDetector.
* @hide
*/
- private static boolean isLocalEmergencyNumberInternal(long subId, String number,
+ private static boolean isLocalEmergencyNumberInternal(int subId, String number,
Context context,
boolean useExactMatch) {
String countryIso;
@@ -2034,7 +2059,7 @@ public class PhoneNumberUtils
* to read the VM number.
* @hide
*/
- public static boolean isVoiceMailNumber(long subId, String number) {
+ public static boolean isVoiceMailNumber(int subId, String number) {
String vmNumber;
try {
@@ -2284,6 +2309,59 @@ public class PhoneNumberUtils
return retStr;
}
+ /**
+ * Wrap the supplied {@code CharSequence} with a {@code TtsSpan}, annotating it as
+ * containing a phone number in its entirety.
+ *
+ * @param phoneNumber A {@code CharSequence} the entirety of which represents a phone number.
+ * @return A {@code CharSequence} with appropriate annotations.
+ *
+ * @hide
+ */
+ public static CharSequence ttsSpanAsPhoneNumber(CharSequence phoneNumber) {
+ if (phoneNumber == null) {
+ return null;
+ }
+ Spannable spannable = Spannable.Factory.getInstance().newSpannable(phoneNumber);
+ PhoneNumberUtils.ttsSpanAsPhoneNumber(spannable, 0, spannable.length());
+ return spannable;
+ }
+
+ /**
+ * Attach a {@link TtsSpan} to the supplied {@code Spannable} at the indicated location,
+ * annotating that location as containing a phone number.
+ *
+ * @param s A {@code Spannable} to annotate.
+ * @param start The starting character position of the phone number in {@code s}.
+ * @param end The ending character position of the phone number in {@code s}.
+ *
+ * @hide
+ */
+ public static void ttsSpanAsPhoneNumber(Spannable s, int start, int end) {
+ s.setSpan(
+ new TtsSpan.TelephoneBuilder()
+ .setNumberParts(splitAtNonNumerics(s.subSequence(start, end)))
+ .build(),
+ start,
+ end,
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+
+ // Split a phone number like "+20(123)-456#" using spaces, ignoring anything that is not
+ // a digit, to produce a result like "20 123 456".
+ private static String splitAtNonNumerics(CharSequence number) {
+ StringBuilder sb = new StringBuilder(number.length());
+ for (int i = 0; i < number.length(); i++) {
+ sb.append(PhoneNumberUtils.isISODigit(number.charAt(i))
+ ? number.charAt(i)
+ : " ");
+ }
+ // It is very important to remove extra spaces. At time of writing, any leading or trailing
+ // spaces, or any sequence of more than one space, will confuse TalkBack and cause the TTS
+ // span to be non-functional!
+ return sb.toString().replaceAll(" +", " ").trim();
+ }
+
private static String getCurrentIdp(boolean useNanp) {
// in case, there is no IDD is found, we shouldn't convert it.
String ps = SystemProperties.get(
@@ -2773,7 +2851,7 @@ public class PhoneNumberUtils
/**
* Returns Default voice subscription Id.
*/
- private static long getDefaultVoiceSubId() {
+ private static int getDefaultVoiceSubId() {
return SubscriptionManager.getDefaultVoiceSubId();
}
//==== End of utility methods used only in compareStrictly() =====
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index e2189f5..fce4ae7 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -20,6 +20,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.telephony.SubscriptionManager;
import android.telephony.CellLocation;
import android.telephony.CellInfo;
import android.telephony.VoLteServiceState;
@@ -31,6 +32,7 @@ import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import com.android.internal.telephony.IPhoneStateListener;
+import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -225,7 +227,7 @@ public class PhoneStateListener {
* @hide
*/
/** @hide */
- protected long mSubId = 0;
+ protected int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
private final Handler mHandler;
@@ -234,7 +236,7 @@ public class PhoneStateListener {
* This class requires Looper.myLooper() not return null.
*/
public PhoneStateListener() {
- this(SubscriptionManager.DEFAULT_SUB_ID, Looper.myLooper());
+ this(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, Looper.myLooper());
}
/**
@@ -243,16 +245,16 @@ public class PhoneStateListener {
* @hide
*/
public PhoneStateListener(Looper looper) {
- this(SubscriptionManager.DEFAULT_SUB_ID, looper);
+ this(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, looper);
}
/**
* Create a PhoneStateListener for the Phone using the specified subscription.
* This class requires Looper.myLooper() not return null. To supply your
- * own non-null Looper use PhoneStateListener(long subId, Looper looper) below.
+ * own non-null Looper use PhoneStateListener(int subId, Looper looper) below.
* @hide
*/
- public PhoneStateListener(long subId) {
+ public PhoneStateListener(int subId) {
this(subId, Looper.myLooper());
}
@@ -261,7 +263,7 @@ public class PhoneStateListener {
* and non-null Looper.
* @hide
*/
- public PhoneStateListener(long subId, Looper looper) {
+ public PhoneStateListener(int subId, Looper looper) {
if (DBG) log("ctor: subId=" + subId + " looper=" + looper);
mSubId = subId;
mHandler = new Handler(looper) {
diff --git a/telephony/java/android/telephony/RadioAccessFamily.aidl b/telephony/java/android/telephony/RadioAccessFamily.aidl
new file mode 100644
index 0000000..f42e134
--- /dev/null
+++ b/telephony/java/android/telephony/RadioAccessFamily.aidl
@@ -0,0 +1,19 @@
+/*
+* Copyright (C) 2014 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package android.telephony;
+
+parcelable RadioAccessFamily; \ No newline at end of file
diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java
new file mode 100644
index 0000000..734fc68
--- /dev/null
+++ b/telephony/java/android/telephony/RadioAccessFamily.java
@@ -0,0 +1,151 @@
+/*
+* Copyright (C) 2014 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.internal.telephony.RILConstants;
+
+/**
+ * Object to indicate the phone radio type and access technology.
+ *
+ * @hide
+ */
+public class RadioAccessFamily implements Parcelable {
+
+ // Radio Access Family
+ public static final int RAF_UNKNOWN = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN);
+ public static final int RAF_GPRS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS);
+ public static final int RAF_EDGE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE);
+ public static final int RAF_UMTS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
+ public static final int RAF_IS95A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
+ public static final int RAF_IS95B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B);
+ public static final int RAF_1xRTT = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
+ public static final int RAF_EVDO_0 = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0);
+ public static final int RAF_EVDO_A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A);
+ public static final int RAF_HSDPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA);
+ public static final int RAF_HSUPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA);
+ public static final int RAF_HSPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
+ public static final int RAF_EVDO_B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B);
+ public static final int RAF_EHRPD = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD);
+ public static final int RAF_LTE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ public static final int RAF_HSPAP = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP);
+ public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
+ public static final int RAF_TD_SCDMA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA);
+
+ /* Phone ID of phone */
+ private int mPhoneId;
+
+ /* Radio Access Family */
+ private int mRadioAccessFamily;
+
+ /**
+ * Constructor.
+ *
+ * @param phoneId the phone ID
+ * @param radioAccessFamily the phone radio access family defined
+ * in RadioAccessFamily. It's a bit mask value to represent
+ * the support type.
+ */
+ public RadioAccessFamily(int phoneId, int radioAccessFamily) {
+ mPhoneId = phoneId;
+ mRadioAccessFamily = radioAccessFamily;
+ }
+
+ /**
+ * Get phone ID.
+ *
+ * @return phone ID
+ */
+ public int getPhoneId() {
+ return mPhoneId;
+ }
+
+ /**
+ * get radio access family.
+ *
+ * @return radio access family
+ */
+ public int getRadioAccessFamily() {
+ return mRadioAccessFamily;
+ }
+
+ @Override
+ public String toString() {
+ String ret = "{ mPhoneId = " + mPhoneId
+ + ", mRadioAccessFamily = " + mRadioAccessFamily
+ + "}";
+ return ret;
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ *
+ * @return describe content
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ *
+ * @param outParcel The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written.
+ */
+ @Override
+ public void writeToParcel(Parcel outParcel, int flags) {
+ outParcel.writeInt(mPhoneId);
+ outParcel.writeInt(mRadioAccessFamily);
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ */
+ public static final Creator<RadioAccessFamily> CREATOR =
+ new Creator<RadioAccessFamily>() {
+
+ @Override
+ public RadioAccessFamily createFromParcel(Parcel in) {
+ int phoneId = in.readInt();
+ int radioAccessFamily = in.readInt();
+
+ return new RadioAccessFamily(phoneId, radioAccessFamily);
+ }
+
+ @Override
+ public RadioAccessFamily[] newArray(int size) {
+ return new RadioAccessFamily[size];
+ }
+ };
+
+ public static int getRafFromNetworkType(int type) {
+ // TODO map from RILConstants.NETWORK_TYPE_* to RAF_*
+ switch (type) {
+ case RILConstants.NETWORK_MODE_WCDMA_PREF:
+ case RILConstants.NETWORK_MODE_GSM_UMTS:
+ return RAF_UMTS | RAF_GSM;
+ case RILConstants.NETWORK_MODE_GSM_ONLY:
+ return RAF_GSM;
+ default:
+ return RAF_UNKNOWN;
+ }
+ }
+}
+
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 52d0516..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);
@@ -864,4 +1093,23 @@ public class ServiceState implements Parcelable {
|| radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_B
|| radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD;
}
+
+ /**
+ * Returns a merged ServiceState consisting of the base SS with voice settings from the
+ * voice SS. The voice SS is only used if it is IN_SERVICE (otherwise the base SS is returned).
+ * @hide
+ * */
+ public static ServiceState mergeServiceStates(ServiceState baseSs, ServiceState voiceSs) {
+ if (voiceSs.mVoiceRegState != STATE_IN_SERVICE) {
+ return baseSs;
+ }
+
+ ServiceState newSs = new ServiceState(baseSs);
+
+ // voice overrides
+ newSs.mVoiceRegState = voiceSs.mVoiceRegState;
+ newSs.mIsEmergencyOnly = false; // only get here if voice is IN_SERVICE
+
+ return newSs;
+ }
}
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index 3363ca6..17db3fb 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -20,6 +20,7 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
+import android.content.res.Resources;
/**
* Contains phone signal strength related information.
@@ -50,6 +51,11 @@ public class SignalStrength implements Parcelable {
//Use int max, as -1 is a valid value in signal strength
public static final int INVALID = 0x7FFFFFFF;
+ private static final int RSRP_THRESH_TYPE_STRICT = 0;
+ private static final int[] RSRP_THRESH_STRICT = new int[] {-140, -115, -105, -95, -85, -44};
+ private static final int[] RSRP_THRESH_LENIENT = new int[] {-140, -128, -118, -108, -98, -44};
+
+
private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5
private int mGsmBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5
private int mCdmaDbm; // This value is the RSSI value
@@ -745,12 +751,21 @@ public class SignalStrength implements Parcelable {
*/
int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1;
- if (mLteRsrp > -44) rsrpIconLevel = -1;
- else if (mLteRsrp >= -85) rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
- else if (mLteRsrp >= -95) rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
- else if (mLteRsrp >= -105) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
- else if (mLteRsrp >= -115) rsrpIconLevel = SIGNAL_STRENGTH_POOR;
- else if (mLteRsrp >= -140) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ int rsrpThreshType = Resources.getSystem().getInteger(com.android.internal.R.integer.
+ config_LTE_RSRP_threshold_type);
+ int[] threshRsrp;
+ if (rsrpThreshType == RSRP_THRESH_TYPE_STRICT) {
+ threshRsrp = RSRP_THRESH_STRICT;
+ } else {
+ threshRsrp = RSRP_THRESH_LENIENT;
+ }
+
+ if (mLteRsrp > threshRsrp[5]) rsrpIconLevel = -1;
+ else if (mLteRsrp >= threshRsrp[4]) rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
+ else if (mLteRsrp >= threshRsrp[3]) rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
+ else if (mLteRsrp >= threshRsrp[2]) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
+ else if (mLteRsrp >= threshRsrp[1]) rsrpIconLevel = SIGNAL_STRENGTH_POOR;
+ else if (mLteRsrp >= threshRsrp[0]) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
/*
* Values are -200 dB to +300 (SNR*10dB) RS_SNR >= 13.0 dB =>4 bars 4.5
@@ -789,6 +804,7 @@ public class SignalStrength implements Parcelable {
else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;
else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;
+
if (DBG) log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+ rssiIconLevel);
return rssiIconLevel;
diff --git a/telephony/java/android/telephony/SubInfoRecord.java b/telephony/java/android/telephony/SubInfoRecord.java
deleted file mode 100644
index 805f787..0000000
--- a/telephony/java/android/telephony/SubInfoRecord.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telephony;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * A Parcelable class for Subscription Information.
- * @hide - to be unhidden
- */
-public class SubInfoRecord implements Parcelable {
-
- /**
- * Subscription Identifier, this is a device unique number
- * and not an index into an array
- */
- public long subId;
- /** The GID for a SIM that maybe associated with this subscription, empty if unknown */
- public String iccId;
- /**
- * The slot identifier for that currently contains the subscription
- * and not necessarily unique and maybe INVALID_SLOT_ID if unknown
- */
- public int slotId;
- /**
- * The string displayed to the user that identifies this subscription
- */
- public String displayName;
- /**
- * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
- * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
- */
- public int nameSource;
- /**
- * The color to be used for when displaying to the user
- */
- public int color;
- /**
- * A number presented to the user identify this subscription
- */
- public String number;
- /**
- * How to display the phone number, DISPLAY_NUMBER_NONE, DISPLAY_NUMBER_FIRST,
- * DISPLAY_NUMBER_LAST
- */
- public int displayNumberFormat;
- /**
- * Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE
- */
- public int dataRoaming;
- /**
- * SIM Icon resource identifiers. FIXME: Check with MTK what it really is
- */
- public int[] simIconRes;
- /**
- * Mobile Country Code
- */
- public int mcc;
- /**
- * Mobile Network Code
- */
- public int mnc;
-
- public SubInfoRecord() {
- this.subId = SubscriptionManager.INVALID_SUB_ID;
- this.iccId = "";
- this.slotId = SubscriptionManager.INVALID_SLOT_ID;
- this.displayName = "";
- this.nameSource = 0;
- this.color = 0;
- this.number = "";
- this.displayNumberFormat = 0;
- this.dataRoaming = 0;
- this.simIconRes = new int[2];
- this.mcc = 0;
- this.mnc = 0;
- }
-
- public SubInfoRecord(long subId, String iccId, int slotId, String displayName, int nameSource,
- int color, String number, int displayFormat, int roaming, int[] iconRes,
- int mcc, int mnc) {
- this.subId = subId;
- this.iccId = iccId;
- this.slotId = slotId;
- this.displayName = displayName;
- this.nameSource = nameSource;
- this.color = color;
- this.number = number;
- this.displayNumberFormat = displayFormat;
- this.dataRoaming = roaming;
- this.simIconRes = iconRes;
- this.mcc = mcc;
- this.mnc = mnc;
- }
-
- public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
- @Override
- public SubInfoRecord createFromParcel(Parcel source) {
- long subId = source.readLong();
- String iccId = source.readString();
- int slotId = source.readInt();
- String displayName = source.readString();
- int nameSource = source.readInt();
- int color = source.readInt();
- String number = source.readString();
- int displayNumberFormat = source.readInt();
- int dataRoaming = source.readInt();
- int[] iconRes = new int[2];
- source.readIntArray(iconRes);
- int mcc = source.readInt();
- int mnc = source.readInt();
-
- return new SubInfoRecord(subId, iccId, slotId, displayName, nameSource, color, number,
- displayNumberFormat, dataRoaming, iconRes, mcc, mnc);
- }
-
- @Override
- public SubInfoRecord[] newArray(int size) {
- return new SubInfoRecord[size];
- }
- };
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeLong(subId);
- dest.writeString(iccId);
- dest.writeInt(slotId);
- dest.writeString(displayName);
- dest.writeInt(nameSource);
- dest.writeInt(color);
- dest.writeString(number);
- dest.writeInt(displayNumberFormat);
- dest.writeInt(dataRoaming);
- dest.writeIntArray(simIconRes);
- dest.writeInt(mcc);
- dest.writeInt(mnc);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public String toString() {
- return "{mSubId=" + subId + ", mIccId=" + iccId + " mSlotId=" + slotId
- + " mDisplayName=" + displayName + " mNameSource=" + nameSource
- + " mColor=" + color + " mNumber=" + number
- + " mDisplayNumberFormat=" + displayNumberFormat + " mDataRoaming=" + dataRoaming
- + " mSimIconRes=" + simIconRes + " mMcc " + mcc + " mMnc " + mnc + "}";
- }
-}
diff --git a/telephony/java/android/telephony/SubInfoRecord.aidl b/telephony/java/android/telephony/SubscriptionInfo.aidl
index a2de676..1e13732 100755
--- a/telephony/java/android/telephony/SubInfoRecord.aidl
+++ b/telephony/java/android/telephony/SubscriptionInfo.aidl
@@ -16,4 +16,4 @@
package android.telephony;
-parcelable SubInfoRecord;
+parcelable SubscriptionInfo;
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
new file mode 100644
index 0000000..e57f9e3
--- /dev/null
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -0,0 +1,340 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+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.
+ */
+public class SubscriptionInfo implements Parcelable {
+
+ /**
+ * Size of text to render on the icon.
+ */
+ private static final int TEXT_SIZE = 16;
+
+ /**
+ * Subscription Identifier, this is a device unique number
+ * and not an index into an array
+ */
+ private int mId;
+
+ /**
+ * The GID for a SIM that maybe associated with this subscription, empty if unknown
+ */
+ private String mIccId;
+
+ /**
+ * The index of the slot that currently contains the subscription
+ * and not necessarily unique and maybe INVALID_SLOT_ID if unknown
+ */
+ private int mSimSlotIndex;
+
+ /**
+ * The name displayed to the user that identifies this subscription
+ */
+ private CharSequence mDisplayName;
+
+ /**
+ * The string displayed to the user that identifies Subscription Provider Name
+ */
+ private CharSequence mCarrierName;
+
+ /**
+ * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
+ * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
+ */
+ private int mNameSource;
+
+ /**
+ * The color to be used for tinting the icon when displaying to the user
+ */
+ private int mIconTint;
+
+ /**
+ * A number presented to the user identify this subscription
+ */
+ private String mNumber;
+
+ /**
+ * Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE
+ */
+ private int mDataRoaming;
+
+ /**
+ * SIM Icon bitmap
+ */
+ private Bitmap mIconBitmap;
+
+ /**
+ * Mobile Country Code
+ */
+ private int mMcc;
+
+ /**
+ * Mobile Network Code
+ */
+ private int mMnc;
+
+ /**
+ * ISO Country code for the subscription's provider
+ */
+ private String mCountryIso;
+
+ /**
+ * @hide
+ */
+ public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
+ CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
+ Bitmap icon, int mcc, int mnc, String countryIso) {
+ this.mId = id;
+ this.mIccId = iccId;
+ this.mSimSlotIndex = simSlotIndex;
+ this.mDisplayName = displayName;
+ this.mCarrierName = carrierName;
+ this.mNameSource = nameSource;
+ this.mIconTint = iconTint;
+ this.mNumber = number;
+ this.mDataRoaming = roaming;
+ this.mIconBitmap = icon;
+ this.mMcc = mcc;
+ this.mMnc = mnc;
+ this.mCountryIso = countryIso;
+ }
+
+ /**
+ * Returns the subscription ID.
+ */
+ public int getSubscriptionId() {
+ return this.mId;
+ }
+
+ /**
+ * Returns the ICC ID.
+ */
+ public String getIccId() {
+ return this.mIccId;
+ }
+
+ /**
+ * Returns the slot index of this Subscription's SIM card.
+ */
+ public int getSimSlotIndex() {
+ return this.mSimSlotIndex;
+ }
+
+ /**
+ * Returns the name displayed to the user that identifies this subscription
+ */
+ public CharSequence getDisplayName() {
+ return this.mDisplayName;
+ }
+
+ /**
+ * Sets the name displayed to the user that identifies this subscription
+ * @hide
+ */
+ public void setDisplayName(CharSequence name) {
+ this.mDisplayName = name;
+ }
+
+ /**
+ * Returns the name displayed to the user that identifies Subscription provider name
+ */
+ public CharSequence getCarrierName() {
+ return this.mCarrierName;
+ }
+
+ /**
+ * Sets the name displayed to the user that identifies Subscription provider name
+ * @hide
+ */
+ public void setCarrierName(CharSequence name) {
+ this.mCarrierName = name;
+ }
+
+ /**
+ * Return the source of the name, eg NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
+ * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
+ */
+ public int getNameSource() {
+ return this.mNameSource;
+ }
+
+ /**
+ * Creates and returns an icon {@code Bitmap} to represent this {@code SubscriptionInfo} in a user
+ * interface.
+ *
+ * @param context A {@code Context} to get the {@code DisplayMetrics}s from.
+ *
+ * @return A bitmap icon for this {@code SubscriptionInfo}.
+ */
+ 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(metrics, width, height, mIconBitmap.getConfig());
+
+ Canvas canvas = new Canvas(workingBitmap);
+ Paint paint = new Paint();
+
+ // Tint the icon with the color.
+ paint.setColorFilter(new PorterDuffColorFilter(mIconTint, PorterDuff.Mode.SRC_ATOP));
+ canvas.drawBitmap(mIconBitmap, 0, 0, paint);
+ paint.setColorFilter(null);
+
+ // Write the sim slot index.
+ paint.setAntiAlias(true);
+ paint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));
+ paint.setColor(Color.WHITE);
+ // 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();
+ final float yOffset = (height / 2.f) - textBound.centerY();
+ canvas.drawText(index, xOffset, yOffset, paint);
+
+ return workingBitmap;
+ }
+
+ /**
+ * A highlight color to use in displaying information about this {@code PhoneAccount}.
+ *
+ * @return A hexadecimal color value.
+ */
+ public int getIconTint() {
+ return mIconTint;
+ }
+
+ /**
+ * Sets the color displayed to the user that identifies this subscription
+ * @hide
+ */
+ public void setIconTint(int iconTint) {
+ this.mIconTint = iconTint;
+ }
+
+ /**
+ * Returns the number of this subscription.
+ */
+ public String getNumber() {
+ return mNumber;
+ }
+
+ /**
+ * Return the data roaming value.
+ */
+ public int getDataRoaming() {
+ return this.mDataRoaming;
+ }
+
+ /**
+ * Returns the MCC.
+ */
+ public int getMcc() {
+ return this.mMcc;
+ }
+
+ /**
+ * Returns the MNC.
+ */
+ public int getMnc() {
+ return this.mMnc;
+ }
+
+ /**
+ * Returns the ISO country code
+ */
+ public String getCountryIso() {
+ return this.mCountryIso;
+ }
+
+ public static final Parcelable.Creator<SubscriptionInfo> CREATOR = new Parcelable.Creator<SubscriptionInfo>() {
+ @Override
+ public SubscriptionInfo createFromParcel(Parcel source) {
+ int id = source.readInt();
+ String iccId = source.readString();
+ int simSlotIndex = source.readInt();
+ CharSequence displayName = source.readCharSequence();
+ CharSequence carrierName = source.readCharSequence();
+ int nameSource = source.readInt();
+ int iconTint = source.readInt();
+ String number = source.readString();
+ int dataRoaming = source.readInt();
+ int mcc = source.readInt();
+ int mnc = source.readInt();
+ String countryIso = source.readString();
+ Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source);
+
+ return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
+ nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso);
+ }
+
+ @Override
+ public SubscriptionInfo[] newArray(int size) {
+ return new SubscriptionInfo[size];
+ }
+ };
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mId);
+ dest.writeString(mIccId);
+ dest.writeInt(mSimSlotIndex);
+ dest.writeCharSequence(mDisplayName);
+ dest.writeCharSequence(mCarrierName);
+ dest.writeInt(mNameSource);
+ dest.writeInt(mIconTint);
+ dest.writeString(mNumber);
+ dest.writeInt(mDataRoaming);
+ dest.writeInt(mMcc);
+ dest.writeInt(mMnc);
+ dest.writeString(mCountryIso);
+ mIconBitmap.writeToParcel(dest, flags);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public String toString() {
+ return "{id=" + mId + ", iccId=" + mIccId + " simSlotIndex=" + mSimSlotIndex
+ + " displayName=" + mDisplayName + " carrierName=" + mCarrierName
+ + " nameSource=" + mNameSource + " iconTint=" + mIconTint + " number=" + mNumber
+ + " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc " + mMcc
+ + " mnc " + mMnc + "}";
+ }
+}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index fe68263..20cd037 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -16,17 +16,23 @@
package android.telephony;
+import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.provider.BaseColumns;
import android.telephony.Rlog;
+import android.os.Handler;
+import android.os.Message;
import android.os.ServiceManager;
import android.os.RemoteException;
import com.android.internal.telephony.ISub;
+import com.android.internal.telephony.IOnSubscriptionsChangedListener;
+import com.android.internal.telephony.ITelephonyRegistry;
import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.TelephonyProperties;
import java.util.ArrayList;
import java.util.List;
@@ -34,87 +40,82 @@ import java.util.List;
/**
* SubscriptionManager is the application interface to SubscriptionController
* and provides information about the current Telephony Subscriptions.
- *
- * The android.Manifest.permission.READ_PHONE_STATE to retrieve the information, except
- * getActiveSubIdList and getActiveSubIdCount for which no permission is needed.
- *
- * @hide - to be unhidden
+ * * <p>
+ * You do not instantiate this class directly; instead, you retrieve
+ * a reference to an instance through {@link #from}.
+ * <p>
+ * All SDK public methods require android.Manifest.permission.READ_PHONE_STATE.
*/
-public class SubscriptionManager implements BaseColumns {
- private static final String LOG_TAG = "SUB";
- private static final boolean DBG = true;
+public class SubscriptionManager {
+ private static final String LOG_TAG = "SubscriptionManager";
+ private static final boolean DBG = false;
private static final boolean VDBG = false;
- /** An invalid phone identifier */
- /** @hide - to be unhidden */
- public static final int INVALID_PHONE_ID = -1000;
-
- /** Indicates the caller wants the default phone id. */
- /** @hide - to be unhidden */
- public static final int DEFAULT_PHONE_ID = Integer.MAX_VALUE;
-
- /** An invalid slot identifier */
- /** @hide - to be unhidden */
- public static final int INVALID_SLOT_ID = -1000;
+ /** An invalid subscription identifier */
+ public static final int INVALID_SUBSCRIPTION_ID = -1;
- /** Indicates the caller wants the default slot id. */
+ /** Base value for Dummy SUBSCRIPTION_ID's. */
+ /** FIXME: Remove DummySubId's, but for now have them map just below INVALID_SUBSCRIPTION_ID
/** @hide */
- public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE;
+ public static final int DUMMY_SUBSCRIPTION_ID_BASE = INVALID_SUBSCRIPTION_ID - 1;
- /** Indicates the user should be asked which sub to use. */
+ /** An invalid phone identifier */
/** @hide */
- public static final long ASK_USER_SUB_ID = -1001;
+ public static final int INVALID_PHONE_INDEX = -1;
- /** An invalid subscription identifier */
- public static final long INVALID_SUB_ID = -1000;
+ /** An invalid slot identifier */
+ /** @hide */
+ public static final int INVALID_SIM_SLOT_INDEX = -1;
/** Indicates the caller wants the default sub id. */
- /** @hide - to be unhidden */
- public static final long DEFAULT_SUB_ID = Long.MAX_VALUE;
-
/** @hide */
- public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
+ public static final int DEFAULT_SUBSCRIPTION_ID = Integer.MAX_VALUE;
- /** @hide */
- public static final int DEFAULT_INT_VALUE = -100;
+ /**
+ * Indicates the caller wants the default phone id.
+ * Used in SubscriptionController and PhoneBase but do we really need it???
+ * @hide
+ */
+ public static final int DEFAULT_PHONE_INDEX = Integer.MAX_VALUE;
+ /** Indicates the caller wants the default slot id. NOT used remove? */
/** @hide */
- public static final String DEFAULT_STRING_VALUE = "N/A";
+ public static final int DEFAULT_SIM_SLOT_INDEX = Integer.MAX_VALUE;
+ /** Minimum possible subid that represents a subscription */
/** @hide */
- public static final int EXTRA_VALUE_NEW_SIM = 1;
+ public static final int MIN_SUBSCRIPTION_ID_VALUE = 0;
+ /** Maximum possible subid that represents a subscription */
/** @hide */
- public static final int EXTRA_VALUE_REMOVE_SIM = 2;
- /** @hide */
- public static final int EXTRA_VALUE_REPOSITION_SIM = 3;
- /** @hide */
- public static final int EXTRA_VALUE_NOCHANGE = 4;
+ public static final int MAX_SUBSCRIPTION_ID_VALUE = DEFAULT_SUBSCRIPTION_ID - 1;
/** @hide */
- public static final String INTENT_KEY_DETECT_STATUS = "simDetectStatus";
- /** @hide */
- public static final String INTENT_KEY_SIM_COUNT = "simCount";
- /** @hide */
- public static final String INTENT_KEY_NEW_SIM_SLOT = "newSIMSlot";
+ public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
+
+ /**
+ * TelephonyProvider unique key column name is the subscription id.
+ * <P>Type: TEXT (String)</P>
+ */
/** @hide */
- public static final String INTENT_KEY_NEW_SIM_STATUS = "newSIMStatus";
+ public static final String UNIQUE_KEY_SUBSCRIPTION_ID = "_id";
/**
- * The ICC ID of a SIM.
+ * TelephonyProvider column name for SIM ICC Identifier
* <P>Type: TEXT (String)</P>
*/
/** @hide */
public static final String ICC_ID = "icc_id";
/**
+ * TelephonyProvider column name for user SIM_SlOT_INDEX
* <P>Type: INTEGER (int)</P>
*/
/** @hide */
- public static final String SIM_ID = "sim_id";
+ public static final String SIM_SLOT_INDEX = "sim_id";
/** SIM is not inserted */
- /** @hide - to be unhidden */
+ /** @hide */
public static final int SIM_NOT_INSERTED = -1;
/**
@@ -125,6 +126,13 @@ public class SubscriptionManager implements BaseColumns {
public static final String DISPLAY_NAME = "display_name";
/**
+ * TelephonyProvider column name for the service provider name for the SIM.
+ * <P>Type: TEXT (String)</P>
+ */
+ /** @hide */
+ public static final String CARRIER_NAME = "carrier_name";
+
+ /**
* Default name resource
* @hide
*/
@@ -208,7 +216,7 @@ public class SubscriptionManager implements BaseColumns {
public static final int DISPLAY_NUMBER_LAST = 2;
/** @hide */
- public static final int DISLPAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST;
+ public static final int DISPLAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST;
/**
* TelephonyProvider column name for permission for data roaming of a SIM.
@@ -229,54 +237,171 @@ public class SubscriptionManager implements BaseColumns {
/**
* TelephonyProvider column name for the MCC associated with a SIM.
* <P>Type: INTEGER (int)</P>
+ * @hide
*/
public static final String MCC = "mcc";
/**
* TelephonyProvider column name for the MNC associated with a SIM.
* <P>Type: INTEGER (int)</P>
+ * @hide
*/
public static final String MNC = "mnc";
-
- private static final int RES_TYPE_BACKGROUND_DARK = 0;
-
- private static final int RES_TYPE_BACKGROUND_LIGHT = 1;
-
- private static final int[] sSimBackgroundDarkRes = setSimResource(RES_TYPE_BACKGROUND_DARK);
-
/**
* Broadcast Action: The user has changed one of the default subs related to
* data, phone calls, or sms</p>
+ *
+ * TODO: Change to a listener
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String SUB_DEFAULT_CHANGED_ACTION =
"android.intent.action.SUB_DEFAULT_CHANGED";
+ private final Context mContext;
+
+ /**
+ * A listener class for monitoring changes to {@link SubscriptionInfo} records.
+ * <p>
+ * Override the onSubscriptionsChanged method in the object that extends this
+ * class and pass it to {@link #registerOnSubscriptionsChangedListener(OnSubscriptionsChangedListener)}
+ * to register your listener and to unregister invoke
+ * {@link #unregisterOnSubscriptionsChangedListener(OnSubscriptionsChangedListener)}
+ * <p>
+ * Permissions android.Manifest.permission.READ_PHONE_STATE is required
+ * for #onSubscriptionsChanged to be invoked.
+ */
+ public static class OnSubscriptionsChangedListener {
+ /** @hide */
+ public static final String PERMISSION_ON_SUBSCRIPTIONS_CHANGED =
+ android.Manifest.permission.READ_PHONE_STATE;
+
+ private final Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ if (DBG) {
+ log("handleMessage: invoke the overriden onSubscriptionsChanged()");
+ }
+ OnSubscriptionsChangedListener.this.onSubscriptionsChanged();
+ }
+ };
+
+ /**
+ * Callback invoked when there is any change to any SubscriptionInfo. Typically
+ * this method would invoke {@link #getActiveSubscriptionInfoList}
+ */
+ public void onSubscriptionsChanged() {
+ if (DBG) log("onSubscriptionsChanged: NOT OVERRIDDEN");
+ }
+
+ /**
+ * The callback methods need to be called on the handler thread where
+ * this object was created. If the binder did that for us it'd be nice.
+ */
+ IOnSubscriptionsChangedListener callback = new IOnSubscriptionsChangedListener.Stub() {
+ @Override
+ public void onSubscriptionsChanged() {
+ if (DBG) log("callback: received, sendEmptyMessage(0) to handler");
+ mHandler.sendEmptyMessage(0);
+ }
+ };
+
+ private void log(String s) {
+ Rlog.d(LOG_TAG, s);
+ }
+ }
+
/** @hide */
- public SubscriptionManager() {
+ public SubscriptionManager(Context context) {
if (DBG) logd("SubscriptionManager created");
+ mContext = context;
}
/**
- * Get the SubInfoRecord associated with the subId
- * @param subId The unique SubInfoRecord index in database
- * @return SubInfoRecord, maybe null
- * @hide - to be unhidden
+ * Get an instance of the SubscriptionManager from the Context.
+ * This invokes {@link android.content.Context#getSystemService
+ * Context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE)}.
+ *
+ * @param context to use.
+ * @return SubscriptionManager instance
*/
- public static SubInfoRecord getSubInfoForSubscriber(long subId) {
+ public static SubscriptionManager from(Context context) {
+ return (SubscriptionManager) context.getSystemService(
+ Context.TELEPHONY_SUBSCRIPTION_SERVICE);
+ }
+
+ /**
+ * Register for changes to the list of active {@link SubscriptionInfo} records or to the
+ * individual records themselves. When a change occurs the onSubscriptionsChanged method of
+ * the listener will be invoked immediately if there has been a notification.
+ *
+ * @param listener an instance of {@link OnSubscriptionsChangedListener} with
+ * onSubscriptionsChanged overridden.
+ */
+ public void registerOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
+ String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>";
+ if (DBG) {
+ logd("register OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
+ + " listener=" + listener);
+ }
+ try {
+ // We use the TelephonyRegistry as it runs in the system and thus is always
+ // available. Where as SubscriptionController could crash and not be available
+ ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
+ "telephony.registry"));
+ if (tr != null) {
+ tr.registerOnSubscriptionsChangedListener(pkgForDebug, listener.callback);
+ }
+ } catch (RemoteException ex) {
+ // Should not happen
+ }
+ }
+
+ /**
+ * Unregister the {@link OnSubscriptionsChangedListener}. This is not strictly necessary
+ * as the listener will automatically be unregistered if an attempt to invoke the listener
+ * fails.
+ *
+ * @param listener that is to be unregistered.
+ */
+ public void unregisterOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
+ String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>";
+ if (DBG) {
+ logd("unregister OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
+ + " listener=" + listener);
+ }
+ try {
+ // We use the TelephonyRegistry as its runs in the system and thus is always
+ // available where as SubscriptionController could crash and not be available
+ ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
+ "telephony.registry"));
+ if (tr != null) {
+ tr.unregisterOnSubscriptionsChangedListener(pkgForDebug, listener.callback);
+ }
+ } catch (RemoteException ex) {
+ // Should not happen
+ }
+ }
+
+ /**
+ * Get the active SubscriptionInfo with the subId key
+ * @param subId The unique SubscriptionInfo key in database
+ * @return SubscriptionInfo, maybe null if its not active.
+ */
+ public SubscriptionInfo getActiveSubscriptionInfo(int subId) {
+ if (VDBG) logd("[getActiveSubscriptionInfo]+ subId=" + subId);
if (!isValidSubId(subId)) {
- logd("[getSubInfoForSubscriberx]- invalid subId");
+ logd("[getActiveSubscriptionInfo]- invalid subId");
return null;
}
- SubInfoRecord subInfo = null;
+ SubscriptionInfo subInfo = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- subInfo = iSub.getSubInfoForSubscriber(subId);
+ subInfo = iSub.getActiveSubscriptionInfo(subId);
}
} catch (RemoteException ex) {
// ignore it
@@ -287,77 +412,67 @@ public class SubscriptionManager implements BaseColumns {
}
/**
- * Get the SubInfoRecord according to an IccId
+ * Get the active SubscriptionInfo associated with the iccId
* @param iccId the IccId of SIM card
- * @return SubInfoRecord List, maybe empty but not null
+ * @return SubscriptionInfo, maybe null if its not active
* @hide
*/
- public static List<SubInfoRecord> getSubInfoUsingIccId(String iccId) {
- if (VDBG) logd("[getSubInfoUsingIccId]+ iccId=" + iccId);
+ public SubscriptionInfo getActiveSubscriptionInfoForIccIndex(String iccId) {
+ if (VDBG) logd("[getActiveSubscriptionInfoForIccIndex]+ iccId=" + iccId);
if (iccId == null) {
- logd("[getSubInfoUsingIccId]- null iccid");
+ logd("[getActiveSubscriptionInfoForIccIndex]- null iccid");
return null;
}
- List<SubInfoRecord> result = null;
+ SubscriptionInfo result = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getSubInfoUsingIccId(iccId);
+ result = iSub.getActiveSubscriptionInfoForIccId(iccId);
}
} catch (RemoteException ex) {
// ignore it
}
-
- if (result == null) {
- result = new ArrayList<SubInfoRecord>();
- }
return result;
}
/**
- * Get the SubInfoRecord according to slotId
- * @param slotId the slot which the SIM is inserted
- * @return SubInfoRecord list, maybe empty but not null
- * @hide - to be unhidden
+ * Get the active SubscriptionInfo associated with the slotIdx
+ * @param slotIdx the slot which the subscription is inserted
+ * @return SubscriptionInfo, maybe null if its not active
*/
- public static List<SubInfoRecord> getSubInfoUsingSlotId(int slotId) {
- // FIXME: Consider never returning null
- if (!isValidSlotId(slotId)) {
- logd("[getSubInfoUsingSlotId]- invalid slotId");
+ public SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx) {
+ if (VDBG) logd("[getActiveSubscriptionInfoForSimSlotIndex]+ slotIdx=" + slotIdx);
+ if (!isValidSlotId(slotIdx)) {
+ logd("[getActiveSubscriptionInfoForSimSlotIndex]- invalid slotIdx");
return null;
}
- List<SubInfoRecord> result = null;
+ SubscriptionInfo result = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getSubInfoUsingSlotId(slotId);
+ result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIdx);
}
} catch (RemoteException ex) {
// ignore it
}
-
- if (result == null) {
- result = new ArrayList<SubInfoRecord>();
- }
return result;
}
/**
- * Get all the SubInfoRecord(s) in subInfo database
- * @return List of all SubInfoRecords in database, include those that were inserted before
- * maybe empty but not null.
+ * @return List of all SubscriptionInfo records in database,
+ * include those that were inserted before, maybe empty but not null.
* @hide
*/
- public static List<SubInfoRecord> getAllSubInfoList() {
- if (VDBG) logd("[getAllSubInfoList]+");
+ public List<SubscriptionInfo> getAllSubscriptionInfoList() {
+ if (VDBG) logd("[getAllSubscriptionInfoList]+");
- List<SubInfoRecord> result = null;
+ List<SubscriptionInfo> result = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -369,41 +484,52 @@ public class SubscriptionManager implements BaseColumns {
}
if (result == null) {
- result = new ArrayList<SubInfoRecord>();
+ result = new ArrayList<SubscriptionInfo>();
}
return result;
}
/**
- * Get the SubInfoRecord(s) of the currently inserted SIM(s)
- * @return Array list of currently inserted SubInfoRecord(s) maybe empty but not null
- * @hide - to be unhidden
+ * Get the SubscriptionInfo(s) of the currently inserted SIM(s). The records will be sorted
+ * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}.
+ *
+ * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device.
+ * <ul>
+ * <li>
+ * If null is returned the current state is unknown but if a {@link OnSubscriptionsChangedListener}
+ * has been registered {@link OnSubscriptionsChangedListener#onSubscriptionsChanged} will be
+ * invoked in the future.
+ * </li>
+ * <li>
+ * If the list is empty then there are no {@link SubscriptionInfo} records currently available.
+ * </li>
+ * <li>
+ * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex}
+ * then by {@link SubscriptionInfo#getSubscriptionId}.
+ * </li>
+ * </ul>
*/
- public static List<SubInfoRecord> getActiveSubInfoList() {
- List<SubInfoRecord> result = null;
+ public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
+ List<SubscriptionInfo> result = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getActiveSubInfoList();
+ result = iSub.getActiveSubscriptionInfoList();
}
} catch (RemoteException ex) {
// ignore it
}
-
- if (result == null) {
- result = new ArrayList<SubInfoRecord>();
- }
return result;
}
/**
- * Get the SUB count of all SUB(s) in subinfo database
- * @return all SIM count in database, include what was inserted before
+ * @return the count of all subscriptions in the database, this includes
+ * all subscriptions that have been seen.
* @hide
*/
- public static int getAllSubInfoCount() {
- if (VDBG) logd("[getAllSubInfoCount]+");
+ public int getAllSubscriptionInfoCount() {
+ if (VDBG) logd("[getAllSubscriptionInfoCount]+");
int result = 0;
@@ -420,11 +546,11 @@ public class SubscriptionManager implements BaseColumns {
}
/**
- * Get the count of active SUB(s)
- * @return active SIM count
- * @hide
+ * @return the current number of active subscriptions. There is no guarantee the value
+ * returned by this method will be the same as the length of the list returned by
+ * {@link #getActiveSubscriptionInfoList}.
*/
- public static int getActiveSubInfoCount() {
+ public int getActiveSubscriptionInfoCount() {
int result = 0;
try {
@@ -440,19 +566,39 @@ public class SubscriptionManager implements BaseColumns {
}
/**
- * Add a new SubInfoRecord to subinfo database if needed
+ * @return the maximum number of active subscriptions that will be returned by
+ * {@link #getActiveSubscriptionInfoList} and the value returned by
+ * {@link #getActiveSubscriptionInfoCount}.
+ */
+ public int getActiveSubscriptionInfoCountMax() {
+ int result = 0;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ result = iSub.getActiveSubInfoCountMax();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ return result;
+ }
+
+ /**
+ * Add a new SubscriptionInfo to SubscriptionInfo database if needed
* @param iccId the IccId of the SIM card
* @param slotId the slot which the SIM is inserted
* @return the URL of the newly created row or the updated row
* @hide
*/
- public static Uri addSubInfoRecord(String iccId, int slotId) {
- if (VDBG) logd("[addSubInfoRecord]+ iccId:" + iccId + " slotId:" + slotId);
+ public Uri addSubscriptionInfoRecord(String iccId, int slotId) {
+ if (VDBG) logd("[addSubscriptionInfoRecord]+ iccId:" + iccId + " slotId:" + slotId);
if (iccId == null) {
- logd("[addSubInfoRecord]- null iccId");
+ logd("[addSubscriptionInfoRecord]- null iccId");
}
if (!isValidSlotId(slotId)) {
- logd("[addSubInfoRecord]- invalid slotId");
+ logd("[addSubscriptionInfoRecord]- invalid slotId");
}
try {
@@ -471,17 +617,16 @@ public class SubscriptionManager implements BaseColumns {
}
/**
- * Set SIM color by simInfo index
- * @param color the color of the SIM
+ * Set SIM icon tint color by simInfo index
+ * @param tint the RGB value of icon tint color of the SIM
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
* @hide
*/
- public static int setColor(int color, long subId) {
- if (VDBG) logd("[setColor]+ color:" + color + " subId:" + subId);
- int size = sSimBackgroundDarkRes.length;
- if (!isValidSubId(subId) || color < 0 || color >= size) {
- logd("[setColor]- fail");
+ public int setIconTint(int tint, int subId) {
+ if (VDBG) logd("[setIconTint]+ tint:" + tint + " subId:" + subId);
+ if (!isValidSubId(subId)) {
+ logd("[setIconTint]- fail");
return -1;
}
@@ -490,7 +635,7 @@ public class SubscriptionManager implements BaseColumns {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setColor(color, subId);
+ result = iSub.setIconTint(tint, subId);
}
} catch (RemoteException ex) {
// ignore it
@@ -503,24 +648,24 @@ public class SubscriptionManager implements BaseColumns {
/**
* Set display name by simInfo index
* @param displayName the display name of SIM card
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
* @hide
*/
- public static int setDisplayName(String displayName, long subId) {
+ public int setDisplayName(String displayName, int subId) {
return setDisplayName(displayName, subId, NAME_SOURCE_UNDEFINDED);
}
/**
* Set display name by simInfo index with name source
* @param displayName the display name of SIM card
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @param nameSource 0: NAME_SOURCE_DEFAULT_SOURCE, 1: NAME_SOURCE_SIM_SOURCE,
* 2: NAME_SOURCE_USER_INPUT, -1 NAME_SOURCE_UNDEFINED
* @return the number of records updated or -1 if invalid subId
* @hide
*/
- public static int setDisplayName(String displayName, long subId, long nameSource) {
+ public int setDisplayName(String displayName, int subId, long nameSource) {
if (VDBG) {
logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId
+ " nameSource:" + nameSource);
@@ -548,11 +693,11 @@ public class SubscriptionManager implements BaseColumns {
/**
* Set phone number by subId
* @param number the phone number of the SIM
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
* @hide
*/
- public static int setDisplayNumber(String number, long subId) {
+ public int setDisplayNumber(String number, int subId) {
if (number == null || !isValidSubId(subId)) {
logd("[setDisplayNumber]- fail");
return -1;
@@ -574,42 +719,13 @@ public class SubscriptionManager implements BaseColumns {
}
/**
- * Set number display format. 0: none, 1: the first four digits, 2: the last four digits
- * @param format the display format of phone number
- * @param subId the unique SubInfoRecord index in database
- * @return the number of records updated
- * @hide
- */
- public static int setDisplayNumberFormat(int format, long subId) {
- if (VDBG) logd("[setDisplayNumberFormat]+ format:" + format + " subId:" + subId);
- if (format < 0 || !isValidSubId(subId)) {
- logd("[setDisplayNumberFormat]- fail, return -1");
- return -1;
- }
-
- int result = 0;
-
- try {
- ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
- if (iSub != null) {
- result = iSub.setDisplayNumberFormat(format, subId);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
-
- return result;
-
- }
-
- /**
* Set data roaming by simInfo index
* @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
* @hide
*/
- public static int setDataRoaming(int roaming, long subId) {
+ public int setDataRoaming(int roaming, int subId) {
if (VDBG) logd("[setDataRoaming]+ roaming:" + roaming + " subId:" + subId);
if (roaming < 0 || !isValidSubId(subId)) {
logd("[setDataRoaming]- fail");
@@ -634,14 +750,14 @@ public class SubscriptionManager implements BaseColumns {
* Get slotId associated with the subscription.
* @return slotId as a positive integer or a negative value if an error either
* SIM_NOT_INSERTED or INVALID_SLOT_ID.
- * @hide - to be unhidden
+ * @hide
*/
- public static int getSlotId(long subId) {
+ public static int getSlotId(int subId) {
if (!isValidSubId(subId)) {
logd("[getSlotId]- fail");
}
- int result = INVALID_SLOT_ID;
+ int result = INVALID_SIM_SLOT_INDEX;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -657,13 +773,13 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static long[] getSubId(int slotId) {
+ public static int[] getSubId(int slotId) {
if (!isValidSlotId(slotId)) {
logd("[getSubId]- fail");
return null;
}
- long[] subId = null;
+ int[] subId = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -678,13 +794,13 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static int getPhoneId(long subId) {
+ public static int getPhoneId(int subId) {
if (!isValidSubId(subId)) {
logd("[getPhoneId]- fail");
- return INVALID_PHONE_ID;
+ return INVALID_PHONE_INDEX;
}
- int result = INVALID_PHONE_ID;
+ int result = INVALID_PHONE_INDEX;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -700,33 +816,8 @@ public class SubscriptionManager implements BaseColumns {
}
- private static int[] setSimResource(int type) {
- int[] simResource = null;
-
- switch (type) {
- case RES_TYPE_BACKGROUND_DARK:
- simResource = new int[] {
- com.android.internal.R.drawable.sim_dark_blue,
- com.android.internal.R.drawable.sim_dark_orange,
- com.android.internal.R.drawable.sim_dark_green,
- com.android.internal.R.drawable.sim_dark_purple
- };
- break;
- case RES_TYPE_BACKGROUND_LIGHT:
- simResource = new int[] {
- com.android.internal.R.drawable.sim_light_blue,
- com.android.internal.R.drawable.sim_light_orange,
- com.android.internal.R.drawable.sim_light_green,
- com.android.internal.R.drawable.sim_light_purple
- };
- break;
- }
-
- return simResource;
- }
-
private static void logd(String msg) {
- Rlog.d(LOG_TAG, "[SubManager] " + msg);
+ Rlog.d(LOG_TAG, msg);
}
/**
@@ -735,8 +826,8 @@ public class SubscriptionManager implements BaseColumns {
* getDefaultDataSubId().
* @hide
*/
- public static long getDefaultSubId() {
- long subId = INVALID_SUB_ID;
+ public static int getDefaultSubId() {
+ int subId = INVALID_SUBSCRIPTION_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -752,8 +843,8 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static long getDefaultVoiceSubId() {
- long subId = INVALID_SUB_ID;
+ public static int getDefaultVoiceSubId() {
+ int subId = INVALID_SUBSCRIPTION_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -769,7 +860,7 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static void setDefaultVoiceSubId(long subId) {
+ public void setDefaultVoiceSubId(int subId) {
if (VDBG) logd("setDefaultVoiceSubId sub id = " + subId);
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -782,8 +873,8 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static SubInfoRecord getDefaultVoiceSubInfo() {
- return getSubInfoForSubscriber(getDefaultVoiceSubId());
+ public SubscriptionInfo getDefaultVoiceSubscriptionInfo() {
+ return getActiveSubscriptionInfo(getDefaultVoiceSubId());
}
/** @hide */
@@ -792,11 +883,13 @@ public class SubscriptionManager implements BaseColumns {
}
/**
- * @return subId of the DefaultSms subscription or the value INVALID_SUB_ID if an error.
- * @hide - to be unhidden
+ * @return subId of the DefaultSms subscription or
+ * the value INVALID_SUBSCRIPTION_ID if an error.
+ *
+ * @hide
*/
- public static long getDefaultSmsSubId() {
- long subId = INVALID_SUB_ID;
+ public static int getDefaultSmsSubId() {
+ int subId = INVALID_SUBSCRIPTION_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -812,7 +905,7 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static void setDefaultSmsSubId(long subId) {
+ public void setDefaultSmsSubId(int subId) {
if (VDBG) logd("setDefaultSmsSubId sub id = " + subId);
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -825,18 +918,18 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static SubInfoRecord getDefaultSmsSubInfo() {
- return getSubInfoForSubscriber(getDefaultSmsSubId());
+ public SubscriptionInfo getDefaultSmsSubscriptionInfo() {
+ return getActiveSubscriptionInfo(getDefaultSmsSubId());
}
/** @hide */
- public static int getDefaultSmsPhoneId() {
+ public int getDefaultSmsPhoneId() {
return getPhoneId(getDefaultSmsSubId());
}
/** @hide */
- public static long getDefaultDataSubId() {
- long subId = INVALID_SUB_ID;
+ public static int getDefaultDataSubId() {
+ int subId = INVALID_SUBSCRIPTION_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -852,7 +945,7 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static void setDefaultDataSubId(long subId) {
+ public void setDefaultDataSubId(int subId) {
if (VDBG) logd("setDataSubscription sub id = " + subId);
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -865,17 +958,17 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static SubInfoRecord getDefaultDataSubInfo() {
- return getSubInfoForSubscriber(getDefaultDataSubId());
+ public SubscriptionInfo getDefaultDataSubscriptionInfo() {
+ return getActiveSubscriptionInfo(getDefaultDataSubId());
}
/** @hide */
- public static int getDefaultDataPhoneId() {
+ public int getDefaultDataPhoneId() {
return getPhoneId(getDefaultDataSubId());
}
/** @hide */
- public static void clearSubInfo() {
+ public void clearSubscriptionInfo() {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
@@ -890,14 +983,14 @@ public class SubscriptionManager implements BaseColumns {
//FIXME this is vulnerable to race conditions
/** @hide */
- public static boolean allDefaultsSelected() {
- if (getDefaultDataSubId() == INVALID_SUB_ID) {
+ public boolean allDefaultsSelected() {
+ if (getDefaultDataSubId() == INVALID_SUBSCRIPTION_ID) {
return false;
}
- if (getDefaultSmsSubId() == INVALID_SUB_ID) {
+ if (getDefaultSmsSubId() == INVALID_SUBSCRIPTION_ID) {
return false;
}
- if (getDefaultVoiceSubId() == INVALID_SUB_ID) {
+ if (getDefaultVoiceSubId() == INVALID_SUBSCRIPTION_ID) {
return false;
}
return true;
@@ -905,10 +998,10 @@ public class SubscriptionManager implements BaseColumns {
/**
* If a default is set to subscription which is not active, this will reset that default back to
- * INVALID_SUB_ID.
+ * INVALID_SUBSCRIPTION_ID.
* @hide
*/
- public static void clearDefaultsForInactiveSubIds() {
+ public void clearDefaultsForInactiveSubIds() {
if (VDBG) logd("clearDefaultsForInactiveSubIds");
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -922,33 +1015,34 @@ public class SubscriptionManager implements BaseColumns {
/**
* @return true if a valid subId else false
- * @hide - to be unhidden
+ * @hide
+ */
+ public static boolean isValidSubId(int subId) {
+ return subId > INVALID_SUBSCRIPTION_ID ;
+ }
+
+ /**
+ * @return true if subId is an usable subId value else false. A
+ * usable subId means its neither a INVALID_SUBSCRIPTION_ID nor a DEFAUL_SUB_ID.
+ * @hide
*/
- public static boolean isValidSubId(long subId) {
- return subId > INVALID_SUB_ID ;
+ public static boolean isUsableSubIdValue(int subId) {
+ return subId >= MIN_SUBSCRIPTION_ID_VALUE && subId <= MAX_SUBSCRIPTION_ID_VALUE;
}
/** @hide */
public static boolean isValidSlotId(int slotId) {
- // We are testing INVALID_SLOT_ID and slotId >= 0 independently because we should
- // not assume that INVALID_SLOT_ID will always be a negative value. Any negative
- // value is invalid.
- return slotId != INVALID_SLOT_ID && slotId >= 0 &&
- slotId < TelephonyManager.getDefault().getSimCount();
+ return slotId >= 0 && slotId < TelephonyManager.getDefault().getSimCount();
}
/** @hide */
public static boolean isValidPhoneId(int phoneId) {
- // We are testing INVALID_PHONE_ID and phoneId >= 0 independently because we should
- // not assume that INVALID_PHONE_ID will always be a negative value. Any negative
- // value is invalid.
- return phoneId != INVALID_PHONE_ID && phoneId >= 0 &&
- phoneId < TelephonyManager.getDefault().getPhoneCount();
+ return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getPhoneCount();
}
/** @hide */
public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) {
- long[] subIds = SubscriptionManager.getSubId(phoneId);
+ int[] subIds = SubscriptionManager.getSubId(phoneId);
if (subIds != null && subIds.length > 0) {
putPhoneIdAndSubIdExtra(intent, phoneId, subIds[0]);
} else {
@@ -957,7 +1051,7 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, long subId) {
+ public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, int subId) {
if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
@@ -971,8 +1065,8 @@ public class SubscriptionManager implements BaseColumns {
* is never null but the length maybe 0.
* @hide
*/
- public static long[] getActiveSubIdList() {
- long[] subId = null;
+ public @NonNull int[] getActiveSubscriptionIdList() {
+ int[] subId = null;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -984,11 +1078,61 @@ public class SubscriptionManager implements BaseColumns {
}
if (subId == null) {
- subId = new long[0];
+ subId = new int[0];
}
return subId;
}
+
+ /**
+ * Returns true if the device is considered roaming on the current
+ * network for a subscription.
+ * <p>
+ * Availability: Only when user registered to a network.
+ *
+ * @param subId The subscription ID
+ * @return true if the network for the subscription is roaming, false otherwise
+ */
+ public boolean isNetworkRoaming(int subId) {
+ final int phoneId = getPhoneId(subId);
+ if (phoneId < 0) {
+ // What else can we do?
+ return false;
+ }
+ // FIXME: use better way to get roaming status instead of reading from system property
+ 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 6ba151f..852978b 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -16,11 +16,15 @@
package android.telephony;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -37,6 +41,7 @@ import com.android.internal.telephony.TelephonyProperties;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -79,6 +84,7 @@ public class TelephonyManager {
}
private final Context mContext;
+ private SubscriptionManager mSubscriptionManager;
private static String multiSimConfig =
SystemProperties.get(TelephonyProperties.PROPERTY_MULTI_SIM_CONFIG);
@@ -104,6 +110,7 @@ public class TelephonyManager {
} else {
mContext = context;
}
+ mSubscriptionManager = SubscriptionManager.from(mContext);
if (sRegistry == null) {
sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
@@ -157,6 +164,9 @@ public class TelephonyManager {
public int getPhoneCount() {
int phoneCount = 1;
switch (getMultiSimConfiguration()) {
+ case UNKNOWN:
+ phoneCount = 1;
+ break;
case DSDS:
case DSDA:
phoneCount = PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM;
@@ -572,8 +582,28 @@ public class TelephonyManager {
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
public String getDeviceSoftwareVersion() {
+ return getDeviceSoftwareVersion(getDefaultSim());
+ }
+
+ /**
+ * Returns the software version number for the device, for example,
+ * the IMEI/SV for GSM phones. Return null if the software version is
+ * not available.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ *
+ * @param slotId of which deviceID is returned
+ */
+ /** {@hide} */
+ public String getDeviceSoftwareVersion(int slotId) {
+ // FIXME methods taking slot id should not use subscription, instead us Uicc directly
+ int[] subId = SubscriptionManager.getSubId(slotId);
+ if (subId == null || subId.length == 0) {
+ return null;
+ }
try {
- return getSubscriberInfo().getDeviceSvn();
+ return getSubscriberInfo().getDeviceSvnUsingSubId(subId[0]);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -603,7 +633,11 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getDeviceId(int slotId) {
- long[] subId = SubscriptionManager.getSubId(slotId);
+ // FIXME methods taking slot id should not use subscription, instead us Uicc directly
+ int[] subId = SubscriptionManager.getSubId(slotId);
+ if (subId == null || subId.length == 0) {
+ return null;
+ }
try {
return getSubscriberInfo().getDeviceIdForSubscriber(subId[0]);
} catch (RemoteException ex) {
@@ -634,7 +668,7 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getImei(int slotId) {
- long[] subId = SubscriptionManager.getSubId(slotId);
+ int[] subId = SubscriptionManager.getSubId(slotId);
try {
return getSubscriberInfo().getImeiForSubscriber(subId[0]);
} catch (RemoteException ex) {
@@ -645,6 +679,32 @@ public class TelephonyManager {
}
/**
+ * Returns the NAI. Return null if NAI is not available.
+ *
+ */
+ /** {@hide}*/
+ public String getNai() {
+ return getNai(getDefaultSim());
+ }
+
+ /**
+ * Returns the NAI. Return null if NAI is not available.
+ *
+ * @param slotId of which Nai is returned
+ */
+ /** {@hide}*/
+ public String getNai(int slotId) {
+ int[] subId = SubscriptionManager.getSubId(slotId);
+ try {
+ return getSubscriberInfo().getNaiForSubscriber(subId[0]);
+ } catch (RemoteException ex) {
+ return null;
+ } catch (NullPointerException ex) {
+ return null;
+ }
+ }
+
+ /**
* Returns the current location of the device.
*<p>
* If there is only one radio in the device and that radio has an LTE connection,
@@ -698,7 +758,7 @@ public class TelephonyManager {
* @param subId for which the location updates are enabled
*/
/** @hide */
- public void enableLocationUpdates(long subId) {
+ public void enableLocationUpdates(int subId) {
try {
getITelephony().enableLocationUpdatesForSubscriber(subId);
} catch (RemoteException ex) {
@@ -720,7 +780,7 @@ public class TelephonyManager {
}
/** @hide */
- public void disableLocationUpdates(long subId) {
+ public void disableLocationUpdates(int subId) {
try {
getITelephony().disableLocationUpdatesForSubscriber(subId);
} catch (RemoteException ex) {
@@ -785,24 +845,24 @@ public class TelephonyManager {
*/
/** {@hide} */
@SystemApi
- public int getCurrentPhoneType(long subId) {
-
+ public int getCurrentPhoneType(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getActivePhoneTypeForSubscriber(subId);
} else {
// This can happen when the ITelephony interface is not up yet.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
}
} catch (RemoteException ex) {
// This shouldn't happen in the normal case, as a backup we
// read from the system property.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
} catch (NullPointerException ex) {
// This shouldn't happen in the normal case, as a backup we
// read from the system property.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
}
}
@@ -823,31 +883,29 @@ public class TelephonyManager {
}
private int getPhoneTypeFromProperty() {
- return getPhoneTypeFromProperty(getDefaultSubscription());
+ return getPhoneTypeFromProperty(getDefaultPhone());
}
/** {@hide} */
- private int getPhoneTypeFromProperty(long subId) {
- String type =
- getTelephonyProperty
- (TelephonyProperties.CURRENT_ACTIVE_PHONE, subId, null);
- if (type != null) {
- return (Integer.parseInt(type));
- } else {
- return getPhoneTypeFromNetworkType(subId);
+ private int getPhoneTypeFromProperty(int phoneId) {
+ String type = getTelephonyProperty(phoneId,
+ TelephonyProperties.CURRENT_ACTIVE_PHONE, null);
+ if (type == null || type.equals("")) {
+ return getPhoneTypeFromNetworkType(phoneId);
}
+ return Integer.parseInt(type);
}
private int getPhoneTypeFromNetworkType() {
- return getPhoneTypeFromNetworkType(getDefaultSubscription());
+ return getPhoneTypeFromNetworkType(getDefaultPhone());
}
/** {@hide} */
- private int getPhoneTypeFromNetworkType(long subId) {
+ private int getPhoneTypeFromNetworkType(int phoneId) {
// When the system property CURRENT_ACTIVE_PHONE, has not been set,
// use the system property for default network type.
// This is a fail safe, and can only happen at first boot.
- String mode = getTelephonyProperty("ro.telephony.default_network", subId, null);
+ String mode = getTelephonyProperty(phoneId, "ro.telephony.default_network", null);
if (mode != null) {
return TelephonyManager.getPhoneType(Integer.parseInt(mode));
}
@@ -999,10 +1057,9 @@ public class TelephonyManager {
* @param subId
*/
/** {@hide} */
- public String getNetworkOperatorName(long subId) {
-
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
- subId, "");
+ public String getNetworkOperatorName(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ALPHA, "");
}
/**
@@ -1027,10 +1084,9 @@ public class TelephonyManager {
* @param subId
*/
/** {@hide} */
- public String getNetworkOperator(long subId) {
-
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC,
- subId, "");
+ public String getNetworkOperator(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
}
/**
@@ -1052,9 +1108,10 @@ public class TelephonyManager {
* @param subId
*/
/** {@hide} */
- public boolean isNetworkRoaming(long subId) {
- return "true".equals(getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
- subId, null));
+ public boolean isNetworkRoaming(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return Boolean.parseBoolean(getTelephonyProperty(phoneId,
+ TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null));
}
/**
@@ -1080,9 +1137,9 @@ public class TelephonyManager {
* @param subId for which Network CountryIso is returned
*/
/** {@hide} */
- public String getNetworkCountryIso(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
- subId, "");
+ public String getNetworkCountryIso(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
}
/** Network type is unknown */
@@ -1152,7 +1209,7 @@ public class TelephonyManager {
* @see #NETWORK_TYPE_HSPAP
*/
/** {@hide} */
- public int getNetworkType(long subId) {
+ public int getNetworkType(int subId) {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
@@ -1206,7 +1263,7 @@ public class TelephonyManager {
* @param subId for which network type is returned
*/
/** {@hide} */
- public int getDataNetworkType(long subId) {
+ public int getDataNetworkType(int subId) {
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
@@ -1238,7 +1295,7 @@ public class TelephonyManager {
*
*/
/** {@hide} */
- public int getVoiceNetworkType(long subId) {
+ public int getVoiceNetworkType(int subId) {
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
@@ -1361,10 +1418,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;
@@ -1372,14 +1433,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_CARD_IO_ERROR = 6;
+ 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 = 8;
/**
* @return true if a ICC card is present
@@ -1395,7 +1464,7 @@ public class TelephonyManager {
*/
/** {@hide} */
// FIXME Input argument slotId should be of type int
- public boolean hasIccCard(long slotId) {
+ public boolean hasIccCard(int slotId) {
try {
return getITelephony().hasIccCardUsingSlotId(slotId);
@@ -1409,8 +1478,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
@@ -1418,6 +1486,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() {
@@ -1425,10 +1495,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
@@ -1436,39 +1505,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) {
- long[] subId = SubscriptionManager.getSubId(slotId);
- if (subId == null) {
- return SIM_STATE_ABSENT;
- }
- // FIXME Do not use a property to determine SIM_STATE, call
- // appropriate method on some object.
- String prop =
- getTelephonyProperty(TelephonyProperties.PROPERTY_SIM_STATE, subId[0], "");
- 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 {
+ public int getSimState(int slotIdx) {
+ int[] subId = SubscriptionManager.getSubId(slotIdx);
+ if (subId == null || subId.length == 0) {
+ 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;
}
/**
@@ -1480,7 +1530,16 @@ public class TelephonyManager {
* @see #getSimState
*/
public String getSimOperator() {
- long subId = getDefaultSubscription();
+ int subId = SubscriptionManager.getDefaultDataSubId();
+ if (!SubscriptionManager.isUsableSubIdValue(subId)) {
+ subId = SubscriptionManager.getDefaultSmsSubId();
+ if (!SubscriptionManager.isUsableSubIdValue(subId)) {
+ subId = SubscriptionManager.getDefaultVoiceSubId();
+ if (!SubscriptionManager.isUsableSubIdValue(subId)) {
+ subId = SubscriptionManager.getDefaultSubId();
+ }
+ }
+ }
Rlog.d(TAG, "getSimOperator(): default subId=" + subId);
return getSimOperator(subId);
}
@@ -1496,9 +1555,10 @@ public class TelephonyManager {
* @param subId for which SimOperator is returned
*/
/** {@hide} */
- public String getSimOperator(long subId) {
- String operator = getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC,
- subId, "");
+ public String getSimOperator(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ String operator = getTelephonyProperty(phoneId,
+ TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
Rlog.d(TAG, "getSimOperator: subId=" + subId + " operator=" + operator);
return operator;
}
@@ -1524,9 +1584,9 @@ public class TelephonyManager {
* @param subId for which SimOperatorName is returned
*/
/** {@hide} */
- public String getSimOperatorName(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
- subId, "");
+ public String getSimOperatorName(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, "");
}
/**
@@ -1542,9 +1602,10 @@ public class TelephonyManager {
* @param subId for which SimCountryIso is returned
*/
/** {@hide} */
- public String getSimCountryIso(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
- subId, "");
+ public String getSimCountryIso(int subId) {
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
+ "");
}
/**
@@ -1567,7 +1628,7 @@ public class TelephonyManager {
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
/** {@hide} */
- public String getSimSerialNumber(long subId) {
+ public String getSimSerialNumber(int subId) {
try {
return getSubscriberInfo().getIccSerialNumberForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1603,7 +1664,7 @@ public class TelephonyManager {
*
*/
/** {@hide} */
- public int getLteOnCdmaMode(long subId) {
+ public int getLteOnCdmaMode(int subId) {
try {
return getITelephony().getLteOnCdmaModeForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1643,7 +1704,7 @@ public class TelephonyManager {
* @param subId whose subscriber id is returned
*/
/** {@hide} */
- public String getSubscriberId(long subId) {
+ public String getSubscriberId(int subId) {
try {
return getSubscriberInfo().getSubscriberIdForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1682,7 +1743,7 @@ public class TelephonyManager {
* @param subscription whose subscriber id is returned
*/
/** {@hide} */
- public String getGroupIdLevel1(long subId) {
+ public String getGroupIdLevel1(int subId) {
try {
return getSubscriberInfo().getGroupIdLevel1ForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1714,7 +1775,7 @@ public class TelephonyManager {
* @param subId whose phone number for line 1 is returned
*/
/** {@hide} */
- public String getLine1NumberForSubscriber(long subId) {
+ public String getLine1NumberForSubscriber(int subId) {
String number = null;
try {
number = getITelephony().getLine1NumberForDisplay(subId);
@@ -1739,17 +1800,16 @@ public class TelephonyManager {
* for display purpose only, for example, displayed in Phone Status. It won't
* change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
* value.
- * <p>
- * Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ *
+ * <p>Requires that the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges
*
* @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number
- * @hide
+ * @return true if the operation was executed correctly.
*/
- public void setLine1NumberForDisplay(String alphaTag, String number) {
- setLine1NumberForDisplayForSubscriber(getDefaultSubscription(), alphaTag, number);
+ public boolean setLine1NumberForDisplay(String alphaTag, String number) {
+ return setLine1NumberForDisplayForSubscriber(getDefaultSubscription(), alphaTag, number);
}
/**
@@ -1757,22 +1817,23 @@ public class TelephonyManager {
* for display purpose only, for example, displayed in Phone Status. It won't
* change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
* value.
- * <p>
- * Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ *
+ * <p>Requires that the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges
*
* @param subId the subscriber that the alphatag and dialing number belongs to.
* @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number
+ * @return true if the operation was executed correctly.
* @hide
*/
- public void setLine1NumberForDisplayForSubscriber(long subId, String alphaTag, String number) {
+ public boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number) {
try {
- getITelephony().setLine1NumberForDisplayForSubscriber(subId, alphaTag, number);
+ return getITelephony().setLine1NumberForDisplayForSubscriber(subId, alphaTag, number);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
+ return false;
}
/**
@@ -1799,7 +1860,7 @@ public class TelephonyManager {
* nobody seems to call this.
*/
/** {@hide} */
- public String getLine1AlphaTagForSubscriber(long subId) {
+ public String getLine1AlphaTagForSubscriber(int subId) {
String alphaTag = null;
try {
alphaTag = getITelephony().getLine1AlphaTagForDisplay(subId);
@@ -1820,6 +1881,23 @@ public class TelephonyManager {
}
/**
+ * Return the set of subscriber IDs that should be considered as "merged
+ * together" for data usage purposes. This is commonly {@code null} to
+ * indicate no merging is required. Any returned subscribers are sorted in a
+ * deterministic order.
+ *
+ * @hide
+ */
+ public @Nullable String[] getMergedSubscriberIds() {
+ try {
+ return getITelephony().getMergedSubscriberIds();
+ } catch (RemoteException ex) {
+ } catch (NullPointerException ex) {
+ }
+ return null;
+ }
+
+ /**
* Returns the MSISDN string.
* for a GSM phone. Return null if it is unavailable.
* <p>
@@ -1842,7 +1920,7 @@ public class TelephonyManager {
* @param subId for which msisdn is returned
*/
/** {@hide} */
- public String getMsisdn(long subId) {
+ public String getMsisdn(int subId) {
try {
return getSubscriberInfo().getMsisdnForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1872,7 +1950,7 @@ public class TelephonyManager {
* @param subId whose voice mail number is returned
*/
/** {@hide} */
- public String getVoiceMailNumber(long subId) {
+ public String getVoiceMailNumber(int subId) {
try {
return getSubscriberInfo().getVoiceMailNumberForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1904,7 +1982,7 @@ public class TelephonyManager {
* @param subId
*/
/** {@hide} */
- public String getCompleteVoiceMailNumber(long subId) {
+ public String getCompleteVoiceMailNumber(int subId) {
try {
return getSubscriberInfo().getCompleteVoiceMailNumberForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1916,6 +1994,39 @@ public class TelephonyManager {
}
/**
+ * Sets the voice mail number.
+ *
+ * <p>Requires that the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges
+ *
+ * @param alphaTag The alpha tag to display.
+ * @param number The voicemail number.
+ */
+ public boolean setVoiceMailNumber(String alphaTag, String number) {
+ return setVoiceMailNumber(getDefaultSubscription(), alphaTag, number);
+ }
+
+ /**
+ * Sets the voicemail number for the given subscriber.
+ *
+ * <p>Requires that the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges
+ *
+ * @param subId The subscription id.
+ * @param alphaTag The alpha tag to display.
+ * @param number The voicemail number.
+ */
+ /** {@hide} */
+ public boolean setVoiceMailNumber(int subId, String alphaTag, String number) {
+ try {
+ return getITelephony().setVoiceMailNumber(subId, alphaTag, number);
+ } catch (RemoteException ex) {
+ } catch (NullPointerException ex) {
+ }
+ return false;
+ }
+
+ /**
* Returns the voice mail count. Return 0 if unavailable.
* <p>
* Requires Permission:
@@ -1934,7 +2045,7 @@ public class TelephonyManager {
* @param subId whose voice message count is returned
*/
/** {@hide} */
- public int getVoiceMessageCount(long subId) {
+ public int getVoiceMessageCount(int subId) {
try {
return getITelephony().getVoiceMessageCountForSubscriber(subId);
} catch (RemoteException ex) {
@@ -1966,7 +2077,7 @@ public class TelephonyManager {
* voice mail number is returned
*/
/** {@hide} */
- public String getVoiceMailAlphaTag(long subId) {
+ public String getVoiceMailAlphaTag(int subId) {
try {
return getSubscriberInfo().getVoiceMailAlphaTagForSubscriber(subId);
} catch (RemoteException ex) {
@@ -2026,6 +2137,9 @@ public class TelephonyManager {
}
}
+ /**
+ * @hide
+ */
private IPhoneSubInfo getSubscriberInfo() {
// get it each time because that process crashes a lot
return IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
@@ -2046,11 +2160,7 @@ public class TelephonyManager {
* Returns a constant indicating the call state (cellular) on the device.
*/
public int getCallState() {
- try {
- return getTelecomService().getCallState();
- } catch (RemoteException | NullPointerException e) {
- return CALL_STATE_IDLE;
- }
+ return getCallState(getDefaultSubscription());
}
/**
@@ -2060,7 +2170,7 @@ public class TelephonyManager {
* @param subId whose call state is returned
*/
/** {@hide} */
- public int getCallState(long subId) {
+ public int getCallState(int subId) {
try {
return getITelephony().getCallStateForSubscriber(subId);
} catch (RemoteException ex) {
@@ -2143,10 +2253,16 @@ public class TelephonyManager {
}
}
+ /**
+ * @hide
+ */
private ITelephony getITelephony() {
return ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
}
+ /**
+ * @hide
+ */
private ITelecomService getTelecomService() {
return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
}
@@ -2205,7 +2321,7 @@ public class TelephonyManager {
* Returns the CDMA ERI icon index to display for a subscription
*/
/** {@hide} */
- public int getCdmaEriIconIndex(long subId) {
+ public int getCdmaEriIconIndex(int subId) {
try {
return getITelephony().getCdmaEriIconIndexForSubscriber(subId);
} catch (RemoteException ex) {
@@ -2233,7 +2349,7 @@ public class TelephonyManager {
* 1 - FLASHING
*/
/** {@hide} */
- public int getCdmaEriIconMode(long subId) {
+ public int getCdmaEriIconMode(int subId) {
try {
return getITelephony().getCdmaEriIconModeForSubscriber(subId);
} catch (RemoteException ex) {
@@ -2258,7 +2374,7 @@ public class TelephonyManager {
*
*/
/** {@hide} */
- public String getCdmaEriText(long subId) {
+ public String getCdmaEriText(int subId) {
try {
return getITelephony().getCdmaEriTextForSubscriber(subId);
} catch (RemoteException ex) {
@@ -2282,8 +2398,6 @@ public class TelephonyManager {
* PackageManager.FEATURE_TELEPHONY system feature, which is available
* on any device with a telephony radio, even if the device is
* data-only.
- *
- * @hide pending API review
*/
public boolean isVoiceCapable() {
if (mContext == null) return true;
@@ -2382,6 +2496,7 @@ public class TelephonyManager {
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param AID Application id. See ETSI 102.221 and 101.220.
* @return an IccOpenLogicalChannelResponse object.
@@ -2402,6 +2517,7 @@ public class TelephonyManager {
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param channel is the channel id to be closed as retruned by a successful
* iccOpenLogicalChannel.
@@ -2423,6 +2539,7 @@ public class TelephonyManager {
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param channel is the channel id to be closed as returned by a successful
* iccOpenLogicalChannel.
@@ -2454,6 +2571,7 @@ public class TelephonyManager {
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param cla Class of the APDU command.
* @param instruction Instruction of the APDU command.
@@ -2481,6 +2599,7 @@ public class TelephonyManager {
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param fileID
* @param command
@@ -2506,6 +2625,7 @@ public class TelephonyManager {
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param content String containing SAT/USAT response in hexadecimal
* format starting with command tag. See TS 102 223 for
@@ -2624,14 +2744,20 @@ public class TelephonyManager {
/**
* Returns Default subscription.
*/
- private static long getDefaultSubscription() {
+ private static int getDefaultSubscription() {
return SubscriptionManager.getDefaultSubId();
}
+ /**
+ * Returns Default phone.
+ */
+ private static int getDefaultPhone() {
+ return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubId());
+ }
+
/** {@hide} */
public int getDefaultSim() {
- //TODO Need to get it from Telephony Devcontroller
- return 0;
+ return SubscriptionManager.getSlotId(SubscriptionManager.getDefaultSubId());
}
/**
@@ -2639,11 +2765,10 @@ public class TelephonyManager {
*
* @hide
*/
- public static void setTelephonyProperty(String property, long subId, String value) {
+ public static void setTelephonyProperty(int phoneId, String property, String value) {
String propVal = "";
String p[] = null;
String prop = SystemProperties.get(property);
- int phoneId = SubscriptionManager.getPhoneId(subId);
if (value == null) {
value = "";
@@ -2653,7 +2778,11 @@ public class TelephonyManager {
p = prop.split(",");
}
- if (phoneId < 0) return;
+ if (!SubscriptionManager.isValidPhoneId(phoneId)) {
+ Rlog.d(TAG, "setTelephonyProperty: invalid phoneId=" + phoneId +
+ " property=" + property + " value: " + value + " prop=" + prop);
+ return;
+ }
for (int i = 0; i < phoneId; i++) {
String str = "";
@@ -2670,13 +2799,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);
}
@@ -2738,6 +2869,12 @@ public class TelephonyManager {
String valArray[] = null;
String v = android.provider.Settings.Global.getString(cr, name);
+ if (index == Integer.MAX_VALUE) {
+ throw new RuntimeException("putIntAtIndex index == MAX_VALUE index=" + index);
+ }
+ if (index < 0) {
+ throw new RuntimeException("putIntAtIndex index < 0 index=" + index);
+ }
if (v != null) {
valArray = v.split(",");
}
@@ -2767,9 +2904,8 @@ public class TelephonyManager {
*
* @hide
*/
- public static String getTelephonyProperty(String property, long subId, String defaultVal) {
+ public static String getTelephonyProperty(int phoneId, String property, String defaultVal) {
String propVal = null;
- int phoneId = SubscriptionManager.getPhoneId(subId);
String prop = SystemProperties.get(property);
if ((prop != null) && (prop.length() > 0)) {
String values[] = prop.split(",");
@@ -2777,16 +2913,19 @@ 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()) {
- //TODO Need to get it from Telephony Devcontroller
return 2;
} else {
- return 1;
+ return 1;
}
}
@@ -2851,7 +2990,7 @@ public class TelephonyManager {
* @return the response of SIM Authentication, or null if not available
* @hide
*/
- public String getIccSimChallengeResponse(long subId, int appType, String data) {
+ public String getIccSimChallengeResponse(int subId, int appType, String data) {
try {
return getSubscriberInfo().getIccSimChallengeResponse(subId, appType, data);
} catch (RemoteException ex) {
@@ -2950,36 +3089,45 @@ public class TelephonyManager {
* Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
*
* <p>
- * Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ * Requires that the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges
*
* @return true on success; false on any failure.
- * @hide
*/
public boolean setGlobalPreferredNetworkType() {
return setPreferredNetworkType(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
}
/**
- * Values used to return status for hasCarrierPrivileges call.
+ * 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 static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1;
+ 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
*/
+ /** @hide */
+ public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1;
+ /** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0;
- /**
- * Values used to return status for hasCarrierPrivileges call.
- * @hide
- */
+ /** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1;
- /**
- * Values used to return status for hasCarrierPrivileges call.
- * @hide
- */
+ /** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2;
/**
@@ -2991,22 +3139,18 @@ public class TelephonyManager {
*
* TODO: Add a link to documentation.
*
- * @return CARRIER_PRIVILEGE_STATUS_HAS_ACCESS if the app has carrier privileges.
- * CARRIER_PRIVILEGE_STATUS_NO_ACCESS if the app does not have carrier privileges.
- * CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED if the carrier rules are not loaded.
- * CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES if there was an error loading carrier
- * rules (or if there are no rules).
- * @hide
+ * @return true if the app has carrier privileges.
*/
- public int hasCarrierPrivileges() {
+ public boolean hasCarrierPrivileges() {
try {
- return getITelephony().hasCarrierPrivileges();
+ return getITelephony().getCarrierPrivilegeStatus() ==
+ CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
} catch (RemoteException ex) {
Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
} catch (NullPointerException ex) {
Rlog.e(TAG, "hasCarrierPrivileges NPE", ex);
}
- return CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
+ return false;
}
/**
@@ -3017,13 +3161,11 @@ public class TelephonyManager {
* brand value input. To unset the value, the same function should be
* called with a null brand value.
*
- * <p>Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * or has to be carrier app - see #hasCarrierPrivileges.
+ * <p>Requires that the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges
*
* @param brand The brand name to display/set.
* @return true if the operation was executed correctly.
- * @hide
*/
public boolean setOperatorBrandOverride(String brand) {
try {
@@ -3048,7 +3190,7 @@ public class TelephonyManager {
/** @hide */
@SystemApi
- public String getCdmaMdn(long subId) {
+ public String getCdmaMdn(int subId) {
try {
return getITelephony().getCdmaMdn(subId);
} catch (RemoteException ex) {
@@ -3066,7 +3208,7 @@ public class TelephonyManager {
/** @hide */
@SystemApi
- public String getCdmaMin(long subId) {
+ public String getCdmaMin(int subId) {
try {
return getITelephony().getCdmaMin(subId);
} catch (RemoteException ex) {
@@ -3082,9 +3224,9 @@ public class TelephonyManager {
try {
return getITelephony().checkCarrierPrivilegesForPackage(pkgname);
} catch (RemoteException ex) {
- Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
+ Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex);
} catch (NullPointerException ex) {
- Rlog.e(TAG, "hasCarrierPrivileges NPE", ex);
+ Rlog.e(TAG, "checkCarrierPrivilegesForPackage NPE", ex);
}
return CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
}
@@ -3265,6 +3407,17 @@ public class TelephonyManager {
/** @hide */
@SystemApi
+ public boolean handlePinMmiForSubscriber(int subId, String dialString) {
+ try {
+ return getITelephony().handlePinMmiForSubscriber(subId, dialString);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#handlePinMmi", e);
+ }
+ return false;
+ }
+
+ /** @hide */
+ @SystemApi
public void toggleRadioOnOff() {
try {
getITelephony().toggleRadioOnOff();
@@ -3371,90 +3524,87 @@ public class TelephonyManager {
}
/**
- * Set whether Android should display a simplified Mobile Network Settings UI
- * for the current ICCID.
- * <p>
- * Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
- *
- * @param enable true means enabling the simplified UI.
- * @hide
- */
- public void enableSimplifiedNetworkSettings(boolean enable) {
- enableSimplifiedNetworkSettingsForSubscriber(getDefaultSubscription(), enable);
- }
-
- /**
- * Set whether Android should display a simplified Mobile Network Settings UI
- * for the current ICCID.
- * <p>
- * Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ * Returns the result and response from RIL for oem request
*
- * @param subId for which the simplified UI should be enabled or disabled.
- * @param enable true means enabling the simplified UI.
+ * @param oemReq the data is sent to ril.
+ * @param oemResp the respose data from RIL.
+ * @return negative value request was not handled or get error
+ * 0 request was handled succesfully, but no response data
+ * positive value success, data length of response
* @hide
*/
- public void enableSimplifiedNetworkSettingsForSubscriber(long subId, boolean enable) {
+ public int invokeOemRilRequestRaw(byte[] oemReq, byte[] oemResp) {
try {
- getITelephony().enableSimplifiedNetworkSettingsForSubscriber(subId, enable);
+ return getITelephony().invokeOemRilRequestRaw(oemReq, oemResp);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
+ return -1;
}
- /**
- * Get whether a simplified Mobile Network Settings UI is enabled for the
- * current ICCID.
- * <p>
- * Requires Permission:
- * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
- *
- * @return true if the simplified UI is enabled.
- * @hide
- */
- public boolean getSimplifiedNetworkSettingsEnabled() {
- return getSimplifiedNetworkSettingsEnabledForSubscriber(getDefaultSubscription());
+ /** @hide */
+ @SystemApi
+ public void enableVideoCalling(boolean enable) {
+ try {
+ getITelephony().enableVideoCalling(enable);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#enableVideoCalling", e);
+ }
}
- /**
- * Get whether a simplified Mobile Network Settings UI is enabled for the
- * current ICCID.
- * <p>
- * Requires Permission:
- * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
- *
- * @param subId for which the simplified UI should be enabled or disabled.
- * @return true if the simplified UI is enabled.
- * @hide
- */
- public boolean getSimplifiedNetworkSettingsEnabledForSubscriber(long subId) {
+ /** @hide */
+ @SystemApi
+ public boolean isVideoCallingEnabled() {
try {
- return getITelephony().getSimplifiedNetworkSettingsEnabledForSubscriber(subId);
- } catch (RemoteException ex) {
- } catch (NullPointerException ex) {
+ return getITelephony().isVideoCallingEnabled();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#isVideoCallingEnabled", e);
}
return false;
}
/**
- * Returns the result and response from RIL for oem request
+ * This function retrieves value for setting "name+subId", and if that is not found
+ * retrieves value for setting "name", and if that is not found uses def as default
*
- * @param oemReq the data is sent to ril.
- * @param oemResp the respose data from RIL.
- * @return negative value request was not handled or get error
- * 0 request was handled succesfully, but no response data
- * positive value success, data length of response
- * @hide
- */
- public int invokeOemRilRequestRaw(byte[] oemReq, byte[] oemResp) {
+ * @hide */
+ public static int getIntWithSubId(ContentResolver cr, String name, int subId, int def) {
+ return Settings.Global.getInt(cr, name + subId, Settings.Global.getInt(cr, name, def));
+ }
+
+ /**
+ * This function retrieves value for setting "name+subId", and if that is not found
+ * retrieves value for setting "name", and if that is not found throws
+ * SettingNotFoundException
+ *
+ * @hide */
+ public static int getIntWithSubId(ContentResolver cr, String name, int subId)
+ throws SettingNotFoundException {
try {
- return getITelephony().invokeOemRilRequestRaw(oemReq, oemResp);
- } catch (RemoteException ex) {
- } catch (NullPointerException ex) {
+ return Settings.Global.getInt(cr, name + subId);
+ } catch (SettingNotFoundException e) {
+ try {
+ int val = Settings.Global.getInt(cr, name);
+ /* We are now moving from 'setting' to 'setting+subId', and using the value stored
+ * for 'setting' as default. Reset the default (since it may have a user set
+ * value). */
+ int default_val = val;
+ if (name.equals(Settings.Global.MOBILE_DATA)) {
+ default_val = "true".equalsIgnoreCase(
+ SystemProperties.get("ro.com.android.mobiledata", "true")) ? 1 : 0;
+ } else if (name.equals(Settings.Global.DATA_ROAMING)) {
+ default_val = "true".equalsIgnoreCase(
+ SystemProperties.get("ro.com.android.dataroaming", "false")) ? 1 : 0;
+ }
+
+ if (default_val != val) {
+ Settings.Global.putInt(cr, name, default_val);
+ }
+
+ return val;
+ } catch (SettingNotFoundException exc) {
+ throw new SettingNotFoundException(name);
+ }
}
- return -1;
}
}
diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java
index 8b7901c..9de938a 100644
--- a/telephony/java/com/android/ims/ImsCallProfile.java
+++ b/telephony/java/com/android/ims/ImsCallProfile.java
@@ -114,6 +114,10 @@ public class ImsCallProfile implements Parcelable {
public static final String EXTRA_CALL_MODE_CHANGEABLE = "call_mode_changeable";
public static final String EXTRA_CONFERENCE_AVAIL = "conference_avail";
+ // Extra string for internal use only. OEMs should not use
+ // this for packing extras.
+ public static final String EXTRA_OEM_EXTRAS = "OemCallExtras";
+
/**
* Integer extra properties
* oir : Rule for originating identity (number) presentation, MO/MT.
@@ -151,6 +155,18 @@ public class ImsCallProfile implements Parcelable {
public static final int DIALSTRING_USSD = 2;
/**
+ * Values for causes that restrict call types
+ */
+ // Default cause not restricted at peer and HD is supported
+ public static final int CALL_RESTRICT_CAUSE_NONE = 0;
+ // Service not supported by RAT at peer
+ public static final int CALL_RESTRICT_CAUSE_RAT = 1;
+ // Service Disabled at peer
+ public static final int CALL_RESTRICT_CAUSE_DISABLED = 2;
+ // HD is not supported
+ public static final int CALL_RESTRICT_CAUSE_HD = 3;
+
+ /**
* String extra properties
* oi : Originating identity (number), MT only
* cna : Calling name
@@ -164,11 +180,10 @@ public class ImsCallProfile implements Parcelable {
public int mServiceType;
public int mCallType;
+ public int mRestrictCause = CALL_RESTRICT_CAUSE_NONE;
public Bundle mCallExtras;
public ImsStreamMediaProfile mMediaProfile;
-
-
public ImsCallProfile(Parcel in) {
readFromParcel(in);
}
diff --git a/telephony/java/com/android/ims/ImsConferenceState.java b/telephony/java/com/android/ims/ImsConferenceState.java
index f708d5b..c57ef98 100644
--- a/telephony/java/com/android/ims/ImsConferenceState.java
+++ b/telephony/java/com/android/ims/ImsConferenceState.java
@@ -24,6 +24,8 @@ import java.util.Set;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telecom.Call;
+import android.telecom.Connection;
/**
* Provides the conference information (defined in RFC 4575) for IMS conference call.
@@ -139,4 +141,30 @@ public class ImsConferenceState implements Parcelable {
return new ImsConferenceState[size];
}
};
+
+ /**
+ * Translates an {@code ImsConferenceState} status type to a telecom connection state.
+ *
+ * @param status The status type.
+ * @return The corresponding {@link android.telecom.Connection} state.
+ */
+ public static int getConnectionStateForStatus(String status) {
+ if (status.equals(STATUS_PENDING)) {
+ return Connection.STATE_INITIALIZING;
+ } else if (status.equals(STATUS_DIALING_IN)) {
+ return Connection.STATE_RINGING;
+ } else if (status.equals(STATUS_ALERTING) ||
+ status.equals(STATUS_DIALING_OUT)) {
+ return Connection.STATE_DIALING;
+ } else if (status.equals(STATUS_ON_HOLD)) {
+ return Connection.STATE_HOLDING;
+ } else if (status.equals(STATUS_CONNECTED) ||
+ status.equals(STATUS_MUTED_VIA_FOCUS) ||
+ status.equals(STATUS_DISCONNECTING)) {
+ return Connection.STATE_ACTIVE;
+ } else if (status.equals(STATUS_DISCONNECTED)) {
+ return Connection.STATE_DISCONNECTED;
+ }
+ return Call.STATE_ACTIVE;
+ }
}
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/ims/ImsStreamMediaProfile.java b/telephony/java/com/android/ims/ImsStreamMediaProfile.java
index 003499c..359b270 100644
--- a/telephony/java/com/android/ims/ImsStreamMediaProfile.java
+++ b/telephony/java/com/android/ims/ImsStreamMediaProfile.java
@@ -41,10 +41,18 @@ public class ImsStreamMediaProfile implements Parcelable {
* Audio information
*/
public static final int AUDIO_QUALITY_NONE = 0;
- public static final int AUDIO_QUALITY_AMR = (1 << 0);
- public static final int AUDIO_QUALITY_AMR_WB = (1 << 1);
-
- /**
+ public static final int AUDIO_QUALITY_AMR = 1;
+ public static final int AUDIO_QUALITY_AMR_WB = 2;
+ public static final int AUDIO_QUALITY_QCELP13K = 3;
+ public static final int AUDIO_QUALITY_EVRC = 4;
+ public static final int AUDIO_QUALITY_EVRC_B = 5;
+ public static final int AUDIO_QUALITY_EVRC_WB = 6;
+ public static final int AUDIO_QUALITY_EVRC_NW = 7;
+ public static final int AUDIO_QUALITY_GSM_EFR = 8;
+ public static final int AUDIO_QUALITY_GSM_FR = 9;
+ public static final int AUDIO_QUALITY_GSM_HR = 10;
+
+ /**
* Video information
*/
public static final int VIDEO_QUALITY_NONE = 0;
diff --git a/telephony/java/com/android/ims/internal/IImsCallSession.aidl b/telephony/java/com/android/ims/internal/IImsCallSession.aidl
index 98b2d8a..b1f2d32 100644
--- a/telephony/java/com/android/ims/internal/IImsCallSession.aidl
+++ b/telephony/java/com/android/ims/internal/IImsCallSession.aidl
@@ -55,6 +55,13 @@ interface IImsCallSession {
ImsCallProfile getLocalCallProfile();
/**
+ * Gets the remote call profile that this session is associated with
+ *
+ * @return the remote call profile that this session is associated with
+ */
+ ImsCallProfile getRemoteCallProfile();
+
+ /**
* Gets the value associated with the specified property of this session.
*
* @return the string value associated with the specified property
@@ -160,10 +167,13 @@ interface IImsCallSession {
void resume(in ImsStreamMediaProfile profile);
/**
- * Merges the active & hold call. When it succeeds, {@link Listener#callSessionMerged}
- * is called.
+ * Merges the active & hold call. When the merge starts,
+ * {@link Listener#callSessionMergeStarted} is called.
+ * {@link Listener#callSessionMergeComplete} is called if the merge is successful, and
+ * {@link Listener#callSessionMergeFailed} is called if the merge fails.
*
- * @see Listener#callSessionMerged, Listener#callSessionMergeFailed
+ * @see Listener#callSessionMergeStarted, Listener#callSessionMergeComplete,
+ * Listener#callSessionMergeFailed
*/
void merge();
@@ -213,6 +223,20 @@ interface IImsCallSession {
void sendDtmf(char c, in Message result);
/**
+ * Start a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>,
+ * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15,
+ * and event flash to 16. Currently, event flash is not supported.
+ *
+ * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs.
+ */
+ void startDtmf(char c);
+
+ /**
+ * Stop a DTMF code.
+ */
+ void stopDtmf();
+
+ /**
* Sends an USSD message.
*
* @param ussdMessage USSD message to send
@@ -225,4 +249,10 @@ interface IImsCallSession {
* intermediates between the propriety implementation and Telecomm/InCall.
*/
IImsVideoCallProvider getVideoCallProvider();
+
+ /**
+ * Determines if the current session is multiparty.
+ * @return {@code True} if the session is multiparty.
+ */
+ boolean isMultiparty();
}
diff --git a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
index acd1eb9..84d1c545 100644
--- a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
+++ b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
@@ -48,10 +48,11 @@ interface IImsCallSessionListener {
void callSessionResumeReceived(in IImsCallSession session, in ImsCallProfile profile);
/**
- * Notifiies the result of call merge operation.
+ * Notifies the result of call merge operation.
*/
- void callSessionMerged(in IImsCallSession session,
+ void callSessionMergeStarted(in IImsCallSession session,
in IImsCallSession newSession, in ImsCallProfile profile);
+ void callSessionMergeComplete(in IImsCallSession session);
void callSessionMergeFailed(in IImsCallSession session,
in ImsReasonInfo reasonInfo);
@@ -104,4 +105,14 @@ interface IImsCallSessionListener {
in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo);
void callSessionHandoverFailed(in IImsCallSession session,
in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo);
+
+ /**
+ * Notifies the TTY mode change by remote party.
+ * @param mode one of the following:
+ * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF}
+ * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL}
+ * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO}
+ * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
+ */
+ void callSessionTtyModeReceived(in IImsCallSession session, in int mode);
}
diff --git a/telephony/java/com/android/ims/internal/IImsConfig.aidl b/telephony/java/com/android/ims/internal/IImsConfig.aidl
index e8d921e..c5ccf5f 100644
--- a/telephony/java/com/android/ims/internal/IImsConfig.aidl
+++ b/telephony/java/com/android/ims/internal/IImsConfig.aidl
@@ -73,9 +73,9 @@ interface IImsConfig {
*
* @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
* @param value in Integer format.
- * @return void.
+ * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants.
*/
- void setProvisionedValue(int item, int value);
+ int setProvisionedValue(int item, int value);
/**
* Sets the value for IMS service/capabilities parameters by the operator device
@@ -84,9 +84,9 @@ interface IImsConfig {
*
* @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
* @param value in String format.
- * @return void.
+ * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants.
*/
- void setProvisionedStringValue(int item, String value);
+ int setProvisionedStringValue(int item, String value);
/**
* Gets the value of the specified IMS feature item for specified network type.
diff --git a/telephony/java/com/android/ims/internal/IImsService.aidl b/telephony/java/com/android/ims/internal/IImsService.aidl
index 5138305..30c48d7 100644
--- a/telephony/java/com/android/ims/internal/IImsService.aidl
+++ b/telephony/java/com/android/ims/internal/IImsService.aidl
@@ -26,11 +26,13 @@ import com.android.ims.internal.IImsEcbm;
import com.android.ims.internal.IImsUt;
import com.android.ims.internal.IImsConfig;
+import android.os.Message;
+
/**
* {@hide}
*/
interface IImsService {
- int open(int serviceClass, in PendingIntent incomingCallIntent,
+ int open(int phoneId, int serviceClass, in PendingIntent incomingCallIntent,
in IImsRegistrationListener listener);
void close(int serviceId);
boolean isConnected(int serviceId, int serviceType, int callType);
@@ -51,23 +53,26 @@ interface IImsService {
/**
* Config interface to get/set IMS service/capability parameters.
*/
- IImsConfig getConfigInterface();
+ IImsConfig getConfigInterface(int phoneId);
/**
* Used for turning on IMS when its in OFF state.
*/
- void turnOnIms();
+ void turnOnIms(int phoneId);
/**
* Used for turning off IMS when its in ON state.
* When IMS is OFF, device will behave as CSFB'ed.
*/
- void turnOffIms();
-
+ void turnOffIms(int phoneId);
/**
* ECBM interface for Emergency Callback mode mechanism.
*/
IImsEcbm getEcbmInterface(int serviceId);
+ /**
+ * Used to set current TTY Mode.
+ */
+ void setUiTTYMode(int serviceId, int uiTtyMode, in Message onComplete);
}
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java
index 88e5bd6..5cd5d4e 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfo.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfo.java
@@ -301,7 +301,7 @@ public class CallerInfo {
public static CallerInfo getCallerInfo(Context context, String number) {
if (VDBG) Rlog.v(TAG, "getCallerInfo() based on number...");
- long subId = SubscriptionManager.getDefaultSubId();
+ int subId = SubscriptionManager.getDefaultSubId();
return getCallerInfo(context, number, subId);
}
@@ -316,7 +316,7 @@ public class CallerInfo {
* a matching number is not found, then a generic caller info is returned,
* with all relevant fields empty or null.
*/
- public static CallerInfo getCallerInfo(Context context, String number, long subId) {
+ public static CallerInfo getCallerInfo(Context context, String number, int subId) {
if (TextUtils.isEmpty(number)) {
return null;
@@ -418,12 +418,12 @@ public class CallerInfo {
// string in the phone number field.
/* package */ CallerInfo markAsVoiceMail() {
- long subId = SubscriptionManager.getDefaultSubId();
+ int subId = SubscriptionManager.getDefaultSubId();
return markAsVoiceMail(subId);
}
- /* package */ CallerInfo markAsVoiceMail(long subId) {
+ /* package */ CallerInfo markAsVoiceMail(int subId) {
mIsVoiceMail = true;
try {
diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
index 0d18389..aae7617 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
@@ -81,7 +81,7 @@ public class CallerInfoAsyncQuery {
public int event;
public String number;
- public long subId;
+ public int subId;
}
@@ -388,7 +388,7 @@ public class CallerInfoAsyncQuery {
public static CallerInfoAsyncQuery startQuery(int token, Context context, String number,
OnQueryCompleteListener listener, Object cookie) {
- long subId = SubscriptionManager.getDefaultSubId();
+ int subId = SubscriptionManager.getDefaultSubId();
return startQuery(token, context, number, listener, cookie, subId);
}
@@ -404,7 +404,7 @@ public class CallerInfoAsyncQuery {
* the phone type of the incoming connection.
*/
public static CallerInfoAsyncQuery startQuery(int token, Context context, String number,
- OnQueryCompleteListener listener, Object cookie, long subId) {
+ OnQueryCompleteListener listener, Object cookie, int subId) {
if (DBG) {
Rlog.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####");
diff --git a/telephony/java/com/android/internal/telephony/DcParamObject.java b/telephony/java/com/android/internal/telephony/DcParamObject.java
new file mode 100644
index 0000000..139939c
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/DcParamObject.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import android.os.Parcelable;
+import android.os.Parcel;
+
+public class DcParamObject implements Parcelable {
+
+ private int mSubId;
+
+ public DcParamObject(int subId) {
+ mSubId = subId;
+ }
+
+ public DcParamObject(Parcel in) {
+ readFromParcel(in);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(mSubId);
+ }
+
+ private void readFromParcel(Parcel in) {
+ mSubId = in.readInt();
+ }
+
+ public static final Parcelable.Creator<DcParamObject> CREATOR = new Parcelable.Creator<DcParamObject>() {
+ public DcParamObject createFromParcel(Parcel in) {
+ return new DcParamObject(in);
+ }
+ public DcParamObject[] newArray(int size) {
+ return new DcParamObject[size];
+ }
+ };
+
+ public int getSubId() {
+ return mSubId;
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index 7eef89a..a4e9486 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -99,6 +99,7 @@ public class DctConstants {
public static final int EVENT_PROVISIONING_APN_ALARM = BASE + 39;
public static final int CMD_NET_STAT_POLL = BASE + 40;
public static final int EVENT_DATA_RAT_CHANGED = BASE + 41;
+ public static final int CMD_CLEAR_PROVISIONING_SPINNER = BASE + 42;
/***** Constants *****/
@@ -115,6 +116,7 @@ public class DctConstants {
public static final int APN_EMERGENCY_ID = 9;
public static final int APN_NUM_TYPES = 10;
+ public static final int INVALID = -1;
public static final int DISABLED = 0;
public static final int ENABLED = 1;
diff --git a/telephony/java/com/android/internal/telephony/IMms.aidl b/telephony/java/com/android/internal/telephony/IMms.aidl
index ebfefd1..49ac400 100644
--- a/telephony/java/com/android/internal/telephony/IMms.aidl
+++ b/telephony/java/com/android/internal/telephony/IMms.aidl
@@ -39,7 +39,7 @@ interface IMms {
* @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed
*/
- void sendMessage(long subId, String callingPkg, in Uri contentUri,
+ void sendMessage(int subId, String callingPkg, in Uri contentUri,
String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent);
/**
@@ -56,50 +56,16 @@ interface IMms {
* @param downloadedIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is downloaded, or the download is failed
*/
- void downloadMessage(long subId, String callingPkg, String locationUrl,
+ void downloadMessage(int subId, String callingPkg, String locationUrl,
in Uri contentUri, in Bundle configOverrides,
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
*/
- Bundle getCarrierConfigValues(long subId);
+ Bundle getCarrierConfigValues(int subId);
/**
* Import a text message into system's SMS store
@@ -204,7 +170,7 @@ interface IMms {
* @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed
*/
- void sendStoredMessage(long subId, String callingPkg, in Uri messageUri,
+ void sendStoredMessage(int subId, String callingPkg, in Uri messageUri,
in Bundle configOverrides, in PendingIntent sentIntent);
/**
diff --git a/telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl b/telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl
new file mode 100644
index 0000000..493b1ff
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+oneway interface IOnSubscriptionsChangedListener {
+ void onSubscriptionsChanged();
+}
+
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index c203442..eec5333 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -27,16 +27,21 @@ interface IPhoneSubInfo {
*/
String getDeviceId();
+ /**
+ * Retrieves the unique Network Access ID
+ */
+ String getNaiForSubscriber(int subId);
+
/**
* Retrieves the unique device ID of a subId for the device, e.g., IMEI
* for GSM phones.
*/
- String getDeviceIdForSubscriber(long subId);
+ String getDeviceIdForSubscriber(int subId);
/**
* Retrieves the IMEI.
*/
- String getImeiForSubscriber(long subId);
+ String getImeiForSubscriber(int subId);
/**
* Retrieves the software version number for the device, e.g., IMEI/SV
@@ -45,6 +50,12 @@ interface IPhoneSubInfo {
String getDeviceSvn();
/**
+ * Retrieves the software version number of a subId for the device, e.g., IMEI/SV
+ * for GSM phones.
+ */
+ String getDeviceSvnUsingSubId(int subId);
+
+ /**
* Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
*/
String getSubscriberId();
@@ -52,7 +63,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the unique subscriber ID of a given subId, e.g., IMSI for GSM phones.
*/
- String getSubscriberIdForSubscriber(long subId);
+ String getSubscriberIdForSubscriber(int subId);
/**
* Retrieves the Group Identifier Level1 for GSM phones.
@@ -62,7 +73,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the Group Identifier Level1 for GSM phones of a subId.
*/
- String getGroupIdLevel1ForSubscriber(long subId);
+ String getGroupIdLevel1ForSubscriber(int subId);
/**
* Retrieves the serial number of the ICC, if applicable.
@@ -72,7 +83,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the serial number of a given subId.
*/
- String getIccSerialNumberForSubscriber(long subId);
+ String getIccSerialNumberForSubscriber(int subId);
/**
* Retrieves the phone number string for line 1.
@@ -82,7 +93,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the phone number string for line 1 of a subcription.
*/
- String getLine1NumberForSubscriber(long subId);
+ String getLine1NumberForSubscriber(int subId);
/**
@@ -93,7 +104,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the alpha identifier for line 1 of a subId.
*/
- String getLine1AlphaTagForSubscriber(long subId);
+ String getLine1AlphaTagForSubscriber(int subId);
/**
@@ -104,7 +115,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the Msisdn of a subId.
*/
- String getMsisdnForSubscriber(long subId);
+ String getMsisdnForSubscriber(int subId);
/**
* Retrieves the voice mail number.
@@ -114,7 +125,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the voice mail number of a given subId.
*/
- String getVoiceMailNumberForSubscriber(long subId);
+ String getVoiceMailNumberForSubscriber(int subId);
/**
* Retrieves the complete voice mail number.
@@ -124,7 +135,7 @@ interface IPhoneSubInfo {
/**
* Retrieves the complete voice mail number for particular subId
*/
- String getCompleteVoiceMailNumberForSubscriber(long subId);
+ String getCompleteVoiceMailNumberForSubscriber(int subId);
/**
* Retrieves the alpha identifier associated with the voice mail number.
@@ -135,7 +146,7 @@ interface IPhoneSubInfo {
* Retrieves the alpha identifier associated with the voice mail number
* of a subId.
*/
- String getVoiceMailAlphaTagForSubscriber(long subId);
+ String getVoiceMailAlphaTagForSubscriber(int subId);
/**
* Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
@@ -188,5 +199,5 @@ interface IPhoneSubInfo {
* @param data authentication challenge data
* @return challenge response
*/
- String getIccSimChallengeResponse(long subId, int appType, String data);
+ String getIccSimChallengeResponse(int subId, int appType, String data);
}
diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl
index 32bb8b4..6fdf121 100644
--- a/telephony/java/com/android/internal/telephony/ISms.aidl
+++ b/telephony/java/com/android/internal/telephony/ISms.aidl
@@ -47,7 +47,7 @@ interface ISms {
* @param subId the subId id.
* @return list of SmsRawData of all sms on ICC
*/
- List<SmsRawData> getAllMessagesFromIccEfForSubscriber(in long subId, String callingPkg);
+ List<SmsRawData> getAllMessagesFromIccEfForSubscriber(in int subId, String callingPkg);
/**
* Update the specified message on the ICC.
@@ -75,7 +75,7 @@ interface ISms {
* @return success or not
*
*/
- boolean updateMessageOnIccEfForSubscriber(in long subId, String callingPkg,
+ boolean updateMessageOnIccEfForSubscriber(in int subId, String callingPkg,
int messageIndex, int newStatus, in byte[] pdu);
/**
@@ -99,7 +99,7 @@ interface ISms {
* @return success or not
*
*/
- boolean copyMessageToIccEfForSubscriber(in long subId, String callingPkg, int status,
+ boolean copyMessageToIccEfForSubscriber(in int subId, String callingPkg, int status,
in byte[] pdu, in byte[] smsc);
/**
@@ -152,7 +152,7 @@ interface ISms {
* raw pdu of the status report is in the extended data ("pdu").
* @param subId the subId id.
*/
- void sendDataForSubscriber(long subId, String callingPkg, in String destAddr,
+ void sendDataForSubscriber(int subId, String callingPkg, in String destAddr,
in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent,
in PendingIntent deliveryIntent);
@@ -206,7 +206,7 @@ interface ISms {
* raw pdu of the status report is in the extended data ("pdu").
* @param subId the subId on which the SMS has to be sent.
*/
- void sendTextForSubscriber(in long subId, String callingPkg, in String destAddr,
+ void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr,
in String scAddr, in String text, in PendingIntent sentIntent,
in PendingIntent deliveryIntent);
@@ -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
@@ -283,88 +272,109 @@ interface ISms {
* extended data ("pdu").
* @param subId the subId on which the SMS has to be sent.
*/
- void sendMultipartTextForSubscriber(in long subId, String callingPkg,
+ void sendMultipartTextForSubscriber(in int subId, String callingPkg,
in String destinationAddress, in String scAddress,
in List<String> parts, in List<PendingIntent> sentIntents,
in List<PendingIntent> deliveryIntents);
/**
* Enable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier. Note that if two different clients enable the same
- * message identifier, they must both disable it for the device to stop
- * receiving those messages.
+ * message identifier and RAN type. The RAN type specify this message ID
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
+ * enable the same message identifier, they must both disable it for the
+ * device to stop receiving those messages.
*
* @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #disableCellBroadcast(int)
+ * @see #disableCellBroadcast(int, int)
*/
- boolean enableCellBroadcast(int messageIdentifier);
+ boolean enableCellBroadcast(int messageIdentifier, int ranType);
/**
* Enable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier. Note that if two different clients enable the same
- * message identifier, they must both disable it for the device to stop
- * receiving those messages.
+ * message identifier and RAN type. The RAN type specify this message ID
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
+ * enable the same message identifier, they must both disable it for the
+ * device to stop receiving those messages.
*
* @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
* @param subId for which the broadcast has to be enabled
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #disableCellBroadcast(int)
+ * @see #disableCellBroadcast(int, int)
*/
- boolean enableCellBroadcastForSubscriber(in long subId, int messageIdentifier);
+ boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType);
/**
* Disable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier. Note that if two different clients enable the same
- * message identifier, they must both disable it for the device to stop
- * receiving those messages.
+ * message identifier and RAN type. The RAN type specify this message ID
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
+ * enable the same message identifier, they must both disable it for the
+ * device to stop receiving those messages.
*
* @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #enableCellBroadcast(int)
+ * @see #enableCellBroadcast(int, int)
*/
- boolean disableCellBroadcast(int messageIdentifier);
+ boolean disableCellBroadcast(int messageIdentifier, int ranType);
/**
* Disable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier. Note that if two different clients enable the same
- * message identifier, they must both disable it for the device to stop
- * receiving those messages.
+ * message identifier and RAN type. The RAN type specify this message ID
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
+ * enable the same message identifier, they must both disable it for the
+ * device to stop receiving those messages.
*
* @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
* @param subId for which the broadcast has to be disabled
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #enableCellBroadcast(int)
+ * @see #enableCellBroadcast(int, int)
*/
- boolean disableCellBroadcastForSubscriber(in long subId, int messageIdentifier);
+ boolean disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType);
/*
* Enable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier range. Note that if two different clients enable
- * a message identifier range, they must both disable it for the device
- * to stop receiving those messages.
+ * message identifier range and RAN type. The RAN type specify this message
+ * ID range belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different
+ * clients enable a message identifier range, they must both disable it for
+ * the device to stop receiving those messages.
*
* @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
* @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #disableCellBroadcastRange(int, int)
+ * @see #disableCellBroadcastRange(int, int, int)
*/
- boolean enableCellBroadcastRange(int startMessageId, int endMessageId);
+ boolean enableCellBroadcastRange(int startMessageId, int endMessageId, int ranType);
/*
* Enable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier range. Note that if two different clients enable
+ * message identifier range and RAN type. The RAN type specify this message ID range
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
* a message identifier range, they must both disable it for the device
* to stop receiving those messages.
*
@@ -373,15 +383,20 @@ interface ISms {
* @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
* @param subId for which the broadcast has to be enabled
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #disableCellBroadcastRange(int, int)
+ * @see #disableCellBroadcastRange(int, int, int)
*/
- boolean enableCellBroadcastRangeForSubscriber(long subId, int startMessageId, int endMessageId);
+ boolean enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId,
+ int ranType);
/**
* Disable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier range. Note that if two different clients enable
+ * message identifier range and RAN type. The RAN type specify this message ID range
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
* a message identifier range, they must both disable it for the device
* to stop receiving those messages.
*
@@ -389,15 +404,19 @@ interface ISms {
* C.R1001-G (3GPP2)
* @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #enableCellBroadcastRange(int, int)
+ * @see #enableCellBroadcastRange(int, int, int)
*/
- boolean disableCellBroadcastRange(int startMessageId, int endMessageId);
+ boolean disableCellBroadcastRange(int startMessageId, int endMessageId, int ranType);
/**
* Disable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier range. Note that if two different clients enable
+ * message identifier range and RAN type. The RAN type specify this message ID range
+ * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
* a message identifier range, they must both disable it for the device
* to stop receiving those messages.
*
@@ -406,12 +425,15 @@ interface ISms {
* @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
* C.R1001-G (3GPP2)
* @param subId for which the broadcast has to be disabled
+ * @param ranType as defined in class SmsManager, the value can be one of these:
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
+ * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
* @return true if successful, false otherwise
*
- * @see #enableCellBroadcastRange(int, int, int)
+ * @see #enableCellBroadcastRange(int, int, int, int)
*/
- boolean disableCellBroadcastRangeForSubscriber(long subId, int startMessageId,
- int endMessageId);
+ boolean disableCellBroadcastRangeForSubscriber(int subId, int startMessageId,
+ int endMessageId, int ranType);
/**
* Returns the premium SMS send permission for the specified package.
@@ -423,7 +445,7 @@ interface ISms {
* Returns the premium SMS send permission for the specified package.
* Requires system permission.
*/
- int getPremiumSmsPermissionForSubscriber(long subId, String packageName);
+ int getPremiumSmsPermissionForSubscriber(int subId, String packageName);
/**
* Set the SMS send permission for the specified package.
@@ -439,7 +461,7 @@ interface ISms {
* Set the SMS send permission for the specified package.
* Requires system permission.
*/
- void setPremiumSmsPermissionForSubscriber(long subId, String packageName, int permission);
+ void setPremiumSmsPermissionForSubscriber(int subId, String packageName, int permission);
/**
* SMS over IMS is supported if IMS is registered and SMS is supported
@@ -459,13 +481,13 @@ interface ISms {
*
* @see #getImsSmsFormat()
*/
- boolean isImsSmsSupportedForSubscriber(long subId);
+ boolean isImsSmsSupportedForSubscriber(int subId);
/*
* get user prefered SMS subId
* @return subId id
*/
- long getPreferredSmsSubscription();
+ int getPreferredSmsSubscription();
/**
* Gets SMS format supported on IMS. SMS over IMS format is
@@ -489,7 +511,7 @@ interface ISms {
*
* @see #isImsSmsSupported()
*/
- String getImsSmsFormatForSubscriber(long subId);
+ String getImsSmsFormatForSubscriber(int subId);
/*
* Get SMS prompt property, enabled or not
@@ -524,7 +546,7 @@ interface ISms {
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
*/
- void sendStoredText(long subId, String callingPkg, in Uri messageUri, String scAddress,
+ void sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress,
in PendingIntent sentIntent, in PendingIntent deliveryIntent);
/**
@@ -560,7 +582,7 @@ interface ISms {
* to the recipient. The raw pdu of the status report is in the
* extended data ("pdu").
*/
- void sendStoredMultipartText(long subId, String callingPkg, in Uri messageUri,
+ void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri,
String scAddress, in List<PendingIntent> sentIntents,
in List<PendingIntent> deliveryIntents);
}
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index b87365e..acbc0aa 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -17,56 +17,77 @@
package com.android.internal.telephony;
import android.app.PendingIntent;
-import android.telephony.SubInfoRecord;
+import android.telephony.SubscriptionInfo;
+import com.android.internal.telephony.ISubscriptionListener;
interface ISub {
/**
- * Get the SubInfoRecord according to an index
- * @param subId The unique SubInfoRecord index in database
- * @return SubInfoRecord, maybe null
+ * @return a list of all subscriptions in the database, this includes
+ * all subscriptions that have been seen.
*/
- SubInfoRecord getSubInfoForSubscriber(long subId);
+ List<SubscriptionInfo> getAllSubInfoList();
/**
- * Get the SubInfoRecord according to an IccId
- * @param iccId the IccId of SIM card
- * @return SubInfoRecord, maybe null
+ * @return the count of all subscriptions in the database, this includes
+ * all subscriptions that have been seen.
*/
- List<SubInfoRecord> getSubInfoUsingIccId(String iccId);
+ int getAllSubInfoCount();
/**
- * Get the SubInfoRecord according to slotId
- * @param slotId the slot which the SIM is inserted
- * @return SubInfoRecord, maybe null
+ * Get the active SubscriptionInfo with the subId key
+ * @param subId The unique SubscriptionInfo key in database
+ * @return SubscriptionInfo, maybe null if its not active
*/
- List<SubInfoRecord> getSubInfoUsingSlotId(int slotId);
+ SubscriptionInfo getActiveSubscriptionInfo(int subId);
/**
- * Get all the SubInfoRecord(s) in subinfo database
- * @return Array list of all SubInfoRecords in database, include thsoe that were inserted before
+ * Get the active SubscriptionInfo associated with the iccId
+ * @param iccId the IccId of SIM card
+ * @return SubscriptionInfo, maybe null if its not active
*/
- List<SubInfoRecord> getAllSubInfoList();
+ SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId);
/**
- * Get the SubInfoRecord(s) of the currently inserted SIM(s)
- * @return Array list of currently inserted SubInfoRecord(s)
+ * Get the active SubscriptionInfo associated with the slotIdx
+ * @param slotIdx the slot which the subscription is inserted
+ * @return SubscriptionInfo, maybe null if its not active
*/
- List<SubInfoRecord> getActiveSubInfoList();
+ SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx);
/**
- * Get the SUB count of all SUB(s) in subinfo database
- * @return all SIM count in database, include what was inserted before
+ * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted
+ * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}.
+ *
+ * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device.
+ * <ul>
+ * <li>
+ * If null is returned the current state is unknown but if a {@link OnSubscriptionsChangedListener}
+ * has been registered {@link OnSubscriptionsChangedListener#onSubscriptionsChanged} will be
+ * invoked in the future.
+ * </li>
+ * <li>
+ * If the list is empty then there are no {@link SubscriptionInfo} records currently available.
+ * </li>
+ * <li>
+ * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex}
+ * then by {@link SubscriptionInfo#getSubscriptionId}.
+ * </li>
+ * </ul>
*/
- int getAllSubInfoCount();
+ List<SubscriptionInfo> getActiveSubscriptionInfoList();
/**
- * Get the count of active SUB(s)
- * @return active SIM count
+ * @return the number of active subscriptions
*/
int getActiveSubInfoCount();
/**
- * Add a new SubInfoRecord to subinfo database if needed
+ * @return the maximum number of subscriptions this device will support at any one time.
+ */
+ int getActiveSubInfoCountMax();
+
+ /**
+ * Add a new SubscriptionInfo to subinfo database if needed
* @param iccId the IccId of the SIM card
* @param slotId the slot which the SIM is inserted
* @return the URL of the newly created row or the updated row
@@ -74,81 +95,80 @@ interface ISub {
int addSubInfoRecord(String iccId, int slotId);
/**
- * Set SIM color by simInfo index
- * @param color the color of the SIM
- * @param subId the unique SubInfoRecord index in database
+ * Set SIM icon tint color by simInfo index
+ * @param tint the icon tint color of the SIM
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
*/
- int setColor(int color, long subId);
+ int setIconTint(int tint, int subId);
/**
* Set display name by simInfo index
* @param displayName the display name of SIM card
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
*/
- int setDisplayName(String displayName, long subId);
+ int setDisplayName(String displayName, int subId);
/**
* Set display name by simInfo index with name source
* @param displayName the display name of SIM card
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
* @return the number of records updated
*/
- int setDisplayNameUsingSrc(String displayName, long subId, long nameSource);
+ int setDisplayNameUsingSrc(String displayName, int subId, long nameSource);
/**
* Set phone number by subId
* @param number the phone number of the SIM
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
*/
- int setDisplayNumber(String number, long subId);
-
- /**
- * Set number display format. 0: none, 1: the first four digits, 2: the last four digits
- * @param format the display format of phone number
- * @param subId the unique SubInfoRecord index in database
- * @return the number of records updated
- */
- int setDisplayNumberFormat(int format, long subId);
+ int setDisplayNumber(String number, int subId);
/**
* Set data roaming by simInfo index
* @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
- * @param subId the unique SubInfoRecord index in database
+ * @param subId the unique SubscriptionInfo index in database
* @return the number of records updated
*/
- int setDataRoaming(int roaming, long subId);
+ int setDataRoaming(int roaming, int subId);
- int getSlotId(long subId);
+ int getSlotId(int subId);
- long[] getSubId(int slotId);
+ int[] getSubId(int slotId);
- long getDefaultSubId();
+ int getDefaultSubId();
int clearSubInfo();
- int getPhoneId(long subId);
+ int getPhoneId(int subId);
/**
* Get the default data subscription
* @return Id of the data subscription
*/
- long getDefaultDataSubId();
+ int getDefaultDataSubId();
- void setDefaultDataSubId(long subId);
+ void setDefaultDataSubId(int subId);
- long getDefaultVoiceSubId();
+ int getDefaultVoiceSubId();
- void setDefaultVoiceSubId(long subId);
+ void setDefaultVoiceSubId(int subId);
- long getDefaultSmsSubId();
+ int getDefaultSmsSubId();
- void setDefaultSmsSubId(long subId);
+ void setDefaultSmsSubId(int subId);
void clearDefaultsForInactiveSubIds();
- long[] getActiveSubIdList();
+ 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/ISubscriptionListener.aidl b/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl
new file mode 100644
index 0000000..4ccdea5
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import android.telephony.SubscriptionInfo;
+
+oneway interface ISubscriptionListener {
+ void onSubscriptionInfoChanged();
+}
+
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 0868f41..d19fa2c 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -21,13 +21,14 @@ import android.os.Bundle;
import android.telephony.CellInfo;
import android.telephony.IccOpenLogicalChannelResponse;
import android.telephony.NeighboringCellInfo;
+import android.telephony.RadioAccessFamily;
import java.util.List;
/**
* Interface used to interact with the phone. Mostly this is used by the
* TelephonyManager class. A few places are still using this directly.
- * Please clean them up if possible and use TelephonyManager insteadl.
+ * Please clean them up if possible and use TelephonyManager instead.
*
* {@hide}
*/
@@ -59,7 +60,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return whether it hung up
*/
- boolean endCallForSubscriber(long subId);
+ boolean endCallForSubscriber(int subId);
/**
* Answer the currently-ringing call.
@@ -79,6 +80,23 @@ interface ITelephony {
void answerRingingCall();
/**
+ * Answer the currently-ringing call on particular subId .
+ *
+ * If there's already a current active call, that call will be
+ * automatically put on hold. If both lines are currently in use, the
+ * current active call will be ended.
+ *
+ * TODO: provide a flag to let the caller specify what policy to use
+ * if both lines are in use. (The current behavior is hardwired to
+ * "answer incoming, end ongoing", which is how the CALL button
+ * is specced to behave.)
+ *
+ * TODO: this should be a oneway call (especially since it's called
+ * directly from the key queue thread).
+ */
+ void answerRingingCallForSubscriber(int subId);
+
+ /**
* Silence the ringer if an incoming call is currently ringing.
* (If vibrating, stop the vibrator also.)
*
@@ -103,7 +121,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return true if the phone state is OFFHOOK.
*/
- boolean isOffhookForSubscriber(long subId);
+ boolean isOffhookForSubscriber(int subId);
/**
* Check if an incoming phone call is ringing or call waiting
@@ -112,7 +130,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return true if the phone state is RINGING.
*/
- boolean isRingingForSubscriber(long subId);
+ boolean isRingingForSubscriber(int subId);
/**
* Check if an incoming phone call is ringing or call waiting.
@@ -132,7 +150,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return true if the phone state is IDLE.
*/
- boolean isIdleForSubscriber(long subId);
+ boolean isIdleForSubscriber(int subId);
/**
* Check to see if the radio is on or not.
@@ -145,7 +163,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return returns true if the radio is on.
*/
- boolean isRadioOnForSubscriber(long subId);
+ boolean isRadioOnForSubscriber(int subId);
/**
* Check if the SIM pin lock is enabled.
@@ -167,7 +185,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return whether the operation was a success.
*/
- boolean supplyPinForSubscriber(long subId, String pin);
+ boolean supplyPinForSubscriber(int subId, String pin);
/**
* Supply puk to unlock the SIM and set SIM pin to new pin.
@@ -186,7 +204,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return whether the operation was a success.
*/
- boolean supplyPukForSubscriber(long subId, String puk, String pin);
+ boolean supplyPukForSubscriber(int subId, String puk, String pin);
/**
* Supply a pin to unlock the SIM. Blocks until a result is determined.
@@ -204,7 +222,7 @@ interface ITelephony {
* @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
* retValue[1] = number of attempts remaining if known otherwise -1
*/
- int[] supplyPinReportResultForSubscriber(long subId, String pin);
+ int[] supplyPinReportResultForSubscriber(int subId, String pin);
/**
* Supply puk to unlock the SIM and set SIM pin to new pin.
@@ -226,7 +244,7 @@ interface ITelephony {
* @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
* retValue[1] = number of attempts remaining if known otherwise -1
*/
- int[] supplyPukReportResultForSubscriber(long subId, String puk, String pin);
+ int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin);
/**
* Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
@@ -245,7 +263,7 @@ interface ITelephony {
* @param subId user preferred subId.
* @return true if MMI command is executed.
*/
- boolean handlePinMmiForSubscriber(long subId, String dialString);
+ boolean handlePinMmiForSubscriber(int subId, String dialString);
/**
* Toggles the radio on or off.
@@ -256,7 +274,7 @@ interface ITelephony {
* Toggles the radio on or off on particular subId.
* @param subId user preferred subId.
*/
- void toggleRadioOnOffForSubscriber(long subId);
+ void toggleRadioOnOffForSubscriber(int subId);
/**
* Set the radio to on or off
@@ -267,7 +285,7 @@ interface ITelephony {
* Set the radio to on or off on particular subId.
* @param subId user preferred subId.
*/
- boolean setRadioForSubscriber(long subId, boolean turnOn);
+ boolean setRadioForSubscriber(int subId, boolean turnOn);
/**
* Set the radio to on or off unconditionally
@@ -283,7 +301,7 @@ interface ITelephony {
* Request to update location information for a subscrition in service state
* @param subId user preferred subId.
*/
- void updateServiceLocationForSubscriber(long subId);
+ void updateServiceLocationForSubscriber(int subId);
/**
* Enable location update notifications.
@@ -294,7 +312,7 @@ interface ITelephony {
* Enable location update notifications.
* @param subId user preferred subId.
*/
- void enableLocationUpdatesForSubscriber(long subId);
+ void enableLocationUpdatesForSubscriber(int subId);
/**
* Disable location update notifications.
@@ -305,7 +323,7 @@ interface ITelephony {
* Disable location update notifications.
* @param subId user preferred subId.
*/
- void disableLocationUpdatesForSubscriber(long subId);
+ void disableLocationUpdatesForSubscriber(int subId);
/**
* Allow mobile data connections.
@@ -334,7 +352,7 @@ interface ITelephony {
/**
* Returns the call state for a subId.
*/
- int getCallStateForSubscriber(long subId);
+ int getCallStateForSubscriber(int subId);
int getDataActivity();
int getDataState();
@@ -352,7 +370,7 @@ interface ITelephony {
* and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
* @param subId user preferred subId.
*/
- int getActivePhoneTypeForSubscriber(long subId);
+ int getActivePhoneTypeForSubscriber(int subId);
/**
* Returns the CDMA ERI icon index to display
@@ -363,7 +381,7 @@ interface ITelephony {
* Returns the CDMA ERI icon index to display on particular subId.
* @param subId user preferred subId.
*/
- int getCdmaEriIconIndexForSubscriber(long subId);
+ int getCdmaEriIconIndexForSubscriber(int subId);
/**
* Returns the CDMA ERI icon mode,
@@ -378,7 +396,7 @@ interface ITelephony {
* 1 - FLASHING
* @param subId user preferred subId.
*/
- int getCdmaEriIconModeForSubscriber(long subId);
+ int getCdmaEriIconModeForSubscriber(int subId);
/**
* Returns the CDMA ERI text,
@@ -389,7 +407,7 @@ interface ITelephony {
* Returns the CDMA ERI text for particular subId,
* @param subId user preferred subId.
*/
- String getCdmaEriTextForSubscriber(long subId);
+ String getCdmaEriTextForSubscriber(int subId);
/**
* Returns true if OTA service provisioning needs to run.
@@ -399,6 +417,11 @@ interface ITelephony {
boolean needsOtaServiceProvisioning();
/**
+ * Sets the voicemail number for a particular subscriber.
+ */
+ boolean setVoiceMailNumber(int subId, String alphaTag, String number);
+
+ /**
* Returns the unread count of voicemails
*/
int getVoiceMessageCount();
@@ -408,7 +431,7 @@ interface ITelephony {
* @param subId user preferred subId.
* Returns the unread count of voicemails
*/
- int getVoiceMessageCountForSubscriber(long subId);
+ int getVoiceMessageCountForSubscriber(int subId);
/**
* Returns the network type for data transmission
@@ -420,7 +443,7 @@ interface ITelephony {
* @param subId user preferred subId.
* Returns the network type
*/
- int getNetworkTypeForSubscriber(long subId);
+ int getNetworkTypeForSubscriber(int subId);
/**
* Returns the network type for data transmission
@@ -432,7 +455,7 @@ interface ITelephony {
* @param subId user preferred subId.
* Returns the network type
*/
- int getDataNetworkTypeForSubscriber(long subId);
+ int getDataNetworkTypeForSubscriber(int subId);
/**
* Returns the network type for voice
@@ -444,7 +467,7 @@ interface ITelephony {
* @param subId user preferred subId.
* Returns the network type
*/
- int getVoiceNetworkTypeForSubscriber(long subId);
+ int getVoiceNetworkTypeForSubscriber(int subId);
/**
* Return true if an ICC card is present
@@ -456,7 +479,7 @@ interface ITelephony {
* @param slotId user preferred slotId.
* Return true if an ICC card is present
*/
- boolean hasIccCardUsingSlotId(long slotId);
+ boolean hasIccCardUsingSlotId(int slotId);
/**
* Return if the current radio is LTE on CDMA. This
@@ -476,7 +499,7 @@ interface ITelephony {
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link PHone#LTE_ON_CDMA_TRUE}
*/
- int getLteOnCdmaModeForSubscriber(long subId);
+ int getLteOnCdmaModeForSubscriber(int subId);
/**
* Returns the all observed cell information of the device.
@@ -634,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.
*
@@ -671,13 +703,13 @@ interface ITelephony {
* Return MDN string for CDMA phone.
* @param subId user preferred subId.
*/
- String getCdmaMdn(long subId);
+ String getCdmaMdn(int subId);
/**
* Return MIN string for CDMA phone.
* @param subId user preferred subId.
*/
- String getCdmaMin(long subId);
+ String getCdmaMin(int subId);
/**
* Has the calling application been granted special privileges by the carrier.
@@ -690,7 +722,7 @@ interface ITelephony {
*
* @return carrier privilege status defined in TelephonyManager.
*/
- int hasCarrierPrivileges();
+ int getCarrierPrivilegeStatus();
/**
* Similar to above, but check for pkg whose name is pkgname.
@@ -709,24 +741,6 @@ interface ITelephony {
List<String> getCarrierPackageNamesForIntent(in Intent intent);
/**
- * Set whether Android should display a simplified Mobile Network Settings UI
- * for the current ICCID.
- *
- * @param subId for which the simplified UI should be enabled or disabled.
- * @param enable true means enabling the simplified UI.
- */
- void enableSimplifiedNetworkSettingsForSubscriber(long subId, boolean enable);
-
- /**
- * Get whether a simplified Mobile Network Settings UI is enabled for the
- * current ICCID.
- *
- * @param subId for which the simplified UI should be enabled or disabled.
- * @return true if the simplified UI is enabled.
- */
- boolean getSimplifiedNetworkSettingsEnabledForSubscriber(long subId);
-
- /**
* Set the line 1 phone number string and its alphatag for the current ICCID
* for display purpose only, for example, displayed in Phone Status. It won't
* change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
@@ -735,8 +749,9 @@ interface ITelephony {
* @param subId the subscriber that the alphatag and dialing number belongs to.
* @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number
+ * @return true if the operation was executed correctly.
*/
- void setLine1NumberForDisplayForSubscriber(long subId, String alphaTag, String number);
+ boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number);
/**
* Returns the displayed dialing number string if it was set previously via
@@ -745,7 +760,7 @@ interface ITelephony {
* @param subId whose dialing number for line 1 is returned.
* @return the displayed dialing number if set, or null if not set.
*/
- String getLine1NumberForDisplay(long subId);
+ String getLine1NumberForDisplay(int subId);
/**
* Returns the displayed alphatag of the dialing number if it was set
@@ -755,7 +770,9 @@ interface ITelephony {
* @return the displayed alphatag of the dialing number if set, or null if
* not set.
*/
- String getLine1AlphaTagForDisplay(long subId);
+ String getLine1AlphaTagForDisplay(int subId);
+
+ String[] getMergedSubscriberIds();
/**
* Override the operator branding for the current ICCID.
@@ -796,4 +813,35 @@ interface ITelephony {
* Shutdown Mobile Radios
*/
void shutdownMobileRadios();
+
+ /**
+ * Set phone radio type and access technology.
+ *
+ * @param rafs an RadioAccessFamily array to indicate all phone's
+ * new radio access family. The length of RadioAccessFamily
+ * must equ]]al to phone count.
+ */
+ void setRadioCapability(in RadioAccessFamily[] rafs);
+
+ /**
+ * Get phone radio type and access technology.
+ *
+ * @param phoneId which phone you want to get
+ * @return phone radio type and access technology
+ */
+ int getRadioAccessFamily(in int phoneId);
+
+ /**
+ * Enables or disables video calling.
+ *
+ * @param enable Whether to enable video calling.
+ */
+ void enableVideoCalling(boolean enable);
+
+ /**
+ * Whether video calling has been enabled by the user.
+ *
+ * @return {@code True} if the user has enabled video calling, {@code false} otherwise.
+ */
+ boolean isVideoCallingEnabled();
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index 39defcf..ba62f5f 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -27,31 +27,36 @@ import android.telephony.SignalStrength;
import android.telephony.CellInfo;
import android.telephony.VoLteServiceState;
import com.android.internal.telephony.IPhoneStateListener;
+import com.android.internal.telephony.IOnSubscriptionsChangedListener;
interface ITelephonyRegistry {
+ void registerOnSubscriptionsChangedListener(String pkg,
+ IOnSubscriptionsChangedListener callback);
+ void unregisterOnSubscriptionsChangedListener(String pkg,
+ IOnSubscriptionsChangedListener callback);
void listen(String pkg, IPhoneStateListener callback, int events, boolean notifyNow);
- void listenForSubscriber(in long subId, String pkg, IPhoneStateListener callback, int events,
+ void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events,
boolean notifyNow);
void notifyCallState(int state, String incomingNumber);
- void notifyCallStateForSubscriber(in long subId, int state, String incomingNumber);
- void notifyServiceStateForPhoneId(in int phoneId, in long subId, in ServiceState state);
+ void notifyCallStateForSubscriber(in int subId, int state, String incomingNumber);
+ void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state);
void notifySignalStrength(in SignalStrength signalStrength);
- void notifySignalStrengthForSubscriber(in long subId, in SignalStrength signalStrength);
- void notifyMessageWaitingChangedForPhoneId(in int phoneId, in long subId, in boolean mwi);
+ void notifySignalStrengthForSubscriber(in int subId, in SignalStrength signalStrength);
+ void notifyMessageWaitingChangedForPhoneId(in int phoneId, in int subId, in boolean mwi);
void notifyCallForwardingChanged(boolean cfi);
- void notifyCallForwardingChangedForSubscriber(in long subId, boolean cfi);
+ void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi);
void notifyDataActivity(int state);
- void notifyDataActivityForSubscriber(in long subId, int state);
+ void notifyDataActivityForSubscriber(in int subId, int state);
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
String reason, String apn, String apnType, in LinkProperties linkProperties,
in NetworkCapabilities networkCapabilities, int networkType, boolean roaming);
- void notifyDataConnectionForSubscriber(long subId, int state, boolean isDataConnectivityPossible,
+ void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataConnectivityPossible,
String reason, String apn, String apnType, in LinkProperties linkProperties,
in NetworkCapabilities networkCapabilities, int networkType, boolean roaming);
void notifyDataConnectionFailed(String reason, String apnType);
- void notifyDataConnectionFailedForSubscriber(long subId, String reason, String apnType);
+ void notifyDataConnectionFailedForSubscriber(int subId, String reason, String apnType);
void notifyCellLocation(in Bundle cellLocation);
- void notifyCellLocationForSubscriber(in long subId, in Bundle cellLocation);
+ void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
void notifyOtaspChanged(in int otaspMode);
void notifyCellInfo(in List<CellInfo> cellInfo);
void notifyPreciseCallState(int ringingCallState, int foregroundCallState,
@@ -59,8 +64,9 @@ interface ITelephonyRegistry {
void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause);
void notifyPreciseDataConnectionFailed(String reason, String apnType, String apn,
String failCause);
- void notifyCellInfoForSubscriber(in long subId, in List<CellInfo> cellInfo);
+ void notifyCellInfoForSubscriber(in int subId, in List<CellInfo> cellInfo);
void notifyDataConnectionRealTimeInfo(in DataConnectionRealTimeInfo dcRtInfo);
void notifyVoLteServiceStateChanged(in VoLteServiceState lteState);
- void notifyOemHookRawEventForSubscriber(in long subId, in byte[] rawData);
+ void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData);
+ void notifySubscriptionInfoChanged();
}
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();
+ }
+ }
}
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 62b5596..b8e8064 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -160,9 +160,6 @@ public class PhoneConstants {
public static final int SUB2 = 1;
public static final int SUB3 = 2;
- public static final int EVENT_SUBSCRIPTION_ACTIVATED = 500;
- public static final int EVENT_SUBSCRIPTION_DEACTIVATED = 501;
-
// TODO: Remove these constants and use an int instead.
public static final int SIM_ID_1 = 0;
public static final int SIM_ID_2 = 1;
@@ -186,4 +183,7 @@ public class PhoneConstants {
// Initial MTU value.
public static final int UNSET_MTU = 0;
+
+ //FIXME maybe this shouldn't be here - sprout only
+ public static final int CAPABILITY_3G = 1;
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index e730bde..082e8bb 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -24,6 +24,8 @@ package com.android.internal.telephony;
* Also they should all probably be static final.
*/
+import android.os.SystemProperties;
+
/**
* {@hide}
*/
@@ -57,7 +59,17 @@ public interface RILConstants {
retries needed */
int MISSING_RESOURCE = 16; /* no logical channel available */
int NO_SUCH_ELEMENT = 17; /* application not found on SIM */
+ int DIAL_MODIFIED_TO_USSD = 18; /* DIAL request modified to USSD */
+ int DIAL_MODIFIED_TO_SS = 19; /* DIAL request modified to SS */
+ int DIAL_MODIFIED_TO_DIAL = 20; /* DIAL request modified to DIAL with different data*/
+ int USSD_MODIFIED_TO_DIAL = 21; /* USSD request modified to DIAL */
+ int USSD_MODIFIED_TO_SS = 22; /* USSD request modified to SS */
+ int USSD_MODIFIED_TO_USSD = 23; /* USSD request modified to different USSD request */
+ int SS_MODIFIED_TO_DIAL = 24; /* SS request modified to DIAL */
+ int SS_MODIFIED_TO_USSD = 25; /* SS request modified to USSD */
int SUBSCRIPTION_NOT_SUPPORTED = 26; /* Subscription not supported */
+ int SS_MODIFIED_TO_SS = 27; /* SS request modified to different SS request */
+
/* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */
int NETWORK_MODE_WCDMA_PREF = 0; /* GSM/WCDMA (WCDMA preferred) */
@@ -76,7 +88,8 @@ public interface RILConstants {
int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10; /* LTE, CDMA, EvDo, GSM/WCDMA */
int NETWORK_MODE_LTE_ONLY = 11; /* LTE Only mode. */
int NETWORK_MODE_LTE_WCDMA = 12; /* LTE/WCDMA */
- int PREFERRED_NETWORK_MODE = NETWORK_MODE_WCDMA_PREF;
+ int PREFERRED_NETWORK_MODE = SystemProperties.getInt("ro.telephony.default_network",
+ NETWORK_MODE_WCDMA_PREF);
int CDMA_CELL_BROADCAST_SMS_DISABLED = 1;
int CDMA_CELL_BROADCAST_SMS_ENABLED = 0;
@@ -161,6 +174,7 @@ cat include/telephony/ril.h | \
public static final int DATA_PROFILE_FOTA = 3;
public static final int DATA_PROFILE_CBS = 4;
public static final int DATA_PROFILE_OEM_BASE = 1000;
+ public static final int DATA_PROFILE_INVALID = 0xFFFFFFFF;
int RIL_REQUEST_GET_SIM_STATUS = 1;
int RIL_REQUEST_ENTER_SIM_PIN = 2;
@@ -291,6 +305,8 @@ cat include/telephony/ril.h | \
int RIL_REQUEST_SET_DC_RT_INFO_RATE = 127;
int RIL_REQUEST_SET_DATA_PROFILE = 128;
int RIL_REQUEST_SHUTDOWN = 129;
+ int RIL_REQUEST_GET_RADIO_CAPABILITY = 130;
+ int RIL_REQUEST_SET_RADIO_CAPABILITY = 131;
int RIL_UNSOL_RESPONSE_BASE = 1000;
int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
@@ -334,4 +350,8 @@ cat include/telephony/ril.h | \
int RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED = 1038;
int RIL_UNSOL_SRVCC_STATE_NOTIFY = 1039;
int RIL_UNSOL_HARDWARE_CONFIG_CHANGED = 1040;
+ int RIL_UNSOL_DC_RT_INFO_CHANGED = 1041;
+ int RIL_UNSOL_RADIO_CAPABILITY = 1042;
+ int RIL_UNSOL_ON_SS = 1043;
+ int RIL_UNSOL_STK_CC_ALPHA_NOTIFY = 1044;
}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index e7aca90..c67e5d7 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -312,27 +312,7 @@ public class TelephonyIntents {
public static final String EXTRA_SPN = "spn";
/**
- * <p>Broadcast Action: It indicates one column of a siminfo record has been changed
- * The intent will have the following extra values:</p>
- * <ul>
- * <li><em>columnName</em> - The siminfo column that is updated.</li>
- * <li><em>stringContent</em> - The string value of the updated column.</li>
- * <li><em>intContent</em> - The int value of the updated column.</li>
- * </ul>
- * <p class="note">This is a protected intent that can only be sent
- * by the system.
- */
- public static final String ACTION_SIMINFO_CONTENT_CHANGE
- = "android.intent.action.ACTION_SIMINFO_CONTENT_CHANGE";
-
- /**
* <p>Broadcast Action: It indicates one column of a subinfo record has been changed
- * The intent will have the following extra values:</p>
- * <ul>
- * <li><em>columnName</em> - The siminfo column that is updated.</li>
- * <li><em>stringContent</em> - The string value of the updated column.</li>
- * <li><em>intContent</em> - The int value of the updated column.</li>
- * </ul>
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
@@ -340,28 +320,14 @@ public class TelephonyIntents {
= "android.intent.action.ACTION_SUBINFO_CONTENT_CHANGE";
/**
- * <p>Broadcast Action: It indicates siminfo update is completed when SIM inserted state change
- * The intent will have the following extra values:</p>
- * <p class="note">This is a protected intent that can only be sent
- * by the system.
- */
- public static final String ACTION_SIMINFO_UPDATED
- = "android.intent.action.ACTION_SIMINFO_UPDATED";
-
- /**
* <p>Broadcast Action: It indicates subinfo record update is completed
* when SIM inserted state change
- * The intent will have the following extra values:</p>
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_SUBINFO_RECORD_UPDATED
= "android.intent.action.ACTION_SUBINFO_RECORD_UPDATED";
- public static final String EXTRA_COLUMN_NAME = "columnName";
- public static final String EXTRA_INT_CONTENT = "intContent";
- public static final String EXTRA_STRING_CONTENT = "stringContent";
-
/**
* Broadcast Action: The default subscription has changed. This has the following
* extra values:</p>
@@ -401,4 +367,23 @@ public class TelephonyIntents {
*/
public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
= "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+
+ /*
+ * Broadcast Action: An attempt to set phone radio type and access technology has changed.
+ * This has the following extra values:
+ * <ul>
+ * <li><em>phones radio access family </em> - A RadioAccessFamily
+ * array, contain phone ID and new radio access family for each phone.</li>
+ * </ul>
+ */
+ public static final String ACTION_SET_RADIO_CAPABILITY_DONE =
+ "android.intent.action.ACTION_SET_RADIO_CAPABILITY_DONE";
+
+ public static final String EXTRA_RADIO_ACCESS_FAMILY = "rafs";
+
+ /*
+ * Broadcast Action: An attempt to set phone radio access family has failed.
+ */
+ public static final String ACTION_SET_RADIO_CAPABILITY_FAILED =
+ "android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED";
}