diff options
author | Shishir Agrawal <shishir@google.com> | 2013-10-28 14:25:38 -0700 |
---|---|---|
committer | Shishir Agrawal <shishir@google.com> | 2013-12-12 16:57:38 -0800 |
commit | 57f656b9f6271cf857b5ecec5f8c7eacb321ec0b (patch) | |
tree | 005bf310b7a59d39b49d41d61124b64f9d4b491a /telephony/java | |
parent | 7d2edfc073b4a87f9584e12b0c6e80cffea730f5 (diff) | |
download | frameworks_base-57f656b9f6271cf857b5ecec5f8c7eacb321ec0b.zip frameworks_base-57f656b9f6271cf857b5ecec5f8c7eacb321ec0b.tar.gz frameworks_base-57f656b9f6271cf857b5ecec5f8c7eacb321ec0b.tar.bz2 |
Adding support for SIM communication from Android over logical channels.
Expose the folowing commands in ITelephony.aidl and TelephonyManager:
- iccOpenLogicalChannel
- iccCloseLogicalChannel
- iccTransmitApduLogicalChannel
Also add a new SIM_COMMUNICATION permission (maked as dangerous) to control
access to the above commands.
Change-Id: I89c08adc6f9738907e3b547c749f3cc61f300710
Diffstat (limited to 'telephony/java')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 63 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 42 |
2 files changed, 104 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 8f17e72..e0602ed 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1439,4 +1439,67 @@ public class TelephonyManager { return mContext.getResources().getString( com.android.internal.R.string.config_mms_user_agent_profile_url); } + + /** + * Opens a logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * @param AID Application id. See ETSI 102.221 and 101.220. + * @return The logical channel id which is negative on error. + */ + public int iccOpenLogicalChannel(String AID) { + try { + return getITelephony().iccOpenLogicalChannel(AID); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return -1; + } + + /** + * Closes a previously opened logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * @param channel is the channel id to be closed as retruned by a successful + * iccOpenLogicalChannel. + * @return true if the channel was closed successfully. + */ + public boolean iccCloseLogicalChannel(int channel) { + try { + return getITelephony().iccCloseLogicalChannel(channel); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return false; + } + + /** + * Transmit an APDU to the ICC card over a logical channel. + * + * Input parameters equivalent to TS 27.007 AT+CGLA command. + * + * @param channel is the channel id to be closed as retruned by a successful + * iccOpenLogicalChannel. + * @param cla Class of the APDU command. + * @param instruction Instruction of the APDU command. + * @param p1 P1 value of the APDU command. + * @param p2 P2 value of the APDU command. + * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU + * is sent to the SIM. + * @param data Data to be sent with the APDU. + * @return The APDU response from the ICC card with the status appended at + * the end. If an error occurs, an empty string is returned. + */ + public String iccTransmitApduLogicalChannel(int channel, int cla, + int command, int p1, int p2, int p3, String data) { + try { + return getITelephony().iccTransmitApduLogicalChannel(channel, cla, + command, p1, p2, p3, data); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return ""; + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 7bd2c84..55da644 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -324,5 +324,45 @@ interface ITelephony { * Sets minimum time in milli-seconds between onCellInfoChanged */ void setCellInfoListRate(int rateInMillis); -} + /** + * Opens a logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * @param AID Application id. See ETSI 102.221 and 101.220. + * @return The logical channel id which is set to -1 on error. + */ + int iccOpenLogicalChannel(String AID); + + /** + * Closes a previously opened logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * @param channel is the channel id to be closed as retruned by a + * successful iccOpenLogicalChannel. + * @return true if the channel was closed successfully. + */ + boolean iccCloseLogicalChannel(int channel); + + /** + * Transmit an APDU to the ICC card over a logical channel. + * + * Input parameters equivalent to TS 27.007 AT+CGLA command. + * + * @param channel is the channel id to be closed as retruned by a + * successful iccOpenLogicalChannel. + * @param cla Class of the APDU command. + * @param instruction Instruction of the APDU command. + * @param p1 P1 value of the APDU command. + * @param p2 P2 value of the APDU command. + * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU + * is sent to the SIM. + * @param data Data to be sent with the APDU. + * @return The APDU response from the ICC card with the status appended at + * the end. If an error occurs, an empty string is returned. + */ + String iccTransmitApduLogicalChannel(int channel, int cla, int command, + int p1, int p2, int p3, String data); +} |