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

* commit 'a9b67771547a89ad08ffb5008adb89dde4009d9a':
  Carrierprivileges: Addressing API council suggestions.
This commit is contained in:
Shishir Agrawal
2014-11-20 17:50:25 +00:00
committed by Android Git Automerger
3 changed files with 29 additions and 38 deletions

View File

@@ -28691,7 +28691,7 @@ package android.telephony {
method public java.lang.String getSubscriberId(); method public java.lang.String getSubscriberId();
method public java.lang.String getVoiceMailAlphaTag(); method public java.lang.String getVoiceMailAlphaTag();
method public java.lang.String getVoiceMailNumber(); method public java.lang.String getVoiceMailNumber();
method public int hasCarrierPrivileges(); method public boolean hasCarrierPrivileges();
method public boolean hasIccCard(); method public boolean hasIccCard();
method public boolean iccCloseLogicalChannel(int); method public boolean iccCloseLogicalChannel(int);
method public byte[] iccExchangeSimIO(int, int, int, int, int, java.lang.String); 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_IDLE = 0; // 0x0
field public static final int CALL_STATE_OFFHOOK = 2; // 0x2 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 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_DORMANT = 4; // 0x4
field public static final int DATA_ACTIVITY_IN = 1; // 0x1 field public static final int DATA_ACTIVITY_IN = 1; // 0x1
field public static final int DATA_ACTIVITY_INOUT = 3; // 0x3 field public static final int DATA_ACTIVITY_INOUT = 3; // 0x3

View File

@@ -1797,10 +1797,9 @@ public class TelephonyManager {
* for display purpose only, for example, displayed in Phone Status. It won't * 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 * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
* value. * value.
* <p> *
* Requires Permission: * <p>Requires that the calling app has carrier privileges.
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * @see #hasCarrierPrivileges
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
* *
* @param alphaTag alpha-tagging of the dailing nubmer * @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number * @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 * 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 * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
* value. * value.
* <p> *
* Requires Permission: * <p>Requires that the calling app has carrier privileges.
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * @see #hasCarrierPrivileges
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
* *
* @param subId the subscriber that the alphatag and dialing number belongs to. * @param subId the subscriber that the alphatag and dialing number belongs to.
* @param alphaTag alpha-tagging of the dailing nubmer * @param alphaTag alpha-tagging of the dailing nubmer
@@ -1974,10 +1972,9 @@ public class TelephonyManager {
/** /**
* Sets the voice mail number. * Sets the voice mail number.
* <p> *
* Requires Permission: * <p>Requires that the calling app has carrier privileges.
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * @see #hasCarrierPrivileges
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
* *
* @param alphaTag The alpha tag to display. * @param alphaTag The alpha tag to display.
* @param number The voicemail number. * @param number The voicemail number.
@@ -1988,10 +1985,9 @@ public class TelephonyManager {
/** /**
* Sets the voicemail number for the given subscriber. * Sets the voicemail number for the given subscriber.
* <p> *
* Requires Permission: * <p>Requires that the calling app has carrier privileges.
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * @see #hasCarrierPrivileges
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
* *
* @param subId The subscriber id. * @param subId The subscriber id.
* @param alphaTag The alpha tag to display. * @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. * Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
* *
* <p> * <p>
* Requires Permission: * Requires that the calling app has carrier privileges.
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * @see #hasCarrierPrivileges
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
* *
* @return true on success; false on any failure. * @return true on success; false on any failure.
*/ */
@@ -3085,9 +3080,13 @@ public class TelephonyManager {
/** /**
* Values used to return status for hasCarrierPrivileges call. * Values used to return status for hasCarrierPrivileges call.
*/ */
/** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1;
/** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0;
/** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1;
/** @hide */
public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2;
/** /**
@@ -3099,21 +3098,18 @@ public class TelephonyManager {
* *
* TODO: Add a link to documentation. * TODO: Add a link to documentation.
* *
* @return CARRIER_PRIVILEGE_STATUS_HAS_ACCESS if the app has carrier privileges. * @return true 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).
*/ */
public int hasCarrierPrivileges() { public boolean hasCarrierPrivileges() {
try { try {
return getITelephony().hasCarrierPrivileges(); return getITelephony().getCarrierPrivilegeStatus() ==
CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
} catch (RemoteException ex) { } catch (RemoteException ex) {
Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex); Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
Rlog.e(TAG, "hasCarrierPrivileges NPE", 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 * brand value input. To unset the value, the same function should be
* called with a null brand value. * called with a null brand value.
* *
* <p>Requires Permission: * <p>Requires that the calling app has carrier privileges.
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * @see #hasCarrierPrivileges
* or has to be carrier app - see #hasCarrierPrivileges.
* *
* @param brand The brand name to display/set. * @param brand The brand name to display/set.
* @return true if the operation was executed correctly. * @return true if the operation was executed correctly.
@@ -3188,9 +3183,9 @@ public class TelephonyManager {
try { try {
return getITelephony().checkCarrierPrivilegesForPackage(pkgname); return getITelephony().checkCarrierPrivilegesForPackage(pkgname);
} catch (RemoteException ex) { } catch (RemoteException ex) {
Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex); Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex);
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
Rlog.e(TAG, "hasCarrierPrivileges NPE", ex); Rlog.e(TAG, "checkCarrierPrivilegesForPackage NPE", ex);
} }
return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; return CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
} }

View File

@@ -713,7 +713,7 @@ interface ITelephony {
* *
* @return carrier privilege status defined in TelephonyManager. * @return carrier privilege status defined in TelephonyManager.
*/ */
int hasCarrierPrivileges(); int getCarrierPrivilegeStatus();
/** /**
* Similar to above, but check for pkg whose name is pkgname. * Similar to above, but check for pkg whose name is pkgname.