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

Commit 0783a61d authored by Shishir Agrawal's avatar Shishir Agrawal Committed by Android Git Automerger
Browse files

am a9b67771: Merge "Carrierprivileges: Addressing API council suggestions." into lmp-mr1-dev

* commit 'a9b67771':
  Carrierprivileges: Addressing API council suggestions.
parents 57b641a2 a9b67771
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -28691,7 +28691,7 @@ package android.telephony {
    method public java.lang.String getSubscriberId();
    method public java.lang.String getVoiceMailAlphaTag();
    method public java.lang.String getVoiceMailNumber();
    method public int hasCarrierPrivileges();
    method public boolean hasCarrierPrivileges();
    method public boolean hasIccCard();
    method public boolean iccCloseLogicalChannel(int);
    method public byte[] iccExchangeSimIO(int, int, int, int, int, java.lang.String);
@@ -28711,10 +28711,6 @@ package android.telephony {
    field public static final int CALL_STATE_IDLE = 0; // 0x0
    field public static final int CALL_STATE_OFFHOOK = 2; // 0x2
    field public static final int CALL_STATE_RINGING = 1; // 0x1
    field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe
    field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1
    field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0
    field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff
    field public static final int DATA_ACTIVITY_DORMANT = 4; // 0x4
    field public static final int DATA_ACTIVITY_IN = 1; // 0x1
    field public static final int DATA_ACTIVITY_INOUT = 3; // 0x3
+27 −32
Original line number Diff line number Diff line
@@ -1797,10 +1797,9 @@ public class TelephonyManager {
     * for display purpose only, for example, displayed in Phone Status. It won't
     * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
     * value.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * <p>Requires that the calling app has carrier privileges.
     * @see #hasCarrierPrivileges
     *
     * @param alphaTag alpha-tagging of the dailing nubmer
     * @param number The dialing number
@@ -1814,10 +1813,9 @@ public class TelephonyManager {
     * for display purpose only, for example, displayed in Phone Status. It won't
     * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
     * value.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * <p>Requires that the calling app has carrier privileges.
     * @see #hasCarrierPrivileges
     *
     * @param subId the subscriber that the alphatag and dialing number belongs to.
     * @param alphaTag alpha-tagging of the dailing nubmer
@@ -1974,10 +1972,9 @@ public class TelephonyManager {

    /**
     * Sets the voice mail number.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * <p>Requires that the calling app has carrier privileges.
     * @see #hasCarrierPrivileges
     *
     * @param alphaTag The alpha tag to display.
     * @param number The voicemail number.
@@ -1988,10 +1985,9 @@ public class TelephonyManager {

    /**
     * Sets the voicemail number for the given subscriber.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * <p>Requires that the calling app has carrier privileges.
     * @see #hasCarrierPrivileges
     *
     * @param subId The subscriber id.
     * @param alphaTag The alpha tag to display.
@@ -3072,9 +3068,8 @@ public class TelephonyManager {
     * Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
     *
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     * Requires that the calling app has carrier privileges.
     * @see #hasCarrierPrivileges
     *
     * @return true on success; false on any failure.
     */
@@ -3085,9 +3080,13 @@ public class TelephonyManager {
    /**
     * Values used to return status for hasCarrierPrivileges call.
     */
    /** @hide */
    public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1;
    /** @hide */
    public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0;
    /** @hide */
    public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1;
    /** @hide */
    public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2;

    /**
@@ -3099,21 +3098,18 @@ public class TelephonyManager {
     *
     * TODO: Add a link to documentation.
     *
     * @return CARRIER_PRIVILEGE_STATUS_HAS_ACCESS if the app has carrier privileges.
     *         CARRIER_PRIVILEGE_STATUS_NO_ACCESS if the app does not have carrier privileges.
     *         CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED if the carrier rules are not loaded.
     *         CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES if there was an error loading carrier
     *             rules (or if there are no rules).
     * @return true if the app has carrier privileges.
     */
    public int hasCarrierPrivileges() {
    public boolean hasCarrierPrivileges() {
        try {
            return getITelephony().hasCarrierPrivileges();
            return getITelephony().getCarrierPrivilegeStatus() ==
                CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
        } catch (RemoteException ex) {
            Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
        } catch (NullPointerException ex) {
            Rlog.e(TAG, "hasCarrierPrivileges NPE", ex);
        }
        return CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
        return false;
    }

    /**
@@ -3124,9 +3120,8 @@ public class TelephonyManager {
     * brand value input. To unset the value, the same function should be
     * called with a null brand value.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     *  or has to be carrier app - see #hasCarrierPrivileges.
     * <p>Requires that the calling app has carrier privileges.
     * @see #hasCarrierPrivileges
     *
     * @param brand The brand name to display/set.
     * @return true if the operation was executed correctly.
@@ -3188,9 +3183,9 @@ public class TelephonyManager {
        try {
            return getITelephony().checkCarrierPrivilegesForPackage(pkgname);
        } catch (RemoteException ex) {
            Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
            Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex);
        } catch (NullPointerException ex) {
            Rlog.e(TAG, "hasCarrierPrivileges NPE", ex);
            Rlog.e(TAG, "checkCarrierPrivilegesForPackage NPE", ex);
        }
        return CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
    }
+1 −1
Original line number Diff line number Diff line
@@ -713,7 +713,7 @@ interface ITelephony {
     *
     * @return carrier privilege status defined in TelephonyManager.
     */
    int hasCarrierPrivileges();
    int getCarrierPrivilegeStatus();

    /**
     * Similar to above, but check for pkg whose name is pkgname.