From 4a25d71606bdac84221b56a173813c8b20fd7aa1 Mon Sep 17 00:00:00 2001 From: Robert Szewczyk Date: Tue, 19 Mar 2024 02:14:04 +0000 Subject: [PATCH] Fix a a few gaps in jumping between Java and C++ for Messages cluster (#32295) Fix dangling problems arising from uint16 seconds for duration to uint64_t milliseconds --- examples/tv-app/android/java/MessagesManager.cpp | 4 ++-- .../src/com/matter/tv/server/tvapp/MessagesManagerStub.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tv-app/android/java/MessagesManager.cpp b/examples/tv-app/android/java/MessagesManager.cpp index 680c96b3a34807..ad214e117d33d8 100644 --- a/examples/tv-app/android/java/MessagesManager.cpp +++ b/examples/tv-app/android/java/MessagesManager.cpp @@ -74,7 +74,7 @@ void MessagesManager::InitializeWithObjects(jobject managerObject) } mPresentMessagesMethod = - env->GetMethodID(managerClass, "presentMessages", "(Ljava/lang/String;IIJILjava/lang/String;Ljava/util/HashMap;)Z"); + env->GetMethodID(managerClass, "presentMessages", "(Ljava/lang/String;IIJJLjava/lang/String;Ljava/util/HashMap;)Z"); if (mPresentMessagesMethod == nullptr) { ChipLogError(Zcl, "Failed to access MessagesManager 'presentMessages' method"); @@ -182,7 +182,7 @@ CHIP_ERROR MessagesManager::HandleGetMessages(AttributeValueEncoder & aEncoder) message.startTime = DataModel::Nullable(static_cast(jstartTime)); } - jfieldID durationField = env->GetFieldID(messageClass, "duration", "I"); + jfieldID durationField = env->GetFieldID(messageClass, "duration", "J"); jlong jduration = env->GetLongField(messageObject, durationField); if (jduration >= 0) { diff --git a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java index 054218a78c6a54..b31f14a112304b 100644 --- a/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java +++ b/examples/tv-app/android/java/src/com/matter/tv/server/tvapp/MessagesManagerStub.java @@ -36,7 +36,7 @@ public MessagesManagerStub(int endpoint) { responseOptions.put(new Long(1), "Yes"); responseOptions.put(new Long(2), "No"); presentMessages( - "31323334353637383930313233343536", 1, 1, 30, 60, "TestMessage", responseOptions); + "31323334353637383930313233343536", 1, 1, 30, 60000, "TestMessage", responseOptions); Log.d(TAG, "MessagesManagerStub: added dummy message"); }