Merge "Make TelephonyManager#get/setAllowedCarriers system api"

am: 6d064d8780

Change-Id: I8f9b1c8e9ce1fda6cd03cd0dd459ead8837bd90d
This commit is contained in:
Polina Bondarenko
2017-01-23 17:10:05 +00:00
committed by android-build-merger
3 changed files with 35 additions and 0 deletions

View File

@@ -10249,6 +10249,7 @@ package android.content.pm {
field public static final java.lang.String FEATURE_SIP = "android.software.sip"; field public static final java.lang.String FEATURE_SIP = "android.software.sip";
field public static final java.lang.String FEATURE_SIP_VOIP = "android.software.sip.voip"; field public static final java.lang.String FEATURE_SIP_VOIP = "android.software.sip.voip";
field public static final java.lang.String FEATURE_TELEPHONY = "android.hardware.telephony"; field public static final java.lang.String FEATURE_TELEPHONY = "android.hardware.telephony";
field public static final java.lang.String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock";
field public static final java.lang.String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; field public static final java.lang.String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
field public static final java.lang.String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; field public static final java.lang.String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
field public static final deprecated java.lang.String FEATURE_TELEVISION = "android.hardware.type.television"; field public static final deprecated java.lang.String FEATURE_TELEVISION = "android.hardware.type.television";
@@ -40766,6 +40767,7 @@ package android.telephony {
method public void enableVideoCalling(boolean); method public void enableVideoCalling(boolean);
method public boolean endCall(); method public boolean endCall();
method public java.util.List<android.telephony.CellInfo> getAllCellInfo(); method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
method public int getCallState(); method public int getCallState();
method public android.os.PersistableBundle getCarrierConfig(); 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> getCarrierPackageNamesForIntent(android.content.Intent);
@@ -40839,6 +40841,7 @@ package android.telephony {
method public void listen(android.telephony.PhoneStateListener, int); method public void listen(android.telephony.PhoneStateListener, int);
method public boolean needsOtaServiceProvisioning(); method public boolean needsOtaServiceProvisioning();
method public java.lang.String sendEnvelopeWithStatus(java.lang.String); method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
method public void setDataEnabled(boolean); method public void setDataEnabled(boolean);
method public void setDataEnabled(int, boolean); method public void setDataEnabled(int, boolean);
method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String); method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String);

View File

@@ -1809,6 +1809,20 @@ public abstract class PackageManager {
@SdkConstant(SdkConstantType.FEATURE) @SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
/**
* Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
* The device supports telephony carrier restriction mechanism.
*
* <p>Devices declaring this feature must have an implementation of the
* {@link android.telephony.TelephonyManager#getAllowedCarriers} and
* {@link android.telephony.TelephonyManager#setAllowedCarriers}.
* @hide
*/
@SystemApi
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TELEPHONY_CARRIERLOCK =
"android.hardware.telephony.carrierlock";
/** /**
* Feature for {@link #getSystemAvailableFeatures} and * Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device supports connecting to USB devices * {@link #hasSystemFeature}: The device supports connecting to USB devices

View File

@@ -5682,10 +5682,17 @@ public class TelephonyManager {
* Set the allowed carrier list for slotId * Set the allowed carrier list for slotId
* Require system privileges. In the future we may add this to carrier APIs. * Require system privileges. In the future we may add this to carrier APIs.
* *
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE}
*
* <p>This method works only on devices with {@link
* android.content.pm.PackageManager#FEATURE_TELEPHONY_CARRIERLOCK} enabled.
*
* @return The number of carriers set successfully. Should be length of * @return The number of carriers set successfully. Should be length of
* carrierList on success; -1 on error. * carrierList on success; -1 on error.
* @hide * @hide
*/ */
@SystemApi
public int setAllowedCarriers(int slotId, List<CarrierIdentifier> carriers) { public int setAllowedCarriers(int slotId, List<CarrierIdentifier> carriers) {
try { try {
ITelephony service = getITelephony(); ITelephony service = getITelephony();
@@ -5694,6 +5701,8 @@ public class TelephonyManager {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e); Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
} catch (NullPointerException e) {
Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
} }
return -1; return -1;
} }
@@ -5702,10 +5711,17 @@ public class TelephonyManager {
* Get the allowed carrier list for slotId. * Get the allowed carrier list for slotId.
* Require system privileges. In the future we may add this to carrier APIs. * Require system privileges. In the future we may add this to carrier APIs.
* *
* <p>Requires Permission:
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE}
*
* <p>This method returns valid data on devices with {@link
* android.content.pm.PackageManager#FEATURE_TELEPHONY_CARRIERLOCK} enabled.
*
* @return List of {@link android.telephony.CarrierIdentifier}; empty list * @return List of {@link android.telephony.CarrierIdentifier}; empty list
* means all carriers are allowed. * means all carriers are allowed.
* @hide * @hide
*/ */
@SystemApi
public List<CarrierIdentifier> getAllowedCarriers(int slotId) { public List<CarrierIdentifier> getAllowedCarriers(int slotId) {
try { try {
ITelephony service = getITelephony(); ITelephony service = getITelephony();
@@ -5714,6 +5730,8 @@ public class TelephonyManager {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e); Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
} catch (NullPointerException e) {
Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
} }
return new ArrayList<CarrierIdentifier>(0); return new ArrayList<CarrierIdentifier>(0);
} }