Merge "Make TelephonyManager#get/setAllowedCarriers system api"
This commit is contained in:
committed by
Android (Google) Code Review
commit
22e1cbad24
@@ -10634,6 +10634,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";
|
||||
@@ -41556,6 +41557,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);
|
||||
@@ -41631,6 +41633,7 @@ package android.telephony {
|
||||
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
|
||||
method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
|
||||
method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
|
||||
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);
|
||||
|
||||
@@ -1861,6 +1861,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
|
||||
|
||||
@@ -5809,10 +5809,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();
|
||||
@@ -5821,6 +5828,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;
|
||||
}
|
||||
@@ -5829,10 +5838,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();
|
||||
@@ -5841,6 +5857,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