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/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h
index 8d0c36a..8d7fee9 100644
--- a/src/controller/CommissionerDiscoveryController.h
+++ b/src/controller/CommissionerDiscoveryController.h
@@ -138,7 +138,8 @@
*
*/
virtual void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId,
- chip::Messaging::ExchangeManager & exchangeMgr, chip::SessionHandle & sessionHandle) = 0;
+ chip::Messaging::ExchangeManager & exchangeMgr,
+ const chip::SessionHandle & sessionHandle) = 0;
virtual ~PostCommissioningListener() = default;
};
@@ -217,7 +218,7 @@
*
*/
void CommissioningSucceeded(uint16_t vendorId, uint16_t productId, NodeId nodeId,
- chip::Messaging::ExchangeManager & exchangeMgr, chip::SessionHandle & sessionHandle);
+ chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle);
/**
* This method should be called by the commissioner to indicate that commissioning failed.