Skip to content

Commit c525049

Browse files
committed
fix: android: do not initialize tracing if it is disabled
1 parent d6b2cee commit c525049

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/platform/android/AndroidChipPlatform-JNI.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
#include "CommissionableDataProviderImpl.h"
4444
#include "DiagnosticDataProviderImpl.h"
4545
#include "DnssdImpl.h"
46+
47+
#if MATTER_TRACING_ENABLED
4648
#include "tracing.h"
49+
#endif // MATTER_TRACING_ENABLED
4750

4851
using namespace chip;
4952

@@ -97,7 +100,9 @@ CHIP_ERROR AndroidChipPlatformJNI_OnLoad(JavaVM * jvm, void * reserved)
97100
err = BleConnectCallbackJNI_OnLoad(jvm, reserved);
98101
SuccessOrExit(err);
99102

103+
#if MATTER_TRACING_ENABLED
100104
chip::Android::InitializeTracing();
105+
#endif // MATTER_TRACING_ENABLED
101106
exit:
102107
if (err != CHIP_NO_ERROR)
103108
{
@@ -110,7 +115,9 @@ CHIP_ERROR AndroidChipPlatformJNI_OnLoad(JavaVM * jvm, void * reserved)
110115

111116
void AndroidChipPlatformJNI_OnUnload(JavaVM * jvm, void * reserved)
112117
{
118+
#if MATTER_TRACING_ENABLED
113119
chip::Android::ShutdownTracing();
120+
#endif // MATTER_TRACING_ENABLED
114121

115122
ChipLogProgress(DeviceLayer, "AndroidChipPlatform JNI_OnUnload() called");
116123
BleConnectCallbackJNI_OnUnload(jvm, reserved);

src/platform/android/BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,16 @@ static_library("android") {
8383
]
8484

8585
deps = [
86-
":tracing",
8786
"${chip_root}/src/app:app_config",
8887
"${chip_root}/src/app/common:ids",
8988
"${chip_root}/src/lib/dnssd:platform_header",
9089
"${chip_root}/src/setup_payload",
9190
]
9291

92+
if (matter_enable_tracing_support) {
93+
deps += [ ":tracing" ]
94+
}
95+
9396
public_deps = [ "${chip_root}/src/platform:platform_base" ]
9497

9598
public_configs = []

0 commit comments

Comments
 (0)