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

Commit 308bcec7 authored by Polina Bondarenko's avatar Polina Bondarenko Committed by android-build-merger
Browse files

Merge "Make TelephonyManager#get/setAllowedCarriers system api" am: 6d064d87 am: cf176500

am: b46a93ff

Change-Id: I8f17bef7ccde5953f5b810bd806fc51a4c69e194
parents 08d05b27 b46a93ff
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
+14 −0
Original line number Diff line number Diff line
@@ -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
+18 −0
Original line number Diff line number Diff line
@@ -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);
    }