summaryrefslogtreecommitdiffstats
path: root/telephony/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java/android')
-rw-r--r--telephony/java/android/telephony/CellIdentityCdma.java30
-rw-r--r--telephony/java/android/telephony/CellIdentityGsm.java27
-rw-r--r--telephony/java/android/telephony/CellIdentityLte.java30
-rw-r--r--telephony/java/android/telephony/CellIdentityWcdma.java30
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java152
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java3
-rw-r--r--telephony/java/android/telephony/PreciseCallState.java2
-rw-r--r--telephony/java/android/telephony/PreciseDataConnectionState.java2
-rw-r--r--telephony/java/android/telephony/ServiceState.java14
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java2
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java90
11 files changed, 272 insertions, 110 deletions
diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java
index dbd48d9..b39b4c7 100644
--- a/telephony/java/android/telephony/CellIdentityCdma.java
+++ b/telephony/java/android/telephony/CellIdentityCdma.java
@@ -20,6 +20,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
+import java.util.Objects;
+
/**
* CellIdentity is to represent a unique CDMA cell
*/
@@ -137,27 +139,25 @@ public final class CellIdentityCdma implements Parcelable {
@Override
public int hashCode() {
- int primeNum = 31;
- return (mNetworkId * primeNum) + (mSystemId * primeNum) + (mBasestationId * primeNum) +
- (mLatitude * primeNum) + (mLongitude * primeNum);
+ return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude);
}
@Override
public boolean equals(Object other) {
- if (super.equals(other)) {
- try {
- CellIdentityCdma o = (CellIdentityCdma)other;
- return mNetworkId == o.mNetworkId &&
- mSystemId == o.mSystemId &&
- mBasestationId == o.mBasestationId &&
- mLatitude == o.mLatitude &&
- mLongitude == o.mLongitude;
- } catch (ClassCastException e) {
- return false;
- }
- } else {
+ if (this == other) {
+ return true;
+ }
+
+ if (!(other instanceof CellIdentityCdma)) {
return false;
}
+
+ CellIdentityCdma o = (CellIdentityCdma) other;
+ return mNetworkId == o.mNetworkId &&
+ mSystemId == o.mSystemId &&
+ mBasestationId == o.mBasestationId &&
+ mLatitude == o.mLatitude &&
+ mLongitude == o.mLongitude;
}
@Override
diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java
index 6f8cc91..90d2aa0 100644
--- a/telephony/java/android/telephony/CellIdentityGsm.java
+++ b/telephony/java/android/telephony/CellIdentityGsm.java
@@ -20,6 +20,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
+import java.util.Objects;
+
/**
* CellIdentity to represent a unique GSM cell
*/
@@ -113,25 +115,24 @@ public final class CellIdentityGsm implements Parcelable {
@Override
public int hashCode() {
- int primeNum = 31;
- return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum);
+ return Objects.hash(mMcc, mMnc, mLac, mCid);
}
@Override
public boolean equals(Object other) {
- if (super.equals(other)) {
- try {
- CellIdentityGsm o = (CellIdentityGsm)other;
- return mMcc == o.mMcc &&
- mMnc == o.mMnc &&
- mLac == o.mLac &&
- mCid == o.mCid;
- } catch (ClassCastException e) {
- return false;
- }
- } else {
+ if (this == other) {
+ return true;
+ }
+
+ if (!(other instanceof CellIdentityGsm)) {
return false;
}
+
+ CellIdentityGsm o = (CellIdentityGsm) other;
+ return mMcc == o.mMcc &&
+ mMnc == o.mMnc &&
+ mLac == o.mLac &&
+ mCid == o.mCid;
}
@Override
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java
index 72578a4..1e7ac08 100644
--- a/telephony/java/android/telephony/CellIdentityLte.java
+++ b/telephony/java/android/telephony/CellIdentityLte.java
@@ -20,6 +20,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
+import java.util.Objects;
+
/**
* CellIdentity is to represent a unique LTE cell
*/
@@ -117,27 +119,25 @@ public final class CellIdentityLte implements Parcelable {
@Override
public int hashCode() {
- int primeNum = 31;
- return (mMcc * primeNum) + (mMnc * primeNum) + (mCi * primeNum) + (mPci * primeNum) +
- (mTac * primeNum);
+ return Objects.hash(mMcc, mMnc, mCi, mPci, mTac);
}
@Override
public boolean equals(Object other) {
- if (super.equals(other)) {
- try {
- CellIdentityLte o = (CellIdentityLte)other;
- return mMcc == o.mMcc &&
- mMnc == o.mMnc &&
- mCi == o.mCi &&
- mPci == o.mPci &&
- mTac == o.mTac;
- } catch (ClassCastException e) {
- return false;
- }
- } else {
+ if (this == other) {
+ return true;
+ }
+
+ if (!(other instanceof CellIdentityLte)) {
return false;
}
+
+ CellIdentityLte o = (CellIdentityLte) other;
+ return mMcc == o.mMcc &&
+ mMnc == o.mMnc &&
+ mCi == o.mCi &&
+ mPci == o.mPci &&
+ mTac == o.mTac;
}
@Override
diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java
index 2f8fa42..56ee8c9 100644
--- a/telephony/java/android/telephony/CellIdentityWcdma.java
+++ b/telephony/java/android/telephony/CellIdentityWcdma.java
@@ -20,6 +20,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
+import java.util.Objects;
+
/**
* CellIdentity to represent a unique UMTS cell
*/
@@ -118,27 +120,25 @@ public final class CellIdentityWcdma implements Parcelable {
@Override
public int hashCode() {
- int primeNum = 31;
- return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum) +
- (mPsc * primeNum);
+ return Objects.hash(mMcc, mMnc, mLac, mCid, mPsc);
}
@Override
public boolean equals(Object other) {
- if (super.equals(other)) {
- try {
- CellIdentityWcdma o = (CellIdentityWcdma)other;
- return mMcc == o.mMcc &&
- mMnc == o.mMnc &&
- mLac == o.mLac &&
- mCid == o.mCid &&
- mPsc == o.mPsc;
- } catch (ClassCastException e) {
- return false;
- }
- } else {
+ if (this == other) {
+ return true;
+ }
+
+ if (!(other instanceof CellIdentityWcdma)) {
return false;
}
+
+ CellIdentityWcdma o = (CellIdentityWcdma) other;
+ return mMcc == o.mMcc &&
+ mMnc == o.mMnc &&
+ mLac == o.mLac &&
+ mCid == o.mCid &&
+ mPsc == o.mPsc;
}
@Override
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 729eefa..aae3ff6 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -34,11 +34,9 @@ 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;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_IDP_STRING;
import java.util.Locale;
@@ -1143,6 +1141,7 @@ public class PhoneNumberUtils
*
* @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead
*/
+ @Deprecated
public static String formatNumber(String source) {
SpannableStringBuilder text = new SpannableStringBuilder(source);
formatNumber(text, getFormatTypeForLocale(Locale.getDefault()));
@@ -1161,6 +1160,7 @@ public class PhoneNumberUtils
* @hide
* @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead
*/
+ @Deprecated
public static String formatNumber(String source, int defaultFormattingType) {
SpannableStringBuilder text = new SpannableStringBuilder(source);
formatNumber(text, defaultFormattingType);
@@ -1176,6 +1176,7 @@ public class PhoneNumberUtils
*
* @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead
*/
+ @Deprecated
public static int getFormatTypeForLocale(Locale locale) {
String country = locale.getCountry();
@@ -1192,6 +1193,7 @@ public class PhoneNumberUtils
*
* @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead
*/
+ @Deprecated
public static void formatNumber(Editable text, int defaultFormattingType) {
int formatType = defaultFormattingType;
@@ -1240,6 +1242,7 @@ public class PhoneNumberUtils
*
* @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead
*/
+ @Deprecated
public static void formatNanpNumber(Editable text) {
int length = text.length();
if (length > "+1-nnn-nnn-nnnn".length()) {
@@ -1355,6 +1358,7 @@ public class PhoneNumberUtils
*
* @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead
*/
+ @Deprecated
public static void formatJapaneseNumber(Editable text) {
JapanesePhoneNumberFormatter.format(text);
}
@@ -1376,32 +1380,52 @@ public class PhoneNumberUtils
}
/**
- * Format the given phoneNumber to the E.164 representation.
+ * Formats the specified {@code phoneNumber} to the E.164 representation.
+ *
+ * @param phoneNumber the phone number to format.
+ * @param defaultCountryIso the ISO 3166-1 two letters country code.
+ * @return the E.164 representation, or null if the given phone number is not valid.
+ */
+ public static String formatNumberToE164(String phoneNumber, String defaultCountryIso) {
+ return formatNumberInternal(phoneNumber, defaultCountryIso, PhoneNumberFormat.E164);
+ }
+
+ /**
+ * Formats the specified {@code phoneNumber} to the RFC3966 representation.
+ *
+ * @param phoneNumber the phone number to format.
+ * @param defaultCountryIso the ISO 3166-1 two letters country code.
+ * @return the RFC3966 representation, or null if the given phone number is not valid.
+ */
+ public static String formatNumberToRFC3966(String phoneNumber, String defaultCountryIso) {
+ return formatNumberInternal(phoneNumber, defaultCountryIso, PhoneNumberFormat.RFC3966);
+ }
+
+ /**
+ * Formats the raw phone number (string) using the specified {@code formatIdentifier}.
* <p>
- * The given phone number must have an area code and could have a country
- * code.
+ * The given phone number must have an area code and could have a country code.
* <p>
- * The defaultCountryIso is used to validate the given number and generate
- * the E.164 phone number if the given number doesn't have a country code.
+ * The defaultCountryIso is used to validate the given number and generate the formatted number
+ * if the specified number doesn't have a country code.
*
- * @param phoneNumber
- * the phone number to format
- * @param defaultCountryIso
- * the ISO 3166-1 two letters country code
- * @return the E.164 representation, or null if the given phone number is
- * not valid.
+ * @param rawPhoneNumber The phone number to format.
+ * @param defaultCountryIso The ISO 3166-1 two letters country code.
+ * @param formatIdentifier The (enum) identifier of the desired format.
+ * @return the formatted representation, or null if the specified number is not valid.
*/
- public static String formatNumberToE164(String phoneNumber, String defaultCountryIso) {
+ private static String formatNumberInternal(
+ String rawPhoneNumber, String defaultCountryIso, PhoneNumberFormat formatIdentifier) {
+
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
- String result = null;
try {
- PhoneNumber pn = util.parse(phoneNumber, defaultCountryIso);
- if (util.isValidNumber(pn)) {
- result = util.format(pn, PhoneNumberFormat.E164);
+ PhoneNumber phoneNumber = util.parse(rawPhoneNumber, defaultCountryIso);
+ if (util.isValidNumber(phoneNumber)) {
+ return util.format(phoneNumber, formatIdentifier);
}
- } catch (NumberParseException e) {
- }
- return result;
+ } catch (NumberParseException ignored) { }
+
+ return null;
}
/**
@@ -2311,15 +2335,13 @@ public class PhoneNumberUtils
*
* @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) {
+ public static CharSequence getPhoneTtsSpannable(CharSequence phoneNumber) {
if (phoneNumber == null) {
return null;
}
Spannable spannable = Spannable.Factory.getInstance().newSpannable(phoneNumber);
- PhoneNumberUtils.ttsSpanAsPhoneNumber(spannable, 0, spannable.length());
+ PhoneNumberUtils.addPhoneTtsSpan(spannable, 0, spannable.length());
return spannable;
}
@@ -2330,19 +2352,83 @@ public class PhoneNumberUtils
* @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(),
+ public static void addPhoneTtsSpan(Spannable s, int start, int end) {
+ s.setSpan(getPhoneTtsSpan(s.subSequence(start, end).toString()),
start,
end,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
+ /**
+ * 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.
+ * @deprecated Renamed {@link #getPhoneTtsSpannable}.
+ *
+ * @hide
+ */
+ @Deprecated
+ public static CharSequence ttsSpanAsPhoneNumber(CharSequence phoneNumber) {
+ return getPhoneTtsSpannable(phoneNumber);
+ }
+
+ /**
+ * 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}.
+ *
+ * @deprecated Renamed {@link #addPhoneTtsSpan}.
+ *
+ * @hide
+ */
+ @Deprecated
+ public static void ttsSpanAsPhoneNumber(Spannable s, int start, int end) {
+ addPhoneTtsSpan(s, start, end);
+ }
+
+ /**
+ * Create a {@code TtsSpan} for the supplied {@code String}.
+ *
+ * @param phoneNumberString A {@code String} the entirety of which represents a phone number.
+ * @return A {@code TtsSpan} for {@param phoneNumberString}.
+ */
+ public static TtsSpan getPhoneTtsSpan(String phoneNumberString) {
+ if (phoneNumberString == null) {
+ return null;
+ }
+
+ // Parse the phone number
+ final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
+ PhoneNumber phoneNumber = null;
+ try {
+ // Don't supply a defaultRegion so this fails for non-international numbers because
+ // we don't want to TalkBalk to read a country code (e.g. +1) if it is not already
+ // present
+ phoneNumber = phoneNumberUtil.parse(phoneNumberString, /* defaultRegion */ null);
+ } catch (NumberParseException ignored) {
+ }
+
+ // Build a telephone tts span
+ final TtsSpan.TelephoneBuilder builder = new TtsSpan.TelephoneBuilder();
+ if (phoneNumber == null) {
+ // Strip separators otherwise TalkBack will be silent
+ // (this behavior was observed with TalkBalk 4.0.2 from their alpha channel)
+ builder.setNumberParts(splitAtNonNumerics(phoneNumberString));
+ } else {
+ if (phoneNumber.hasCountryCode()) {
+ builder.setCountryCode(Integer.toString(phoneNumber.getCountryCode()));
+ }
+ builder.setNumberParts(Long.toString(phoneNumber.getNationalNumber()));
+ }
+ return builder.build();
+ }
+
// 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) {
@@ -2456,7 +2542,7 @@ public class PhoneNumberUtils
*
* @param number SIP address of the form "username@domainname"
* (or the URI-escaped equivalent "username%40domainname")
- * @see isUriNumber
+ * @see #isUriNumber
*
* @hide
*/
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index fce4ae7..611dd7bd 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -27,13 +27,10 @@ import android.telephony.VoLteServiceState;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
-import android.telephony.SubscriptionManager;
import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import com.android.internal.telephony.IPhoneStateListener;
-import com.android.internal.telephony.PhoneConstants;
-
import java.util.List;
/**
diff --git a/telephony/java/android/telephony/PreciseCallState.java b/telephony/java/android/telephony/PreciseCallState.java
index a85df15..f246416 100644
--- a/telephony/java/android/telephony/PreciseCallState.java
+++ b/telephony/java/android/telephony/PreciseCallState.java
@@ -16,10 +16,8 @@
package android.telephony;
-import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.telephony.Rlog;
import android.telephony.DisconnectCause;
import android.telephony.PreciseDisconnectCause;
diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java
index 87529fe..31c9a9e 100644
--- a/telephony/java/android/telephony/PreciseDataConnectionState.java
+++ b/telephony/java/android/telephony/PreciseDataConnectionState.java
@@ -16,10 +16,8 @@
package android.telephony;
-import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.net.LinkProperties;
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 559a58c..cdecb33 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -148,7 +148,11 @@ public class ServiceState implements Parcelable {
public static final int RIL_RADIO_TECHNOLOGY_GSM = 16;
/** @hide */
public static final int RIL_RADIO_TECHNOLOGY_TD_SCDMA = 17;
-
+ /**
+ * IWLAN
+ * @hide
+ */
+ public static final int RIL_RADIO_TECHNOLOGY_IWLAN = 18;
/**
* Available registration states for GSM, UMTS and CDMA.
*/
@@ -697,6 +701,9 @@ public class ServiceState implements Parcelable {
case RIL_RADIO_TECHNOLOGY_GSM:
rtString = "GSM";
break;
+ case RIL_RADIO_TECHNOLOGY_IWLAN:
+ rtString = "IWLAN";
+ break;
default:
rtString = "Unexpected";
Rlog.w(LOG_TAG, "Unexpected radioTechnology=" + rt);
@@ -1030,6 +1037,8 @@ public class ServiceState implements Parcelable {
return TelephonyManager.NETWORK_TYPE_HSPAP;
case ServiceState.RIL_RADIO_TECHNOLOGY_GSM:
return TelephonyManager.NETWORK_TYPE_GSM;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN:
+ return TelephonyManager.NETWORK_TYPE_IWLAN;
default:
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -1080,7 +1089,8 @@ public class ServiceState implements Parcelable {
|| radioTechnology == RIL_RADIO_TECHNOLOGY_LTE
|| radioTechnology == RIL_RADIO_TECHNOLOGY_HSPAP
|| radioTechnology == RIL_RADIO_TECHNOLOGY_GSM
- || radioTechnology == RIL_RADIO_TECHNOLOGY_TD_SCDMA;
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_TD_SCDMA
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_IWLAN;
}
/** @hide */
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index aca94e9..08aec08 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -32,8 +32,6 @@ 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;
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index dbd4f92..b44fa6c 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -29,6 +29,7 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.telecom.PhoneAccount;
import android.util.Log;
import com.android.internal.telecom.ITelecomService;
@@ -41,9 +42,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.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -1238,6 +1237,10 @@ public class TelephonyManager {
public static final int NETWORK_TYPE_HSPAP = 15;
/** Current network is GSM {@hide} */
public static final int NETWORK_TYPE_GSM = 16;
+ /** Current network is TD_SCDMA {@hide} */
+ public static final int NETWORK_TYPE_TD_SCDMA = 17;
+ /** Current network is IWLAN {@hide} */
+ public static final int NETWORK_TYPE_IWLAN = 18;
/**
* @return the NETWORK_TYPE_xxxx for current data connection.
@@ -1408,8 +1411,10 @@ public class TelephonyManager {
case NETWORK_TYPE_EVDO_B:
case NETWORK_TYPE_EHRPD:
case NETWORK_TYPE_HSPAP:
+ case NETWORK_TYPE_TD_SCDMA:
return NETWORK_CLASS_3_G;
case NETWORK_TYPE_LTE:
+ case NETWORK_TYPE_IWLAN:
return NETWORK_CLASS_4_G;
default:
return NETWORK_CLASS_UNKNOWN;
@@ -1469,6 +1474,10 @@ public class TelephonyManager {
return "HSPA+";
case NETWORK_TYPE_GSM:
return "GSM";
+ case NETWORK_TYPE_TD_SCDMA:
+ return "TD_SCDMA";
+ case NETWORK_TYPE_IWLAN:
+ return "IWLAN";
default:
return "UNKNOWN";
}
@@ -3936,12 +3945,60 @@ public class TelephonyManager {
}
/**
- * 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
+ * Whether the device supports configuring the DTMF tone length.
*
- * @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));
+ * @return {@code true} if the DTMF tone length can be changed, and {@code false} otherwise.
+ */
+ public boolean canChangeDtmfToneLength() {
+ try {
+ return getITelephony().canChangeDtmfToneLength();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#canChangeDtmfToneLength", e);
+ }
+ return false;
+ }
+
+ /**
+ * Whether the device is a world phone.
+ *
+ * @return {@code true} if the device is a world phone, and {@code false} otherwise.
+ */
+ public boolean isWorldPhone() {
+ try {
+ return getITelephony().isWorldPhone();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#isWorldPhone", e);
+ }
+ return false;
+ }
+
+ /**
+ * Whether the phone supports TTY mode.
+ *
+ * @return {@code true} if the device supports TTY mode, and {@code false} otherwise.
+ */
+ public boolean isTtyModeSupported() {
+ try {
+ return getITelephony().isTtyModeSupported();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#isTtyModeSupported", e);
+ }
+ return false;
+ }
+
+ /**
+ * Whether the phone supports hearing aid compatibility.
+ *
+ * @return {@code true} if the device supports hearing aid compatibility, and {@code false}
+ * otherwise.
+ */
+ public boolean isHearingAidCompatibilitySupported() {
+ try {
+ return getITelephony().isHearingAidCompatibilitySupported();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#isHearingAidCompatibilitySupported", e);
+ }
+ return false;
}
/**
@@ -3984,7 +4041,7 @@ public class TelephonyManager {
/**
* Returns the IMS Registration Status
- *@hide
+ * @hide
*/
public boolean isImsRegistered() {
try {
@@ -4338,4 +4395,21 @@ public class TelephonyManager {
ServiceState.rilRadioTechnologyToString(type));
}
}
+
+ /**
+ * Returns the subscription ID for the given phone account.
+ * @hide
+ */
+ public int getSubIdForPhoneAccount(PhoneAccount phoneAccount) {
+ int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ try {
+ ITelephony service = getITelephony();
+ if (service != null) {
+ retval = service.getSubIdForPhoneAccount(phoneAccount);
+ }
+ } catch (RemoteException e) {
+ }
+
+ return retval;
+ }
}