From 6f4271697facb18f5cd68a7502626185f799edae Mon Sep 17 00:00:00 2001 From: sheetalarkadam <100380551+sheetalarkadam@users.noreply.github.com> Date: Fri, 7 Aug 2026 14:21:40 -0700 Subject: [PATCH] fix(cpp): remove the dead Android 1DS Java HTTP bridge The C++ core does not compile for Android: android_telemetry_bridge.cc:4:10: fatal error: 'http/HttpClient_Android.hpp' file not found HttpClient_Android.hpp is an internal header of cpp_client_telemetry (upstream lib/http/), and ports/cpp-client-telemetry/portfile.cmake installs only the public mat/ surface, so the include cannot resolve. Installing that header would not have been the fix. The port configures upstream with -DMATSDK_USE_VCPKG_DEPS=ON, and upstream's lib/CMakeLists.txt compiles http/HttpClient_Android.cpp only in the *else* branch of that option; with vcpkg deps, Android builds HttpClient_Curl.cpp instead. Confirmed against the built library: libmat.a for arm64-android defines 0 HttpClient_Android symbols and 37 HttpClient_Curl symbols. Adding the header would have traded a compile error for a link error. So the Java/JNI transport does not exist in this configuration. Android uploads over curl exactly like Linux, and the readiness gate it guarded was asking a question with no meaning here -- it could only ever have suppressed uploads that in fact work. Remove the bridge, the gate, and the source-list entry that pulled it in. No behavioural risk on desktop: the removed code was all inside ANDROID / __ANDROID__ guards. No regression risk on Android either, since telemetry has never compiled there. Verified: clean Android arm64-v8a build (166/166, links) and a Windows RelWithDebInfo build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24ef037b-246f-4fea-a1a3-4fae5223cb0c --- sdk_v2/cpp/CMakeLists.txt | 3 --- sdk_v2/cpp/src/telemetry/android_telemetry_bridge.cc | 12 ------------ sdk_v2/cpp/src/telemetry/one_ds_telemetry.cc | 12 ------------ 3 files changed, 27 deletions(-) delete mode 100644 sdk_v2/cpp/src/telemetry/android_telemetry_bridge.cc diff --git a/sdk_v2/cpp/CMakeLists.txt b/sdk_v2/cpp/CMakeLists.txt index c2e838860..c8e95cca3 100644 --- a/sdk_v2/cpp/CMakeLists.txt +++ b/sdk_v2/cpp/CMakeLists.txt @@ -252,9 +252,6 @@ set(FOUNDRY_LOCAL_SOURCES # 1DS bridge — always compiled for Foundry Local Core. list(APPEND FOUNDRY_LOCAL_SOURCES src/telemetry/one_ds_telemetry.cc) -if(ANDROID) - list(APPEND FOUNDRY_LOCAL_SOURCES src/telemetry/android_telemetry_bridge.cc) -endif() # Organize headers into filters matching the directory structure in Visual Studio source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Source" FILES ${FOUNDRY_LOCAL_SOURCES}) diff --git a/sdk_v2/cpp/src/telemetry/android_telemetry_bridge.cc b/sdk_v2/cpp/src/telemetry/android_telemetry_bridge.cc deleted file mode 100644 index 9a4d7c79b..000000000 --- a/sdk_v2/cpp/src/telemetry/android_telemetry_bridge.cc +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#include "http/HttpClient_Android.hpp" - -extern "C" __attribute__((visibility("default"))) bool FoundryLocalIsAndroidTelemetryReady() noexcept { - try { - return Microsoft::Applications::Events::HttpClient_Android::GetClientInstance() != nullptr; - } catch (...) { - return false; - } -} diff --git a/sdk_v2/cpp/src/telemetry/one_ds_telemetry.cc b/sdk_v2/cpp/src/telemetry/one_ds_telemetry.cc index 02fee0d7c..89479fc19 100644 --- a/sdk_v2/cpp/src/telemetry/one_ds_telemetry.cc +++ b/sdk_v2/cpp/src/telemetry/one_ds_telemetry.cc @@ -24,10 +24,6 @@ #include #include "one_ds_tenant_token.h" -#if defined(__ANDROID__) -extern "C" bool FoundryLocalIsAndroidTelemetryReady() noexcept; -#endif - namespace fl { namespace { @@ -192,14 +188,6 @@ OneDsTelemetry::OneDsTelemetry(const std::string& app_name, "[Telemetry] Disabled via configuration; non-essential 1DS upload disabled " "(ProcessInfo still uploads)"); } -#if defined(__ANDROID__) - if (!FoundryLocalIsAndroidTelemetryReady()) { - logger_.Log(LogLevel::Information, - "[Telemetry] Android 1DS Java HTTP bridge is not initialized; 1DS upload disabled " - "(events still logged locally)"); - return; - } -#endif const auto token = GetToken(); if (token.empty()) { logger_.Log(LogLevel::Information,