Skip to content

Commit 999d9fe

Browse files
committed
Fix get catalog list
1 parent 58d02b0 commit 999d9fe

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/handlers/ApplicationLauncherManagerImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void registerSelf(Context context) {
8181
@Override
8282
public int[] getCatalogList() {
8383
Log.i(TAG, "Get Catalog List");
84-
return new int[0];
84+
return new int[]{65521, 8891, 3191};
8585
}
8686

8787
@Override

examples/tv-app/android/java/application-launcher/ApplicationLauncherManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncode
6262
chip::DeviceLayer::StackUnlock unlock;
6363
CHIP_ERROR err = CHIP_NO_ERROR;
6464
JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
65-
std::list<std::string> acceptedHeadersList;
6665
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NO_ENV, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
6766
chip::JniLocalReferenceScope scope(env);
6867

@@ -73,8 +72,8 @@ CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncode
7372
env->ExceptionClear();
7473

7574
return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR {
76-
jobjectArray jCatalogList =
77-
(jobjectArray) env->CallObjectMethod(mApplicationLauncherManagerObject.ObjectRef(), mGetCatalogListMethod);
75+
jintArray jCatalogList =
76+
(jintArray) env->CallObjectMethod(mApplicationLauncherManagerObject.ObjectRef(), mGetCatalogListMethod);
7877
if (env->ExceptionCheck())
7978
{
8079
ChipLogError(Zcl, "Java exception in ApplicationLauncherManager::GetCatalogList");
@@ -84,9 +83,10 @@ CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncode
8483
}
8584

8685
jint size = env->GetArrayLength(jCatalogList);
86+
jint *elements = env->GetIntArrayElements(jCatalogList, 0);
8787
for (int i = 0; i < size; i++)
8888
{
89-
jint jCatalogVendorId = (jint) env->GetObjectArrayElement(jCatalogList, i);
89+
jint jCatalogVendorId = elements[i];
9090
ReturnErrorOnFailure(encoder.Encode(static_cast<uint16_t>(jCatalogVendorId)));
9191
}
9292

0 commit comments

Comments
 (0)