Fix for null pointer exception when logical channel opened
with empty AID.
Empty byte array is passing when the received aid is set to null.
Bug: 266649129
Test: Manual openLogicalChannel with empty AID
Change-Id: I335468b6be5aeb87f6fa84e33d036db1c37dfcc5
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java
index 25bb896..5bb3e3b 100644
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -670,7 +670,7 @@
try {
responseArray[0] = new LogicalChannelResponse();
android.hardware.secure_element.LogicalChannelResponse aidlRs =
- mAidlHal.openLogicalChannel(aid, p2);
+ mAidlHal.openLogicalChannel(aid == null ? new byte[0] : aid, p2);
responseArray[0].channelNumber = aidlRs.channelNumber;
responseArray[0].selectResponse = byteArrayToArrayList(aidlRs.selectResponse);
} catch (RemoteException e) {
@@ -712,7 +712,6 @@
Channel logicalChannel = new Channel(session, this, channelNumber,
selectResponse, aid, listener);
logicalChannel.setChannelAccess(channelAccess);
-
mChannels.put(channelNumber, logicalChannel);
return logicalChannel;
}