First JNI test & changes necessary to make it work (#24355)
* * Change various references of "SessionHandle &" to instead use "const SessionHandle &" to match how SessionHandle is often used as a parameter & to support rvalue
* Add Java/JNI hooks into for-test classes (like MessagingContext) to allow for unit tests of Java & JNI functionality
* Add first JNI unit test, GetConnectedDeviceCallbackJniTest, testing success/failure cases for device callback
* Restyled by whitespace
* Restyled by clang-format
* Restyled by gn
* * Fix a user-reported bug where we were seeing the following callstack:
JNIEnv::NewObject(_jclass*, _jmethodID*, ...)
chip::Controller::GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void*, chip::ScopedNodeId const&, chip::ChipError)
chip::OperationalSessionSetup::DequeueConnectionCallbacks(chip::ChipError)
chip::OperationalSessionSetup::OnNodeAddressResolutionFailed(chip::PeerId const&, chip::ChipError)
chip::AddressResolve::Impl::Resolver::HandleAction(chip::IntrusiveList<chip::AddressResolve::Impl::NodeLookupHandle, (chip::IntrusiveMode)0, chip::IntrusiveListBaseHook<chip::AddressResolve::Impl::NodeLookupHandle, (chip::IntrusiveMode)0> >::Iterator&)
chip::AddressResolve::Impl::Resolver::HandleTimer()
chip::System::LayerImplSelect::HandleEvents()
Though JNI tests were added to try to catch this at presubmit, those tests did not fail, which leads me to believe there's a difference in the JRE (wherein the version with the user-reported bug), a cast to an int is not being done, whereas in android emulator, the cast to int is done
* Add a README pointing to building android guide & specifying that these tests must be run externally due to android emulator dependency
* Fix path to android_building.md
* Restyled by clang-format
* Restyled by prettier-markdown
* Missed const correctness changes for SessionHandle&
* Restyled by clang-format
* More missed const correctness changes for SessionHandle&
* Restyled by clang-format
* More missed const correctness changes for SessionHandle&
* Restyled by clang-format
* Only build JNI test libs if chip_link_tests
* Restyled by gn
* Add missing tests.gni import
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/controller/CurrentFabricRemover.h b/src/controller/CurrentFabricRemover.h
index 8acef3c..63921f9 100644
--- a/src/controller/CurrentFabricRemover.h
+++ b/src/controller/CurrentFabricRemover.h
@@ -70,10 +70,10 @@
FabricIndex mFabricIndex = kUndefinedFabricIndex;
Step mNextStep = Step::kAcceptRemoveFabricStart;
- CHIP_ERROR ReadCurrentFabricIndex(Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle);
- CHIP_ERROR SendRemoveFabricIndex(Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle);
+ CHIP_ERROR ReadCurrentFabricIndex(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle);
+ CHIP_ERROR SendRemoveFabricIndex(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle);
- static void OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle);
+ static void OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle);
static void OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR error);
static void OnSuccessReadCurrentFabricIndex(void * context, FabricIndex fabricIndex);