summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Yu <jackcwyu@google.com>2020-05-28 18:02:01 +0800
committerJack Yu <jackcwyu@google.com>2020-06-03 20:43:26 +0800
commit79a2fb585586e203d6dc76cb38ec3c2d4a27a84a (patch)
treeee767c7d8eb55a157137794ec90d264930aa58ca
parentb8b2823edddd8275c1d154714f7965bbedfa1adb (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. Bug: 157349625 Test: openLogicalChannel with null aid Merged-In: Icf7ee2b299154874f1bdd4b5b409c7df04eb831b Change-Id: Icf7ee2b299154874f1bdd4b5b409c7df04eb831b
-rw-r--r--src/com/android/se/SecureElementService.java3
-rw-r--r--src/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 5ca4646..e979fd9 100644
--- a/src/com/android/se/SecureElementService.java
+++ b/src/com/android/se/SecureElementService.java
@@ -303,9 +303,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 fb507e0..ee3d7e7 100644
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -496,7 +496,7 @@ public class Terminal {
packageName);
try {
channelAccess = setUpChannelAccess(aid, packageName, pid, false);
- } catch (MissingResourceException e) {
+ } catch (MissingResourceException | UnsupportedOperationException e) {
return null;
}
}
@@ -738,6 +738,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.");
}
}