Skip to content

Commit 9237cd7

Browse files
yunhanw-googlerestyled-commits
authored andcommitted
[Android]add missing stack unlock for onattribute and onevent callback for android IM (project-chip#32217)
* add missing unlock for onattribute and onevent callback for android IM * Restyled by whitespace --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 9bea639 commit 9237cd7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/controller/java/AndroidCallbacks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ jobject GetNodeStateObj(JNIEnv * env, const char * nodeStateClassSignature, jobj
138138
JniReferences::GetInstance().FindMethod(env, wrapperCallback, "getNodeState", nodeStateClassSignature, &getNodeStateMethod);
139139
VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr, ChipLogError(Controller, "Could not find getNodeState method"));
140140

141-
DeviceLayer::StackUnlock unlock;
142141
jobject ret = env->CallObjectMethod(wrapperCallback, getNodeStateMethod);
143142
VerifyOrReturnValue(!env->ExceptionCheck(), nullptr, env->ExceptionDescribe());
144143

@@ -270,6 +269,7 @@ CHIP_ERROR ConvertReportTlvToJson(const uint32_t id, TLV::TLVReader & data, std:
270269
void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPath, TLV::TLVReader * apData,
271270
const app::StatusIB & aStatus)
272271
{
272+
DeviceLayer::StackUnlock unlock;
273273
CHIP_ERROR err = CHIP_NO_ERROR;
274274
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
275275
VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread"));
@@ -408,6 +408,7 @@ void ReportCallback::UpdateClusterDataVersion()
408408

409409
void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLVReader * apData, const app::StatusIB * apStatus)
410410
{
411+
DeviceLayer::StackUnlock unlock;
411412
CHIP_ERROR err = CHIP_NO_ERROR;
412413
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
413414
VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread"));
@@ -642,7 +643,6 @@ void ReportCallback::ReportError(const app::ConcreteAttributePath * attributePat
642643
eventClusterId = static_cast<jlong>(eventPath->mClusterId);
643644
eventId = static_cast<jlong>(eventPath->mEventId);
644645
}
645-
646646
env->CallVoidMethod(wrapperCallback, onErrorMethod, isAttributePath, attributeEndpointId, attributeClusterId, attributeId,
647647
isEventPath, eventEndpointId, eventClusterId, eventId, exception);
648648
VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe());

0 commit comments

Comments
 (0)