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

* commit '0783a61d8a6f17ca0fe3d0e55a3c48aceec823d4':
  Carrierprivileges: Addressing API council suggestions.
This commit is contained in:
Shishir Agrawal
2014-11-21 00:43:23 +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 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

View File

@@ -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.
@@ -3068,9 +3064,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.
*/
@@ -3081,9 +3076,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;
/**
@@ -3095,21 +3094,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;
}
/**
@@ -3120,9 +3116,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.
@@ -3184,9 +3179,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;
}

View File

@@ -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.