Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc9a6fb9 authored by Jeff Davidson's avatar Jeff Davidson
Browse files

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.

Change-Id: I5baacc1fd7e75d54e1d6521c24f792f427d9e228
Test: TreeHugger build/boot
Fixes: 35766530
parent 7485a9bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -39406,7 +39406,6 @@ package android.telephony {
    method public android.os.PersistableBundle getCarrierConfig();
    method public android.os.PersistableBundle getCarrierConfig();
    method public android.telephony.CellLocation getCellLocation();
    method public android.telephony.CellLocation getCellLocation();
    method public int getDataActivity();
    method public int getDataActivity();
    method public boolean getDataEnabled();
    method public int getDataNetworkType();
    method public int getDataNetworkType();
    method public int getDataState();
    method public int getDataState();
    method public java.lang.String getDeviceId();
    method public java.lang.String getDeviceId();
@@ -39446,6 +39445,7 @@ package android.telephony {
    method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String);
    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 java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String);
    method public boolean isConcurrentVoiceAndDataAllowed();
    method public boolean isConcurrentVoiceAndDataAllowed();
    method public boolean isDataEnabled();
    method public boolean isHearingAidCompatibilitySupported();
    method public boolean isHearingAidCompatibilitySupported();
    method public boolean isNetworkRoaming();
    method public boolean isNetworkRoaming();
    method public boolean isSmsCapable();
    method public boolean isSmsCapable();
+3 −2
Original line number Original line Diff line number Diff line
@@ -42692,8 +42692,8 @@ package android.telephony {
    method public int getCurrentPhoneType();
    method public int getCurrentPhoneType();
    method public int getCurrentPhoneType(int);
    method public int getCurrentPhoneType(int);
    method public int getDataActivity();
    method public int getDataActivity();
    method public boolean getDataEnabled();
    method public deprecated boolean getDataEnabled();
    method public boolean getDataEnabled(int);
    method public deprecated boolean getDataEnabled(int);
    method public int getDataNetworkType();
    method public int getDataNetworkType();
    method public int getDataState();
    method public int getDataState();
    method public java.lang.String getDeviceId();
    method public java.lang.String getDeviceId();
@@ -42739,6 +42739,7 @@ package android.telephony {
    method public java.lang.String iccTransmitApduLogicalChannel(int, 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 isConcurrentVoiceAndDataAllowed();
    method public boolean isDataConnectivityPossible();
    method public boolean isDataConnectivityPossible();
    method public boolean isDataEnabled();
    method public boolean isHearingAidCompatibilitySupported();
    method public boolean isHearingAidCompatibilitySupported();
    method public boolean isIdle();
    method public boolean isIdle();
    method public boolean isNetworkRoaming();
    method public boolean isNetworkRoaming();
+1 −1
Original line number Original line Diff line number Diff line
@@ -39590,7 +39590,6 @@ package android.telephony {
    method public android.os.PersistableBundle getCarrierConfig();
    method public android.os.PersistableBundle getCarrierConfig();
    method public android.telephony.CellLocation getCellLocation();
    method public android.telephony.CellLocation getCellLocation();
    method public int getDataActivity();
    method public int getDataActivity();
    method public boolean getDataEnabled();
    method public int getDataNetworkType();
    method public int getDataNetworkType();
    method public int getDataState();
    method public int getDataState();
    method public java.lang.String getDeviceId();
    method public java.lang.String getDeviceId();
@@ -39630,6 +39629,7 @@ package android.telephony {
    method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String);
    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 java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String);
    method public boolean isConcurrentVoiceAndDataAllowed();
    method public boolean isConcurrentVoiceAndDataAllowed();
    method public boolean isDataEnabled();
    method public boolean isHearingAidCompatibilitySupported();
    method public boolean isHearingAidCompatibilitySupported();
    method public boolean isNetworkRoaming();
    method public boolean isNetworkRoaming();
    method public boolean isSmsCapable();
    method public boolean isSmsCapable();
+25 −6
Original line number Original line Diff line number Diff line
@@ -5189,23 +5189,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.
     * Returns whether mobile data is enabled or not.
     *
     *
     * <p>Requires Permission:
     * <p>Requires one of the following permissions:
     * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE},
     * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE},
     * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the
     * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the
     * calling app has carrier privileges.
     * 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.
     * @return true if mobile data is enabled.
     *
     *
     * @see #hasCarrierPrivileges
     * @see #hasCarrierPrivileges
     */
     */
    public boolean getDataEnabled() {
    @SuppressWarnings("deprecation")
    public boolean isDataEnabled() {
        return getDataEnabled(getSubId());
        return getDataEnabled(getSubId());
    }
    }


    /** @hide */
    /**
     * @deprecated use {@link #isDataEnabled(int)} instead.
     * @hide
     */
    @SystemApi
    @SystemApi
    public boolean getDataEnabled(int subId) {
    public boolean getDataEnabled(int subId) {
        boolean retVal = false;
        boolean retVal = false;