1 /* 2 * Copyright (C) 2017, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /* 17 * Copyright (c) 2015-2017, The Linux Foundation. 18 */ 19 /* 20 * Contributed by: Giesecke & Devrient GmbH. 21 */ 22 23 package android.se.omapi; 24 25 import android.se.omapi.ISecureElementChannel; 26 import android.se.omapi.ISecureElementReader; 27 import android.se.omapi.ISecureElementListener; 28 29 /** @hide */ 30 interface ISecureElementSession { 31 32 /** 33 * Returns the ATR of the connected card or null if the ATR is not available 34 */ getAtr()35 byte[] getAtr(); 36 37 /** 38 * Close the connection with the Secure Element. This will close any 39 * channels opened by this application with this Secure Element. 40 */ close()41 void close(); 42 43 /** 44 * Close any channel opened on this session. 45 */ closeChannels()46 void closeChannels(); 47 48 49 /** 50 * Tells if this session is closed. 51 * 52 * @return <code>true</code> if the session is closed, false otherwise. 53 */ isClosed()54 boolean isClosed(); 55 56 /** 57 * Opens a connection using the basic channel of the card in the 58 * specified reader and returns a channel handle. Selects the specified 59 * applet if aid != null. 60 * Logical channels cannot be opened with this connection. 61 * Use interface method openLogicalChannel() to open a logical channel. 62 */ openBasicChannel(in byte[] aid, in byte p2, ISecureElementListener listener)63 ISecureElementChannel openBasicChannel(in byte[] aid, in byte p2, 64 ISecureElementListener listener); 65 66 /** 67 * Opens a connection using the next free logical channel of the card in the 68 * specified reader. Selects the specified applet. 69 * Selection of other applets with this connection is not supported. 70 */ openLogicalChannel(in byte[] aid, in byte p2, ISecureElementListener listener)71 ISecureElementChannel openLogicalChannel(in byte[] aid, in byte p2, 72 ISecureElementListener listener); 73 } 74