├── Android.mk ├── AndroidManifest.xml ├── CleanSpec.mk ├── assets └── star.png ├── etc └── sample_nfcee_access.xml ├── nci ├── Android.mk ├── jni │ ├── Android.mk │ ├── CondVar.cpp │ ├── CondVar.h │ ├── DataQueue.cpp │ ├── DataQueue.h │ ├── IntervalTimer.cpp │ ├── IntervalTimer.h │ ├── JavaClassConstants.h │ ├── Mutex.cpp │ ├── Mutex.h │ ├── NativeLlcpConnectionlessSocket.cpp │ ├── NativeLlcpServiceSocket.cpp │ ├── NativeLlcpSocket.cpp │ ├── NativeNfcManager.cpp │ ├── NativeNfcTag.cpp │ ├── NativeP2pDevice.cpp │ ├── NfcJniUtil.cpp │ ├── NfcJniUtil.h │ ├── NfcTag.cpp │ ├── NfcTag.h │ ├── PeerToPeer.cpp │ ├── PeerToPeer.h │ ├── Pn544Interop.cpp │ ├── Pn544Interop.h │ ├── PowerSwitch.cpp │ ├── PowerSwitch.h │ ├── RouteDataSet.cpp │ ├── RouteDataSet.h │ ├── RoutingManager.cpp │ ├── RoutingManager.h │ ├── SyncEvent.h │ └── extns │ │ ├── Android.mk │ │ └── pn54x │ │ ├── Android.mk │ │ ├── inc │ │ ├── phNxpExtns.h │ │ └── phNxpExtns_Custom.h │ │ └── src │ │ ├── common │ │ ├── phNciNfcTypes.h │ │ ├── phNfcCompId.h │ │ ├── phNfcStatus.h │ │ ├── phNfcTypes.h │ │ └── phNfcTypes_Mapping.h │ │ ├── log │ │ ├── phNxpLog.c │ │ └── phNxpLog.h │ │ ├── mifare │ │ ├── phFriNfc.h │ │ ├── phFriNfc_MifStdFormat.c │ │ ├── phFriNfc_MifStdFormat.h │ │ ├── phFriNfc_MifareStdMap.c │ │ ├── phFriNfc_MifareStdMap.h │ │ ├── phFriNfc_NdefMap.h │ │ ├── phFriNfc_SmtCrdFmt.c │ │ ├── phFriNfc_SmtCrdFmt.h │ │ ├── phNxpExtns_MifareStd.c │ │ └── phNxpExtns_MifareStd.h │ │ ├── phNxpExtns.c │ │ └── utils │ │ ├── phNxpConfig.cpp │ │ └── phNxpConfig.h └── src │ └── com │ └── android │ └── nfc │ └── dhimpl │ ├── NativeLlcpConnectionlessSocket.java │ ├── NativeLlcpServiceSocket.java │ ├── NativeLlcpSocket.java │ ├── NativeNfcManager.java │ ├── NativeNfcTag.java │ └── NativeP2pDevice.java ├── nxp ├── Android.mk ├── jni │ ├── Android.mk │ ├── com_android_nfc.cpp │ ├── com_android_nfc.h │ ├── com_android_nfc_NativeLlcpConnectionlessSocket.cpp │ ├── com_android_nfc_NativeLlcpServiceSocket.cpp │ ├── com_android_nfc_NativeLlcpSocket.cpp │ ├── com_android_nfc_NativeNfcManager.cpp │ ├── com_android_nfc_NativeNfcTag.cpp │ ├── com_android_nfc_NativeP2pDevice.cpp │ ├── com_android_nfc_list.cpp │ └── com_android_nfc_list.h └── src │ └── com │ └── android │ └── nfc │ └── dhimpl │ ├── NativeLlcpConnectionlessSocket.java │ ├── NativeLlcpServiceSocket.java │ ├── NativeLlcpSocket.java │ ├── NativeNfcManager.java │ ├── NativeNfcTag.java │ └── NativeP2pDevice.java ├── res ├── drawable-hdpi │ ├── ic_menu_cancel_holo_dark.png │ ├── icon.png │ ├── nfc.png │ └── tap_again.png ├── drawable-mdpi │ ├── back.png │ ├── ic_menu_cancel_holo_dark.png │ ├── icon.png │ └── tap_again.png ├── drawable-xhdpi │ ├── icon.png │ └── tap_again.png ├── drawable-xxhdpi │ ├── icon.png │ └── tap_again.png ├── drawable-xxxhdpi │ └── icon.png ├── layout │ ├── cardemu_item.xml │ ├── cardemu_payment_item.xml │ ├── cardemu_resolver.xml │ ├── screenshot.xml │ └── tapagain.xml ├── raw │ ├── end.ogg │ ├── error.ogg │ └── start.ogg ├── values-af │ ├── provisioning.xml │ └── strings.xml ├── values-am │ ├── provisioning.xml │ └── strings.xml ├── values-ar │ ├── provisioning.xml │ └── strings.xml ├── values-as-rIN │ └── strings.xml ├── values-ast-rES │ └── strings.xml ├── values-az-rAZ │ ├── provisioning.xml │ └── strings.xml ├── values-b+sr+Latn │ ├── provisioning.xml │ └── strings.xml ├── values-be-rBY │ ├── provisioning.xml │ └── strings.xml ├── values-bg │ ├── provisioning.xml │ └── strings.xml ├── values-bn-rBD │ ├── provisioning.xml │ └── strings.xml ├── values-br-rFR │ └── strings.xml ├── values-bs-rBA │ ├── provisioning.xml │ └── strings.xml ├── values-ca │ ├── provisioning.xml │ └── strings.xml ├── values-cs │ ├── provisioning.xml │ └── strings.xml ├── values-csb-rPL │ └── strings.xml ├── values-cy │ └── strings.xml ├── values-da │ ├── provisioning.xml │ └── strings.xml ├── values-de │ ├── provisioning.xml │ └── strings.xml ├── values-el │ ├── provisioning.xml │ └── strings.xml ├── values-en-rAU │ ├── provisioning.xml │ └── strings.xml ├── values-en-rGB │ ├── provisioning.xml │ └── strings.xml ├── values-en-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-en-rPT │ └── strings.xml ├── values-eo │ └── strings.xml ├── values-es-rCO │ └── strings.xml ├── values-es-rMX │ └── strings.xml ├── values-es-rUS │ ├── provisioning.xml │ └── strings.xml ├── values-es │ ├── provisioning.xml │ └── strings.xml ├── values-et-rEE │ ├── provisioning.xml │ └── strings.xml ├── values-eu-rES │ ├── provisioning.xml │ └── strings.xml ├── values-fa │ ├── provisioning.xml │ └── strings.xml ├── values-fi │ ├── provisioning.xml │ └── strings.xml ├── values-fr-rCA │ ├── provisioning.xml │ └── strings.xml ├── values-fr │ ├── provisioning.xml │ └── strings.xml ├── values-frp-rIT │ └── strings.xml ├── values-fy-rNL │ └── strings.xml ├── values-ga-rIE │ └── strings.xml ├── values-gd-rGB │ └── strings.xml ├── values-gl-rES │ ├── provisioning.xml │ └── strings.xml ├── values-gu-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-hi │ ├── provisioning.xml │ └── strings.xml ├── values-hr │ ├── provisioning.xml │ └── strings.xml ├── values-hu │ ├── provisioning.xml │ └── strings.xml ├── values-hy-rAM │ ├── provisioning.xml │ └── strings.xml ├── values-in │ ├── provisioning.xml │ └── strings.xml ├── values-is-rIS │ ├── provisioning.xml │ └── strings.xml ├── values-it │ ├── provisioning.xml │ └── strings.xml ├── values-iw │ ├── provisioning.xml │ └── strings.xml ├── values-ja │ ├── provisioning.xml │ └── strings.xml ├── values-ka-rGE │ ├── provisioning.xml │ └── strings.xml ├── values-kk-rKZ │ ├── provisioning.xml │ └── strings.xml ├── values-km-rKH │ ├── provisioning.xml │ └── strings.xml ├── values-kn-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-ko │ ├── provisioning.xml │ └── strings.xml ├── values-ku │ └── strings.xml ├── values-ky-rKG │ ├── provisioning.xml │ └── strings.xml ├── values-lb │ └── strings.xml ├── values-lo-rLA │ ├── provisioning.xml │ └── strings.xml ├── values-lt │ ├── provisioning.xml │ └── strings.xml ├── values-lv │ ├── provisioning.xml │ └── strings.xml ├── values-mk-rMK │ ├── provisioning.xml │ └── strings.xml ├── values-ml-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-mn-rMN │ ├── provisioning.xml │ └── strings.xml ├── values-mr-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-ms-rMY │ ├── provisioning.xml │ └── strings.xml ├── values-my-rMM │ ├── provisioning.xml │ └── strings.xml ├── values-nb │ ├── provisioning.xml │ └── strings.xml ├── values-ne-rNP │ ├── provisioning.xml │ └── strings.xml ├── values-nl │ ├── provisioning.xml │ └── strings.xml ├── values-oc-rFR │ └── strings.xml ├── values-or-rIN │ └── strings.xml ├── values-pa-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-pl │ ├── provisioning.xml │ └── strings.xml ├── values-pt-rPT │ ├── provisioning.xml │ └── strings.xml ├── values-pt │ ├── provisioning.xml │ └── strings.xml ├── values-ro │ ├── provisioning.xml │ └── strings.xml ├── values-ru │ ├── provisioning.xml │ └── strings.xml ├── values-si-rLK │ ├── provisioning.xml │ └── strings.xml ├── values-sk │ ├── provisioning.xml │ └── strings.xml ├── values-sl │ ├── provisioning.xml │ └── strings.xml ├── values-sq-rAL │ ├── provisioning.xml │ └── strings.xml ├── values-sr │ ├── provisioning.xml │ └── strings.xml ├── values-sv │ ├── provisioning.xml │ └── strings.xml ├── values-sw │ ├── provisioning.xml │ └── strings.xml ├── values-ta-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-te-rIN │ ├── provisioning.xml │ └── strings.xml ├── values-th │ ├── provisioning.xml │ └── strings.xml ├── values-tl │ ├── provisioning.xml │ └── strings.xml ├── values-tr │ ├── provisioning.xml │ └── strings.xml ├── values-ug │ └── strings.xml ├── values-uk │ ├── provisioning.xml │ └── strings.xml ├── values-ur-rPK │ ├── provisioning.xml │ └── strings.xml ├── values-uz-rUZ │ ├── provisioning.xml │ └── strings.xml ├── values-vi │ ├── provisioning.xml │ └── strings.xml ├── values-zh-rCN │ ├── provisioning.xml │ └── strings.xml ├── values-zh-rHK │ ├── provisioning.xml │ └── strings.xml ├── values-zh-rTW │ ├── provisioning.xml │ └── strings.xml ├── values-zu │ ├── provisioning.xml │ └── strings.xml └── values │ ├── provisioning.xml │ └── strings.xml ├── src └── com │ └── android │ └── nfc │ ├── BeamShareActivity.java │ ├── ConfirmConnectToWifiNetworkActivity.java │ ├── DeviceHost.java │ ├── ForegroundUtils.java │ ├── LlcpException.java │ ├── LlcpPacket.java │ ├── NfcApplication.java │ ├── NfcBackupAgent.java │ ├── NfcDiscoveryParameters.java │ ├── NfcDispatcher.java │ ├── NfcPermissions.java │ ├── NfcRootActivity.java │ ├── NfcService.java │ ├── NfcUnlockManager.java │ ├── NfcWifiProtectedSetup.java │ ├── NfceeAccessControl.java │ ├── P2pEventManager.java │ ├── P2pLinkManager.java │ ├── RegisteredComponentCache.java │ ├── ScreenStateHelper.java │ ├── TechListChooserActivity.java │ ├── beam │ ├── BeamManager.java │ ├── BeamReceiveService.java │ ├── BeamSendService.java │ ├── BeamStatusReceiver.java │ ├── BeamTransferManager.java │ ├── BeamTransferRecord.aidl │ ├── BeamTransferRecord.java │ ├── BluetoothOppHandover.java │ ├── FireflyRenderer.java │ ├── MimeTypeUtil.java │ └── SendUi.java │ ├── cardemulation │ ├── AidRoutingManager.java │ ├── AppChooserActivity.java │ ├── CardEmulationManager.java │ ├── DefaultRemovedActivity.java │ ├── EnabledNfcFServices.java │ ├── HostEmulationManager.java │ ├── HostNfcFEmulationManager.java │ ├── PreferredServices.java │ ├── RegisteredAidCache.java │ ├── RegisteredNfcFServicesCache.java │ ├── RegisteredServicesCache.java │ ├── RegisteredT3tIdentifiersCache.java │ ├── SystemCodeRoutingManager.java │ └── TapAgainDialog.java │ ├── echoserver │ └── EchoServer.java │ ├── handover │ ├── BluetoothPeripheralHandover.java │ ├── ConfirmConnectActivity.java │ ├── HandoverClient.java │ ├── HandoverDataParser.java │ ├── HandoverServer.java │ └── PeripheralHandoverService.java │ ├── ndefpush │ ├── NdefPushClient.java │ ├── NdefPushProtocol.java │ └── NdefPushServer.java │ └── snep │ ├── SnepClient.java │ ├── SnepException.java │ ├── SnepMessage.java │ ├── SnepMessenger.java │ └── SnepServer.java └── tests ├── Android.mk ├── AndroidManifest.xml └── src └── com └── android └── nfc ├── MockLlcpSocket.java └── snep ├── SnepBasicTests.java ├── SnepCustomClientTests.java ├── SnepDefaultClientTests.java ├── SnepValidationClientTests.java └── SnepValidationServerTests.java /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | ######################################## 4 | # NXP Configuration 5 | ######################################## 6 | include $(CLEAR_VARS) 7 | 8 | LOCAL_MODULE_TAGS := optional 9 | 10 | LOCAL_SRC_FILES := \ 11 | $(call all-java-files-under, src) 12 | 13 | LOCAL_SRC_FILES += \ 14 | $(call all-java-files-under, nxp) 15 | 16 | LOCAL_PACKAGE_NAME := Nfc 17 | LOCAL_CERTIFICATE := platform 18 | 19 | LOCAL_JNI_SHARED_LIBRARIES := libnfc_jni 20 | 21 | LOCAL_PROGUARD_ENABLED := disabled 22 | 23 | include $(BUILD_PACKAGE) 24 | 25 | ######################################## 26 | # NCI Configuration 27 | ######################################## 28 | include $(CLEAR_VARS) 29 | 30 | LOCAL_MODULE_TAGS := optional 31 | 32 | LOCAL_SRC_FILES := \ 33 | $(call all-java-files-under, src) 34 | 35 | LOCAL_SRC_FILES += \ 36 | $(call all-java-files-under, nci) 37 | 38 | LOCAL_PACKAGE_NAME := NfcNci 39 | LOCAL_OVERRIDES_PACKAGES := Nfc 40 | LOCAL_CERTIFICATE := platform 41 | 42 | LOCAL_JNI_SHARED_LIBRARIES := libnfc_nci_jni 43 | 44 | LOCAL_PROGUARD_ENABLED := disabled 45 | 46 | include $(BUILD_PACKAGE) 47 | 48 | include $(call all-makefiles-under,$(LOCAL_PATH)) 49 | -------------------------------------------------------------------------------- /CleanSpec.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # If you don't need to do a full clean build but would like to touch 17 | # a file or delete some intermediate files, add a clean step to the end 18 | # of the list. These steps will only be run once, if they haven't been 19 | # run before. 20 | # 21 | # E.g.: 22 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) 23 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) 24 | # 25 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with 26 | # files that are missing or have been moved. 27 | # 28 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. 29 | # Use $(OUT_DIR) to refer to the "out" directory. 30 | # 31 | # If you need to re-do something that's already mentioned, just copy 32 | # the command and add it to the bottom of the list. E.g., if a change 33 | # that you made last week required touching a file and a change you 34 | # made today requires touching the same file, just copy the old 35 | # touch step and add it to the end of the list. 36 | # 37 | # ************************************************ 38 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 39 | # ************************************************ 40 | 41 | # For example: 42 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) 43 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) 44 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) 45 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) 46 | 47 | # ************************************************ 48 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 49 | # ************************************************ 50 | 51 | $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/app/Nfc.apk) 52 | $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/app/NfcGoogle.apk) 53 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/NfcGoogle_intermediates) 54 | -------------------------------------------------------------------------------- /assets/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/assets/star.png -------------------------------------------------------------------------------- /nci/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(call all-makefiles-under,$(LOCAL_PATH)) 4 | -------------------------------------------------------------------------------- /nci/jni/Android.mk: -------------------------------------------------------------------------------- 1 | VOB_COMPONENTS := external/libnfc-nci/src 2 | NFA := $(VOB_COMPONENTS)/nfa 3 | NFC := $(VOB_COMPONENTS)/nfc 4 | 5 | LOCAL_PATH := $(call my-dir) 6 | include $(CLEAR_VARS) 7 | include $(call all-makefiles-under,$(LOCAL_PATH)) 8 | 9 | ifneq ($(NCI_VERSION),) 10 | LOCAL_CFLAGS += -DNCI_VERSION=$(NCI_VERSION) -O0 -g 11 | endif 12 | 13 | LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Werror 14 | 15 | LOCAL_SRC_FILES := $(call all-subdir-cpp-files) $(call all-subdir-c-files) 16 | 17 | LOCAL_C_INCLUDES += \ 18 | external/libxml2/include \ 19 | frameworks/native/include \ 20 | libcore/include \ 21 | $(NFA)/include \ 22 | $(NFA)/brcm \ 23 | $(NFC)/include \ 24 | $(NFC)/brcm \ 25 | $(NFC)/int \ 26 | $(VOB_COMPONENTS)/hal/include \ 27 | $(VOB_COMPONENTS)/hal/int \ 28 | $(VOB_COMPONENTS)/include \ 29 | $(VOB_COMPONENTS)/gki/ulinux \ 30 | $(VOB_COMPONENTS)/gki/common 31 | 32 | LOCAL_SHARED_LIBRARIES := \ 33 | libicuuc \ 34 | libnativehelper \ 35 | libcutils \ 36 | libutils \ 37 | liblog \ 38 | libnfc-nci \ 39 | 40 | LOCAL_STATIC_LIBRARIES := libxml2 41 | 42 | LOCAL_MODULE := libnfc_nci_jni 43 | 44 | include $(BUILD_SHARED_LIBRARY) 45 | -------------------------------------------------------------------------------- /nci/jni/CondVar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 | /* 18 | * Encapsulate a condition variable for thread synchronization. 19 | */ 20 | 21 | #pragma once 22 | #include 23 | #include "Mutex.h" 24 | 25 | 26 | class CondVar 27 | { 28 | public: 29 | /******************************************************************************* 30 | ** 31 | ** Function: CondVar 32 | ** 33 | ** Description: Initialize member variables. 34 | ** 35 | ** Returns: None. 36 | ** 37 | *******************************************************************************/ 38 | CondVar (); 39 | 40 | 41 | /******************************************************************************* 42 | ** 43 | ** Function: ~CondVar 44 | ** 45 | ** Description: Cleanup all resources. 46 | ** 47 | ** Returns: None. 48 | ** 49 | *******************************************************************************/ 50 | ~CondVar (); 51 | 52 | 53 | /******************************************************************************* 54 | ** 55 | ** Function: wait 56 | ** 57 | ** Description: Block the caller and wait for a condition. 58 | ** 59 | ** Returns: None. 60 | ** 61 | *******************************************************************************/ 62 | void wait (Mutex& mutex); 63 | 64 | 65 | /******************************************************************************* 66 | ** 67 | ** Function: wait 68 | ** 69 | ** Description: Block the caller and wait for a condition. 70 | ** millisec: Timeout in milliseconds. 71 | ** 72 | ** Returns: True if wait is successful; false if timeout occurs. 73 | ** 74 | *******************************************************************************/ 75 | bool wait (Mutex& mutex, long millisec); 76 | 77 | 78 | /******************************************************************************* 79 | ** 80 | ** Function: notifyOne 81 | ** 82 | ** Description: Unblock the waiting thread. 83 | ** 84 | ** Returns: None. 85 | ** 86 | *******************************************************************************/ 87 | void notifyOne (); 88 | 89 | private: 90 | pthread_cond_t mCondition; 91 | }; 92 | -------------------------------------------------------------------------------- /nci/jni/IntervalTimer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 | /* 18 | * Asynchronous interval timer. 19 | */ 20 | 21 | #include "IntervalTimer.h" 22 | #include "OverrideLog.h" 23 | 24 | 25 | IntervalTimer::IntervalTimer() 26 | { 27 | mTimerId = 0; 28 | mCb = NULL; 29 | } 30 | 31 | 32 | bool IntervalTimer::set(int ms, TIMER_FUNC cb) 33 | { 34 | if (mTimerId == 0) 35 | { 36 | if (cb == NULL) 37 | return false; 38 | 39 | if (!create(cb)) 40 | return false; 41 | } 42 | if (cb != mCb) 43 | { 44 | kill(); 45 | if (!create(cb)) 46 | return false; 47 | } 48 | 49 | int stat = 0; 50 | struct itimerspec ts; 51 | ts.it_value.tv_sec = ms / 1000; 52 | ts.it_value.tv_nsec = (ms % 1000) * 1000000; 53 | 54 | ts.it_interval.tv_sec = 0; 55 | ts.it_interval.tv_nsec = 0; 56 | 57 | stat = timer_settime(mTimerId, 0, &ts, 0); 58 | if (stat == -1) 59 | ALOGE("IntervalTimer::set: fail set timer"); 60 | return stat == 0; 61 | } 62 | 63 | 64 | IntervalTimer::~IntervalTimer() 65 | { 66 | kill(); 67 | } 68 | 69 | 70 | void IntervalTimer::kill() 71 | { 72 | if (mTimerId == 0) 73 | return; 74 | 75 | timer_delete(mTimerId); 76 | mTimerId = 0; 77 | mCb = NULL; 78 | } 79 | 80 | 81 | bool IntervalTimer::create(TIMER_FUNC cb) 82 | { 83 | struct sigevent se; 84 | int stat = 0; 85 | 86 | /* 87 | * Set the sigevent structure to cause the signal to be 88 | * delivered by creating a new thread. 89 | */ 90 | se.sigev_notify = SIGEV_THREAD; 91 | se.sigev_value.sival_ptr = &mTimerId; 92 | se.sigev_notify_function = cb; 93 | se.sigev_notify_attributes = NULL; 94 | mCb = cb; 95 | stat = timer_create(CLOCK_MONOTONIC, &se, &mTimerId); 96 | if (stat == -1) 97 | ALOGE("IntervalTimer::create: fail create timer"); 98 | return stat == 0; 99 | } 100 | -------------------------------------------------------------------------------- /nci/jni/IntervalTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 | /* 18 | * Asynchronous interval timer. 19 | */ 20 | 21 | #include 22 | 23 | 24 | class IntervalTimer 25 | { 26 | public: 27 | typedef void (*TIMER_FUNC) (union sigval); 28 | 29 | IntervalTimer(); 30 | ~IntervalTimer(); 31 | bool set(int ms, TIMER_FUNC cb); 32 | void kill(); 33 | bool create(TIMER_FUNC ); 34 | 35 | private: 36 | timer_t mTimerId; 37 | TIMER_FUNC mCb; 38 | }; 39 | -------------------------------------------------------------------------------- /nci/jni/JavaClassConstants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 | #pragma once 17 | 18 | 19 | namespace android 20 | { 21 | extern jmethodID gCachedNfcManagerNotifyNdefMessageListeners; 22 | extern jmethodID gCachedNfcManagerNotifyTransactionListeners; 23 | extern jmethodID gCachedNfcManagerNotifyLlcpLinkActivation; 24 | extern jmethodID gCachedNfcManagerNotifyLlcpLinkDeactivated; 25 | extern jmethodID gCachedNfcManagerNotifyLlcpFirstPacketReceived; 26 | 27 | /* 28 | * host-based card emulation 29 | */ 30 | extern jmethodID gCachedNfcManagerNotifyHostEmuActivated; 31 | extern jmethodID gCachedNfcManagerNotifyHostEmuData; 32 | extern jmethodID gCachedNfcManagerNotifyHostEmuDeactivated; 33 | 34 | extern const char* gNativeP2pDeviceClassName; 35 | extern const char* gNativeLlcpServiceSocketClassName; 36 | extern const char* gNativeLlcpConnectionlessSocketClassName; 37 | extern const char* gNativeLlcpSocketClassName; 38 | extern const char* gNativeNfcTagClassName; 39 | extern const char* gNativeNfcManagerClassName; 40 | } 41 | -------------------------------------------------------------------------------- /nci/jni/NativeP2pDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 | #include "OverrideLog.h" 18 | #include "NfcJniUtil.h" 19 | #include "JavaClassConstants.h" 20 | 21 | #include 22 | #include 23 | 24 | namespace android 25 | { 26 | 27 | 28 | static jboolean nativeP2pDeviceDoConnect (JNIEnv*, jobject) 29 | { 30 | ALOGD ("%s", __FUNCTION__); 31 | return JNI_TRUE; 32 | } 33 | 34 | 35 | static jboolean nativeP2pDeviceDoDisconnect (JNIEnv*, jobject) 36 | { 37 | ALOGD ("%s", __FUNCTION__); 38 | return JNI_TRUE; 39 | } 40 | 41 | 42 | static jbyteArray nativeP2pDeviceDoTransceive (JNIEnv*, jobject, jbyteArray) 43 | { 44 | ALOGD ("%s", __FUNCTION__); 45 | return NULL; 46 | } 47 | 48 | 49 | static jbyteArray nativeP2pDeviceDoReceive (JNIEnv*, jobject) 50 | { 51 | ALOGD ("%s", __FUNCTION__); 52 | return NULL; 53 | } 54 | 55 | 56 | static jboolean nativeP2pDeviceDoSend (JNIEnv*, jobject, jbyteArray) 57 | { 58 | ALOGD ("%s", __FUNCTION__); 59 | return JNI_TRUE; 60 | } 61 | 62 | 63 | /***************************************************************************** 64 | ** 65 | ** Description: JNI functions 66 | ** 67 | *****************************************************************************/ 68 | static JNINativeMethod gMethods[] = 69 | { 70 | {"doConnect", "()Z", (void *) nativeP2pDeviceDoConnect}, 71 | {"doDisconnect", "()Z", (void *) nativeP2pDeviceDoDisconnect}, 72 | {"doTransceive", "([B)[B", (void *) nativeP2pDeviceDoTransceive}, 73 | {"doReceive", "()[B", (void *) nativeP2pDeviceDoReceive}, 74 | {"doSend", "([B)Z", (void *) nativeP2pDeviceDoSend}, 75 | }; 76 | 77 | 78 | /******************************************************************************* 79 | ** 80 | ** Function: register_com_android_nfc_NativeP2pDevice 81 | ** 82 | ** Description: Regisgter JNI functions with Java Virtual Machine. 83 | ** e: Environment of JVM. 84 | ** 85 | ** Returns: Status of registration. 86 | ** 87 | *******************************************************************************/ 88 | int register_com_android_nfc_NativeP2pDevice (JNIEnv* e) 89 | { 90 | return jniRegisterNativeMethods (e, gNativeP2pDeviceClassName, 91 | gMethods, NELEM(gMethods)); 92 | } 93 | 94 | 95 | } // namepspace android 96 | -------------------------------------------------------------------------------- /nci/jni/Pn544Interop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 | /***************************************************************************** 18 | ** 19 | ** Description: Implement operations that provide compatibility with NXP 20 | ** PN544 controller. Specifically facilitate peer-to-peer 21 | ** operations with PN544 controller. 22 | ** 23 | *****************************************************************************/ 24 | #pragma once 25 | #include "NfcJniUtil.h" 26 | 27 | 28 | /******************************************************************************* 29 | ** 30 | ** Function: pn544InteropStopPolling 31 | ** 32 | ** Description: Stop polling to let NXP PN544 controller poll. 33 | ** PN544 should activate in P2P mode. 34 | ** 35 | ** Returns: None 36 | ** 37 | *******************************************************************************/ 38 | void pn544InteropStopPolling (); 39 | 40 | 41 | /******************************************************************************* 42 | ** 43 | ** Function: pn544InteropIsBusy 44 | ** 45 | ** Description: Is the code performing operations? 46 | ** 47 | ** Returns: True if the code is busy. 48 | ** 49 | *******************************************************************************/ 50 | bool pn544InteropIsBusy (); 51 | 52 | 53 | /******************************************************************************* 54 | ** 55 | ** Function: pn544InteropAbortNow 56 | ** 57 | ** Description: Request to abort all operations. 58 | ** 59 | ** Returns: None. 60 | ** 61 | *******************************************************************************/ 62 | void pn544InteropAbortNow (); 63 | -------------------------------------------------------------------------------- /nci/jni/extns/Android.mk: -------------------------------------------------------------------------------- 1 | EXTNS_PATH := $(call my-dir) 2 | include $(call all-makefiles-under,$(EXTNS_PATH)) 3 | -------------------------------------------------------------------------------- /nci/jni/extns/pn54x/Android.mk: -------------------------------------------------------------------------------- 1 | EXTN_PN54X_PATH:= $(call my-dir) 2 | 3 | LOCAL_C_INCLUDES += \ 4 | $(EXTN_PN54X_PATH)/inc \ 5 | $(EXTN_PN54X_PATH)/src/common \ 6 | $(EXTN_PN54X_PATH)/src/log \ 7 | $(EXTN_PN54X_PATH)/src/mifare \ 8 | $(EXTN_PN54X_PATH)/src/utils 9 | 10 | LOCAL_CFLAGS += -DNXP_UICC_ENABLE 11 | -------------------------------------------------------------------------------- /nci/jni/extns/pn54x/src/common/phNfcCompId.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 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 | /* 18 | * NFC Component ID Values - Used for Function Return Codes 19 | */ 20 | 21 | #ifndef PHNFCCOMPID_H 22 | #define PHNFCCOMPID_H 23 | 24 | /* 25 | * Component IDs 26 | * 27 | * IDs for all NFC components. Combined with the Status Code they build the value (status) 28 | * returned by each function. 29 | * 30 | * ID Number Spaces: 31 | * - 01..1F: HAL 32 | * - 20..3F: NFC-MW (Local Device) 33 | * - 40..5F: NFC-MW (Remote Device) 34 | * . 35 | * 36 | * The value CID_NFC_NONE does not exist for Component IDs. Do not use this value except 37 | * for NFCSTATUS_SUCCESS. The enumeration function uses CID_NFC_NONE 38 | * to mark unassigned "References". 39 | */ 40 | #define CID_NFC_NONE 0x00 /* Unassigned or doesn't apply (see #NFCSTATUS_SUCCESS) */ 41 | #define CID_NFC_TML 0x01 /* Transport Mapping Layer */ 42 | #define CID_NFC_LLC 0x07 /* Logical Link Control Layer */ 43 | #define CID_NFC_NCI 0x08 /* NFC Controller(NFCC) Interface Layer */ 44 | #define CID_NFC_DNLD 0x09 /* Firmware Download Management Layer */ 45 | #define CID_NFC_HAL 0x10 /* Hardware Abstraction Layer */ 46 | #define CID_NFC_OSAL CID_NFC_NONE /* Operating System Abstraction Layer*/ 47 | #define CID_FRI_NFC_OVR_HAL 0x20 /* NFC-Device, HAL-based */ 48 | #define CID_FRI_NFC_NDEF_RECORD 0x22 /* NDEF Record Tools Library. */ 49 | #define CID_FRI_NFC_NDEF_MAP 0x23 /* NDEF Mapping. */ 50 | #define CID_FRI_NFC_NDEF_REGISTRY 0x24 /* NDEF_REGISTRY. */ 51 | #define CID_FRI_NFC_AUTO_DEV_DIS 0x25 /* Automatic Device Discovery. */ 52 | #define CID_FRI_NFC_NDEF_SMTCRDFMT 0x26 /* Smart Card Formatting */ 53 | #define CID_NFC_LIB 0x30 /* NFC Library Layer*/ 54 | #define CID_MAX_VALUE 0xF0 /* The maximum CID value that is defined. */ 55 | #define CID_FRI_NFC_LLCP 0x40 /* Logical Link Control Protocol */ 56 | #define CID_FRI_NFC_LLCP_TRANSPORT 0x50 57 | #define CID_FRI_NFC_LLCP_MAC 0x60 58 | 59 | #endif /* PHNFCCOMPID_H */ 60 | -------------------------------------------------------------------------------- /nci/jni/extns/pn54x/src/common/phNfcTypes_Mapping.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 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 | #ifndef PHNFCTYPES_MAPPING_H_ 18 | #define PHNFCTYPES_MAPPING_H_ 19 | 20 | 21 | typedef phNfc_sData_t phHal_sData_t; 22 | typedef phNfc_sSupProtocol_t phHal_sSupProtocol_t; 23 | #define phHal_eMifareRaw phNfc_eMifareRaw 24 | #define phHal_eMifareAuthentA phNfc_eMifareAuthentA 25 | #define phHal_eMifareAuthentB phNfc_eMifareAuthentB 26 | #define phHal_eMifareRead16 phNfc_eMifareRead16 27 | #define phHal_eMifareRead phNfc_eMifareRead 28 | #define phHal_eMifareWrite16 phNfc_eMifareWrite16 29 | #define phHal_eMifareWrite4 phNfc_eMifareWrite4 30 | #define phHal_eMifareInc phNfc_eMifareInc 31 | #define phHal_eMifareDec phNfc_eMifareDec 32 | #define phHal_eMifareTransfer phNfc_eMifareTransfer 33 | #define phHal_eMifareRestore phNfc_eMifareRestore 34 | #define phHal_eMifareReadSector phNfc_eMifareReadSector 35 | #define phHal_eMifareWriteSector phNfc_eMifareWriteSector 36 | #define phHal_eMifareReadN phNfc_eMifareReadN 37 | #define phHal_eMifareWriteN phNfc_eMifareWriteN 38 | #define phHal_eMifareSectorSel phNfc_eMifareSectorSel 39 | #define phHal_eMifareAuth phNfc_eMifareAuth 40 | #define phHal_eMifareProxCheck phNfc_eMifareProxCheck 41 | #define phHal_eMifareInvalidCmd phNfc_eMifareInvalidCmd 42 | 43 | typedef phNfc_eMifareCmdList_t phHal_eMifareCmdList_t; 44 | 45 | typedef phNfc_uCmdList_t phHal_uCmdList_t; 46 | typedef phNfc_sRemoteDevInformation_t phHal_sRemoteDevInformation_t; 47 | typedef phNfc_sRemoteDevInformation_t phLibNfc_sRemoteDevInformation_t; 48 | #endif /* PHNFCTYPES_MAPPING_H_ */ 49 | -------------------------------------------------------------------------------- /nci/src/com/android/nfc/dhimpl/NativeLlcpConnectionlessSocket.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost; 20 | import com.android.nfc.LlcpPacket; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * LlcpConnectionlessSocket represents a LLCP Connectionless object to be used 26 | * in a connectionless communication 27 | */ 28 | public class NativeLlcpConnectionlessSocket implements DeviceHost.LlcpConnectionlessSocket { 29 | 30 | private int mHandle; 31 | private int mSap; 32 | private int mLinkMiu; 33 | 34 | public NativeLlcpConnectionlessSocket() { } 35 | 36 | public native boolean doSendTo(int sap, byte[] data); 37 | 38 | public native LlcpPacket doReceiveFrom(int linkMiu); 39 | 40 | public native boolean doClose(); 41 | 42 | @Override 43 | public int getLinkMiu(){ 44 | return mLinkMiu; 45 | } 46 | 47 | @Override 48 | public int getSap(){ 49 | return mSap; 50 | } 51 | 52 | @Override 53 | public void send(int sap, byte[] data) throws IOException { 54 | if (!doSendTo(sap, data)) { 55 | throw new IOException(); 56 | } 57 | } 58 | 59 | @Override 60 | public LlcpPacket receive() throws IOException { 61 | LlcpPacket packet = doReceiveFrom(mLinkMiu); 62 | if (packet == null) { 63 | throw new IOException(); 64 | } 65 | return packet; 66 | } 67 | 68 | public int getHandle(){ 69 | return mHandle; 70 | } 71 | 72 | @Override 73 | public void close() throws IOException { 74 | if (!doClose()) { 75 | throw new IOException(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /nci/src/com/android/nfc/dhimpl/NativeLlcpServiceSocket.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost; 20 | import com.android.nfc.DeviceHost.LlcpSocket; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * LlcpServiceSocket represents a LLCP Service to be used in a 26 | * Connection-oriented communication 27 | */ 28 | public class NativeLlcpServiceSocket implements DeviceHost.LlcpServerSocket { 29 | private int mHandle; 30 | private int mLocalMiu; 31 | private int mLocalRw; 32 | private int mLocalLinearBufferLength; 33 | private int mSap; 34 | private String mServiceName; 35 | 36 | public NativeLlcpServiceSocket(){ } 37 | 38 | private native NativeLlcpSocket doAccept(int miu, int rw, int linearBufferLength); 39 | @Override 40 | public LlcpSocket accept() throws IOException { 41 | LlcpSocket socket = doAccept(mLocalMiu, mLocalRw, mLocalLinearBufferLength); 42 | if (socket == null) throw new IOException(); 43 | return socket; 44 | } 45 | 46 | private native boolean doClose(); 47 | @Override 48 | public void close() throws IOException { 49 | if (!doClose()) { 50 | throw new IOException(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /nci/src/com/android/nfc/dhimpl/NativeLlcpSocket.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * LlcpClientSocket represents a LLCP Connection-Oriented client to be used in a 25 | * connection-oriented communication 26 | */ 27 | public class NativeLlcpSocket implements DeviceHost.LlcpSocket { 28 | private int mHandle; 29 | private int mSap; 30 | private int mLocalMiu; 31 | private int mLocalRw; 32 | 33 | public NativeLlcpSocket(){ } 34 | 35 | private native boolean doConnect(int nSap); 36 | @Override 37 | public void connectToSap(int sap) throws IOException { 38 | if (!doConnect(sap)) { 39 | throw new IOException(); 40 | } 41 | } 42 | 43 | private native boolean doConnectBy(String sn); 44 | @Override 45 | public void connectToService(String serviceName) throws IOException { 46 | if (!doConnectBy(serviceName)) { 47 | throw new IOException(); 48 | } 49 | } 50 | 51 | private native boolean doClose(); 52 | @Override 53 | public void close() throws IOException { 54 | if (!doClose()) { 55 | throw new IOException(); 56 | } 57 | } 58 | 59 | private native boolean doSend(byte[] data); 60 | @Override 61 | public void send(byte[] data) throws IOException { 62 | if (!doSend(data)) { 63 | throw new IOException(); 64 | } 65 | } 66 | 67 | private native int doReceive(byte[] recvBuff); 68 | @Override 69 | public int receive(byte[] recvBuff) throws IOException { 70 | int receiveLength = doReceive(recvBuff); 71 | if (receiveLength == -1) { 72 | throw new IOException(); 73 | } 74 | return receiveLength; 75 | } 76 | 77 | private native int doGetRemoteSocketMiu(); 78 | @Override 79 | public int getRemoteMiu() { return doGetRemoteSocketMiu(); } 80 | 81 | private native int doGetRemoteSocketRw(); 82 | @Override 83 | public int getRemoteRw() { return doGetRemoteSocketRw(); } 84 | 85 | @Override 86 | public int getLocalSap(){ 87 | return mSap; 88 | } 89 | 90 | @Override 91 | public int getLocalMiu(){ 92 | return mLocalMiu; 93 | } 94 | 95 | @Override 96 | public int getLocalRw(){ 97 | return mLocalRw; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /nci/src/com/android/nfc/dhimpl/NativeP2pDevice.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost.NfcDepEndpoint; 20 | 21 | /** 22 | * Native interface to the P2P Initiator functions 23 | */ 24 | public class NativeP2pDevice implements NfcDepEndpoint { 25 | 26 | private int mHandle; 27 | 28 | private int mMode; 29 | 30 | private byte[] mGeneralBytes; 31 | 32 | private byte mLlcpVersion; 33 | 34 | private native byte[] doReceive(); 35 | @Override 36 | public byte[] receive() { 37 | return doReceive(); 38 | } 39 | 40 | private native boolean doSend(byte[] data); 41 | @Override 42 | public boolean send(byte[] data) { 43 | return doSend(data); 44 | } 45 | 46 | private native boolean doConnect(); 47 | @Override 48 | public boolean connect() { 49 | return doConnect(); 50 | } 51 | 52 | private native boolean doDisconnect(); 53 | @Override 54 | public boolean disconnect() { 55 | return doDisconnect(); 56 | } 57 | 58 | public native byte[] doTransceive(byte[] data); 59 | @Override 60 | public byte[] transceive(byte[] data) { 61 | return doTransceive(data); 62 | } 63 | 64 | @Override 65 | public int getHandle() { 66 | return mHandle; 67 | } 68 | 69 | @Override 70 | public int getMode() { 71 | return mMode; 72 | } 73 | 74 | @Override 75 | public byte[] getGeneralBytes() { 76 | return mGeneralBytes; 77 | } 78 | 79 | @Override 80 | public byte getLlcpVersion() { 81 | return mLlcpVersion; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /nxp/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(call all-makefiles-under,$(LOCAL_PATH)) 4 | -------------------------------------------------------------------------------- /nxp/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | 6 | 7 | LOCAL_SRC_FILES:= \ 8 | com_android_nfc_NativeLlcpConnectionlessSocket.cpp \ 9 | com_android_nfc_NativeLlcpServiceSocket.cpp \ 10 | com_android_nfc_NativeLlcpSocket.cpp \ 11 | com_android_nfc_NativeNfcManager.cpp \ 12 | com_android_nfc_NativeNfcTag.cpp \ 13 | com_android_nfc_NativeP2pDevice.cpp \ 14 | com_android_nfc_list.cpp \ 15 | com_android_nfc.cpp 16 | 17 | LOCAL_C_INCLUDES += \ 18 | $(JNI_H_INCLUDE) \ 19 | external/libnfc-nxp/src \ 20 | external/libnfc-nxp/inc \ 21 | libcore/include 22 | 23 | LOCAL_SHARED_LIBRARIES := \ 24 | libnativehelper \ 25 | libcutils \ 26 | libutils \ 27 | liblog \ 28 | libnfc \ 29 | libhardware 30 | 31 | #LOCAL_CFLAGS += -O0 -g 32 | 33 | LOCAL_MODULE := libnfc_jni 34 | LOCAL_MODULE_TAGS := optional 35 | 36 | include $(BUILD_SHARED_LIBRARY) 37 | -------------------------------------------------------------------------------- /nxp/jni/com_android_nfc_list.h: -------------------------------------------------------------------------------- 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 | #ifndef __COM_ANDROID_NFC_LIST_H__ 18 | #define __COM_ANDROID_NFC_LIST_H__ 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | struct listNode 27 | { 28 | void* pData; 29 | struct listNode* pNext; 30 | }; 31 | 32 | struct listHead 33 | { 34 | listNode* pFirst; 35 | pthread_mutex_t mutex; 36 | }; 37 | 38 | bool listInit(listHead* pList); 39 | bool listDestroy(listHead* pList); 40 | bool listAdd(listHead* pList, void* pData); 41 | bool listRemove(listHead* pList, void* pData); 42 | bool listGetAndRemoveNext(listHead* pList, void** ppData); 43 | void listDump(listHead* pList); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* __COM_ANDROID_NFC_LIST_H__ */ 50 | -------------------------------------------------------------------------------- /nxp/src/com/android/nfc/dhimpl/NativeLlcpConnectionlessSocket.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost; 20 | import com.android.nfc.LlcpPacket; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * LlcpConnectionlessSocket represents a LLCP Connectionless object to be used 26 | * in a connectionless communication 27 | */ 28 | public class NativeLlcpConnectionlessSocket implements DeviceHost.LlcpConnectionlessSocket { 29 | 30 | private int mHandle; 31 | private int mSap; 32 | private int mLinkMiu; 33 | 34 | public NativeLlcpConnectionlessSocket() { } 35 | 36 | public native boolean doSendTo(int sap, byte[] data); 37 | 38 | public native LlcpPacket doReceiveFrom(int linkMiu); 39 | 40 | public native boolean doClose(); 41 | 42 | @Override 43 | public int getLinkMiu(){ 44 | return mLinkMiu; 45 | } 46 | 47 | @Override 48 | public int getSap(){ 49 | return mSap; 50 | } 51 | 52 | @Override 53 | public void send(int sap, byte[] data) throws IOException { 54 | if (!doSendTo(sap, data)) { 55 | throw new IOException(); 56 | } 57 | } 58 | 59 | @Override 60 | public LlcpPacket receive() throws IOException { 61 | LlcpPacket packet = doReceiveFrom(mLinkMiu); 62 | if (packet == null) { 63 | throw new IOException(); 64 | } 65 | return packet; 66 | } 67 | 68 | public int getHandle(){ 69 | return mHandle; 70 | } 71 | 72 | @Override 73 | public void close() throws IOException { 74 | if (!doClose()) { 75 | throw new IOException(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /nxp/src/com/android/nfc/dhimpl/NativeLlcpServiceSocket.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost; 20 | import com.android.nfc.DeviceHost.LlcpSocket; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * LlcpServiceSocket represents a LLCP Service to be used in a 26 | * Connection-oriented communication 27 | */ 28 | public class NativeLlcpServiceSocket implements DeviceHost.LlcpServerSocket { 29 | private int mHandle; 30 | private int mLocalMiu; 31 | private int mLocalRw; 32 | private int mLocalLinearBufferLength; 33 | private int mSap; 34 | private String mServiceName; 35 | 36 | public NativeLlcpServiceSocket(){ } 37 | 38 | private native NativeLlcpSocket doAccept(int miu, int rw, int linearBufferLength); 39 | @Override 40 | public LlcpSocket accept() throws IOException { 41 | LlcpSocket socket = doAccept(mLocalMiu, mLocalRw, mLocalLinearBufferLength); 42 | if (socket == null) throw new IOException(); 43 | return socket; 44 | } 45 | 46 | private native boolean doClose(); 47 | @Override 48 | public void close() throws IOException { 49 | if (!doClose()) { 50 | throw new IOException(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /nxp/src/com/android/nfc/dhimpl/NativeP2pDevice.java: -------------------------------------------------------------------------------- 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 com.android.nfc.dhimpl; 18 | 19 | import com.android.nfc.DeviceHost.NfcDepEndpoint; 20 | 21 | /** 22 | * Native interface to the P2P Initiator functions 23 | */ 24 | public class NativeP2pDevice implements NfcDepEndpoint { 25 | 26 | private int mHandle; 27 | 28 | private int mMode; 29 | 30 | private byte mLlcpVersion; 31 | 32 | private byte[] mGeneralBytes; 33 | 34 | private native byte[] doReceive(); 35 | @Override 36 | public byte[] receive() { 37 | return doReceive(); 38 | } 39 | 40 | private native boolean doSend(byte[] data); 41 | @Override 42 | public boolean send(byte[] data) { 43 | return doSend(data); 44 | } 45 | 46 | private native boolean doConnect(); 47 | @Override 48 | public boolean connect() { 49 | return doConnect(); 50 | } 51 | 52 | private native boolean doDisconnect(); 53 | @Override 54 | public boolean disconnect() { 55 | return doDisconnect(); 56 | } 57 | 58 | public native byte[] doTransceive(byte[] data); 59 | @Override 60 | public byte[] transceive(byte[] data) { 61 | return doTransceive(data); 62 | } 63 | 64 | @Override 65 | public int getHandle() { 66 | return mHandle; 67 | } 68 | 69 | @Override 70 | public int getMode() { 71 | return mMode; 72 | } 73 | 74 | @Override 75 | public byte[] getGeneralBytes() { 76 | return mGeneralBytes; 77 | } 78 | 79 | @Override 80 | public byte getLlcpVersion() { 81 | return mLlcpVersion; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_menu_cancel_holo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-hdpi/ic_menu_cancel_holo_dark.png -------------------------------------------------------------------------------- /res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-hdpi/nfc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-hdpi/nfc.png -------------------------------------------------------------------------------- /res/drawable-hdpi/tap_again.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-hdpi/tap_again.png -------------------------------------------------------------------------------- /res/drawable-mdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-mdpi/back.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_menu_cancel_holo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-mdpi/ic_menu_cancel_holo_dark.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-mdpi/tap_again.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-mdpi/tap_again.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/tap_again.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-xhdpi/tap_again.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/tap_again.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-xxhdpi/tap_again.png -------------------------------------------------------------------------------- /res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /res/layout/cardemu_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 26 | 32 | 33 | 34 | 43 | 44 | -------------------------------------------------------------------------------- /res/layout/cardemu_payment_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 24 | 29 | 30 | -------------------------------------------------------------------------------- /res/layout/cardemu_resolver.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 24 | 27 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/layout/tapagain.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 23 | 33 | 45 | 46 | -------------------------------------------------------------------------------- /res/raw/end.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/raw/end.ogg -------------------------------------------------------------------------------- /res/raw/error.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/raw/error.ogg -------------------------------------------------------------------------------- /res/raw/start.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_Nfc/213bb1371c8ea7c68b15e325004b347f251061c9/res/raw/start.ogg -------------------------------------------------------------------------------- /res/values-af/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-am/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ar/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-as-rIN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-az-rAZ/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-b+sr+Latn/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-be-rBY/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-bg/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-bn-rBD/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-br-rFR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-bs-rBA/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ca/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-cs/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-csb-rPL/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-cy/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-da/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-de/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-el/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-en-rAU/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-en-rGB/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-en-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-en-rPT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-eo/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Nuligi 6 | 7 | aparato 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Jes 18 | 20 | 22 | 24 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /res/values-es-rCO/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-es-rMX/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-es-rUS/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-es/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-et-rEE/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-eu-rES/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "aplikazioa/com.android.kudeatutakohorniketa" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-fa/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-fi/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-fr-rCA/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-fr/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-frp-rIT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-fy-rNL/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-ga-rIE/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-gd-rGB/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-gl-rES/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-gu-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-hi/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-hr/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-hu/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-hy-rAM/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-in/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-is-rIS/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-it/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-iw/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ja/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ka-rGE/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-kk-rKZ/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-km-rKH/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-kn-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ko/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ky-rKG/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-lo-rLA/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-lt/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-lv/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-mk-rMK/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ml-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-mn-rMN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-mr-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ms-rMY/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-my-rMM/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-nb/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ne-rNP/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-nl/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-oc-rFR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-or-rIN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/values-pa-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-pl/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-pt-rPT/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-pt/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ro/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ru/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-si-rLK/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-sk/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-sl/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-sq-rAL/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-sr/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-sv/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-sw/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ta-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-te-rIN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-th/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-tl/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-tr/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-uk/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-ur-rPK/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-uz-rUZ/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-vi/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-zh-rCN/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-zh-rHK/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-zh-rTW/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values-zu/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 22 | 23 | "application/com.android.managedprovisioning" 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values/provisioning.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 21 | true 22 | 23 | 25 | 26 | application/com.android.managedprovisioning 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/com/android/nfc/LlcpException.java: -------------------------------------------------------------------------------- 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 com.android.nfc; 18 | 19 | import android.nfc.ErrorCodes; 20 | 21 | /** 22 | * Generic exception thrown in case something unexpected happened during an 23 | * LLCP communication. 24 | */ 25 | public class LlcpException extends Exception { 26 | /** 27 | * Constructs a new LlcpException with the current stack trace and the 28 | * specified detail message. 29 | * 30 | * @param s the detail message for this exception. 31 | */ 32 | public LlcpException(String s) { 33 | super(s); 34 | } 35 | 36 | public LlcpException(int error) { 37 | super(ErrorCodes.asString(error)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/android/nfc/LlcpPacket.java: -------------------------------------------------------------------------------- 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 com.android.nfc; 18 | 19 | /** 20 | * Represents a LLCP packet received in a LLCP Connectionless communication; 21 | */ 22 | public class LlcpPacket { 23 | 24 | private int mRemoteSap; 25 | 26 | private byte[] mDataBuffer; 27 | 28 | public LlcpPacket() { 29 | 30 | } 31 | 32 | /** 33 | * Returns the remote Service Access Point number 34 | */ 35 | public int getRemoteSap() { 36 | return mRemoteSap; 37 | } 38 | 39 | /** 40 | * Returns the data buffer 41 | */ 42 | public byte[] getDataBuffer() { 43 | return mDataBuffer; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/android/nfc/NfcApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 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 com.android.nfc; 18 | 19 | import android.app.ActivityManager; 20 | import android.app.ActivityManager.RunningAppProcessInfo; 21 | import android.app.Application; 22 | import android.os.Process; 23 | import android.os.UserHandle; 24 | import android.view.ThreadedRenderer; 25 | 26 | import java.util.Iterator; 27 | import java.util.List; 28 | 29 | public class NfcApplication extends Application { 30 | 31 | static final String TAG = "NfcApplication"; 32 | static final String NFC_PROCESS = "com.android.nfc"; 33 | 34 | NfcService mNfcService; 35 | 36 | public NfcApplication() { 37 | 38 | } 39 | 40 | @Override 41 | public void onCreate() { 42 | super.onCreate(); 43 | 44 | boolean isMainProcess = false; 45 | // We start a service in a separate process to do 46 | // handover transfer. We don't want to instantiate an NfcService 47 | // object in those cases, hence check the name of the process 48 | // to determine whether we're the main NFC service, or the 49 | // handover process 50 | ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE); 51 | List processes = am.getRunningAppProcesses(); 52 | Iterator i = processes.iterator(); 53 | while (i.hasNext()) { 54 | RunningAppProcessInfo appInfo = (RunningAppProcessInfo)(i.next()); 55 | if (appInfo.pid == Process.myPid()) { 56 | isMainProcess = (NFC_PROCESS.equals(appInfo.processName)); 57 | break; 58 | } 59 | } 60 | if (UserHandle.myUserId() == 0 && isMainProcess) { 61 | mNfcService = new NfcService(this); 62 | ThreadedRenderer.enableForegroundTrimming(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/com/android/nfc/NfcBackupAgent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 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 com.android.nfc; 18 | 19 | import android.app.backup.BackupAgentHelper; 20 | import android.app.backup.SharedPreferencesBackupHelper; 21 | 22 | public class NfcBackupAgent extends BackupAgentHelper { 23 | // Backup identifier 24 | static final String SHARED_PREFS_BACKUP_KEY = "shared_prefs"; 25 | 26 | @Override 27 | public void onCreate() { 28 | SharedPreferencesBackupHelper helper = 29 | new SharedPreferencesBackupHelper(this, NfcService.PREF); 30 | addHelper(SHARED_PREFS_BACKUP_KEY, helper); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/com/android/nfc/NfcPermissions.java: -------------------------------------------------------------------------------- 1 | package com.android.nfc; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.UserHandle; 6 | 7 | public class NfcPermissions { 8 | 9 | /** 10 | * NFC ADMIN permission - only for system apps 11 | */ 12 | private static final String ADMIN_PERM = android.Manifest.permission.WRITE_SECURE_SETTINGS; 13 | private static final String ADMIN_PERM_ERROR = "WRITE_SECURE_SETTINGS permission required"; 14 | 15 | /** 16 | * Regular NFC permission 17 | */ 18 | static final String NFC_PERMISSION = android.Manifest.permission.NFC; 19 | private static final String NFC_PERM_ERROR = "NFC permission required"; 20 | 21 | public static void validateUserId(int userId) { 22 | if (userId != UserHandle.getCallingUserId()) { 23 | throw new SecurityException("userId passed in is not the calling user."); 24 | } 25 | } 26 | 27 | public static void enforceAdminPermissions(Context context) { 28 | context.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR); 29 | } 30 | 31 | 32 | public static void enforceUserPermissions(Context context) { 33 | context.enforceCallingOrSelfPermission(NFC_PERMISSION, NFC_PERM_ERROR); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/android/nfc/NfcRootActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 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 com.android.nfc; 18 | 19 | import android.app.Activity; 20 | import android.app.ActivityManager; 21 | import android.content.ActivityNotFoundException; 22 | import android.content.Intent; 23 | import android.os.Bundle; 24 | import android.os.UserHandle; 25 | 26 | public class NfcRootActivity extends Activity { 27 | 28 | static final String EXTRA_LAUNCH_INTENT = "launchIntent"; 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | Intent intent = getIntent(); 34 | if (intent != null && intent.hasExtra(EXTRA_LAUNCH_INTENT)) { 35 | final Intent launchIntent = intent.getParcelableExtra(EXTRA_LAUNCH_INTENT); 36 | if (launchIntent != null) { 37 | try { 38 | startActivityAsUser(launchIntent, UserHandle.CURRENT); 39 | } catch (ActivityNotFoundException e) { 40 | } 41 | } 42 | } 43 | finish(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/com/android/nfc/ScreenStateHelper.java: -------------------------------------------------------------------------------- 1 | package com.android.nfc; 2 | 3 | import android.app.KeyguardManager; 4 | import android.content.Context; 5 | import android.os.PowerManager; 6 | 7 | /** 8 | * Helper class for determining the current screen state for NFC activities. 9 | */ 10 | class ScreenStateHelper { 11 | 12 | static final int SCREEN_STATE_UNKNOWN = 0; 13 | static final int SCREEN_STATE_OFF = 1; 14 | static final int SCREEN_STATE_ON_LOCKED = 2; 15 | static final int SCREEN_STATE_ON_UNLOCKED = 3; 16 | 17 | private final PowerManager mPowerManager; 18 | private final KeyguardManager mKeyguardManager; 19 | 20 | ScreenStateHelper(Context context) { 21 | mKeyguardManager = (KeyguardManager) 22 | context.getSystemService(Context.KEYGUARD_SERVICE); 23 | mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); 24 | } 25 | 26 | int checkScreenState() { 27 | //TODO: fix deprecated api 28 | if (!mPowerManager.isScreenOn()) { 29 | return SCREEN_STATE_OFF; 30 | } else if (mKeyguardManager.isKeyguardLocked()) { 31 | return SCREEN_STATE_ON_LOCKED; 32 | } else { 33 | return SCREEN_STATE_ON_UNLOCKED; 34 | } 35 | } 36 | 37 | /** 38 | * For debugging only - no i18n 39 | */ 40 | static String screenStateToString(int screenState) { 41 | switch (screenState) { 42 | case SCREEN_STATE_OFF: 43 | return "OFF"; 44 | case SCREEN_STATE_ON_LOCKED: 45 | return "ON_LOCKED"; 46 | case SCREEN_STATE_ON_UNLOCKED: 47 | return "ON_UNLOCKED"; 48 | default: 49 | return "UNKNOWN"; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/com/android/nfc/TechListChooserActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 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 com.android.nfc; 18 | 19 | import com.android.internal.app.ResolverActivity; 20 | 21 | import android.content.Intent; 22 | import android.content.pm.ResolveInfo; 23 | import android.os.Bundle; 24 | import android.os.Parcelable; 25 | import android.util.Log; 26 | 27 | import java.util.ArrayList; 28 | 29 | public class TechListChooserActivity extends ResolverActivity { 30 | public static final String EXTRA_RESOLVE_INFOS = "rlist"; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | Intent intent = getIntent(); 35 | Parcelable targetParcelable = intent.getParcelableExtra(Intent.EXTRA_INTENT); 36 | if (!(targetParcelable instanceof Intent)) { 37 | Log.w("TechListChooserActivity", "Target is not an intent: " + targetParcelable); 38 | finish(); 39 | return; 40 | } 41 | Intent target = (Intent)targetParcelable; 42 | ArrayList rList = intent.getParcelableArrayListExtra(EXTRA_RESOLVE_INFOS); 43 | CharSequence title = getResources().getText(com.android.internal.R.string.chooseActivity); 44 | super.onCreate(savedInstanceState, target, title, null, rList, false); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/com/android/nfc/beam/BeamTransferRecord.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 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 com.android.nfc.beam; 18 | 19 | parcelable BeamTransferRecord; 20 | -------------------------------------------------------------------------------- /src/com/android/nfc/beam/MimeTypeUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 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 com.android.nfc.beam; 18 | 19 | import android.content.ContentResolver; 20 | import android.content.Context; 21 | import android.net.Uri; 22 | import android.util.Log; 23 | import android.webkit.MimeTypeMap; 24 | 25 | public final class MimeTypeUtil { 26 | 27 | private static final String TAG = "MimeTypeUtil"; 28 | 29 | private MimeTypeUtil() {} 30 | 31 | public static String getMimeTypeForUri(Context context, Uri uri) { 32 | if (uri.getScheme() == null) return null; 33 | 34 | if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { 35 | ContentResolver cr = context.getContentResolver(); 36 | return cr.getType(uri); 37 | } else if (uri.getScheme().equals(ContentResolver.SCHEME_FILE)) { 38 | String extension = MimeTypeMap.getFileExtensionFromUrl(uri.getPath()).toLowerCase(); 39 | if (extension != null) { 40 | return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); 41 | } else { 42 | return null; 43 | } 44 | } else { 45 | Log.d(TAG, "Could not determine mime type for Uri " + uri); 46 | return null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/com/android/nfc/cardemulation/DefaultRemovedActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 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 com.android.nfc.cardemulation; 18 | 19 | import android.content.DialogInterface; 20 | import android.content.Intent; 21 | import android.os.Bundle; 22 | import android.provider.Settings; 23 | import com.android.internal.R; 24 | 25 | import com.android.internal.app.AlertActivity; 26 | import com.android.internal.app.AlertController; 27 | 28 | public class DefaultRemovedActivity extends AlertActivity implements 29 | DialogInterface.OnClickListener { 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert); 33 | super.onCreate(savedInstanceState); 34 | 35 | AlertController.AlertParams ap = mAlertParams; 36 | 37 | ap.mMessage = getString(com.android.nfc.R.string.default_pay_app_removed); 38 | ap.mNegativeButtonText = getString(R.string.no); 39 | ap.mPositiveButtonText = getString(R.string.yes); 40 | ap.mPositiveButtonListener = this; 41 | setupAlert(); 42 | } 43 | 44 | @Override 45 | public void onClick(DialogInterface dialog, int which) { 46 | // Launch into Settings 47 | Intent intent = new Intent(Settings.ACTION_NFC_PAYMENT_SETTINGS); 48 | startActivity(intent); 49 | } 50 | } -------------------------------------------------------------------------------- /src/com/android/nfc/snep/SnepException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 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 com.android.nfc.snep; 18 | 19 | public class SnepException extends Exception { 20 | 21 | public SnepException(String message) { 22 | super(message); 23 | } 24 | 25 | public SnepException(Exception cause) { 26 | super(cause); 27 | } 28 | 29 | public SnepException(String message, Exception cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2011, The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH:= $(call my-dir) 16 | include $(CLEAR_VARS) 17 | 18 | # We only want this apk build for tests. 19 | LOCAL_MODULE_TAGS := tests 20 | 21 | LOCAL_JAVA_LIBRARIES := android.test.runner 22 | 23 | # Include all test java files. 24 | LOCAL_SRC_FILES := $(call all-java-files-under, src) 25 | 26 | LOCAL_PACKAGE_NAME := NfcTests 27 | LOCAL_CERTIFICATE := platform 28 | 29 | LOCAL_INSTRUMENTATION_FOR := Nfc 30 | 31 | include $(BUILD_PACKAGE) 32 | -------------------------------------------------------------------------------- /tests/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 33 | 36 | 37 | 38 | --------------------------------------------------------------------------------