summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Deva <ganesh.deva_1@nxp.com>2020-07-22 19:21:16 +0530
committernxf24591 <nanjesh.s_1@nxp.com>2020-09-08 17:44:08 +0530
commit43d7b77df86bc370f74b8fc6ea4f9d8df29bfc79 (patch)
treed632189a3ffa3cb849af83a71760ace720c6035c
parented2d622a9f97b4be3278c3881dffb902e295c52e (diff)
Allow OpenLogicalChannel with null aid for privilege apps
Do not return null directly when application try to openLogicalChannel with null aid. Check if it is privilege application first.
-rwxr-xr-xsrc/com/android/se/SecureElementService.java3
-rwxr-xr-xsrc/com/android/se/Terminal.java6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/com/android/se/SecureElementService.java b/src/com/android/se/SecureElementService.java
index 715794d..e9a7b39 100755
--- a/src/com/android/se/SecureElementService.java
+++ b/src/com/android/se/SecureElementService.java
@@ -384,9 +384,6 @@ public final class SecureElementService extends Service {
throw new IllegalStateException("Session is closed");
} else if (listener == null) {
throw new NullPointerException("listener must not be null");
- } else if (((aid == null) || (aid.length == 0)) && mReader.getTerminal().getName()
- .startsWith(SecureElementService.UICC_TERMINAL)) {
- return null;
} else if ((p2 != 0x00) && (p2 != 0x04) && (p2 != 0x08)
&& (p2 != (byte) 0x0C)) {
throw new UnsupportedOperationException("p2 not supported: "
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java
index 4894aec..d86a52d 100755
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -575,7 +575,7 @@ public class Terminal {
packageName);
try {
channelAccess = setUpChannelAccess(aid, packageName, pid, false);
- } catch (MissingResourceException e) {
+ } catch (MissingResourceException | UnsupportedOperationException e) {
return null;
}
}
@@ -838,6 +838,10 @@ public class Terminal {
}
if (isBasicChannel) {
throw new MissingResourceException("openBasicChannel is not allowed.", "", "");
+ } else if (aid == null) {
+ // openLogicalChannel with null aid is only allowed for privilege applications
+ throw new UnsupportedOperationException(
+ "null aid is not accepted in UICC terminal.");
}
}