Skip to content

Commit 1228703

Browse files
yhoyoonpull[bot]
authored andcommitted
[Android] Shutdown factory with device controller (#29881)
This change adds shutdown to AndroidDeviceControllerWrapper, which wraps CHIPDeviceController on the Android platform, so that DeviceControllerFactory and CHIPDeviceController can be shutdown. AndroidDeviceControllerWrapper initializes DeviceControllerFactory and CHIPDeviceController, but since it supports only CHIPDeviceController shutdown, DeviceControllerFactory shutdown is required. If you reuse AndroidDeviceControllerWrapper with the call below without shutting down DeviceControllerFactory, sometimes the DeviceControllerSystemState of DeviceControllerFactory becomes incorrect, causing AndroidDeviceControllerWrapper to operate incorrectly, and the problem cannot be solved unless the process is restarted. - AndroidDeviceControllerWrapper::AllocateNew() - AndroidDeviceControllerWrapper::Controller()->Shutdown() Signed-off-by: Youngho Yoon <yho.yoon@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com> Signed-off-by: Hunsup Jung <hunsup.jung@samsung.com> Signed-off-by: sanghyukko <sanghyuk.ko@samsung.com> Signed-off-by: Jaehoon You <jaehoon.you@samsung.com> Signed-off-by: Kyu-Wook Lim <kyuwook.lim@samsung.com>
1 parent 99c0161 commit 1228703

3 files changed

+9
-1
lines changed

src/controller/java/AndroidDeviceControllerWrapper.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(
368368
return wrapper.release();
369369
}
370370

371+
void AndroidDeviceControllerWrapper::Shutdown()
372+
{
373+
mController->Shutdown();
374+
DeviceControllerFactory::GetInstance().Shutdown();
375+
}
376+
371377
CHIP_ERROR AndroidDeviceControllerWrapper::ApplyNetworkCredentials(chip::Controller::CommissioningParameters & params,
372378
jobject networkCredentials)
373379
{

src/controller/java/AndroidDeviceControllerWrapper.h

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel
173173
uint16_t failsafeTimerSeconds, bool attemptNetworkScanWiFi, bool attemptNetworkScanThread,
174174
bool skipCommissioningComplete, CHIP_ERROR * errInfoOnFailure);
175175

176+
void Shutdown();
177+
176178
#ifdef JAVA_MATTER_CONTROLLER_TEST
177179
chip::Controller::ExampleOperationalCredentialsIssuer * GetAndroidOperationalCredentialsIssuer()
178180
#else

src/controller/java/CHIPDeviceController-JNI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,7 @@ JNI_METHOD(void, shutdownCommissioning)
19601960
StopIOThread();
19611961

19621962
AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle);
1963-
wrapper->Controller()->Shutdown();
1963+
wrapper->Shutdown();
19641964
}
19651965

19661966
JNI_METHOD(jbyteArray, getAttestationChallenge)

0 commit comments

Comments
 (0)