OMAPI是啥?看看谷歌的解释:
说了一大堆懂的人不需要看,不懂的还是看不懂,我就是后者
总之说人话就是,像SIM卡,NFC这类模块需要用到这个东西,那么接着往下看
上层APP想要使用这个OMAPI供应商稳定版服务功能,会调用到SecureElement这个APP的接口
以下为SecureElement的代码路径:
但是安卓13版本上SecureElement默认是不开启OMAPI供应商稳定版服务功能,需要在packages/apps/SecureElement/res/values/config.xml这个路径下将“secure_element_vintf_enabled” 这个属性修改为"true"。咋们看看secure_element_vintf_enabled 是哪段代码中被加载
看看VSTABLE_SECURE_ELEMENT_SERVICE 这个变量的值是android.se.omapi.ISecureElementService/default
可以看到当secure_element_vintf_enabled为true的时候,android.se.omapi.ISecureElementService/default 这个hal层服务才被加载。
那么将secure_element_vintf_enabled 属性修改为true后,编译刷机。
开机完成后进入Launcher,弹出SecureElement的报错框,随后系统进入recovery模式,使用adb logcat > F:/log/1111.log抓取日志,看看为什么报错,报错日志如下:
03-14 10:27:19.273 2799 2799 I SecureElementService: Check if terminal eSE1 is available. // 检查eSE1 是否可用
03-14 10:27:19.274 409 409 I hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.2::ISecureElement/eSE1 in either framework or device VINTF manifest. // 在资源文件中找不到android.hardware.secure_element@1.2::ISecureElement/eSE1这个服务
03-14 10:27:19.274 2799 2799 D SecureElement-Terminal-eSE1: SE Hal V1.2 is not supported // SE Hal V1.2 不被支持
03-14 10:27:19.275 409 409 I hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.1::ISecureElement/eSE1 in either framework or device VINTF manifest.
03-14 10:27:19.276 2799 2799 D SecureElement-Terminal-eSE1: SE Hal V1.1 is not supported
03-14 10:27:19.276 409 409 I hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.0::ISecureElement/eSE1 in either framework or device VINTF manifest.
03-14 10:27:19.277 1976 2602 I NearbyDiscovery: Show notifications: 0 total, no changes since last shown, no-op. [CONTEXT service_id=265 ]
03-14 10:27:19.277 2799 2799 I SecureElementService: No HAL implementation for eSE1
03-14 10:27:19.277 2799 2799 I SecureElementService: Check if terminal SIM1 is available.
03-14 10:27:19.277 409 409 I hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.2::ISecureElement/SIM1 in either framework or device VINTF manifest.
03-14 10:27:19.278 2799 2799 D SecureElement-Terminal-SIM1: SE Hal V1.2 is not supported
03-14 10:27:19.278 409 409 I hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.1::ISecureElement/SIM1 in either framework or device VINTF manifest.
03-14 10:27:19.278 2799 2799 D SecureElement-Terminal-SIM1: SE Hal V1.1 is not supported
03-14 10:27:19.279 409 409 I hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.0::ISecureElement/SIM1 in either framework or device VINTF manifest.
03-14 10:27:19.279 2743 2743 D WindowTokenClient: Only apply configuration update to Resources because shouldReportConfigChange is false.
03-14 10:27:19.279 2743 2743 D WindowTokenClient: android.window.WindowTokenClient.attachToDisplayArea:118 android.window.WindowContextController.attachToDisplayArea:107 android.window.WindowProviderService.attachBaseContext:161 android.app.Service.attach:915 android.app.ActivityThread.handleCreateService:4553
03-14 10:27:19.279 2799 2799 I SecureElementService: No HAL implementation for SIM1
03-14 10:27:19.279 1976 2602 I NearbyDiscovery: DiscoveryModule: EventLoop destroyed [CONTEXT service_id=265 ]
03-14 10:27:19.280 408 408 I servicemanager: Could not find android.se.omapi.ISecureElementService/default in the VINTF manifest.
03-14 10:27:19.281 2799 2799 D AndroidRuntime: Shutting down VM // 虚拟机被关闭
03-14 10:27:19.282 2799 2799 E AndroidRuntime: FATAL EXCEPTION: main
03-14 10:27:19.282 2799 2799 E AndroidRuntime: Process: com.android.se, PID: 2799
03-14 10:27:19.282 2799 2799 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.se.SecureElementService: java.lang.IllegalArgumentException: VINTF declaration error
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4568)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7941)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: VINTF declaration error
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Parcel.createExceptionOrNull(Parcel.java:3015)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:2995)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2978)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2920)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.IServiceManager$Stub$Proxy.addService(IServiceManager.java:446)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:72)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.ServiceManager.addService(ServiceManager.java:213)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.os.ServiceManager.addService(ServiceManager.java:180)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at com.android.se.SecureElementService.onCreate(SecureElementService.java:216)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4555)
03-14 10:27:19.282 2799 2799 E AndroidRuntime: ... 9 more
03-14 10:27:19.282 2056 2247 W MediaProvider: getVolumePath for unknown volume: internal
03-14 10:27:19.285 1215 2001 I mtkpower_client: [Legacy][PowerHal_Wrap_notifyAppState] com.android.se/com.android.se pid=2799 state:3
03-14 10:27:19.285 1215 2001 I game_scn: collectForegroundAppList packName=com.android.se, actName=com.android.se, pid=2799, uid=1068, state:DEAD
03-14 10:27:19.285 558 675 I libPowerHal: [perfNotifyAppState] pack:com.android.se, act:com.android.se, state:3, pid:2799, uid:1068, fps:-1
03-14 10:27:19.285 558 675 I libPowerHal: [perfNotifyAppState] pack:com.android.se, pid:2799, STATE_DEAD
03-14 10:27:19.285 558 675 D RilUtility: notify_rild_crash_pid_set certPid:-1, crash:2799, scn:0x0
03-14 10:27:19.286 2771 2771 I DebugLoggerUI/MyApplication: -->onCreate()
03-14 10:27:19.287 1215 2001 W ActivityManager: Process com.android.se has crashed too many times, killing! Reason: crashed quickly
03-14 10:27:19.291 2799 2799 I Process : Sending signal. PID: 2799 SIG: 9
03-14 10:27:19.292 2771 2771 I DebugLoggerUI/LogReceiver: -->onReceive(), action=android.intent.action.BOOT_COMPLETED
03-14 10:27:19.294 2771 2832 I DebugLoggerUI/LogConfig: -->checkConfig()
03-14 10:27:19.295 2771 2832 I DebugLoggerUI: isTaglogEnable ? false
03-14 10:27:19.298 1215 2829 I DropBoxManagerService: add tag=system_app_crash isTagEnabled=true flags=0x2
根据日志可以看到导致SecureElement报错,系统也进入recovery模式的罪魁祸首就是hal层中OMAPI相关的服务并没有被加载
hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.0::ISecureElement/eSE1 in either framework or device VINTF manifest.. // eSE1相关hal层服务未被加载
hwservicemanager: getTransport: Cannot find entry android.hardware.secure_element@1.2::ISecureElement/SIM1 in either framework or device VINTF manifest. // SIM1相关hal层服务未被加载
像这类问题,一般是在device.mk文件中配置编译规则,编译规则一般是判断宏定义的值来决定hal层的服务是否被编译
先记录到这,后续更新