平台: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