diff options
author | Yukinori Sakamoto <yukinori.sakamoto@sony.com> | 2018-04-06 13:47:04 +0900 |
---|---|---|
committer | Ruchi Kandoi <kandoiruchi@google.com> | 2018-04-10 15:25:12 -0700 |
commit | 0f8b45235b612ac4d7a9cd7af7233039e4358b81 (patch) | |
tree | 215e7a6aa9e81c6997f1409dc2b2fab0ab8d93a6 | |
parent | cf7d2f1d5d06675593e770e267d318357b598fdc (diff) | |
download | SecureElement-0f8b45235b612ac4d7a9cd7af7233039e4358b81.tar.gz |
Close all the channels in use when new SE gets availablepie-dev
All the channels in use should be closed if new SE gets available as the
existing logical channels were opened in accordance with the access
rules previously retrieved.
Bug: 77771494
Test: All the existing channels in use are closed as expected.
Change-Id: Iaca08bdfbdae9b1ba5a1cb863483758242272536
(cherry picked from commit 8c700e8a5b6c3d106613d7f0abbab1ee5d188bed)
-rw-r--r-- | src/com/android/se/Terminal.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java index f92ff88..b3bedba 100644 --- a/src/com/android/se/Terminal.java +++ b/src/com/android/se/Terminal.java @@ -89,6 +89,11 @@ public class Terminal { mAccessControlEnforcer.reset(); } } else { + // If any logical channel in use is in the channel list, it should be closed + // because the access control enfocer allowed to open it by checking the access + // rules retrieved before. Now we are going to retrieve the rules again and + // the new rules can be different from the previous ones. + closeChannels(); try { initializeAccessControl(); } catch (Exception e) { @@ -213,14 +218,13 @@ public class Terminal { } /** - * This method is called in SecureElementService:onDestroy to clean up - * all open channels. + * Cleans up all the channels in use. */ public synchronized void closeChannels() { Collection<Channel> col = mChannels.values(); Channel[] channelList = col.toArray(new Channel[col.size()]); for (Channel channel : channelList) { - closeChannel(channel); + channel.close(); } } |