1 /*
2  * Copyright (C) 2010 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 package android.nfc;
18 
19 import android.app.PendingIntent;
20 import android.content.IntentFilter;
21 import android.nfc.NdefMessage;
22 import android.nfc.Tag;
23 import android.nfc.TechListParcel;
24 import android.nfc.IAppCallback;
25 import android.nfc.INfcAdapterExtras;
26 import android.nfc.INfcControllerAlwaysOnListener;
27 import android.nfc.INfcVendorNciCallback;
28 import android.nfc.INfcTag;
29 import android.nfc.INfcCardEmulation;
30 import android.nfc.INfcFCardEmulation;
31 import android.nfc.INfcOemExtensionCallback;
32 import android.nfc.INfcUnlockHandler;
33 import android.nfc.ITagRemovedCallback;
34 import android.nfc.INfcDta;
35 import android.nfc.INfcWlcStateListener;
36 import android.nfc.NfcAntennaInfo;
37 import android.nfc.WlcListenerDeviceInfo;
38 import android.nfc.cardemulation.PollingFrame;
39 import android.os.Bundle;
40 
41 /**
42  * @hide
43  */
44 interface INfcAdapter
45 {
getNfcTagInterface()46     INfcTag getNfcTagInterface();
getNfcCardEmulationInterface()47     INfcCardEmulation getNfcCardEmulationInterface();
getNfcFCardEmulationInterface()48     INfcFCardEmulation getNfcFCardEmulationInterface();
getNfcAdapterExtrasInterface(in String pkg)49     INfcAdapterExtras getNfcAdapterExtrasInterface(in String pkg);
getNfcDtaInterface(in String pkg)50     INfcDta getNfcDtaInterface(in String pkg);
getState()51     int getState();
disable(boolean saveState, in String pkg)52     boolean disable(boolean saveState, in String pkg);
enable(in String pkg)53     boolean enable(in String pkg);
pausePolling(int timeoutInMs)54     void pausePolling(int timeoutInMs);
resumePolling()55     void resumePolling();
56 
setForegroundDispatch(in PendingIntent intent, in IntentFilter[] filters, in TechListParcel techLists)57     void setForegroundDispatch(in PendingIntent intent,
58             in IntentFilter[] filters, in TechListParcel techLists);
setAppCallback(in IAppCallback callback)59     void setAppCallback(in IAppCallback callback);
60 
ignore(int nativeHandle, int debounceMs, ITagRemovedCallback callback)61     boolean ignore(int nativeHandle, int debounceMs, ITagRemovedCallback callback);
62 
dispatch(in Tag tag)63     void dispatch(in Tag tag);
64 
setReaderMode(IBinder b, IAppCallback callback, int flags, in Bundle extras)65     void setReaderMode (IBinder b, IAppCallback callback, int flags, in Bundle extras);
66 
addNfcUnlockHandler(INfcUnlockHandler unlockHandler, in int[] techList)67     void addNfcUnlockHandler(INfcUnlockHandler unlockHandler, in int[] techList);
removeNfcUnlockHandler(INfcUnlockHandler unlockHandler)68     void removeNfcUnlockHandler(INfcUnlockHandler unlockHandler);
69 
verifyNfcPermission()70     void verifyNfcPermission();
isNfcSecureEnabled()71     boolean isNfcSecureEnabled();
deviceSupportsNfcSecure()72     boolean deviceSupportsNfcSecure();
setNfcSecure(boolean enable)73     boolean setNfcSecure(boolean enable);
getNfcAntennaInfo()74     NfcAntennaInfo getNfcAntennaInfo();
75 
setControllerAlwaysOn(boolean value)76     boolean setControllerAlwaysOn(boolean value);
isControllerAlwaysOn()77     boolean isControllerAlwaysOn();
isControllerAlwaysOnSupported()78     boolean isControllerAlwaysOnSupported();
registerControllerAlwaysOnListener(in INfcControllerAlwaysOnListener listener)79     void registerControllerAlwaysOnListener(in INfcControllerAlwaysOnListener listener);
unregisterControllerAlwaysOnListener(in INfcControllerAlwaysOnListener listener)80     void unregisterControllerAlwaysOnListener(in INfcControllerAlwaysOnListener listener);
81     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
isTagIntentAppPreferenceSupported()82     boolean isTagIntentAppPreferenceSupported();
83     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
getTagIntentAppPreferenceForUser(int userId)84     Map getTagIntentAppPreferenceForUser(int userId);
85     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
setTagIntentAppPreferenceForUser(int userId, String pkg, boolean allow)86     int setTagIntentAppPreferenceForUser(int userId, String pkg, boolean allow);
87 
isReaderOptionEnabled()88     boolean isReaderOptionEnabled();
isReaderOptionSupported()89     boolean isReaderOptionSupported();
90     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
enableReaderOption(boolean enable)91     boolean enableReaderOption(boolean enable);
isObserveModeSupported()92     boolean isObserveModeSupported();
isObserveModeEnabled()93     boolean isObserveModeEnabled();
setObserveMode(boolean enabled, String pkg)94     boolean setObserveMode(boolean enabled, String pkg);
95 
96     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
setWlcEnabled(boolean enable)97     boolean setWlcEnabled(boolean enable);
isWlcEnabled()98     boolean isWlcEnabled();
registerWlcStateListener(in INfcWlcStateListener listener)99     void registerWlcStateListener(in INfcWlcStateListener listener);
unregisterWlcStateListener(in INfcWlcStateListener listener)100     void unregisterWlcStateListener(in INfcWlcStateListener listener);
getWlcListenerDeviceInfo()101     WlcListenerDeviceInfo getWlcListenerDeviceInfo();
102 
updateDiscoveryTechnology(IBinder b, int pollFlags, int listenFlags)103     void updateDiscoveryTechnology(IBinder b, int pollFlags, int listenFlags);
104 
notifyPollingLoop(in PollingFrame frame)105     void notifyPollingLoop(in PollingFrame frame);
notifyHceDeactivated()106     void notifyHceDeactivated();
sendVendorNciMessage(int mt, int gid, int oid, in byte[] payload)107     int sendVendorNciMessage(int mt, int gid, int oid, in byte[] payload);
registerVendorExtensionCallback(in INfcVendorNciCallback callbacks)108     void registerVendorExtensionCallback(in INfcVendorNciCallback callbacks);
unregisterVendorExtensionCallback(in INfcVendorNciCallback callbacks)109     void unregisterVendorExtensionCallback(in INfcVendorNciCallback callbacks);
registerOemExtensionCallback(INfcOemExtensionCallback callbacks)110     void registerOemExtensionCallback(INfcOemExtensionCallback callbacks);
unregisterOemExtensionCallback(INfcOemExtensionCallback callbacks)111     void unregisterOemExtensionCallback(INfcOemExtensionCallback callbacks);
clearPreference()112     void clearPreference();
setScreenState()113     void setScreenState();
checkFirmware()114     void checkFirmware();
115 }
116