From 1d91d768c78804e7aef5c73db592e4f6c2baa820 Mon Sep 17 00:00:00 2001 From: Shamil Yessenkulov Date: Wed, 9 Oct 2024 15:37:33 -0700 Subject: [PATCH] Fixing the hybrid qpl integration with the flipper plugin Summary: In the previous diff hybrid qpl data is started being missing due to JFlipperPlugin not having the isDuplicationAllowed field. Because FlipperPlugin is implemented as the Java Interface it wasn't possible to add it there - instead we added this field to the QPL Flipper Plugin. This is causing an issue when the C++ flipper plugin will be added first to the client. Because isDuplicationAllowed flag as the default will be False. For this reason, Java Flipper plugin is not being attached when calling the native addPlugin() API. Changing this call to check for the identifier and if it's "UIPerft"(Flipper plugin) then changing it to True. Differential Revision: D64058286 fbshipit-source-id: b74810ba9c4e91956545ae4fd3260fc4159ff7c1 --- android/src/main/cpp/sonar.cpp | 3 +++ xplat/Flipper/FlipperPlugin.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/android/src/main/cpp/sonar.cpp b/android/src/main/cpp/sonar.cpp index fd2154154fc..84178df0784 100644 --- a/android/src/main/cpp/sonar.cpp +++ b/android/src/main/cpp/sonar.cpp @@ -811,6 +811,9 @@ class JFlipperClient : public jni::HybridClass { try { auto wrapper = std::make_shared(make_global(plugin)); + if (wrapper->identifier() == "UIPerf") { + wrapper->isDuplicationAllowed.store(true); + } FlipperClient::instance()->addPlugin(wrapper); } catch (const std::exception& e) { handleException(e); diff --git a/xplat/Flipper/FlipperPlugin.h b/xplat/Flipper/FlipperPlugin.h index f44815875f5..7faefa1b799 100644 --- a/xplat/Flipper/FlipperPlugin.h +++ b/xplat/Flipper/FlipperPlugin.h @@ -45,7 +45,7 @@ class FlipperPlugin { return false; } - bool isDuplicationAllowed = false; + std::atomic isDuplicationAllowed{false}; }; } // namespace flipper