SIM based carrier app privileges.

Adding support for SIM based carrier app privileges.

WIP - Missing bits:
- Notifications.
- Certificate check.

Change-Id: Ied3aa6c7d51cc0cde06f5bb58f30893d7a7b1c34
This commit is contained in:
Shishir Agrawal
2014-06-23 13:45:05 -07:00
parent 4b0a7ab6a5
commit 762d5a091f
3 changed files with 56 additions and 5 deletions

View File

@@ -16288,20 +16288,20 @@ package android.net {
method public void unregisterDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
method public void unregisterNetworkCallback(android.net.ConnectivityManager.NetworkCallback);
field public static final deprecated java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
field public static final java.lang.String ACTION_CAPTIVE_PORTAL_DETECTED = "android.net.conn.CAPTIVE_PORTAL_DETECTED";
field public static final java.lang.String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL_SIGN_IN";
field public static final int CAPTIVE_PORTAL_DISCONNECT = 2; // 0x2
field public static final int CAPTIVE_PORTAL_SIGNED_IN = 1; // 0x1
field public static final java.lang.String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
field public static final deprecated int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1
field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo";
field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover";
field public static final java.lang.String EXTRA_NETWORK = "network";
field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
field public static final java.lang.String EXTRA_NETWORK_TYPE = "networkType";
field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
field public static final java.lang.String EXTRA_REASON = "reason";
field public static final java.lang.String ACTION_CAPTIVE_PORTAL_DETECTED = "android.net.conn.CAPTIVE_PORTAL_DETECTED";
field public static final java.lang.String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL_SIGN_IN";
field public static final java.lang.String EXTRA_NETWORK = "network";
field public static final int CAPTIVE_PORTAL_SIGNED_IN = 1;
field public static final int CAPTIVE_PORTAL_DISCONNECT = 2;
field public static final int TYPE_BLUETOOTH = 7; // 0x7
field public static final int TYPE_DUMMY = 8; // 0x8
field public static final int TYPE_ETHERNET = 9; // 0x9
@@ -28327,6 +28327,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 hasIccCard();
method public boolean isNetworkRoaming();
method public void listen(android.telephony.PhoneStateListener, int);
@@ -28335,6 +28336,10 @@ 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

@@ -2811,6 +2811,40 @@ public class TelephonyManager {
return false;
}
/**
* 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
*/

View File

@@ -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();
}