From: Caisking <3449750381@qq.com> Date: Thu, 26 Sep 2024 08:52:21 +0000 (+0800) Subject: #660 手表,已经设置密码锁,关机后在开机、重启、长按电源键10S强制重启,现在需要等手表自动息屏后才会上锁 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a52a790d050b87ad3c2c51e11aab4f644764db3b;p=mirrors%2FFD230.git #660 手表,已经设置密码锁,关机后在开机、重启、长按电源键10S强制重启,现在需要等手表自动息屏后才会上锁 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 0bdcea9e9..5d58f7281 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -274,6 +274,10 @@ #include "schedule/include/ScheduleData.h" #include "sleepmode/include/SleepModePresenter.h" +#include "ui_service.h" +extern "C" void uapi_dev_runtime_set_lock_status(uint8_t status); +extern "C" uint8_t uapi_dev_runtime_get_lock_status(void); + #ifdef SUPPORT_ALIPAY_SEC #include "AlipayMainView.h" #include "AlipayPresenter.h" @@ -529,10 +533,25 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Power is Charging!"); DialModelCharge::GetInstance()->UpdatechargeStatus(1); } + /*开机读取天气历史数据*/ - C_ScheduleDataReadFromFile(); mmi_sleep_mode_switch_read(); + + /*开机如果设置了密码锁,进行锁屏*/ + int lockstate = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_PASSWORD_SWITCH); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "lockstate = %d", lockstate); + // 打印锁定状态判断 + if (lockstate == 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Native ability state is active."); + if (uapi_dev_runtime_get_lock_status() == 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Device is unlocked (lock status == 0)."); + uapi_dev_runtime_set_lock_status(1); // 上锁 + OHOS::MainModel::GetInstance().setDialState(OHOS::DialState::LOCK, true); + } + } } }