Merge "Make TelephonyManager#get/setAllowedCarriers system api"
This commit is contained in:
@@ -10253,6 +10253,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_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_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_GSM = "android.hardware.telephony.gsm";
|
||||
field public static final deprecated java.lang.String FEATURE_TELEVISION = "android.hardware.type.television";
|
||||
@@ -40770,6 +40771,7 @@ package android.telephony {
|
||||
method public void enableVideoCalling(boolean);
|
||||
method public boolean endCall();
|
||||
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 android.os.PersistableBundle getCarrierConfig();
|
||||
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
|
||||
@@ -40843,6 +40845,7 @@ package android.telephony {
|
||||
method public void listen(android.telephony.PhoneStateListener, int);
|
||||
method public boolean needsOtaServiceProvisioning();
|
||||
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(int, boolean);
|
||||
method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String);
|
||||
|
||||
@@ -1809,6 +1809,20 @@ public abstract class PackageManager {
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
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
|
||||
* {@link #hasSystemFeature}: The device supports connecting to USB devices
|
||||
|
||||
@@ -5682,10 +5682,17 @@ public class TelephonyManager {
|
||||
* Set the allowed carrier list for slotId
|
||||
* 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
|
||||
* carrierList on success; -1 on error.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public int setAllowedCarriers(int slotId, List<CarrierIdentifier> carriers) {
|
||||
try {
|
||||
ITelephony service = getITelephony();
|
||||
@@ -5694,6 +5701,8 @@ public class TelephonyManager {
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
|
||||
} catch (NullPointerException e) {
|
||||
Log.e(TAG, "Error calling ITelephony#setAllowedCarriers", e);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -5702,10 +5711,17 @@ public class TelephonyManager {
|
||||
* Get the allowed carrier list for slotId.
|
||||
* 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
|
||||
* means all carriers are allowed.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public List<CarrierIdentifier> getAllowedCarriers(int slotId) {
|
||||
try {
|
||||
ITelephony service = getITelephony();
|
||||
@@ -5714,6 +5730,8 @@ public class TelephonyManager {
|
||||
}
|
||||
} catch (RemoteException 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user