Loading api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -42553,6 +42553,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 isConcurrentVoiceAndDataSupported(); method public boolean isConcurrentVoiceAndDataSupported(); method public boolean isDataEnabled(); method public boolean isDataEnabled(); method public boolean isDataRoamingEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isNetworkRoaming(); method public boolean isNetworkRoaming(); method public boolean isSmsCapable(); method public boolean isSmsCapable(); api/system-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5272,6 +5272,7 @@ package android.telephony { method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public void setDataActivationState(int); method public void setDataActivationState(int); method public deprecated void setDataEnabled(int, boolean); method public deprecated void setDataEnabled(int, boolean); method public void setDataRoamingEnabled(boolean); method public boolean setRadio(boolean); method public boolean setRadio(boolean); method public boolean setRadioPower(boolean); method public boolean setRadioPower(boolean); method public void setSimPowerState(int); method public void setSimPowerState(int); Loading telephony/java/android/telephony/TelephonyManager.java +61 −3 Original line number Original line Diff line number Diff line Loading @@ -6634,9 +6634,9 @@ public class TelephonyManager { * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * * <p>Requires one of the following permissions: * <p>Requires one of the following permissions: * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the * {@link android.Manifest.permission#MODIFY_PHONE_STATE}, or that the calling app has carrier * calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * privileges (see {@link #hasCarrierPrivileges}). * * * <p>Note that this does not take into account any data restrictions that may be present on the * <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 * calling app. Such restrictions may be inspected with Loading @@ -6644,10 +6644,68 @@ public class TelephonyManager { * * * @return true if mobile data is enabled. * @return true if mobile data is enabled. */ */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled() { public boolean isDataEnabled() { return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } } /** * Returns whether mobile data roaming is enabled on the subscription. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires one of the following permissions: * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app * has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return {@code true} if the data roaming is enabled on the subscription, otherwise return * {@code false}. */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled() { boolean isDataRoamingEnabled = false; try { ITelephony telephony = getITelephony(); if (telephony != null) { isDataRoamingEnabled = telephony.isDataRoamingEnabled(getSubId()); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isDataRoamingEnabled", e); } return isDataRoamingEnabled; } /** * Enables/Disables the data roaming on the subscription. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p> Requires permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE} or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). * * @param isEnabled {@code true} to enable mobile data roaming, otherwise disable it. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean isEnabled) { try { ITelephony telephony = getITelephony(); if (telephony != null) { telephony.setDataRoamingEnabled(getSubId(), isEnabled); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#setDataRoamingEnabled", e); } } /** /** * @deprecated use {@link #isDataEnabled()} instead. * @deprecated use {@link #isDataEnabled()} instead. * @hide * @hide Loading telephony/java/com/android/internal/telephony/ITelephony.aidl +16 −0 Original line number Original line Diff line number Diff line Loading @@ -1513,6 +1513,22 @@ interface ITelephony { */ */ void setRadioIndicationUpdateMode(int subId, int filters, int mode); void setRadioIndicationUpdateMode(int subId, int filters, int mode); /** * Returns whether mobile data roaming is enabled on the subscription with id {@code subId}. * * @param subId the subscription id * @return {@code true} if the data roaming is enabled on this subscription. */ boolean isDataRoamingEnabled(int subId); /** * Enables/Disables the data roaming on the subscription with id {@code subId}. * * @param subId the subscription id * @param isEnabled {@code true} to enable mobile data roaming, otherwise disable it. */ void setDataRoamingEnabled(int subId, boolean isEnabled); /** /** * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config Loading telephony/java/com/android/internal/telephony/TelephonyPermissions.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED; import android.Manifest; import android.Manifest; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.content.Context; import android.content.Context; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Binder; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -249,6 +248,26 @@ public final class TelephonyPermissions { enforceCallingOrSelfCarrierPrivilege(subId, message); enforceCallingOrSelfCarrierPrivilege(subId, message); } } /** * Ensure the caller (or self, if not processing an IPC) has * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges. * * @throws SecurityException if the caller does not have the required permission/privileges */ public static void enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { Rlog.d(LOG_TAG, "No READ_PHONE_STATE permission, check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(subId, message); } /** /** * Make sure the caller (or self, if not processing an IPC) has carrier privileges. * Make sure the caller (or self, if not processing an IPC) has carrier privileges. * * Loading Loading
api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -42553,6 +42553,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 isConcurrentVoiceAndDataSupported(); method public boolean isConcurrentVoiceAndDataSupported(); method public boolean isDataEnabled(); method public boolean isDataEnabled(); method public boolean isDataRoamingEnabled(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isHearingAidCompatibilitySupported(); method public boolean isNetworkRoaming(); method public boolean isNetworkRoaming(); method public boolean isSmsCapable(); method public boolean isSmsCapable();
api/system-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5272,6 +5272,7 @@ package android.telephony { method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public void setDataActivationState(int); method public void setDataActivationState(int); method public deprecated void setDataEnabled(int, boolean); method public deprecated void setDataEnabled(int, boolean); method public void setDataRoamingEnabled(boolean); method public boolean setRadio(boolean); method public boolean setRadio(boolean); method public boolean setRadioPower(boolean); method public boolean setRadioPower(boolean); method public void setSimPowerState(int); method public void setSimPowerState(int); Loading
telephony/java/android/telephony/TelephonyManager.java +61 −3 Original line number Original line Diff line number Diff line Loading @@ -6634,9 +6634,9 @@ public class TelephonyManager { * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * * <p>Requires one of the following permissions: * <p>Requires one of the following permissions: * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the * {@link android.Manifest.permission#MODIFY_PHONE_STATE}, or that the calling app has carrier * calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * privileges (see {@link #hasCarrierPrivileges}). * * * <p>Note that this does not take into account any data restrictions that may be present on the * <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 * calling app. Such restrictions may be inspected with Loading @@ -6644,10 +6644,68 @@ public class TelephonyManager { * * * @return true if mobile data is enabled. * @return true if mobile data is enabled. */ */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled() { public boolean isDataEnabled() { return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } } /** * Returns whether mobile data roaming is enabled on the subscription. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires one of the following permissions: * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app * has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return {@code true} if the data roaming is enabled on the subscription, otherwise return * {@code false}. */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled() { boolean isDataRoamingEnabled = false; try { ITelephony telephony = getITelephony(); if (telephony != null) { isDataRoamingEnabled = telephony.isDataRoamingEnabled(getSubId()); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isDataRoamingEnabled", e); } return isDataRoamingEnabled; } /** * Enables/Disables the data roaming on the subscription. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p> Requires permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE} or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). * * @param isEnabled {@code true} to enable mobile data roaming, otherwise disable it. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean isEnabled) { try { ITelephony telephony = getITelephony(); if (telephony != null) { telephony.setDataRoamingEnabled(getSubId(), isEnabled); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#setDataRoamingEnabled", e); } } /** /** * @deprecated use {@link #isDataEnabled()} instead. * @deprecated use {@link #isDataEnabled()} instead. * @hide * @hide Loading
telephony/java/com/android/internal/telephony/ITelephony.aidl +16 −0 Original line number Original line Diff line number Diff line Loading @@ -1513,6 +1513,22 @@ interface ITelephony { */ */ void setRadioIndicationUpdateMode(int subId, int filters, int mode); void setRadioIndicationUpdateMode(int subId, int filters, int mode); /** * Returns whether mobile data roaming is enabled on the subscription with id {@code subId}. * * @param subId the subscription id * @return {@code true} if the data roaming is enabled on this subscription. */ boolean isDataRoamingEnabled(int subId); /** * Enables/Disables the data roaming on the subscription with id {@code subId}. * * @param subId the subscription id * @param isEnabled {@code true} to enable mobile data roaming, otherwise disable it. */ void setDataRoamingEnabled(int subId, boolean isEnabled); /** /** * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config Loading
telephony/java/com/android/internal/telephony/TelephonyPermissions.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED; import android.Manifest; import android.Manifest; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.content.Context; import android.content.Context; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Binder; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -249,6 +248,26 @@ public final class TelephonyPermissions { enforceCallingOrSelfCarrierPrivilege(subId, message); enforceCallingOrSelfCarrierPrivilege(subId, message); } } /** * Ensure the caller (or self, if not processing an IPC) has * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges. * * @throws SecurityException if the caller does not have the required permission/privileges */ public static void enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { Rlog.d(LOG_TAG, "No READ_PHONE_STATE permission, check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(subId, message); } /** /** * Make sure the caller (or self, if not processing an IPC) has carrier privileges. * Make sure the caller (or self, if not processing an IPC) has carrier privileges. * * Loading