From f7c22712e13bdd041cf3110396ab997a35b7602f Mon Sep 17 00:00:00 2001 From: Amit Jain Date: Sun, 26 Feb 2023 16:42:11 -0800 Subject: [PATCH 1/2] Change default passcode returned from account login cluster. Move use of JniUtfString in a code block so that ReleaseStringUTFChars does not happen after DeleteLocalRef. --- .../com/example/contentapp/CommandResponseHolder.java | 2 +- .../tv-app/android/java/ContentAppCommandDelegate.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java index aaaeaa0cba7005..61ee303b408587 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java @@ -30,7 +30,7 @@ private CommandResponseHolder() { setResponseValue( Clusters.AccountLogin.Id, Clusters.AccountLogin.Commands.GetSetupPIN.ID, - "{\"0\":\"12345678\"}"); + "{\"0\":\"20202021\"}"); }; public static CommandResponseHolder getInstance() { diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp index 4708700874304a..9e5a378f3b8160 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp @@ -81,11 +81,11 @@ void ContentAppCommandDelegate::InvokeCommand(CommandHandlerInterface::HandlerCo env->ExceptionDescribe(); env->ExceptionClear(); FormatResponseData(handlerContext, "{\"value\":{}}"); - return; + } else { + JniUtfString respStr(env, resp); + ChipLogProgress(Zcl, "ContentAppCommandDelegate::InvokeCommand got response %s", respStr.c_str()); + FormatResponseData(handlerContext, respStr.c_str()); } - JniUtfString respStr(env, resp); - ChipLogProgress(Zcl, "ContentAppCommandDelegate::InvokeCommand got response %s", respStr.c_str()); - FormatResponseData(handlerContext, respStr.c_str()); env->DeleteLocalRef(resp); } else From a9515dc5c4aaea2a20530f0c89848ecd45d251c2 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 27 Feb 2023 00:46:45 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- examples/tv-app/android/java/ContentAppCommandDelegate.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp index 9e5a378f3b8160..b477b75333866b 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp @@ -81,7 +81,9 @@ void ContentAppCommandDelegate::InvokeCommand(CommandHandlerInterface::HandlerCo env->ExceptionDescribe(); env->ExceptionClear(); FormatResponseData(handlerContext, "{\"value\":{}}"); - } else { + } + else + { JniUtfString respStr(env, resp); ChipLogProgress(Zcl, "ContentAppCommandDelegate::InvokeCommand got response %s", respStr.c_str()); FormatResponseData(handlerContext, respStr.c_str());