Merge "Add getNetworkSpecifier() and getCarrierConfig()"
diff --git a/api/current.txt b/api/current.txt
index 54eb234..460228b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -38190,6 +38190,7 @@
method public android.telephony.TelephonyManager createForSubscriptionId(int);
method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
+ method public android.os.PersistableBundle getCarrierConfig();
method public android.telephony.CellLocation getCellLocation();
method public int getDataActivity();
method public boolean getDataEnabled();
@@ -38207,6 +38208,7 @@
method public java.lang.String getNetworkCountryIso();
method public java.lang.String getNetworkOperator();
method public java.lang.String getNetworkOperatorName();
+ method public java.lang.String getNetworkSpecifier();
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
diff --git a/api/system-current.txt b/api/system-current.txt
index 7c0c78d..79d9588 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -41362,6 +41362,7 @@
method public boolean endCall();
method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
+ method public android.os.PersistableBundle getCarrierConfig();
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int);
method public java.lang.String getCdmaMdn();
@@ -41388,6 +41389,7 @@
method public java.lang.String getNetworkCountryIso();
method public java.lang.String getNetworkOperator();
method public java.lang.String getNetworkOperatorName();
+ method public java.lang.String getNetworkSpecifier();
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
diff --git a/api/test-current.txt b/api/test-current.txt
index c2e9fbb..44d6081 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -38308,6 +38308,7 @@
method public android.telephony.TelephonyManager createForSubscriptionId(int);
method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
+ method public android.os.PersistableBundle getCarrierConfig();
method public android.telephony.CellLocation getCellLocation();
method public int getDataActivity();
method public boolean getDataEnabled();
@@ -38325,6 +38326,7 @@
method public java.lang.String getNetworkCountryIso();
method public java.lang.String getNetworkOperator();
method public java.lang.String getNetworkOperatorName();
+ method public java.lang.String getNetworkSpecifier();
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 9d9a810..861a1eb 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -36,6 +36,7 @@
import android.provider.Settings.SettingNotFoundException;
import android.os.Bundle;
import android.os.Handler;
+import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
@@ -1443,6 +1444,34 @@
return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
}
+
+ /**
+ * Returns the network specifier of the subscription ID pinned to the TelephonyManager.
+ *
+ * @see android.net.NetworkRequest.Builder#setNetworkSpecifier(String)
+ * @see #createForSubscriptionId(int)
+ * @see #createForPhoneAccountHandle(PhoneAccountHandle)
+ */
+ public String getNetworkSpecifier() {
+ return String.valueOf(mSubId);
+ }
+
+ /**
+ * Returns the carrier config of the subscription ID pinned to the TelephonyManager.
+ *
+ * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE
+ * READ_PHONE_STATE}
+ *
+ * @see CarrierConfigManager#getConfigForSubId(int)
+ * @see #createForSubscriptionId(int)
+ * @see #createForPhoneAccountHandle(PhoneAccountHandle)
+ */
+ public PersistableBundle getCarrierConfig() {
+ CarrierConfigManager carrierConfigManager = mContext
+ .getSystemService(CarrierConfigManager.class);
+ return carrierConfigManager.getConfigForSubId(mSubId);
+ }
+
/**
* Returns true if the device is considered roaming on the current
* network, for GSM purposes.