diff --git a/api/current.txt b/api/current.txt index 7d1ee38b5c1aa..e4cc11a16bc65 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37310,7 +37310,8 @@ package android.telephony { method public java.lang.String getDeviceSoftwareVersion(); method public java.lang.String getGroupIdLevel1(); method public java.lang.String getGroupIdLevel1(int); - method public java.lang.String getIccSimChallengeResponse(int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, int, java.lang.String); method public java.lang.String getLine1AlphaTag(int); method public java.lang.String getLine1Number(); method public java.lang.String getLine1Number(int); @@ -37379,6 +37380,13 @@ package android.telephony { field public static final java.lang.String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL"; field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; + field public static final int APPTYPE_CSIM = 4; // 0x4 + field public static final int APPTYPE_ISIM = 5; // 0x5 + field public static final int APPTYPE_RUIM = 3; // 0x3 + field public static final int APPTYPE_SIM = 1; // 0x1 + field public static final int APPTYPE_USIM = 2; // 0x2 + field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81 + field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 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 diff --git a/api/system-current.txt b/api/system-current.txt index ff5747a935cfa..f63d2ac2d5893 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40005,7 +40005,8 @@ package android.telephony { method public java.lang.String getDeviceSoftwareVersion(); method public java.lang.String getGroupIdLevel1(); method public java.lang.String getGroupIdLevel1(int); - method public java.lang.String getIccSimChallengeResponse(int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, int, java.lang.String); method public java.lang.String getLine1AlphaTag(int); method public java.lang.String getLine1Number(); method public java.lang.String getLine1Number(int); @@ -40095,6 +40096,13 @@ package android.telephony { field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; field public static final java.lang.String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION"; + field public static final int APPTYPE_CSIM = 4; // 0x4 + field public static final int APPTYPE_ISIM = 5; // 0x5 + field public static final int APPTYPE_RUIM = 3; // 0x3 + field public static final int APPTYPE_SIM = 1; // 0x1 + field public static final int APPTYPE_USIM = 2; // 0x2 + field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81 + field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 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 diff --git a/api/test-current.txt b/api/test-current.txt index 5163e95a35812..d495d9f694ac1 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37382,7 +37382,8 @@ package android.telephony { method public java.lang.String getDeviceSoftwareVersion(); method public java.lang.String getGroupIdLevel1(); method public java.lang.String getGroupIdLevel1(int); - method public java.lang.String getIccSimChallengeResponse(int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, int, java.lang.String); method public java.lang.String getLine1AlphaTag(int); method public java.lang.String getLine1Number(); method public java.lang.String getLine1Number(int); @@ -37451,6 +37452,13 @@ package android.telephony { field public static final java.lang.String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL"; field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; + field public static final int APPTYPE_CSIM = 4; // 0x4 + field public static final int APPTYPE_ISIM = 5; // 0x5 + field public static final int APPTYPE_RUIM = 3; // 0x3 + field public static final int APPTYPE_SIM = 1; // 0x1 + field public static final int APPTYPE_USIM = 2; // 0x2 + field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81 + field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 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 diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b482811a18f23..865af7821ac2f 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3550,7 +3550,7 @@ public class TelephonyManager { * @return the response of ISIM Authetification, or null if not available * @hide * @deprecated - * @see getIccSimChallengeResponse with appType=PhoneConstants.APPTYPE_ISIM + * @see getIccAuthentication with appType=PhoneConstants.APPTYPE_ISIM */ public String getIsimChallengeResponse(String nonce){ try { @@ -3566,21 +3566,60 @@ public class TelephonyManager { } } + // ICC SIM Application Types + public static final int APPTYPE_SIM = PhoneConstants.APPTYPE_SIM; + public static final int APPTYPE_USIM = PhoneConstants.APPTYPE_USIM; + public static final int APPTYPE_RUIM = PhoneConstants.APPTYPE_RUIM; + public static final int APPTYPE_CSIM = PhoneConstants.APPTYPE_CSIM; + public static final int APPTYPE_ISIM = PhoneConstants.APPTYPE_ISIM; + // authContext (parameter P2) when doing SIM challenge, + // per 3GPP TS 31.102 (Section 7.1.2) + public static final int AUTHTYPE_EAP_SIM = PhoneConstants.AUTH_CONTEXT_EAP_SIM; + public static final int AUTHTYPE_EAP_AKA = PhoneConstants.AUTH_CONTEXT_EAP_AKA; + /** - * Returns the response of SIM Authentication through RIL. - * Returns null if the Authentication hasn't been successful - * @param subId subscription ID to be queried - * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) - * @param data authentication challenge data - * @return the response of SIM Authentication, or null if not available - * @hide + * Returns the response of authentication for the default subscription. + * Returns null if the authentication hasn't been successful + * + *

Requires that the calling app has carrier privileges or READ_PRIVILEGED_PHONE_STATE + * permission. + * + * @param appType the icc application type, like {@link #APPTYPE_USIM} + * @param authType the authentication type, {@link #AUTHTYPE_EAP_AKA} or + * {@link #AUTHTYPE_EAP_SIM} + * @param data authentication challenge data, base64 encoded. + * See 3GPP TS 31.102 7.1.2 for more details. + * @return the response of authentication, or null if not available + * + * @see #hasCarrierPrivileges */ - public String getIccSimChallengeResponse(int subId, int appType, String data) { + public String getIccAuthentication(int appType, int authType, String data) { + return getIccAuthentication(getDefaultSubscription(), appType, authType, data); + } + + /** + * Returns the response of USIM Authentication for specified subId. + * Returns null if the authentication hasn't been successful + * + *

Requires that the calling app has carrier privileges. + * + * @param subId subscription ID used for authentication + * @param appType the icc application type, like {@link #APPTYPE_USIM} + * @param authType the authentication type, {@link #AUTHTYPE_EAP_AKA} or + * {@link #AUTHTYPE_EAP_SIM} + * @param data authentication challenge data, base64 encoded. + * See 3GPP TS 31.102 7.1.2 for more details. + * @return the response of authentication, or null if not available + * + * @see #hasCarrierPrivileges + */ + + public String getIccAuthentication(int subId, int appType, int authType, String data) { try { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getIccSimChallengeResponse(subId, appType, data); + return info.getIccSimChallengeResponse(subId, appType, authType, data); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3599,9 +3638,10 @@ public class TelephonyManager { * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) * @param data authentication challenge data * @return the response of SIM Authentication, or null if not available + * @hide */ public String getIccSimChallengeResponse(int appType, String data) { - return getIccSimChallengeResponse(getDefaultSubscription(), appType, data); + return getIccAuthentication(getDefaultSubscription(), appType, AUTHTYPE_EAP_SIM, data); } /** diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index dc2b297f6dbe5..02baa34545363 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -196,8 +196,9 @@ interface IPhoneSubInfo { * * @param subId subscription ID to be queried * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) + * @param authType Authentication type, see PhoneConstants#AUTHTYPE_xxx * @param data authentication challenge data * @return challenge response */ - String getIccSimChallengeResponse(int subId, int appType, String data); + String getIccSimChallengeResponse(int subId, int appType, int authType, String data); } diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index ecd89eda45774..1680fe33ead79 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -202,4 +202,10 @@ public class PhoneConstants { public static final int AUDIO_OUTPUT_ENABLE_SPEAKER = 0; public static final int AUDIO_OUTPUT_DISABLE_SPEAKER = 1; public static final int AUDIO_OUTPUT_DEFAULT = AUDIO_OUTPUT_ENABLE_SPEAKER; + + // authContext (parameter P2) when doing SIM challenge, + // per 3GPP TS 31.102 (Section 7.1.2) + public static final int AUTH_CONTEXT_EAP_SIM = 128; + public static final int AUTH_CONTEXT_EAP_AKA = 129; + public static final int AUTH_CONTEXT_UNDEFINED = -1; }