diff options
author | Ta-wei Yen <twyen@google.com> | 2016-12-29 15:29:13 -0800 |
---|---|---|
committer | Ta-wei Yen <twyen@google.com> | 2017-01-13 23:53:51 +0000 |
commit | eca691efcb41324e0e62901293889b32cd11cd7e (patch) | |
tree | 6ec76e1e66e97dafb2542ebcd9e4d100c957f1f5 | |
parent | 9cc7ebe7d90c8da1340c8115023bd38451e58f7e (diff) | |
download | base-eca691efcb41324e0e62901293889b32cd11cd7e.tar.gz |
Add getNetworkSpecifier() and getCarrierConfig()
This allows making network request and getting carrier config on a
specfic SIM.
Bug: 32414216
Test: cts-tradefed run cts-dev --module CtsTelephonyTestCases
Merged-In: Id52688d73b74bc55ee2da71a22454957fdd7b57b
Change-Id: Iebe2d883e193afdde13303d76014dfd7f4fb06dd
-rw-r--r-- | api/current.txt | 2 | ||||
-rw-r--r-- | api/system-current.txt | 2 | ||||
-rw-r--r-- | api/test-current.txt | 2 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 29 |
4 files changed, 35 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index 86b2119aed9e..2dc6430eb246 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37444,6 +37444,7 @@ package android.telephony { 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(); @@ -37461,6 +37462,7 @@ package android.telephony { 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 b2f2a3ca43da..2e3217922724 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40606,6 +40606,7 @@ package android.telephony { 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(); @@ -40632,6 +40633,7 @@ package android.telephony { 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 e3a395be4acb..5a2f6076ca84 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37526,6 +37526,7 @@ package android.telephony { 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(); @@ -37543,6 +37544,7 @@ package android.telephony { 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 45d0576efab5..4c8eda0eebfa 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -31,6 +31,7 @@ import android.os.ResultReceiver; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.os.Bundle; +import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; @@ -1412,6 +1413,34 @@ public class TelephonyManager { 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. |