summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt17
-rw-r--r--telephony/java/android/telephony/IccOpenLogicalChannelResponse.aidl20
-rw-r--r--telephony/java/android/telephony/IccOpenLogicalChannelResponse.java121
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java63
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl41
5 files changed, 254 insertions, 8 deletions
diff --git a/api/current.txt b/api/current.txt
index 1e5797a..b4c2e11 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -29237,6 +29237,20 @@ package android.telephony {
field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
}
+ public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
+ method public int describeContents();
+ method public int getChannel();
+ method public byte[] getSelectResponse();
+ method public int getStatus();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator CREATOR;
+ field public static int INVALID_CHANNEL;
+ field public static int MISSING_RESOURCE;
+ field public static int NO_ERROR;
+ field public static int NO_SUCH_ELEMENT;
+ field public static int UNKNOWN_ERROR;
+ }
+
public class MessagingConfigurationManager {
method public boolean getCarrierConfigBoolean(java.lang.String, boolean);
method public int getCarrierConfigInt(java.lang.String, int);
@@ -29559,7 +29573,8 @@ package android.telephony {
method public int hasCarrierPrivileges();
method public boolean hasIccCard();
method public boolean iccCloseLogicalChannel(int);
- method public int iccOpenLogicalChannel(java.lang.String);
+ method public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannel(java.lang.String);
+ method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String);
method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String);
method public boolean isNetworkRoaming();
method public boolean isSmsCapable();
diff --git a/telephony/java/android/telephony/IccOpenLogicalChannelResponse.aidl b/telephony/java/android/telephony/IccOpenLogicalChannelResponse.aidl
new file mode 100644
index 0000000..fe28c97
--- /dev/null
+++ b/telephony/java/android/telephony/IccOpenLogicalChannelResponse.aidl
@@ -0,0 +1,20 @@
+/*
+**
+** Copyright 2014, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.telephony;
+
+parcelable IccOpenLogicalChannelResponse;
diff --git a/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java b/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java
new file mode 100644
index 0000000..bb5e277
--- /dev/null
+++ b/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+
+/**
+ * Response to the {@link TelephonyManager#iccOpenLogicalChannel} command.
+ */
+public class IccOpenLogicalChannelResponse implements Parcelable {
+ // Indicates an invalid channel.
+ public static int INVALID_CHANNEL = -1;
+
+ // Possible status values.
+ public static int NO_ERROR = 1;
+ public static int MISSING_RESOURCE = 2;
+ public static int NO_SUCH_ELEMENT = 3;
+ public static int UNKNOWN_ERROR = 4;
+
+ private final int mChannel;
+ private final int mStatus;
+ private final byte[] mSelectResponse;
+
+ /**
+ * Constructor.
+ *
+ * @hide
+ */
+ public IccOpenLogicalChannelResponse(int channel, int status, byte[] selectResponse) {
+ mChannel = channel;
+ mStatus = status;
+ mSelectResponse = selectResponse;
+ }
+
+ /**
+ * Construct a IccOpenLogicalChannelResponse from a given parcel.
+ */
+ private IccOpenLogicalChannelResponse(Parcel in) {
+ mChannel = in.readInt();
+ mStatus = in.readInt();
+ int arrayLength = in.readInt();
+ if (arrayLength > 0) {
+ mSelectResponse = new byte[arrayLength];
+ in.readByteArray(mSelectResponse);
+ } else {
+ mSelectResponse = null;
+ }
+ }
+
+ /**
+ * @return the channel id.
+ */
+ public int getChannel() {
+ return mChannel;
+ }
+
+ /**
+ * @return the status of the command.
+ */
+ public int getStatus() {
+ return mStatus;
+ }
+
+ /**
+ * @return the select response.
+ */
+ public byte[] getSelectResponse() {
+ return mSelectResponse;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(mChannel);
+ out.writeInt(mStatus);
+ if (mSelectResponse != null & mSelectResponse.length > 0) {
+ out.writeInt(mSelectResponse.length);
+ out.writeByteArray(mSelectResponse);
+ } else {
+ out.writeInt(0);
+ }
+ }
+
+ public static final Parcelable.Creator<IccOpenLogicalChannelResponse> CREATOR
+ = new Parcelable.Creator<IccOpenLogicalChannelResponse>() {
+
+ @Override
+ public IccOpenLogicalChannelResponse createFromParcel(Parcel in) {
+ return new IccOpenLogicalChannelResponse(in);
+ }
+
+ public IccOpenLogicalChannelResponse[] newArray(int size) {
+ return new IccOpenLogicalChannelResponse[size];
+ }
+ };
+
+ @Override
+ public String toString() {
+ return "Channel: " + mChannel + " Status: " + mStatus;
+ }
+}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 35568cf..0772687 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -26,6 +26,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
+import android.util.Pair;
import com.android.internal.telecomm.ITelecommService;
import com.android.internal.telephony.IPhoneSubInfo;
@@ -2348,15 +2349,15 @@ public class TelephonyManager {
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
*
* @param AID Application id. See ETSI 102.221 and 101.220.
- * @return The logical channel id which is negative on error.
+ * @return an IccOpenLogicalChannelResponse object.
*/
- public int iccOpenLogicalChannel(String AID) {
+ public IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID) {
try {
return getITelephony().iccOpenLogicalChannel(AID);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
- return -1;
+ return null;
}
/**
@@ -2414,6 +2415,62 @@ public class TelephonyManager {
}
/**
+ * Transmit an APDU to the ICC card over the basic channel.
+ *
+ * Input parameters equivalent to TS 27.007 AT+CSIM command.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ *
+ * @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 iccTransmitApduBasicChannel(int cla,
+ int instruction, int p1, int p2, int p3, String data) {
+ try {
+ return getITelephony().iccTransmitApduBasicChannel(cla,
+ instruction, p1, p2, p3, data);
+ } catch (RemoteException ex) {
+ } catch (NullPointerException ex) {
+ }
+ return "";
+ }
+
+ /**
+ * Returns the response APDU for a command APDU sent through SIM_IO.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ *
+ * @param fileID
+ * @param 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.
+ * @param filePath
+ * @return The APDU response.
+ */
+ byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3,
+ String filePath) {
+ try {
+ return getITelephony().iccExchangeSimIO(fileID, command, p1, p2,
+ p3, filePath);
+ } catch (RemoteException ex) {
+ } catch (NullPointerException ex) {
+ }
+ return null;
+ }
+
+ /**
* Send ENVELOPE to the SIM and return the response.
*
* <p>Requires Permission:
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 886de40..72b04cf 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -18,9 +18,10 @@ package com.android.internal.telephony;
import android.content.Intent;
import android.os.Bundle;
-import java.util.List;
-import android.telephony.NeighboringCellInfo;
import android.telephony.CellInfo;
+import android.telephony.IccOpenLogicalChannelResponse;
+import android.telephony.NeighboringCellInfo;
+import java.util.List;
/**
@@ -499,9 +500,9 @@ interface ITelephony {
* 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.
+ * @return an IccOpenLogicalChannelResponse object.
*/
- int iccOpenLogicalChannel(String AID);
+ IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID);
/**
* Closes a previously opened logical channel to the ICC card.
@@ -535,6 +536,38 @@ interface ITelephony {
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.
+ *
+ * @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 iccTransmitApduBasicChannel(int cla, int instruction,
+ int p1, int p2, int p3, String data);
+
+ /**
+ * Returns the response APDU for a command APDU sent through SIM_IO.
+ *
+ * @param fileID
+ * @param 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.
+ * @param filePath
+ * @return The APDU response.
+ */
+ byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3,
+ String filePath);
+
+ /**
* Send ENVELOPE to the SIM and returns the response.
*
* @param contents String containing SAT/USAT response in hexadecimal