From: SnickerSun Date: Wed, 21 Feb 2024 03:11:42 +0000 (+0800) Subject: 优化部分日志,恢复middleware ui_test代码,关机和重启 函数抽象到custom_utils中。nativelauncher中的重启关机代码生效 X-Git-Tag: release_V1.2.70_20241020_135402~1298^2~20 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=0d798e49c1629f491b2f4fa6eb55616c23ae3e49;p=mirrors%2FFD230.git 优化部分日志,恢复middleware ui_test代码,关机和重启 函数抽象到custom_utils中。nativelauncher中的重启关机代码生效 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp index 489cb3b51..fd81abf8a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp @@ -9,7 +9,7 @@ #include "RebootModel.h" #include "drag_event.h" #include "wearable_log.h" - +#include "custom_utils.h" namespace OHOS { static RebootPresenter *g_pRebootPresenter = nullptr; @@ -43,10 +43,7 @@ void RebootPresenter::OnResume(void) {} void RebootPresenter::OnStop(void) {} -extern "C" { - uint32_t mcu_os_sys_reset(uint8_t *para, uint32_t para_len); - void uapi_sys_shipmode(uint32_t arg); -} + bool RebootPresenter::OnClick(UIView& view, const ClickEvent& event) { UNUSED(event); @@ -58,13 +55,13 @@ bool RebootPresenter::OnClick(UIView& view, const ClickEvent& event) } else if (strcmp(view.GetViewId(), REBOOTDEVICE_BUTTON) == 0) { // 重启 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "REBOOTDEVICE_BUTTON OnClick"); - mcu_os_sys_reset(NULL,NULL); + uapi_reboot_device(); } else if (strcmp(view.GetViewId(), SHUTDOWNDEVICE_BUTTON) == 0) { // 关机 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SHUTDOWNDEVICE_BUTTON OnClick"); // GetPMSDefaultInterface()->ShutDownDevice(NULL, NULL); - uapi_sys_shipmode(0); + uapi_poweroff_device(); } return true; diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h index feadb4e73..153407a5c 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h @@ -300,7 +300,7 @@ namespace OHOS { static constexpr const char *PNG_APPLIST_SETTING_IMAGE = APP_RES_PATH"/APPLIST_SETTING.bin"; // 设置 static constexpr const char *PNG_APPLIST_TEMP_IMAGE = APP_RES_PATH"/TEMP_IMAGE.bin"; // 体温 - static constexpr const char *PNG_APPLIST_ALIPAY_IMAGE = APP_RES_PATH"/alipay_logo.bin"; // 支付宝 + static constexpr const char *PNG_APPLIST_ALIPAY_IMAGE = APP_RES_PATH"/alipay/alipay_logo.bin"; // 支付宝 static constexpr const char *PNG_ALIPAY_BIND_FAILURE = APP_RES_PATH"/ALIPAY_BIND_FAILURE.bin"; static constexpr const char *PNG_ALIPAY_BIND_SUCCESS = APP_RES_PATH"/ALIPAY_BIND_SUCCESS.bin"; static constexpr const char *PNG_ALIPAY_LIST_PAY = APP_RES_PATH"/ALIPAY_LIST_PAY.bin"; diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index 5d42a4f47..3637aee87 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -62,16 +62,12 @@ #include "graphic_hardware_config.h" #include "graphic_service.h" #include "common/graphic_startup.h" -#include "font/font_global_manager.h" #ifdef SUPPORT_ALIPAY_SEC #include "AlipayMainView.h" #include "AlipayPresenter.h" #endif - namespace OHOS { -static const char* BIN_LANG_EN = RES_PATH"font/en.lang"; -static const char* BIN_LANG_ZH = RES_PATH"font/zh.lang"; struct AppViewMapper { AppViewId id; @@ -144,10 +140,6 @@ NativeLauncher &NativeLauncher::GetInstance(void) void NativeLauncher::InitNativeLauncher() { GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME); WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher"); - - const char* resFiles[] = {BIN_LANG_ZH, BIN_LANG_EN}; - FontGlobalManager::GetInstance()->RegisterLanguageInfo(resFiles, (sizeof(resFiles) / sizeof(char*)), 1); - // 初始化所有预加载slice InitBtHeadsetEvent(); // 蓝牙ct和tg适配初始化 InitAllNativeSlices(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp index 8ee619682..67f4e9741 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp @@ -14,8 +14,6 @@ #include "ScreenModels.h" #include "SettingModel.h" #include "ui_resource_image.h" -#include "components/ui_label_ext.h" -#include "ui_resource_string.h" namespace OHOS { @@ -184,49 +182,49 @@ void PullUpDownView::InitViewImg(void) void PullUpDownView::InitViewLable(void) { - dnotDisturbLable = new UILabelExt(); + dnotDisturbLable = new UILabel(); if (dnotDisturbLable == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dnotDisturbLable new fail"); return; } dnotDisturbLable->SetPosition(DISTURB_LABEL_X, DISTURB_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - dnotDisturbLable->SetTextId(9); + dnotDisturbLable->SetText("勿扰"); dnotDisturbLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); dnotDisturbLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - briScreenLable = new UILabelExt(); + briScreenLable = new UILabel(); if (briScreenLable == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "briScreenLable new fail"); return; } briScreenLable->SetPosition(SCREEN_LABEL_X, SCREEN_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - briScreenLable->SetTextId(10); + briScreenLable->SetText("亮屏"); briScreenLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); briScreenLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - finPhoneLable = new UILabelExt(); + finPhoneLable = new UILabel(); if (finPhoneLable == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhoneLable new fail"); return; } finPhoneLable->SetPosition(PHONE_LABEL_X, PHONE_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - finPhoneLable->SetTextId(11); + finPhoneLable->SetText("找手机"); finPhoneLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); finPhoneLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - droAlarmLable = new UILabelExt(); + droAlarmLable = new UILabel(); if (finPhoneLable == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhoneLable new fail"); return; } droAlarmLable->SetPosition(ALARM_LABEL_X, ALARM_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - droAlarmLable->SetTextId(12); + droAlarmLable->SetText("闹钟"); droAlarmLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); droAlarmLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - droSettingLable = new UILabelExt(); + droSettingLable = new UILabel(); if (droSettingLable == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "droSettingLable new fail"); return; } droSettingLable->SetPosition(SETTING_LABEL_X, SETTING_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - droSettingLable->SetTextId(13); + droSettingLable->SetText("设置"); droSettingLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); droSettingLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp index 029b718b6..09ca5b94d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp @@ -9,7 +9,7 @@ #include "RebootModel.h" #include "drag_event.h" #include "wearable_log.h" - +#include "custom_utils.h" namespace OHOS { static RebootPresenter *g_pRebootPresenter = nullptr; @@ -55,10 +55,12 @@ bool RebootPresenter::OnClick(UIView& view, const ClickEvent& event) // 重启 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "REBOOTDEVICE_BUTTON OnClick"); //GetPMSDefaultInterface()->RebootDevice(NULL, NULL); + uapi_reboot_device(); } else if (strcmp(view.GetViewId(), SHUTDOWNDEVICE_BUTTON) == 0) { // 关机 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SHUTDOWNDEVICE_BUTTON OnClick"); //GetPMSDefaultInterface()->ShutDownDevice(NULL, NULL); + uapi_poweroff_device(); } return true; } diff --git a/code/sdk/application/wstp/at_service/app/app_at_process.c b/code/sdk/application/wstp/at_service/app/app_at_process.c index 5a3c1d443..55db99d28 100755 --- a/code/sdk/application/wstp/at_service/app/app_at_process.c +++ b/code/sdk/application/wstp/at_service/app/app_at_process.c @@ -2367,7 +2367,7 @@ static uint32_t mcu_pms_set_screenoff_time(uint8_t *para, uint32_t para_len) type = strtoul(ptr, NULL, 0); pos++; timeout = strtoul(pos, NULL, 0); - wstp_print("app set screen off: type = %u, timeut = %u.\r\n", type, timeout); + wstp_print("app set screen off: type = %u,%s, timeut = %u.\r\n", type,type==0?"autooff_time":"keepon_time",timeout); const power_display_svr_api_t *display_api = power_display_svr_get_api(); if (type == 0) { ret = display_api->set_screen_auto_off_timeout(timeout); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index b259abfbd..c1c28fb29 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -75,6 +75,20 @@ uint32_t zh_set_sn(uint8_t *buf_sn, uint32_t len_sn) #endif return nvRet; } +// extern "C" { + uint32_t mcu_os_sys_reset(uint8_t *para, uint32_t para_len); + void uapi_sys_shipmode(uint32_t arg); +// } + +void uapi_poweroff_device(void) +{ + uapi_sys_shipmode(0); +} +void uapi_reboot_device(void) +{ + mcu_os_sys_reset(NULL,NULL); +} + #if 0 #define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014 diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index f7895bb07..a40b3771c 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -21,7 +21,8 @@ extern "C" { uint32_t zh_get_sn(uint8_t *buf_sn, uint32_t *len_sn); uint32_t zh_set_sn(uint8_t *buf_sn, uint32_t len_sn); - +void uapi_poweroff_device(void); +void uapi_reboot_device(void); /** * @} diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h index 51c61a594..4a413d15f 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h @@ -1,4 +1,3 @@ - /* * Copyright (c) 2022 CompanyNameMagicTag. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +11,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. -#include "ui_label_ext.h" */ #ifndef PULL_UP_DOWN_VIEW_H @@ -23,7 +21,6 @@ #include "components/ui_image_view.h" #include "components/ui_label.h" #include "components/ui_label_button.h" -#include "components/ui_label_ext.h" namespace OHOS { class PullUpDownView : public AppGroupView { @@ -38,13 +35,11 @@ private: UIImageView *finPhone{nullptr}; UIImageView *droAlarm{nullptr}; UIImageView *droSetting{nullptr}; - - UILabelExt *dnotDisturbLable{nullptr}; - UILabelExt *briScreenLable{nullptr}; - UILabelExt *finPhoneLable{nullptr}; - UILabelExt *droAlarmLable{nullptr}; - UILabelExt *droSettingLable{nullptr}; - + UILabel *dnotDisturbLable{nullptr}; + UILabel *briScreenLable{nullptr}; + UILabel *finPhoneLable{nullptr}; + UILabel *droAlarmLable{nullptr}; + UILabel *droSettingLable{nullptr}; UIImageView *bluetooth{nullptr}; UIImageView *battery{nullptr}; UILabel *batteryLable{nullptr}; diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp index 4a6bf3b75..be5dfeceb 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp @@ -153,7 +153,7 @@ void UITestCross::VideoPage::PageInit() std::string uri("/user/video/demo_pure_video_loop.mp4"); videoPlay_ = new MediaVideoPlay(surface, nullptr, uri, true); #ifdef SUPPORT_AT_OHOSFWK - g_videoPlay = videoPlayer_; + g_videoPlay = videoPlay_; registerNotifyScreenStatus(ScreenStatusNotify); #endif } diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_en.xml b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_en.xml index 5c7701b85..f04195f96 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_en.xml +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_en.xml @@ -3,77 +3,53 @@ languageinfo="en" fontName="DroidSansFallback.ttf" direct="ltf" -> + > + /> + /> + /> + /> + /> + /> + /> + /> - - - - - - - \ No newline at end of file + /> + diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_zh.xml b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_zh.xml index bc6826251..cbd651788 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_zh.xml +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_zh.xml @@ -7,69 +7,45 @@ value="图片" size="32" direct="rtl" - /> + /> + /> + /> + /> + /> + /> + /> + /> - - - - - - - \ No newline at end of file + /> + diff --git a/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/test/test_api.c b/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/test/test_api.c index d3e47df72..9bd108d79 100755 --- a/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/test/test_api.c +++ b/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/test/test_api.c @@ -117,7 +117,7 @@ static void test_alipay_get_fw_version() int result; uint8_t version[8] = {0}; result = csi_get_fw_version(version); - + printf("csi_get_fw_version version - %s \n",version); YUNIT_ASSERT_MSG_QA(result == 0 && version[0] != 0, "the test_alipay_get_fw_version is %d", result, "GET_FW_VERSION"); } @@ -364,29 +364,29 @@ static void case_test_get_productmodel(void) void api_record_test_entry(yunit_test_suite_t *suite) { - // yunit_add_test_case(suite, "test_get_compile_timestamp", case_test_get_compile_timestamp); - // yunit_add_test_case(suite, "test_get_productmodel", case_test_get_productmodel); - // yunit_add_test_case(suite, "test_memory_align", case_test_memory_align); - // yunit_add_test_case(suite, "test_libc_function", case_test_libc_function); - // yunit_add_test_case(suite, "test_int_endian", case_test_int_endian); - // yunit_add_test_case(suite, "hal_get_credential", case_test_get_credential); - // yunit_add_test_case(suite, "hal_compat_check", case_test_compat_check); - // yunit_add_test_case(suite, "hal_suid_update", case_test_hal_suid_update); - // yunit_add_test_case(suite, "hal_suid_remove", case_test_hal_suid_remove); - // yunit_add_test_case(suite, "hal_mem", case_test_hal_mem); - // yunit_add_test_case(suite, "hal_sha", case_test_hal_sha); - // yunit_add_test_case(suite, "hal_aes", case_test_hal_aes); - // yunit_add_test_case(suite, "hal_asset", case_test_hal_asset); - // yunit_add_test_case(suite, "hal_random_pressure", case_test_hal_random_pressure); - // yunit_add_test_case(suite, "hal_mcu_pressure", case_test_hal_mcu_pressure); - // yunit_add_test_case(suite, "hal_random", case_test_hal_random); - // yunit_add_test_case(suite, "hal_uuid", case_test_hal_uuid); + yunit_add_test_case(suite, "test_get_compile_timestamp", case_test_get_compile_timestamp); + yunit_add_test_case(suite, "test_get_productmodel", case_test_get_productmodel); + yunit_add_test_case(suite, "test_memory_align", case_test_memory_align); + yunit_add_test_case(suite, "test_libc_function", case_test_libc_function); + yunit_add_test_case(suite, "test_int_endian", case_test_int_endian); + yunit_add_test_case(suite, "hal_get_credential", case_test_get_credential); + yunit_add_test_case(suite, "hal_compat_check", case_test_compat_check); + yunit_add_test_case(suite, "hal_suid_update", case_test_hal_suid_update); + yunit_add_test_case(suite, "hal_suid_remove", case_test_hal_suid_remove); + yunit_add_test_case(suite, "hal_mem", case_test_hal_mem); + yunit_add_test_case(suite, "hal_sha", case_test_hal_sha); + yunit_add_test_case(suite, "hal_aes", case_test_hal_aes); + yunit_add_test_case(suite, "hal_asset", case_test_hal_asset); + yunit_add_test_case(suite, "hal_random_pressure", case_test_hal_random_pressure); + yunit_add_test_case(suite, "hal_mcu_pressure", case_test_hal_mcu_pressure); + yunit_add_test_case(suite, "hal_random", case_test_hal_random); + yunit_add_test_case(suite, "hal_uuid", case_test_hal_uuid); yunit_add_test_case(suite, "hal_sn", case_test_hal_sn); yunit_add_test_case(suite, "hal_deviceid", case_test_hal_deviceid); - // yunit_add_test_case(suite, "get_fw_version", case_test_get_fw_version); - // yunit_add_test_case(suite, "hal_companyname", case_test_hal_companyname); - // yunit_add_test_case(suite, "hal_timestamp", case_test_hal_timestamp); - // yunit_add_test_case(suite, "hal_prototype", case_test_hal_protoctype); + yunit_add_test_case(suite, "get_fw_version", case_test_get_fw_version); + yunit_add_test_case(suite, "hal_companyname", case_test_hal_companyname); + yunit_add_test_case(suite, "hal_timestamp", case_test_hal_timestamp); + yunit_add_test_case(suite, "hal_prototype", case_test_hal_protoctype); }