diff options
| -rw-r--r-- | core/api/system-current.txt | 12 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 186 |
2 files changed, 194 insertions, 4 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index cbfd86e5478f..fa2d1effe488 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -11661,10 +11661,14 @@ 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 @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.MODIFY_PHONE_STATE) public void iccCloseLogicalChannelByPort(int, int, int); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean iccCloseLogicalChannelBySlot(int, int); + method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannelByPort(int, int, @Nullable String, int); + method @Deprecated @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 iccTransmitApduBasicChannelByPort(int, int, int, int, int, int, int, @Nullable String); + method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduBasicChannelBySlot(int, int, int, int, int, int, @Nullable String); + method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduLogicalChannelByPort(int, int, int, int, int, int, int, int, @Nullable String); + method @Deprecated @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 isAnyRadioPoweredOn(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApnMetered(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index c66229875ee2..8441f547d582 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -6776,10 +6776,12 @@ public class TelephonyManager { * @param p2 P2 parameter (described in ISO 7816-4). * @return an IccOpenLogicalChannelResponse object. * @hide + * @deprecated instead use {@link #iccOpenLogicalChannelByPort(int, int, String, int)} */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @SystemApi @Nullable + @Deprecated public IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot(int slotIndex, @Nullable String aid, int p2) { try { @@ -6800,6 +6802,58 @@ public class TelephonyManager { } /** + * Opens a logical channel to the ICC card using the physical slot index and port index. + * + * Use this method when no subscriptions are available on the SIM and the operation must be + * performed using the physical slot index and port index. + * + * This operation wraps two APDU instructions: + * <ul> + * <li>MANAGE CHANNEL to open a logical channel</li> + * <li>SELECT the given {@code AID} using the given {@code p2}</li> + * </ul> + * + * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08, + * and 0x0C are guaranteed to be supported. + * + * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be + * considered an error and the channel shall not be opened. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * @param slotIndex the physical slot index of the ICC card + * @param portIndex The port index is an enumeration of the ports available on the UICC. + * Use {@link UiccPortInfo#getPortIndex()} to get portIndex. + * @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 + @NonNull + public IccOpenLogicalChannelResponse iccOpenLogicalChannelByPort(int slotIndex, + int portIndex, @Nullable String aid, int p2) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + IccLogicalChannelRequest request = new IccLogicalChannelRequest(); + request.slotIndex = slotIndex; + request.portIndex = portIndex; + request.aid = aid; + request.p2 = p2; + request.callingPackage = getOpPackageName(); + request.binder = new Binder(); + return telephony.iccOpenLogicalChannel(request); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + throw ex.rethrowAsRuntimeException(); + } + } + + /** * Opens a logical channel to the ICC card. * * This operation wraps two APDU instructions: @@ -6889,9 +6943,11 @@ public class TelephonyManager { * iccOpenLogicalChannel. * @return true if the channel was closed successfully. * @hide + * @deprecated instead use {@link #iccCloseLogicalChannelByPort(int, int, int)} */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @SystemApi + @Deprecated public boolean iccCloseLogicalChannelBySlot(int slotIndex, int channel) { try { ITelephony telephony = getITelephony(); @@ -6908,6 +6964,45 @@ public class TelephonyManager { } /** + * Closes a previously opened logical channel to the ICC card using the physical slot index and + * port index. + * + * Use this method when no subscriptions are available on the SIM and the operation must be + * performed using the physical slot index and port index. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * @param slotIndex the physical slot index of the ICC card + * @param portIndex The port index is an enumeration of the ports available on the UICC. + * Use {@link UiccPortInfo#getPortIndex()} to get portIndex. + * @param channel is the channel id to be closed as returned by a successful + * iccOpenLogicalChannel. + * + * @throws IllegalStateException if the Telephony process is not currently available or modem + * currently can't process this command. + * @throws IllegalArgumentException if invalid arguments are passed. + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + public void iccCloseLogicalChannelByPort(int slotIndex, int portIndex, int channel) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + IccLogicalChannelRequest request = new IccLogicalChannelRequest(); + request.slotIndex = slotIndex; + request.portIndex = portIndex; + request.channel = channel; + telephony.iccCloseLogicalChannel(request); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + throw ex.rethrowAsRuntimeException(); + } + } + + /** * Closes a previously opened logical channel to the ICC card. * * Input parameters equivalent to TS 27.007 AT+CCHC command. @@ -6978,10 +7073,13 @@ public class TelephonyManager { * @return The APDU response from the ICC card with the status appended at the end, or null if * there is an issue connecting to the Telephony service. * @hide + * @deprecated instead use + * {@link #iccTransmitApduLogicalChannelByPort(int, int, int, int, int, int, int, int, String)} */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @SystemApi @Nullable + @Deprecated public String iccTransmitApduLogicalChannelBySlot(int slotIndex, int channel, int cla, int instruction, int p1, int p2, int p3, @Nullable String data) { try { @@ -6997,6 +7095,50 @@ 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. + * + * @param slotIndex the physical slot index of the ICC card + * @param portIndex The port index is an enumeration of the ports available on the UICC. + * Use {@link UiccPortInfo#getPortIndex()} to get portIndex. + * @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, or null if + * there is an issue connecting to the Telephony service. + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + @NonNull + public String iccTransmitApduLogicalChannelByPort(int slotIndex, int portIndex, int channel, + int cla, int instruction, int p1, int p2, int p3, @Nullable String data) { + String response; + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + response = telephony.iccTransmitApduLogicalChannelByPort(slotIndex, portIndex, + channel, cla, instruction, p1, p2, p3, data); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + throw ex.rethrowAsRuntimeException(); + } + return response; + } + + /** * Transmit an APDU to the ICC card over a logical channel. * * Input parameters equivalent to TS 27.007 AT+CGLA command. @@ -7081,10 +7223,13 @@ public class TelephonyManager { * @return The APDU response from the ICC card with the status appended at * the end. * @hide + * @deprecated instead use + * {@link #iccTransmitApduBasicChannelByPort(int, int, int, int, int, int, int, String)} */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @SystemApi @NonNull + @Deprecated public String iccTransmitApduBasicChannelBySlot(int slotIndex, int cla, int instruction, int p1, int p2, int p3, @Nullable String data) { try { @@ -7100,6 +7245,47 @@ 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. + * + * @param slotIndex the physical slot index of the ICC card to target + * @param portIndex The port index is an enumeration of the ports available on the UICC. + * Use {@link UiccPortInfo#getPortIndex()} to get portIndex. + * @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 iccTransmitApduBasicChannelByPort(int slotIndex, int portIndex, int cla, + int instruction, int p1, int p2, int p3, @Nullable String data) { + String response; + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + response = telephony.iccTransmitApduBasicChannelByPort(slotIndex, portIndex, + getOpPackageName(), cla, instruction, p1, p2, p3, data); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + throw ex.rethrowAsRuntimeException(); + } + return response; + } + /** * Transmit an APDU to the ICC card over the basic channel. * * Input parameters equivalent to TS 27.007 AT+CSIM command. |