summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYosuke Iwakura <yosuke.iwakura@sony.com>2019-03-22 12:43:44 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-03-22 12:43:44 -0700
commiteb643ce7efca53573268a5b37cb76d3a695e02aa (patch)
treefc6a200c50ec65091362a15a0e4bef009b450cf6
parent89a09c8c0e2d13b68e8ab78e046ca0c3a733a218 (diff)
parent3624ed8af1198b00c6ed07e1cfa3ad13d8e3b0fd (diff)
downloadSecureElement-eb643ce7efca53573268a5b37cb76d3a695e02aa.tar.gz
Merge "Add useful logs regarding channels and ATR"
am: 3624ed8af1 Change-Id: I6b24f6ffea277f001eb1f73941a86a7205d5d9e0
-rw-r--r--src/com/android/se/SecureElementService.java11
-rw-r--r--src/com/android/se/Terminal.java6
2 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/se/SecureElementService.java b/src/com/android/se/SecureElementService.java
index b38cb22..480141a 100644
--- a/src/com/android/se/SecureElementService.java
+++ b/src/com/android/se/SecureElementService.java
@@ -27,6 +27,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Binder;
+import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -40,6 +41,7 @@ import android.se.omapi.SEService;
import android.util.Log;
import com.android.se.Terminal.SecureElementReader;
+import com.android.se.internal.ByteArrayConverter;
import java.io.FileDescriptor;
import java.io.IOException;
@@ -58,6 +60,7 @@ public final class SecureElementService extends Service {
public static final String UICC_TERMINAL = "SIM";
public static final String ESE_TERMINAL = "eSE";
private final String mTag = "SecureElementService";
+ private static final boolean DEBUG = Build.IS_DEBUGGABLE;
// LinkedHashMap will maintain the order of insertion
private LinkedHashMap<String, Terminal> mTerminals = new LinkedHashMap<String, Terminal>();
private final ISecureElementService.Stub mSecureElementServiceBinder =
@@ -250,6 +253,10 @@ public final class SecureElementService extends Service {
@Override
public ISecureElementChannel openBasicChannel(byte[] aid, byte p2,
ISecureElementListener listener) throws RemoteException {
+ if (DEBUG) {
+ Log.i(mTag, "openBasicChannel() AID = "
+ + ByteArrayConverter.byteArrayToHexString(aid) + ", P2 = " + p2);
+ }
if (isClosed()) {
throw new IllegalStateException("Session is closed");
} else if (listener == null) {
@@ -289,6 +296,10 @@ public final class SecureElementService extends Service {
@Override
public ISecureElementChannel openLogicalChannel(byte[] aid, byte p2,
ISecureElementListener listener) throws RemoteException {
+ if (DEBUG) {
+ Log.i(mTag, "openLogicalChannel() AID = "
+ + ByteArrayConverter.byteArrayToHexString(aid) + ", P2 = " + p2);
+ }
if (isClosed()) {
throw new IllegalStateException("Session is closed");
} else if (listener == null) {
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java
index 35c32f6..9220fbf 100644
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -312,7 +312,11 @@ public class Terminal {
if (responseList.isEmpty()) {
return null;
}
- return arrayListToByteArray(responseList);
+ byte[] atr = arrayListToByteArray(responseList);
+ if (DEBUG) {
+ Log.i(mTag, "ATR : " + ByteArrayConverter.byteArrayToHexString(atr));
+ }
+ return atr;
} catch (RemoteException e) {
Log.e(mTag, "Exception in getAtr()" + e);
return null;