diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 7348876344b7d5..e4f76d46d113b5 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -128,8 +128,14 @@ void InteractionModelEngine::Shutdown() mpExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::InteractionModel::Id); mpCASESessionMgr = nullptr; - mpFabricTable = nullptr; - mpExchangeMgr = nullptr; + + // + // We _should_ be clearing these out, but doing so invites a world + // of trouble. #21233 tracks fixing the underlying assumptions to make + // this possible. + // + // mpFabricTable = nullptr; + // mpExchangeMgr = nullptr; } uint32_t InteractionModelEngine::GetNumActiveReadHandlers() const diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index 588f47c14a9389..7b68a4e5d0d7e5 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -547,7 +547,7 @@ void ReportEventCallback::OnSubscriptionEstablished(SubscriptionId aSubscription JniReferences::GetInstance().CallSubscriptionEstablished(mSubscriptionEstablishedCallbackRef); } -void ReportEventCallback::OnResubscriptionAttempt(CHIP_ERROR aTerminationCause, uint32_t aNextResubscribeIntervalMsec) +void ReportEventCallback::OnResubscriptionAttempt(app::ReadClient * apReadClient, CHIP_ERROR aTerminationCause) { VerifyOrReturn(mResubscriptionAttemptCallbackRef != nullptr, ChipLogError(Controller, "mResubscriptionAttemptCallbackRef is null")); @@ -555,6 +555,13 @@ void ReportEventCallback::OnResubscriptionAttempt(CHIP_ERROR aTerminationCause, CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + err = app::ReadClient::Callback::OnResubscriptionNeeded(apReadClient, aTerminationCause); + if (err != CHIP_NO_ERROR) + { + ReportError(nullptr, ErrorStr(err), err.AsInteger()); + return; + } + jmethodID onResubscriptionAttemptMethod; err = JniReferences::GetInstance().FindMethod(env, mResubscriptionAttemptCallbackRef, "onResubscriptionAttempt", "(II)V", &onResubscriptionAttemptMethod); @@ -562,7 +569,7 @@ void ReportEventCallback::OnResubscriptionAttempt(CHIP_ERROR aTerminationCause, DeviceLayer::StackUnlock unlock; env->CallVoidMethod(mResubscriptionAttemptCallbackRef, onResubscriptionAttemptMethod, aTerminationCause.AsInteger(), - aNextResubscribeIntervalMsec); + apReadClient->ComputeTimeTillNextSubscription()); } void ReportEventCallback::ReportError(jobject attributePath, CHIP_ERROR err) diff --git a/src/controller/java/AndroidCallbacks.h b/src/controller/java/AndroidCallbacks.h index 51c38d3c2b4e1a..45fab4c80efcbf 100644 --- a/src/controller/java/AndroidCallbacks.h +++ b/src/controller/java/AndroidCallbacks.h @@ -98,7 +98,7 @@ struct ReportEventCallback : public app::ReadClient::Callback void OnSubscriptionEstablished(SubscriptionId aSubscriptionId) override; - void OnResubscriptionAttempt(CHIP_ERROR aTerminationCause, uint32_t aNextResubscribeIntervalMsec) override; + void OnResubscriptionAttempt(app::ReadClient * apReadClient, CHIP_ERROR aTerminationCause) override; /** Report errors back to Java layer. attributePath may be nullptr for general errors. */ void ReportError(jobject eventPath, CHIP_ERROR err);