MTK Android13 user版本进入engineermode的Bluetooth测试项时闪退

平台:MT6771 android13

问题描述:进入到工模,点击进入Bluetooth测试项直接闪退

Log如下:

复制代码
07-31 10:15:51.480  3605  3605 D EM/EmUtils: getEmAidlService ...
07-31 10:15:51.481   398   398 I servicemanager: Could not find vendor.mediatek.hardware.engineermode.IEmds/default in the VINTF manifest.
07-31 10:15:51.481  3605  3605 D EM/EmHalService: btIsEmSupport by HIDL
07-31 10:15:51.481  3605  3605 V EM/EmUtils: getEmHidlService ...
07-31 10:15:51.481  3605  3605 V EM/EmUtils: getEmHidlService init...
07-31 10:15:51.482   399   399 I hwservicemanager: getTransport: Cannot find entry vendor.mediatek.hardware.engineermode@1.3::IEmd/EmHidlServer in either framework or device VINTF manifest.
07-31 10:15:51.482  3605  3605 W System.err: java.util.NoSuchElementException
07-31 10:15:51.482  3605  3605 W System.err: 	at android.os.HwBinder.getService(Native Method)
07-31 10:15:51.482  3605  3605 W System.err: 	at vendor.mediatek.hardware.engineermode.V1_3.IEmd.getService(IEmd.java:57)
07-31 10:15:51.482  3605  3605 W System.err: 	at com.mediatek.engineermode.EmUtils.getEmHidlService(EmUtils.java:179)
07-31 10:15:51.482  3605  3605 W System.err: 	at com.mediatek.engineermode.EmHalService.btIsEmSupport(EmHalService.java:597)
07-31 10:15:51.482  3605  3605 W System.err: 	at com.mediatek.engineermode.FeatureSupport.isEmBTSupport(FeatureSupport.java:244)
07-31 10:15:51.482  3605  3605 W System.err: 	at com.mediatek.engineermode.bluetooth.BtList.onCreate(BtList.java:93)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.Activity.performCreate(Activity.java:8290)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.Activity.performCreate(Activity.java:8269)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3697)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3853)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2345)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.os.Looper.loopOnce(Looper.java:201)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.os.Looper.loop(Looper.java:288)
07-31 10:15:51.482  3605  3605 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7941)
07-31 10:15:51.482  3605  3605 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
07-31 10:15:51.482  3605  3605 W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
07-31 10:15:51.482  3605  3605 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
07-31 10:15:51.482  3605  3605 E EM/EmUtils: EmHIDLConnection exception2 ...
07-31 10:15:51.483  3605  3605 D AndroidRuntime: Shutting down VM
07-31 10:15:51.483  3605  3605 E AndroidRuntime: FATAL EXCEPTION: main
07-31 10:15:51.483  3605  3605 E AndroidRuntime: Process: com.mediatek.engineermode, PID: 3605
07-31 10:15:51.483  3605  3605 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mediatek.engineermode/com.mediatek.engineermode.bluetooth.BtList}: java.lang.NullPointerException: Attempt to invoke interface method 'int vendor.mediatek.hardware.engineermode.V1_3.IEmd.btIsEmSupport()' on a null object reference
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3716)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3853)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2345)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7941)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int vendor.mediatek.hardware.engineermode.V1_3.IEmd.btIsEmSupport()' on a null object reference
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at com.mediatek.engineermode.EmHalService.btIsEmSupport(EmHalService.java:597)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at com.mediatek.engineermode.FeatureSupport.isEmBTSupport(FeatureSupport.java:244)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at com.mediatek.engineermode.bluetooth.BtList.onCreate(BtList.java:93)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:8290)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:8269)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3697)
07-31 10:15:51.483  3605  3605 E AndroidRuntime: 	... 12 more
07-31 10:15:51.485  1190  1600 I mtkpower_client: [Legacy][PowerHal_Wrap_notifyAppState] com.mediatek.engineermode/com.mediatek.engineermode pid=3605 state:3

从日志咱们可以看到:

c 复制代码
servicemanager: Could not find vendor.mediatek.hardware.engineermode.IEmds/default in the VINTF manifest.

很明显这个服务没有注册,找到编译规则s0_vnd/device/mediatek/vendor/common/device.mk,可以看到以下:

c 复制代码
ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug),)
DEVICE_MANIFEST_FILE += $(LOCAL_PATH)/project_manifest/manifest_em.xml
PRODUCT_PACKAGES += em_hidl

可以看到只有在编译eng,userdebug版本时会编译em_hidl,那在编译规则中加上user即可解决这个问题

c 复制代码
-      ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug),)
+      ifneq ($(filter $(TARGET_BUILD_VARIANT),eng userdebug user),)
        DEVICE_MANIFEST_FILE += $(LOCAL_PATH)/project_manifest/manifest_em.xml
        PRODUCT_PACKAGES += em_hidl
      endif
相关推荐
Bervin121381 天前
Flutter Android环境的搭建
android·flutter
e***87701 天前
windows配置永久路由
android·前端·后端
fouryears_234171 天前
现代 Android 后台应用读取剪贴板最佳实践
android·前端·flutter·dart
YF02111 天前
Frida for MacBook/Android 安装配置
android·前端
雨白1 天前
Android实战:构建高可维护的日志系统
android
茄子凉心1 天前
android 开机启动App
android·java·开发语言
2501_937193142 天前
神马影视 8.8 版源码:4K 播放优化体验测评
android·源码·源代码管理·机顶盒
修炼者2 天前
Kotlin中的Flow流
android·kotlin
洞见不一样的自己2 天前
Android studio 编译问题
android
j***63082 天前
SpringbootActuator未授权访问漏洞
android·前端·后端