Skip to content

Commit

Permalink
Merge branch 'master' into update_rvc_app
Browse files Browse the repository at this point in the history
  • Loading branch information
hicklin authored Feb 1, 2024
2 parents f7cfc38 + 2576913 commit ed627f3
Show file tree
Hide file tree
Showing 33 changed files with 160 additions and 130 deletions.
18 changes: 9 additions & 9 deletions examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleGetChannelList");
VerifyOrExit(mChannelManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -137,7 +137,7 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder)
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleGetLineup");
VerifyOrExit(mChannelManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -200,7 +200,7 @@ CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEnco
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleGetCurrentChannel");
VerifyOrExit(mChannelManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -275,7 +275,7 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResp
std::string name(match.data(), match.size());
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleChangeChannel name %s", name.c_str());
VerifyOrExit(mChannelManagerObject != nullptr, ChipLogError(Zcl, "mChannelManagerObject null"));
Expand Down Expand Up @@ -321,7 +321,7 @@ bool ChannelManager::HandleChangeChannelByNumber(const uint16_t & majorNumber, c
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleChangeChannelByNumber majorNumber %d, minorNumber %d", majorNumber,
minorNumber);
Expand Down Expand Up @@ -349,7 +349,7 @@ bool ChannelManager::HandleSkipChannel(const int16_t & count)
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleSkipChannel count %d", count);
VerifyOrExit(mChannelManagerObject != nullptr, ChipLogError(Zcl, "mChannelManagerObject null"));
Expand Down Expand Up @@ -382,7 +382,7 @@ void ChannelManager::HandleGetProgramGuide(
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

std::vector<ProgramType *> needToFreePrograms;
std::vector<ChannelInfoType *> needToFreeChannels;
Expand Down Expand Up @@ -593,7 +593,7 @@ bool ChannelManager::HandleRecordProgram(const chip::CharSpan & programIdentifie
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleRecordProgram");
VerifyOrExit(mChannelManagerObject != nullptr, ChipLogError(Zcl, "mChannelManagerObject null"));
Expand Down Expand Up @@ -630,7 +630,7 @@ bool ChannelManager::HandleCancelRecordProgram(const chip::CharSpan & programIde
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ChannelManager::HandleCancelRecordProgram");
VerifyOrExit(mChannelManagerObject != nullptr, ChipLogError(Zcl, "mChannelManagerObject null"));
Expand Down
8 changes: 4 additions & 4 deletions examples/tv-app/android/java/ContentLauncherManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper<LaunchRes
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ContentLauncherManager::LaunchContent");
VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -110,7 +110,7 @@ void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelper<LaunchRespons
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ContentLauncherManager::LaunchContentUrl");
VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -164,7 +164,7 @@ CHIP_ERROR ContentLauncherManager::HandleGetAcceptHeaderList(AttributeValueEncod
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
std::list<std::string> acceptedHeadersList;
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NO_ENV, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ContentLauncherManager::GetAcceptHeader");
VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -207,7 +207,7 @@ uint32_t ContentLauncherManager::HandleGetSupportedStreamingProtocols()
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
uint32_t supportedStreamingProtocols = 0;
VerifyOrReturnValue(env != nullptr, 0, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received ContentLauncherManager::GetSupportedStreamingProtocols");
VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/KeypadInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void KeypadInputManager::HandleSendKey(CommandResponseHelper<SendKeyResponseType
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received keypadInputClusterSendKey: %c", to_underlying(keyCode));
VerifyOrExit(mKeypadInputManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand All @@ -76,7 +76,7 @@ void KeypadInputManager::InitializeWithObjects(jobject managerObject)
{
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Failed to GetEnvForCurrentThread for KeypadInputManager"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

mKeypadInputManagerObject = env->NewGlobalRef(managerObject);
VerifyOrReturn(mKeypadInputManagerObject != nullptr, ChipLogError(Zcl, "Failed to NewGlobalRef KeypadInputManager"));
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/LevelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CHIP_ERROR LevelManager::InitializeWithObjects(jobject managerObject)
{
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnLogError(env != nullptr, CHIP_ERROR_INCORRECT_STATE);
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

mLevelManagerObject = env->NewGlobalRef(managerObject);
VerifyOrReturnLogError(mLevelManagerObject != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
Expand All @@ -117,7 +117,7 @@ void LevelManager::HandleLevelChanged(uint8_t value)

JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

VerifyOrReturn(mLevelManagerObject != nullptr, ChipLogProgress(Zcl, "mLevelManagerObject null"));
VerifyOrReturn(mHandleLevelChangedMethod != nullptr, ChipLogProgress(Zcl, "mHandleLevelChangedMethod null"));
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/LowPowerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void LowPowerManager::InitializeWithObjects(jobject managerObject)
{
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Failed to GetEnvForCurrentThread for LowPowerManager"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

mLowPowerManagerObject = env->NewGlobalRef(managerObject);
VerifyOrReturn(mLowPowerManagerObject != nullptr, ChipLogError(Zcl, "Failed to NewGlobalRef LowPowerManager"));
Expand All @@ -66,7 +66,7 @@ bool LowPowerManager::HandleSleep()
{
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received LowPowerManager::Sleep");
VerifyOrExit(mLowPowerManagerObject != nullptr, ChipLogError(Zcl, "mLowPowerManagerObject null"));
Expand Down
12 changes: 6 additions & 6 deletions examples/tv-app/android/java/MediaInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CHIP_ERROR MediaInputManager::HandleGetInputList(chip::app::AttributeValueEncode
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NO_ENV, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaInputManager::HandleGetInputList");
VerifyOrExit(mMediaInputManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -125,7 +125,7 @@ uint8_t MediaInputManager::HandleGetCurrentInput()
jint index = -1;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, 0, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaInputManager::HandleGetCurrentInput");
VerifyOrExit(mMediaInputManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -157,7 +157,7 @@ bool MediaInputManager::HandleSelectInput(const uint8_t index)
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaInputManager::HandleSelectInput %d", index);
VerifyOrExit(mMediaInputManagerObject != nullptr, ChipLogError(Zcl, "mMediaInputManagerObject null"));
Expand All @@ -182,7 +182,7 @@ bool MediaInputManager::HandleShowInputStatus()
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaInputManager::HandleShowInputStatus");
VerifyOrExit(mMediaInputManagerObject != nullptr, ChipLogError(Zcl, "mMediaInputManagerObject null"));
Expand All @@ -207,7 +207,7 @@ bool MediaInputManager::HandleHideInputStatus()
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaInputManager::HandleHideInputStatus");
VerifyOrExit(mMediaInputManagerObject != nullptr, ChipLogError(Zcl, "mMediaInputManagerObject null"));
Expand All @@ -233,7 +233,7 @@ bool MediaInputManager::HandleRenameInput(const uint8_t index, const chip::CharS
jboolean ret = JNI_FALSE;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaInputManager::HandleRenameInput %d to %s", index, name.data());
VerifyOrExit(mMediaInputManagerObject != nullptr, ChipLogError(Zcl, "mMediaInputManagerObject null"));
Expand Down
16 changes: 8 additions & 8 deletions examples/tv-app/android/java/MediaPlaybackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetActiveTrack(bool audio, AttributeValue
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "MediaPlaybackManager::HandleGetActiveAudioTrack");
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -173,7 +173,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetAvailableTracks(bool audio, AttributeV
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "MediaPlaybackManager::HandleGetAvailableAudioTracks");
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -323,7 +323,7 @@ bool MediaPlaybackManager::HandleActivateTrack(bool audio, const chip::CharSpan
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "MediaPlaybackManager::HandleActivateAudioTrack");
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -354,7 +354,7 @@ bool MediaPlaybackManager::HandleDeactivateTextTrack()
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "MediaPlaybackManager::HandleDeactivateTextTrack");
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -443,7 +443,7 @@ uint64_t MediaPlaybackManager::HandleMediaRequestGetAttribute(MediaPlaybackReque
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, ret, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaPlaybackManager::HandleMediaRequestGetAttribute:%d", attribute);
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -483,7 +483,7 @@ long MediaPlaybackManager::HandleMediaRequestGetLongAttribute(MediaPlaybackReque
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, false, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "Received MediaPlaybackManager::HandleMediaRequestGetLongAttribute:%d", attribute);
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -519,7 +519,7 @@ Commands::PlaybackResponse::Type MediaPlaybackManager::HandleMediaRequest(MediaP
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnValue(env != nullptr, response, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "MediaPlaybackManager::Request %d-%ld", mediaPlaybackRequest,
static_cast<long>(deltaPositionMilliseconds));
Expand Down Expand Up @@ -558,7 +558,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncoder
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NULL_OBJECT, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

ChipLogProgress(Zcl, "MediaPlaybackManager::HandleGetSampledPosition");
VerifyOrExit(mMediaPlaybackManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/OnOffManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CHIP_ERROR OnOffManager::InitializeWithObjects(jobject managerObject)
{
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, CHIP_JNI_ERROR_NO_ENV, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

mOnOffManagerObject = env->NewGlobalRef(managerObject);
VerifyOrReturnLogError(mOnOffManagerObject != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
Expand All @@ -117,7 +117,7 @@ void OnOffManager::HandleOnOffChanged(bool value)

JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNIEnv for current thread"));
JniLocalReferenceManager manager(env);
JniLocalReferenceScope scope(env);

VerifyOrReturn(mOnOffManagerObject != nullptr, ChipLogProgress(Zcl, "mOnOffManagerObject null"));
VerifyOrReturn(mHandleOnOffChangedMethod != nullptr, ChipLogProgress(Zcl, "mHandleOnOffChangedMethod null"));
Expand Down
Loading

0 comments on commit ed627f3

Please sign in to comment.