diff options
| author | 2019-03-18 13:56:12 -0700 | |
|---|---|---|
| committer | 2019-03-18 13:56:12 -0700 | |
| commit | dc0ac4fa83e563174fa4d3b1cdbda75d33aa8573 (patch) | |
| tree | a4f433c1fe6376c2fd52e968483184737d0b9c97 | |
| parent | 8f1a1f83dcdfad98d313a1625e239ac3cc9f7bea (diff) | |
| parent | ca075c31767adf1c1b75dbb6194e9ee3a3603f62 (diff) | |
Merge "Add slot based ICC channel APIs" am: e278d2bcdd
am: ca075c3176
Change-Id: Ia43d743a06f21a812f74f98541e618f627dcf4a7
| -rw-r--r-- | api/system-current.txt | 4 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 152 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 71 |
3 files changed, 223 insertions, 4 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index f416ef993f48..e6f5252e2a06 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6397,6 +6397,10 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoiceActivationState(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handlePinMmi(String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handlePinMmiForSubscriber(int, String); + method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean iccCloseLogicalChannelBySlot(int, int); + method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot(int, @Nullable String, int); + method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduBasicChannelBySlot(int, int, int, int, int, int, @Nullable String); + method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduLogicalChannelBySlot(int, int, int, int, int, int, int, @Nullable String); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCurrentPotentialEmergencyNumber(@NonNull String); method public boolean isDataConnectivityPossible(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 103bab2f154b..36fb0202da54 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5164,6 +5164,40 @@ public class TelephonyManager { } /** + * Opens a logical channel to the ICC card using the physical slot index. + * + * Use this method when no subscriptions are available on the SIM and the operation must be + * performed using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}. + * + * @param slotIndex the physical slot index of the ICC card + * @param aid Application id. See ETSI 102.221 and 101.220. + * @param p2 P2 parameter (described in ISO 7816-4). + * @return an IccOpenLogicalChannelResponse object. + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + @Nullable + public IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot(int slotIndex, + @Nullable String aid, int p2) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.iccOpenLogicalChannelBySlot(slotIndex, getOpPackageName(), aid, + p2); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; + } + + /** * Opens a logical channel to the ICC card. * * Input parameters equivalent to TS 27.007 AT+CCHO command. @@ -5207,6 +5241,38 @@ public class TelephonyManager { } /** + * Closes a previously opened logical channel to the ICC card using the physical slot index. + * + * Use this method when no subscriptions are available on the SIM and the operation must be + * performed using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}. + * + * @param slotIndex the physical slot index of the ICC card + * @param channel is the channel id to be closed as returned by a successful + * iccOpenLogicalChannel. + * @return true if the channel was closed successfully. + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + @Nullable + public boolean iccCloseLogicalChannelBySlot(int slotIndex, int channel) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.iccCloseLogicalChannelBySlot(slotIndex, channel); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return false; + } + + /** * Closes a previously opened logical channel to the ICC card. * * Input parameters equivalent to TS 27.007 AT+CCHC command. @@ -5215,7 +5281,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * - * @param channel is the channel id to be closed as retruned by a successful + * @param channel is the channel id to be closed as returned by a successful * iccOpenLogicalChannel. * @return true if the channel was closed successfully. */ @@ -5233,7 +5299,7 @@ public class TelephonyManager { * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @param subId The subscription to use. - * @param channel is the channel id to be closed as retruned by a successful + * @param channel is the channel id to be closed as returned by a successful * iccOpenLogicalChannel. * @return true if the channel was closed successfully. * @hide @@ -5250,6 +5316,48 @@ public class TelephonyManager { } /** + * Transmit an APDU to the ICC card over a logical channel using the physical slot index. + * + * Use this method when no subscriptions are available on the SIM and the operation must be + * performed using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CGLA command. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}. + * + * @param slotIndex the physical slot index of the ICC card + * @param channel is the channel id to be closed as returned 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. + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + @Nullable + public String iccTransmitApduLogicalChannelBySlot(int slotIndex, int channel, int cla, + int instruction, int p1, int p2, int p3, @Nullable String data) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.iccTransmitApduLogicalChannelBySlot(slotIndex, channel, cla, + instruction, p1, p2, p3, data); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; + } + + /** * Transmit an APDU to the ICC card over a logical channel. * * Input parameters equivalent to TS 27.007 AT+CGLA command. @@ -5313,6 +5421,46 @@ public class TelephonyManager { } /** + * Transmit an APDU to the ICC card over the basic channel using the physical slot index. + * + * Use this method when no subscriptions are available on the SIM and the operation must be + * performed using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CSIM command. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}. + * + * @param slotIndex the physical slot index of the ICC card to target + * @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. + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + @NonNull + public String iccTransmitApduBasicChannelBySlot(int slotIndex, int cla, int instruction, int p1, + int p2, int p3, @Nullable String data) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.iccTransmitApduBasicChannelBySlot(slotIndex, getOpPackageName(), + cla, instruction, p1, p2, p3, data); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; + } + + /** * Transmit an APDU to the ICC card over the basic channel. * * Input parameters equivalent to TS 27.007 AT+CSIM command. diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 417618c9c333..672ea0b21340 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -553,6 +553,20 @@ interface ITelephony { void setCellInfoListRate(int rateInMillis); /** + * Opens a logical channel to the ICC card using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * @param slotIndex The physical slot index of the target ICC card + * @param callingPackage the name of the package making the call. + * @param AID Application id. See ETSI 102.221 and 101.220. + * @param p2 P2 parameter (described in ISO 7816-4). + * @return an IccOpenLogicalChannelResponse object. + */ + IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot( + int slotIndex, String callingPackage, String AID, int p2); + + /** * Opens a logical channel to the ICC card. * * Input parameters equivalent to TS 27.007 AT+CCHO command. @@ -567,12 +581,24 @@ interface ITelephony { int subId, String callingPackage, String AID, int p2); /** + * Closes a previously opened logical channel to the ICC card using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * @param slotIndex The physical slot index of the target ICC card + * @param channel is the channel id to be closed as returned by a + * successful iccOpenLogicalChannel. + * @return true if the channel was closed successfully. + */ + boolean iccCloseLogicalChannelBySlot(int slotIndex, int channel); + + /** * Closes a previously opened logical channel to the ICC card. * * Input parameters equivalent to TS 27.007 AT+CCHC command. * * @param subId The subscription to use. - * @param channel is the channel id to be closed as retruned by a + * @param channel is the channel id to be closed as returned by a * successful iccOpenLogicalChannel. * @return true if the channel was closed successfully. */ @@ -580,12 +606,33 @@ interface ITelephony { boolean iccCloseLogicalChannel(int subId, int channel); /** + * Transmit an APDU to the ICC card over a logical channel using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CGLA command. + * + * @param slotIndex The physical slot index of the target ICC card + * @param channel is the channel id to be closed as returned 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. + */ + String iccTransmitApduLogicalChannelBySlot(int slotIndex, int channel, int cla, int instruction, + int p1, int p2, int p3, String data); + + /** * Transmit an APDU to the ICC card over a logical channel. * * Input parameters equivalent to TS 27.007 AT+CGLA command. * * @param subId The subscription to use. - * @param channel is the channel id to be closed as retruned by a + * @param channel is the channel id to be closed as returned by a * successful iccOpenLogicalChannel. * @param cla Class of the APDU command. * @param instruction Instruction of the APDU command. @@ -602,6 +649,26 @@ interface ITelephony { int p1, int p2, int p3, String data); /** + * Transmit an APDU to the ICC card over the basic channel using the physical slot index. + * + * Input parameters equivalent to TS 27.007 AT+CSIM command. + * + * @param slotIndex The physical slot index of the target ICC card + * @param callingPackage the name of the package making the call. + * @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. + */ + String iccTransmitApduBasicChannelBySlot(int slotIndex, String callingPackage, int cla, + int instruction, int p1, int p2, int p3, String data); + + /** * Transmit an APDU to the ICC card over the basic channel. * * Input parameters equivalent to TS 27.007 AT+CSIM command. |