Skip to content

Commit 0294d9d

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

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import("${chip_root}/src/platform/device.gni")
1919

2020
import("${build_root}/config/android_abi.gni")
2121
import("${chip_root}/build/chip/java/rules.gni")
22+
import("${chip_root}/src/tracing/tracing_args.gni")
2223

2324
assert(chip_device_platform == "android")
2425

@@ -83,13 +84,16 @@ static_library("android") {
8384
]
8485

8586
deps = [
86-
":tracing",
8787
"${chip_root}/src/app:app_config",
8888
"${chip_root}/src/app/common:ids",
8989
"${chip_root}/src/lib/dnssd:platform_header",
9090
"${chip_root}/src/setup_payload",
9191
]
9292

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

9599
public_configs = []

0 commit comments

Comments
 (0)