Merge "Add slot based ICC channel APIs"

This commit is contained in:
Jordan Liu
2019-03-18 18:36:54 +00:00
committed by Gerrit Code Review
3 changed files with 223 additions and 4 deletions

View File

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

View File

@@ -5163,6 +5163,40 @@ public class TelephonyManager {
return iccOpenLogicalChannel(getSubId(), AID, -1);
}
/**
* 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.
*
@@ -5206,6 +5240,38 @@ public class TelephonyManager {
return null;
}
/**
* 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.
*
@@ -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
@@ -5249,6 +5315,48 @@ public class TelephonyManager {
return false;
}
/**
* 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.
*
@@ -5312,6 +5420,46 @@ public class TelephonyManager {
return "";
}
/**
* 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.
*

View File

@@ -552,6 +552,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.
*
@@ -566,26 +580,59 @@ interface ITelephony {
IccOpenLogicalChannelResponse iccOpenLogicalChannel(
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.
*/
@UnsupportedAppUsage
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.
@@ -601,6 +648,26 @@ interface ITelephony {
String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction,
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.
*