diff options
author | Shishir Agrawal <shishir@google.com> | 2014-06-23 13:45:05 -0700 |
---|---|---|
committer | Shishir Agrawal <shishir@google.com> | 2014-07-07 16:32:11 -0700 |
commit | 762d5a091f5e19b568bb0ff81a2cb6785b69075f (patch) | |
tree | b15df16a242b94e0f9453a926cb0e05883ef1a4b /telephony/java | |
parent | 4b0a7ab6a5650b21484c75075c89612cd1ce6078 (diff) | |
download | frameworks_base-762d5a091f5e19b568bb0ff81a2cb6785b69075f.zip frameworks_base-762d5a091f5e19b568bb0ff81a2cb6785b69075f.tar.gz frameworks_base-762d5a091f5e19b568bb0ff81a2cb6785b69075f.tar.bz2 |
SIM based carrier app privileges.
Adding support for SIM based carrier app privileges.
WIP - Missing bits:
- Notifications.
- Certificate check.
Change-Id: Ied3aa6c7d51cc0cde06f5bb58f30893d7a7b1c34
Diffstat (limited to 'telephony/java')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 34 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 12 |
2 files changed, 46 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index bd621e8..b29cc12 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2812,6 +2812,40 @@ public class TelephonyManager { } /** + * Values used to return status for hasCarrierPrivileges call. + */ + public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; + public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; + public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; + public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; + + /** + * Has the calling application been granted carrier privileges by the carrier. + * + * If any of the packages in the calling UID has carrier privileges, the + * call will return true. This access is granted by the owner of the UICC + * card and does not depend on the registered carrier. + * + * 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). + */ + public int hasCarrierPrivileges() { + try { + return getITelephony().hasCarrierPrivileges(); + } catch (RemoteException ex) { + Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "hasCarrierPrivileges NPE", ex); + } + return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; + } + + /** * Expose the rest of ITelephony to @SystemApi */ diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index ee04c06..5b6db4d 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -633,5 +633,17 @@ interface ITelephony { */ void setImsRegistrationState(boolean registered); + /** + * Has the calling application been granted special privileges by the carrier. + * + * If any of the packages in the calling UID has carrier privileges, the + * call will return true. This access is granted by the owner of the UICC + * card and does not depend on the registered carrier. + * + * TODO: Add a link to documentation. + * + * @return carrier privelege status defined in TelephonyManager. + */ + int hasCarrierPrivileges(); } |