NFC学习——NfcService 启动过程分析

本文深入分析了NFC设备开机时NfcService的启动过程,结合logcat日志,揭示了NFC框架的基础工作原理。
摘要由CSDN通过智能技术生成

在机器开机过程中,可以抓取到以下的正常logcat信息:

//setp1
I/NfcService( 3809): Starting NFC service
D/NFCJNI  ( 3809): NFC Service : loading JNI
I/RegisteredComponentCache( 3809): ComponentInfo: ResolveInfo{41344108 
com.android.apps.tag.TagViewer p=0 o=0 m=0x108000}, techs: android.nfc.tech.Ndef, 
W/NfceeAccess( 3809): could not find /etc/nfcee_access.xml, no NFCEE access allowed
I/NfceeAccess( 3809): read 0 signature(s) for NFCEE access
D/NfcService( 3809): checking on firmware download

下面是硬件不支持NFC的异常logcat信息:
I/NfcService( 3485): Starting NFC service
D/NFCJNI  ( 3485): NFC Service : loading JNI
W/NfceeAccess( 3485): could not find /etc/nfcee_access.xml, no NFCEE access allowed
I/NfceeAccess( 3485): read 0 signature(s) for NFCEE access
D/NfcService( 3485): checking on firmware download
D/NfcService( 3485): NFC is on. Doing normal stuff
I/NfcService( 3485): Enabling NFC
D/NFCJNI  ( 3485): Start Initialization
E/NFCJNI  ( 3485): hw_get_module() failed.
D/NFCJNI  ( 3485): Terminating client thread...
W/NfcService( 3485): Error enabling NFC
来看正常logcat信息setp1,NfcService 是application,它的onCreate()方法:

@Override
    public void onCreate() {
        super.onCreate();

        mNfcTagService = new TagService();
        mNfcAdapter = new NfcAdapterService();
        mExtrasService = new NfcAdapterExtrasService();

        Log.i(TAG, "Starting NFC service");
        
        //setp2:NFC Service : loading JNI
        mDeviceHost = new NativeNfcManager(this, this);

        HandoverManager handoverManager = new HandoverManager(mContext);
 		
 	//NfcDispatcher主要负责tag消息处理,并派发Intent消息,启动Activity。
 	mNfcDispatcher = new NfcDispatcher(this, handoverManager); 
 	    
 	mP2pLinkManager = new P2pLinkManager(mContext, handoverManager); 
 	mSecureElement = new NativeNfcSecureElement(mContext);                 
 	    
        //setp3:could not find /etc/nfcee_access.xml, no NFCEE access allowed 
        mNfceeAccessControl = new NfceeAccessControl(this); 
        
   //把mNfcAdapter 作为Service 添加到系统服务中,ServiceManager.getService("nfc
  • 9
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值