summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2018-03-12 14:49:01 -0700
committerRuchi Kandoi <kandoiruchi@google.com>2018-03-13 21:49:54 +0000
commitfffcc4e3ff78f746101858c1e055ae681ea343a7 (patch)
treeba7be664beef0a040c683a4a6634b33b03b6d622
parent1fbd76148b61a489d99a3838c765839c69243543 (diff)
downloadSecureElement-fffcc4e3ff78f746101858c1e055ae681ea343a7.tar.gz
Call close() HAL interface for basic channels as well
HAL implementations needs an indication when there aren't any active channels so that lower power mode can be achieved. Calling close for basic channel will inform them when basic channel is not in use. Test: Test application; open/close basic channel Bug: 74550883 Change-Id: Idaaac62bc26af664a2fc9fffa96e179804905553 (cherry picked from commit 31ba2b29aee9f43e4083e78eaa22d9cc94754de5)
-rw-r--r--src/com/android/se/Terminal.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java
index 4042709..c1aeb2c 100644
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -136,10 +136,15 @@ public class Terminal {
if (channel == null) {
return;
}
- if (mIsConnected && !channel.isBasicChannel()) {
+ if (mIsConnected) {
try {
byte status = mSEHal.closeChannel((byte) channel.getChannelNumber());
- if (status != SecureElementStatus.SUCCESS) {
+ /* For Basic Channels, errors are expected.
+ * Underlying implementations use this call as an indication when there
+ * aren't any users actively using the channel, and the chip can go
+ * into low power state.
+ */
+ if (!channel.isBasicChannel() && status != SecureElementStatus.SUCCESS) {
Log.e(mTag, "Error closing channel " + channel.getChannelNumber());
}
} catch (RemoteException e) {