diff options
| author | 2016-11-23 04:14:23 +0000 | |
|---|---|---|
| committer | 2016-11-23 04:14:23 +0000 | |
| commit | 1cea0c249d4180a5883d121ebbf6857379e5294f (patch) | |
| tree | bc0cf9fc57cd6948f457e73492d3dbe684320dcb | |
| parent | cf1a558aed1b5dd28ce5daab4713568ceb6ddbd6 (diff) | |
| parent | b369ad4b19c083e0a0884810a31c3f36316199db (diff) | |
Merge "Expose TelephonyManager#{set,get}DataEnabled." am: 99d6227782 am: fa8e6c0f5a
am: b369ad4b19
Change-Id: I0ed5ac68a7974ade21b1d6aa2279fde179070c0c
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 31 |
3 files changed, 29 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt index 75daeafa4001..79e91fcd8b22 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37380,6 +37380,7 @@ package android.telephony { method public int getCallState(); method public android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); + method public boolean getDataEnabled(); method public int getDataNetworkType(); method public int getDataState(); method public java.lang.String getDeviceId(); @@ -37424,6 +37425,7 @@ package android.telephony { method public boolean isWorldPhone(); method public void listen(android.telephony.PhoneStateListener, int); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); + method public void setDataEnabled(boolean); method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String); method public boolean setOperatorBrandOverride(java.lang.String); method public boolean setPreferredNetworkTypeToGlobal(); diff --git a/api/test-current.txt b/api/test-current.txt index 718ecc1aa5ca..32b03b9a708f 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37462,6 +37462,7 @@ package android.telephony { method public int getCallState(); method public android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); + method public boolean getDataEnabled(); method public int getDataNetworkType(); method public int getDataState(); method public java.lang.String getDeviceId(); @@ -37506,6 +37507,7 @@ package android.telephony { method public boolean isWorldPhone(); method public void listen(android.telephony.PhoneStateListener, int); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); + method public void setDataEnabled(boolean); method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String); method public boolean setOperatorBrandOverride(java.lang.String); method public boolean setPreferredNetworkTypeToGlobal(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 60c2b99b4a98..000abffef27e 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4765,10 +4765,19 @@ public class TelephonyManager { return false; } - /** @hide */ - @SystemApi + /** + * Turns mobile data on or off. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the + * calling app has carrier privileges. + * + * @param enable Whether to enable mobile data. + * + * @see #hasCarrierPrivileges + */ public void setDataEnabled(boolean enable) { - setDataEnabled(SubscriptionManager.getDefaultDataSubscriptionId(), enable); + setDataEnabled(getSubId(), enable); } /** @hide */ @@ -4784,10 +4793,20 @@ public class TelephonyManager { } } - /** @hide */ - @SystemApi + /** + * Returns whether mobile data is enabled or not. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the + * calling app has carrier privileges. + * + * @return true if mobile data is enabled. + * + * @see #hasCarrierPrivileges + */ public boolean getDataEnabled() { - return getDataEnabled(SubscriptionManager.getDefaultDataSubscriptionId()); + return getDataEnabled(getSubId()); } /** @hide */ |