🚀🚀 Matter初始化闪退问题

App开发相关产品技术讨论,包括OEM App、App SDK等话题


Post Reply
User avatar
hackill
Posts: 12

基本信息:

  • SDK 使用5.16.1 版本

问题描述:

使用matter 需要在有matter设备的家庭中进行初始化,偶尔会到一些 so库的闪退问题,解决起来颇为头疼,最终遇到的情况和解决的办法如下。

matter的初始化的代码如下

Code: Select all

IThingMatterFabricManager fabricManager = ThingHomeSdk.getFabricManager();
fabricManager.initFabric(getContext(), spaceId, new IThingDataCallback<OpenFabricInfo>() {
     @Override
     public void onSuccess(OpenFabricInfo result) {

}

@Override
public void onError(String errorCode, String errorMessage) {

}
});

情况1:初始化闪退情况1

闪退信息为

Code: Select all

DEBUG   :     x0  b400007b5e8054f0  x1  0000000000000019  x2  0000007979bdc280  x3  0000007979bdbfea
DEBUG   :     x4  b400007c9e721b41  x5  0000007979bdbf91  x6  0000007979bdb0ec  x7  0000007979bdb0ec
DEBUG   :     x8  0000007979bdc290  x9  0000000000000000  x10 00000000000001a8  x11 0000000000000000
DEBUG   :     x12 00000000ffffffee  x13 0000000000000031  x14 0000000000000000  x15 000000003fffffff
DEBUG   :     x16 0000007968093eb0  x17 0000007968012724  x18 0000007978dec000  x19 0000007979bde948
DEBUG   :     x20 b400007b0e693c50  x21 0000007d56fc1709  x22 0000007979bde378  x23 0000007979bde990
DEBUG   :     x24 00000079edffbd90  x25 0000000000000002  x26 00000079edffbb30  x27 0000000000000002
DEBUG   :     x28 0000007979bde860  x29 0000007979bdc000
DEBUG   :     lr  000000796800f0b8  sp  0000007979bdbfc0  pc  000000796800f0f0  pst 0000000080001000
DEBUG   : 59 total frames
DEBUG   : backtrace:
DEBUG   :       #00 pc 00000000019e00f0  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000) (chip::FabricTable::AddNewPendingTrustedRootCert(chip::Span<unsigned char const> const&)+340)
DEBUG   :       #01 pc 00000000018c685c  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000) (chip::Controller::DeviceController::InitControllerNOCChain(chip::Controller::ControllerInitParams const&)+1204)
DEBUG   :       #02 pc 00000000018c601c  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000) (chip::Controller::DeviceController::Init(chip::Controller::ControllerInitParams)+524)
DEBUG   :       #03 pc 00000000018c8484  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000) (chip::Controller::DeviceCommissioner::Init(chip::Controller::CommissionerInitParams)+64)
DEBUG   :       #04 pc 00000000018e1b80  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000)
DEBUG   :       #05 pc 000000000090b090  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000)
DEBUG   :       #06 pc 0000000000917680  /data/app/~~HHrcjh2jVUh61LR3nTQLQw==/com.ledvance.smartunify-l7sMbNtOVuGtX-wKAsMs8w==/base.apk (offset 0x9540000) (Java_chip_devicecontroller_ChipDeviceController_newDeviceController+2244)
DEBUG   :       #07 pc 0000000000384370  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 3f7d5a016e08d528f129bdd336d81168)

这里的闪退原因 初始化initFabric 重复的init了,在initfabrci初始化的时候,是一个异步的行为,需要等待initFabric 完成后 才能进行 下一个initfabric

初始化闪退情况2

Code: Select all

19444 19773 E Thing   : thing_matter  _ChipDeviceControllerManager Create main device controller exceptionchip.devicecontroller.ChipDeviceControllerException: src/credentials/FabricTable.cpp:795: CHIP Error 0x0000000B: No memory
19444 19773 W Thing   : thing_matter MatterService getMainDeviceController
19444 19773 I Thing   : thing_matter  _ChipDeviceControllerManager Create main controller fabricId is: 13673184 ,nodeId is: 65536
19444 19773 D thing-matter: TS: Reverted Last Known Good Time to previous value
19444 19773 E Thing   : thing_matter  _ChipDeviceControllerManager Create main device controller exceptionchip.devicecontroller.ChipDeviceControllerException: src/credentials/FabricTable.cpp:795: CHIP Error 0x0000000B: No memory
19444 19773 W Thing   : thing_matter MatterService getMainDeviceController
19444 19773 I Thing   : thing_matter  _ChipDeviceControllerManager Create main controller fabricId is: 13673184 ,nodeId is: 65536
19444 19773 E Thing   : thing_matter  _ChipDeviceControllerManager Create main device controller exceptionchip.devicecontroller.ChipDeviceControllerException: src/credentials/FabricTable.cpp:795: CHIP Error 0x0000000B: No memory
19444 19773 W Thing   : thing_matter MatterService getMainDeviceController
19444 19773 I Thing   : thing_matter  _ChipDeviceControllerManager Create main controller fabricId is: 13673184 ,nodeId is: 65536
19444 19773 E Thing   : thing_matter  _ChipDeviceControllerManager Create main device controller exceptionchip.devicecontroller.ChipDeviceControllerException: src/credentials/FabricTable.cpp:795: CHIP Error 0x0000000B: No memory
19444 19773 W Thing   : thing_matter MatterService getMainDeviceController
19444 19773 I Thing   : thing_matter  _ChipDeviceControllerManager Create main controller fabricId is: 13673184 ,nodeId is: 65536

表现的情况为 有常规初始化,却闪退,通过日志分析,在初始化的时候 有报错 src/credentials/FabricTable.cpp:795: CHIP Error 0x0000000B: No memory。针对这情况,分析matter源码找到原因,因为内部限制了 fabric初始化,最多只能为17,所以进行初始化 initfabric 的时候 也需要考虑数量问题。避免越界导致的无法创建,进而引起后续的崩溃

Tuya App SDK Developer


Tags:
Post Reply