M module-services/service-desktop/ServiceDesktop.cpp => module-services/service-desktop/ServiceDesktop.cpp +3 -1
@@ 221,6 221,7 @@ auto ServiceDesktop::usbWorkerDeinit() -> sys::ReturnCodes
desktopWorker->closeWorker();
desktopWorker.reset();
initialized = false;
+ isUsbConfigured = false;
}
return sys::ReturnCodes::Success;
}
@@ 256,7 257,7 @@ auto ServiceDesktop::handle(locks::UnlockedPhone * /*msg*/) -> std::shared_ptr<s
LOG_INFO("Phone unlocked.");
usbSecurityModel->setPhoneUnlocked();
- if (initialized && isPlugEventUnhandled) {
+ if (isUsbConfigured && isPlugEventUnhandled) {
bus.sendUnicast(std::make_shared<sys::TetheringStateRequest>(sys::phone_modes::Tethering::On),
service::name::system_manager);
isPlugEventUnhandled = false;
@@ 353,6 354,7 @@ auto ServiceDesktop::handle(sdesktop::FactoryMessage * /*msg*/) -> std::shared_p
auto ServiceDesktop::handle(sdesktop::usb::USBConfigured *msg) -> std::shared_ptr<sys::Message>
{
+ isUsbConfigured = true;
if (usbSecurityModel->isSecurityEnabled()) {
LOG_INFO("Endpoint security enabled, requesting passcode");
bus.sendUnicast(std::make_shared<locks::UnlockPhone>(), service::name::appmgr);
M module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp => module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp +1 -0
@@ 92,6 92,7 @@ class ServiceDesktop : public sys::Service
static constexpr unsigned int DefaultLogFlushTimeoutInMs = 1000U;
bool initialized = false;
bool isPlugEventUnhandled = false;
+ bool isUsbConfigured = false;
void generateDeviceUniqueId();
auto getDeviceUniqueId() const -> std::string;