diff options
| author | 2017-02-27 10:41:21 -0800 | |
|---|---|---|
| committer | 2017-04-26 10:09:24 -0700 | |
| commit | 9a7d6bb4b91f003d61a7ad9a9817b196f29f99bf (patch) | |
| tree | f96ded4a8b0a36a99bba416e0790597468a42929 | |
| parent | f4db619b0b2b3f4ef36015a1f2a74151c366b2af (diff) | |
Rename getDataEnabled() to isDataEnabled().
The old API is reverted back to @SystemApi and marked deprecated to
avoid breaking any compilation.
Also clean up the Javadoc by making the permissions requirements
clearer and noting that this API does not take per-app data
restrictions into account.
Merged-In: I5baacc1fd7e75d54e1d6521c24f792f427d9e228
Change-Id: I5baacc1fd7e75d54e1d6521c24f792f427d9e228
Test: TreeHugger build/boot
Fixes: 35766530
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | api/system-current.txt | 5 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 31 |
4 files changed, 30 insertions, 10 deletions
diff --git a/api/current.txt b/api/current.txt index 5d968be53c7a..38c9879bacdc 100644 --- a/api/current.txt +++ b/api/current.txt @@ -38180,7 +38180,6 @@ package android.telephony { method public android.os.PersistableBundle getCarrierConfig(); method public deprecated android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); - method public boolean getDataEnabled(); method public int getDataNetworkType(); method public int getDataState(); method public deprecated java.lang.String getDeviceId(); @@ -38225,6 +38224,7 @@ package android.telephony { method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String); method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String); method public boolean isConcurrentVoiceAndDataAllowed(); + method public boolean isDataEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isNetworkRoaming(); method public boolean isSmsCapable(); diff --git a/api/system-current.txt b/api/system-current.txt index f336cdb72133..cbe75074e20e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -41393,8 +41393,8 @@ package android.telephony { method public int getCurrentPhoneType(); method public int getCurrentPhoneType(int); method public int getDataActivity(); - method public boolean getDataEnabled(); - method public boolean getDataEnabled(int); + method public deprecated boolean getDataEnabled(); + method public deprecated boolean getDataEnabled(int); method public int getDataNetworkType(); method public int getDataState(); method public deprecated java.lang.String getDeviceId(); @@ -41443,6 +41443,7 @@ package android.telephony { method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String); method public boolean isConcurrentVoiceAndDataAllowed(); method public boolean isDataConnectivityPossible(); + method public boolean isDataEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isIdle(); method public boolean isNetworkRoaming(); diff --git a/api/test-current.txt b/api/test-current.txt index 65cfd8477cec..dbed400e049c 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -38279,7 +38279,6 @@ package android.telephony { method public android.os.PersistableBundle getCarrierConfig(); method public deprecated android.telephony.CellLocation getCellLocation(); method public int getDataActivity(); - method public boolean getDataEnabled(); method public int getDataNetworkType(); method public int getDataState(); method public deprecated java.lang.String getDeviceId(); @@ -38324,6 +38323,7 @@ package android.telephony { method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String); method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String); method public boolean isConcurrentVoiceAndDataAllowed(); + method public boolean isDataEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isNetworkRoaming(); method public boolean isSmsCapable(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 5a848d956f5d..d751fcb8e00c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5257,23 +5257,42 @@ public class TelephonyManager { } } + + /** + * @deprecated use {@link #isDataEnabled()} instead. + * @hide + */ + @SystemApi + @Deprecated + public boolean getDataEnabled() { + return isDataEnabled(); + } + /** * 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. + * <p>Requires one of the following permissions: + * {@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. + * + * <p>Note that this does not take into account any data restrictions that may be present on the + * calling app. Such restrictions may be inspected with + * {@link ConnectivityManager#getRestrictBackgroundStatus}. * * @return true if mobile data is enabled. * * @see #hasCarrierPrivileges */ - public boolean getDataEnabled() { + @SuppressWarnings("deprecation") + public boolean isDataEnabled() { return getDataEnabled(getSubId()); } - /** @hide */ + /** + * @deprecated use {@link #isDataEnabled(int)} instead. + * @hide + */ @SystemApi public boolean getDataEnabled(int subId) { boolean retVal = false; |