优化部分日志,恢复middleware ui_test代码,关机和重启 函数抽象到custom_utils中。nativelauncher中的重启关机代码生效
authorSnickerSun <snickersun@163.com>
Wed, 21 Feb 2024 03:11:42 +0000 (11:11 +0800)
committerSnickerSun <snickersun@163.com>
Wed, 21 Feb 2024 03:11:42 +0000 (11:11 +0800)
13 files changed:
code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp
code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h
code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp
code/sdk/application/wstp/at_service/app/app_at_process.c
code/sdk/drivers/peripheral/utils/custom_utils.c
code/sdk/drivers/peripheral/utils/custom_utils.h
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_en.xml
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_font/res/string/language_zh.xml
code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/test/test_api.c

index 489cb3b..fd81abf 100644 (file)
@@ -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;
index feadb4e..153407a 100755 (executable)
@@ -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";
index 5d42a4f..3637aee 100755 (executable)
 #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();
index 8ee6196..67f4e97 100755 (executable)
@@ -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);
 }
index 029b718..09ca5b9 100755 (executable)
@@ -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;
 }
index 5a3c1d4..55db99d 100755 (executable)
@@ -2367,7 +2367,7 @@ static uint32_t mcu_pms_set_screenoff_time(uint8_t *para, uint32_t para_len)
     type = strtoul(ptr, NULL, 0);\r
     pos++;\r
     timeout = strtoul(pos, NULL, 0);\r
-    wstp_print("app set screen off: type = %u, timeut = %u.\r\n", type, timeout);\r
+    wstp_print("app set screen off: type = %u,%s, timeut = %u.\r\n", type,type==0?"autooff_time":"keepon_time",timeout);\r
     const power_display_svr_api_t *display_api = power_display_svr_get_api();\r
     if (type == 0) {\r
         ret = display_api->set_screen_auto_off_timeout(timeout);\r
index b259abf..c1c28fb 100644 (file)
@@ -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
index f7895bb..a40b377 100644 (file)
@@ -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);
 
 /**
  * @}
index 51c61a5..4a413d1 100755 (executable)
@@ -1,4 +1,3 @@
-\r
 /*\r
  * Copyright (c) 2022 CompanyNameMagicTag.\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
@@ -12,7 +11,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
-#include "ui_label_ext.h"\r
  */\r
 \r
 #ifndef PULL_UP_DOWN_VIEW_H\r
@@ -23,7 +21,6 @@
 #include "components/ui_image_view.h"\r
 #include "components/ui_label.h"\r
 #include "components/ui_label_button.h"\r
-#include "components/ui_label_ext.h"\r
 \r
 namespace OHOS {\r
 class PullUpDownView : public AppGroupView {\r
@@ -38,13 +35,11 @@ private:
     UIImageView *finPhone{nullptr};\r
     UIImageView *droAlarm{nullptr};\r
     UIImageView *droSetting{nullptr};\r
-\r
-    UILabelExt *dnotDisturbLable{nullptr};\r
-    UILabelExt *briScreenLable{nullptr};\r
-    UILabelExt *finPhoneLable{nullptr};\r
-    UILabelExt *droAlarmLable{nullptr};\r
-    UILabelExt *droSettingLable{nullptr};\r
-    \r
+    UILabel *dnotDisturbLable{nullptr};\r
+    UILabel *briScreenLable{nullptr};\r
+    UILabel *finPhoneLable{nullptr};\r
+    UILabel *droAlarmLable{nullptr};\r
+    UILabel *droSettingLable{nullptr};\r
     UIImageView *bluetooth{nullptr};\r
     UIImageView *battery{nullptr};\r
     UILabel *batteryLable{nullptr};\r
index 4a6bf3b..be5dfec 100755 (executable)
@@ -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
 }
index 5c7701b..f04195f 100755 (executable)
@@ -3,77 +3,53 @@
     languageinfo="en"
     fontName="DroidSansFallback.ttf"
     direct="ltf"
->
+    >
     <lanstr
         id="STR_IMAGE"
         value="Image"
-        size="21"
+        size = "21"
         direct="rtl"
-    />
+        />
 
     <lanstr
         id="STR_PROGRESSBAR"
         value="ProgressBar"
         direct="mixed"
-    />
+        />
 
     <lanstr
         id="STR_SLIDEUNLOCK"
         value="SlideUnlock"
-    />
+        />
 
     <lanstr
         id="STR_LISTBOX"
         value="ListBox"
-    />
+        />
 
     <lanstr
         id="STR_BUTTON"
         value="Button"
-    />
+        />
 
     <lanstr
         id="STR_SCROLLVIEW"
         value="ScrollView"
-    />
+        />
 
     <lanstr
         id="STR_SCROLLGRID"
         value="ScrollGrid"
-    />
+        />
 
     <lanstr
         id="STR_CLOCK"
         value="Clock"
-    />
+        />
     <lanstr
-        size="21"
+        size = "21"
         direct="ltr"
         id="STR_11"
         value="Clock1"
-    />
-    <lanstr
-        id="GLIDE_DISTURBANCE"
-        value="Disturbance"
-    />
-    <lanstr
-        id="GLIDE_BRIGHT"
-        value="Bright"
-    />
-    <lanstr
-        id="GLIDE_PHONE"
-        value="Phone"
-    />
-    <lanstr
-        id="GLIDE_ALARM"
-        value="Alarm"
-    />
-    <lanstr
-        id="GLIDE_SYSTEMSETTING"
-        value="SystemSetting"
-    />
-    <lanstr
-        id="SYSTEM_LANGAGE"
-        value="Language"
-    />
-</language>
\ No newline at end of file
+        />
+</language>
index bc68262..cbd6517 100755 (executable)
@@ -7,69 +7,45 @@
         value="图片"
         size="32"
         direct="rtl"
-    />
+               />
 
     <lanstr
         id="STR_PROGRESSBAR"
         value="进度条"
         direct="mixed"
-    />
+               />
 
     <lanstr
         id="STR_SLIDEUNLOCK"
         value="滑动解锁"
-    />
+               />
 
     <lanstr
         id="STR_LISTBOX"
         value="列表"
-    />
+               />
 
     <lanstr
         id="STR_BUTTON"
         value="按钮"
-    />
+               />
 
     <lanstr
         id="STR_SCROLLVIEW"
         value="滚动视图"
-    />
+               />
 
     <lanstr
         id="STR_SCROLLGRID"
         value="滚动网格"
-    />
+               />
 
     <lanstr
         id="STR_CLOCK"
         value="时钟"
-    />
+               />
     <lanstr
         id="STR_22"
         value="时钟"
-    />
-    <lanstr
-        id="GLIDE_DISTURBANCE"
-        value="勿扰"
-    />
-    <lanstr
-        id="GLIDE_BRIGHT"
-        value="亮屏"
-    />
-    <lanstr
-        id="GLIDE_PHONE"
-        value="找手机"
-    />
-    <lanstr
-        id="GLIDE_ALARM"
-        value="闹钟"
-    />
-    <lanstr
-        id="GLIDE_SYSTEM"
-        value="设置"
-    />
-    <lanstr
-        id="SYSTEM_LANGAGE"
-        value="语言"
-    />
-</language>
\ No newline at end of file
+               />
+</language>
index d3e47df..9bd108d 100755 (executable)
@@ -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);
 }