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 @VintfStability 31 interface ISecureElementSession { 32 33 /** 34 * Returns the ATR of the connected card or null if the ATR is not available 35 */ getAtr()36 byte[] getAtr(); 37 38 /** 39 * Close the connection with the Secure Element. This will close any 40 * channels opened by this application with this Secure Element. 41 */ close()42 void close(); 43 44 /** 45 * Close any channel opened on this session. 46 */ closeChannels()47 void closeChannels(); 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 * Listener is passed to secure element service and used to monitor whether 63 * the client application that uses OMAPI is still alive or not. 64 */ openBasicChannel(in byte[] aid, in byte p2, in ISecureElementListener listener)65 ISecureElementChannel openBasicChannel(in byte[] aid, in byte p2, 66 in ISecureElementListener listener); 67 68 /** 69 * Opens a connection using the next free logical channel of the card in the 70 * specified reader. Selects the specified applet. 71 * Selection of other applets with this connection is not supported. 72 * Listener is passed to secure element service and used to monitor whether 73 * the client application that uses OMAPI is still alive or not. 74 */ openLogicalChannel(in byte[] aid, in byte p2, in ISecureElementListener listener)75 ISecureElementChannel openLogicalChannel(in byte[] aid, in byte p2, 76 in ISecureElementListener listener); 77 } 78