From: SnickerSun Date: Wed, 11 Dec 2024 02:50:15 +0000 (+0800) Subject: patch_602_1029_to_1126 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8f3f40baf293e8a21dca02bebafb2929f43c651a;p=mirrors%2FFD230.git patch_602_1029_to_1126 --- diff --git a/code/sdk/application/brandy/brandy_standard/input_app.c b/code/sdk/application/brandy/brandy_standard/input_app.c index 33f161f31..c758bf401 100644 --- a/code/sdk/application/brandy/brandy_standard/input_app.c +++ b/code/sdk/application/brandy/brandy_standard/input_app.c @@ -409,7 +409,9 @@ static void button_released_state_handler(button_id_t id) g_button_state_record = 0; g_button_press_time = 0; } + uint32_t int_sts = osal_irq_lock(); button_report_click_state(id); + osal_irq_restore(int_sts); } static void button_pressed_state_handler(button_id_t id) diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp index 6ac05da9c..5c59253f0 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp @@ -23,6 +23,8 @@ #include "graphic_config.h" #include "dfx/fps_task.h" #include "notification_manager.h" +#include "baidu_app.h" + #ifdef __cplusplus extern "C" { @@ -80,6 +82,8 @@ void NativeAbility::OnActive(const Want &want) #ifdef JS_ENABLE SliteAbility::OnActive(want); #endif + + msg_center_xiaodu_audio_pcm_clear_res(); } void NativeAbility::StopSlice() diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h index 36a6a1eda..8bc18df70 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h @@ -46,6 +46,7 @@ public: void ApplistUpdate(void); void SetPresenter(ApplistPresenter *p); AppListStyle GetCurrentStyle(void); + void SetInitFlag(bool flag); private: ApplistModel(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp index c83dc49f7..82934f892 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp @@ -59,6 +59,11 @@ namespace OHOS { } } + void ApplistModel::SetInitFlag(bool flag) + { + initFlag = flag; + } + void ApplistModel::ResolvingJSAppItems(void) { #ifdef JS_ENABLE diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp index 39c2411ba..30d94a860 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp @@ -137,6 +137,7 @@ namespace OHOS { SetWantElement(want, startElement); StartAbility(want); + ClearWant(want); delete want; return true; #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp index dbfa000f3..6704a2267 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp @@ -60,12 +60,12 @@ bool DialArcLabelView::SetTextWithWildcard(const char* text) if (text_ == nullptr) { return false; } - if (memcpy_s(text_, textLen, text, textLen) != EOK) { + if (strcpy_s(text_, textLen, text) != EOK) { + GRAPHIC_LOGE("strcpy_s failed"); UIFree(text_); text_ = nullptr; return false; } - text_[textLen] = '\0'; return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp index 065036851..6d7bb7467 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp @@ -143,11 +143,13 @@ void DialDigitalImgView::HandlePosition() } else if (align_ == ImgAlign::CENTER) { curX -= totalWidth / 2; // 2: half } + UIView* prev = this; // this is always the leading view of those images. for (uint8_t i = 0; i < currentIndex_; i++) { - parent_->Add(imgs_[i]); + parent_->Insert(prev, imgs_[i]); imgs_[i]->SetPosition(curX, alignPos_.y); imgs_[i]->Invalidate(); curX += imgs_[i]->GetWidth() + space_; + prev = imgs_[i]; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp index f7cb557e4..b2e41f5de 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp @@ -59,12 +59,12 @@ bool DialLabelView::SetTextWithWildcard(const char* text) if (text_ == nullptr) { return false; } - if (memcpy_s(text_, textLen, text, textLen) != EOK) { + if (strcpy_s(text_, textLen, text) != EOK) { + GRAPHIC_LOGE("strcpy_s failed"); UIFree(text_); text_ = nullptr; return false; } - text_[textLen] = '\0'; return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp index 73f84de61..1093b52cf 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp @@ -179,8 +179,8 @@ void DialViewGroup::AddView(DialDataType type, DialView* view, bool isPeriodic) passiveUpdateTypes_.PushBack(type); } dialViews_.PushBack(dynamic_cast(view)); - ProcessData(type, view); Add(dynamic_cast(view)); + ProcessData(type, view); } void DialViewGroup::SetPeriod(uint32_t period) diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 22279a392..affcaa9f8 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -108,10 +108,12 @@ set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/player/interfaces/kits/ ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput ${ROOT_DIR}/middleware/utils/fs/include/fs ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common ${ROOT_DIR}/application/auto_ota + ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite ) if("JS_ENABLE" IN_LIST DEFINES) diff --git a/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-cli/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-cli/libmsg_center.a index 3fdf6c9d0..fca873e01 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-cli/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-cli/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-ser/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-ser/libmsg_center.a index 8b5ee221f..987773360 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-ser/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-ser/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a index af824c773..d541fd8d5 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a index e0a00bf03..b2a985e75 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h index 7484c9022..53bbb4d1c 100644 --- a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h +++ b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h @@ -123,6 +123,7 @@ errcode_t msg_center_vector_navi_req_destroy_from_watch(uint8_t cmd_id, uint8_t errcode_t msg_center_vector_navi_rec_destroy_from_watch(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); bool is_vector_navi_long_distance(uint8_t type); +void msg_center_xiaodu_audio_pcm_clear_res(void); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 6078e7db8..cb7e65587 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -27,7 +27,11 @@ #include "msg_center_protocol.h" #include "baidumap.h" #include "common_def.h" - +#include "keyinput.h" +#include "KeyInputListener.h" +#include "VolumeSettingView.h" +#include "VolumeSettingPresenter.h" +#include "VolumeSettingView.h" namespace OHOS { #ifdef __cplusplus @@ -46,6 +50,9 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE}, }; +bool g_pressFlag = false; +bool g_longPressFlag = false; + static bool CheckPriority(const Topic topic) { uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]); @@ -192,14 +199,119 @@ static uint8_t MsgCenterGetNotifyTblSize(void) return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]); } +static void CallVolumeDipSwitchControl(uint16_t notifyId, uint8_t states) +{ + VolumeSliderEventListener *volumeSliderEventListener = nullptr; + if (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE || + notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH) { + if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) { + VolumeSettingView *settingView = GetvolumeSetting(); + if (settingView == nullptr) { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); + if (volumeSliderEventListener == nullptr) { + return; + } + volumeSliderEventListener->ChangeVolume(static_cast(VOLUMEUP)); + } else { + HonrsViewChange(); + NotificationManager::GetInstance()->SetVolumeScreenStatus(true); + } + } + return; +} + +static void OnKeyLongPress(uint16_t keyID) +{ + g_longPressFlag = true; // Long press the logo + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button + // After StopNotify, a restart card will pop up first + uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); + if(notifyId == TOPIC_EVENT_ALARM_RING) { + NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT); + NotificationManager::GetInstance()->SetNativeUIRunning(true); + NotificationManager::GetInstance()->StopNotify(); + } + } else if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons + // Switch to user configured shortcut card + } + return; +} + +static void HandleKeyPress(uint16_t notifyId) +{ + if (notifyId == TOPIC_EVENT_ALARM_RING) { + AlarmClockModel::GetInstance()->AlarmGetClockNum(); + AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); + NotificationManager::GetInstance()->StopNotify(); + } +} + +static bool PressKeyEvent(uint16_t keyID, uint8_t state) +{ + switch (state) { + case InputDevice::STATE_PRESS: + g_pressFlag = true; + return true; + case InputDevice::STATE_LONG_PRESS: + OnKeyLongPress(keyID); + return true; + case InputDevice::STATE_RELEASE: + if (g_longPressFlag) { + g_pressFlag = false; + g_longPressFlag = false; + return true; + } + break; + default: + break; + } + return false; +} + +static bool KeyNotifyCallback(uint16_t keyID, uint8_t state) +{ + if (!OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Notify does not exist!"); + OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(nullptr); + g_pressFlag = false; + g_longPressFlag = false; + return false; + } + if (PressKeyEvent(keyID, state)) { + return true; + } + uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button + if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card + // volume+ + CallVolumeDipSwitchControl(notifyId, VOLUMEUP); + } else { + HandleKeyPress(notifyId); + } + } + else if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons + if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card + // volume- + CallVolumeDipSwitchControl(notifyId, VOLUMEDOWN); + } else { + // Switch to user configured shortcut card + } + } + g_pressFlag = false; + g_longPressFlag = false; + return true; +} + bool MsgCenterNotifyProc(const Topic topic, Request* req) { uint8_t i; uint8_t tblSize = MsgCenterGetNotifyTblSize(); - + OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback); for (i = 0; i < tblSize; i++) { MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i); - if (item->topic == topic && item->cb != nullptr) { + if (item != nullptr && item->topic == topic && item->cb != nullptr) { item->cb(topic, req); return true; } @@ -242,7 +354,7 @@ void StartJsApp(char *bundleName) SetWantElement(want, startElement); StartAbility(want); - + ClearWant(want); delete want; } diff --git a/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp b/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp index 33edb7ecd..fe13e2c42 100644 --- a/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp @@ -22,6 +22,7 @@ #include "soc_osal.h" #include "watchdog.h" #include "js_ability.h" +#include "recording_module.h" #ifdef __cplusplus extern "C" { @@ -35,6 +36,7 @@ extern "C" { #define ROUTE_TRANS_MAX_SIZE (60 * 1024) /* 60K大小的导航路线规划,距离大概是15KM */ osMessageQueueId_t g_pcm_stream_msg_queue_id = nullptr; +static bool g_pcm_stream_end_record_sended_flag = false; /* 标识pcm的end帧是否发送完成,用于异常场景时资源清理 */ errcode_t msg_center_navigation_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) { @@ -135,6 +137,8 @@ static errcode_t pcm_stream_task_body(void *data) return ERRCODE_FAIL; } + g_pcm_stream_end_record_sended_flag = false; + for (;;) { osStatus_t ret = osMessageQueueGet(g_pcm_stream_msg_queue_id, &msg, nullptr, osWaitForever); if (ret != osOK) { @@ -147,6 +151,7 @@ static errcode_t pcm_stream_task_body(void *data) msg.data = nullptr; if (res != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm stream failed"); + pcm_stream_del_queue(); return ERRCODE_FAIL; } } else if (msg.msg_id == MSGCENTER_TYPE_ID_XIAODU_END_RECORD) { @@ -156,8 +161,10 @@ static errcode_t pcm_stream_task_body(void *data) msg.data = nullptr; if (res != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm end failed"); + pcm_stream_del_queue(); return ERRCODE_FAIL; } + g_pcm_stream_end_record_sended_flag = true; return ERRCODE_SUCC; } } @@ -165,6 +172,31 @@ static errcode_t pcm_stream_task_body(void *data) return ERRCODE_SUCC; } +/* + 异常场景时清除audio资源、pcm队列资源 + 可能的异常场景包括: + 1)录音过程中,JS直接退出; + 2)录音完成后,等待APP结果未返回时,JS退出; + */ +void msg_center_xiaodu_audio_pcm_clear_res(void) +{ + OHOS::ACELite::AudioCapturerModule::ExceptionStop(); + if (g_pcm_stream_end_record_sended_flag == false) { + pcm_stream_queue_msg msg; + msg.msg_id = MSGCENTER_TYPE_ID_XIAODU_END_RECORD; + msg.data = 0; + msg.len = 1; + if (g_pcm_stream_msg_queue_id != nullptr) { + osStatus_t ret = osMessageQueuePut(g_pcm_stream_msg_queue_id, &msg, 0, 0); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "Fatal err, ret = %d\r\n", ret); + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_MSG_CENTER, "active send pcm end\r\n"); + } + } + return; +} + osMessageQueueId_t GetPcmMsgQueueId(void) { return g_pcm_stream_msg_queue_id; @@ -183,6 +215,7 @@ errcode_t pcm_stream_create_task(void) 0 }; if (osThreadNew((osThreadFunc_t)pcm_stream_task_body, nullptr, &attr) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "create pcm_stream task fail!\r\n"); + pcm_stream_del_queue(); return ERRCODE_FAIL; } diff --git a/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp b/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp index 217a764d7..9be12aa18 100644 --- a/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp +++ b/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp @@ -21,6 +21,7 @@ #include "global.h" #include "gt_bundle_manager_service.h" #include "ApplistModel.h" +#include "bundle_manager.h" #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) #define OHOSFWK_MAX_ARGC 8 @@ -51,6 +52,7 @@ static void ReceiveCallback(const uint8_t resultCode, const void *resultMessage) } else { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bms resultCode = 0x%x", resultCode); } + AdapterFree(installMsg); } static int ConvertCmdToParam(uint8_t *para, uint32_t paraLen, @@ -225,6 +227,7 @@ static uint32_t OhosfwkATCmdAmStartJsApp(uint8_t *para, uint32_t paraLen, char * startElement.deviceId = nullptr; SetWantElement(want, startElement); StartAbility(want); + ClearWant(want); delete want; return ERRCODE_SUCC; } @@ -258,6 +261,18 @@ static uint32_t OhosfwkATCmdChangeLanguage(uint8_t *para, uint32_t paraLen, char WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Language changed to %s\n", languageRegion); + bool scanResult = ScanPackages(nullptr); + + if (scanResult) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Scan Packages Succeeded"); + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Scan Packages Failed"); + return ERRCODE_FAIL; + } + + OHOS::ApplistModel::GetInstance().SetInitFlag(false); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Set InitFlag false Succeeded"); + return ERRCODE_SUCC; } diff --git a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h index 1675ea807..52ef76f12 100644 --- a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h +++ b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h @@ -89,6 +89,12 @@ void pmu_bcore_vdd0p8_power_vset(uint8_t level); */ void pmu_vdd0p8_power_vset(uint8_t level); +/** + * @brief VDD0p8 power adjust get. + * @param level Voltage level. + */ +void pmu_vdd0p8_power_vget(uint8_t *level); + /** * @brief LDO power on/off. * @param sub Which ldo select. diff --git a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c index c5a0c2ddf..984a31262 100644 --- a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c +++ b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c @@ -7,6 +7,8 @@ #include "hal_pmu_vdd.h" #include "std_def.h" +uint8_t g_pmu_0p8_vget = 0; + typedef struct { volatile uint32_t lock; volatile uint32_t req_closed; @@ -62,6 +64,11 @@ void pmu_vdd1p0_request_switch(switch_type_t en) osal_irq_restore(irq); } +void pmu_vdd0p8_power_vget(uint8_t *level) +{ + *level = g_pmu_0p8_vget; +} + void pmu_vdd0p8_power_vset(uint8_t level) { /* 1. Set vset step, default: 0.25mv @@ -69,6 +76,7 @@ void pmu_vdd0p8_power_vset(uint8_t level) * 3. requset vset config * 4. wait ack, clr ack */ + g_pmu_0p8_vget = level; hal_pmu_vdd0p8_set_nor_voltage(level); hal_pmu_vdd0p8_vset_requset(PMU_VSET_MCORE); (void)hal_pmu_vdd0p8_vset_ack_get(PMU_VSET_MCORE); diff --git a/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h b/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h index db816f173..ca5d08b7d 100644 --- a/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h +++ b/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h @@ -45,7 +45,8 @@ typedef enum { #define PMU_LPM_MCPU_WKUP_ALL_MASK 0xFFFF -#define PMU_LPM_MCPU_WKUP_MASK (BIT(PMU_LPM_MCPU_DAP_WAKEUP) | \ +#define PMU_LPM_MCPU_WKUP_MASK (BIT(PMU_LPM_MCPU_CWDT_INT_WAKEUP) | \ + BIT(PMU_LPM_MCPU_DAP_WAKEUP) | \ BIT(PMU_LPM_MCPU_SSI_WAKEUP) | \ BIT(PMU_LPM_MCPU_GPIO_WAKEUP) | \ BIT(PMU_LPM_MCPU_M_RTC_WAKEUP) | \ diff --git a/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c b/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c index 1a7e00b13..a2e29cbf8 100644 --- a/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c +++ b/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c @@ -120,48 +120,17 @@ void HalDelayUs(unsigned usecs) } } -#ifdef SUPPORT_RC_CALIBRATION -volatile uint64_t g_pre_count = 0; -volatile double g_pre_msec = 0; -#endif - uint64_t HalClockGetCycles(void) { -#ifdef SUPPORT_RC_CALIBRATION - volatile double tick_count; -#else uint64_t tick_count; -#endif uint64_t cycle; uint32_t lock_int_save; uint32_t load_tick; -#ifdef SUPPORT_RC_CALIBRATION - volatile double msec; - volatile uint64_t now_count; -#endif lock_int_save = LOS_IntLock(); - -#ifdef SUPPORT_RC_CALIBRATION - if (g_pre_count == 0) { - tick_count = (uapi_systick_get_count() * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ; - g_pre_count = uapi_systick_get_count(); - g_pre_msec = tick_count; - } else { - now_count = uapi_systick_get_count(); - msec = (double)((now_count - g_pre_count) * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ; - tick_count = g_pre_msec + msec; - - g_pre_count = now_count; - g_pre_msec = tick_count; - } -#else tick_count = uapi_systick_get_ms(); -#endif - load_tick = machine_timer_get_load_count(); cycle = (uint64_t)(tick_count * load_tick); - LOS_IntRestore(lock_int_save); return cycle; } diff --git a/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c b/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c index 3b8757c26..34361852c 100644 --- a/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c +++ b/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c @@ -216,12 +216,6 @@ td_s32 sap_ioctl_ao_open(td_u32 cmd, td_void *arg, td_void *file) } #endif - ret = drv_ao_load_aef(); - if (ret != AUDIO_SUCCESS) { - sap_err_log_fun(drv_ao_load_aef, ret); - return ret; - } - audio_unused(cmd); audio_unused(file); return AUDIO_SUCCESS; @@ -668,6 +662,14 @@ td_s32 sap_ioctl_ao_set_aef_profile(td_u32 cmd, td_void *arg, td_void *file) profile = (sap_ao_port_aef_profile *)arg; drv_ao = profile->h_mod; + if (profile->aef_profile > AO_AEF_PROFILE_NONE && profile->aef_profile < AO_AEF_PROFILE_MAX) { + ret = drv_ao_load_aef(); + if (ret != AUDIO_SUCCESS) { + sap_err_log_fun(drv_ao_load_aef, ret); + return ret; + } + } + ret = drv_msg_ao_set_aef_profile(drv_ao, profile->aef_profile); if (ret != AUDIO_SUCCESS) { sap_err_log_fun(drv_msg_ao_set_aef_profile, ret); diff --git a/code/sdk/drivers/drivers/driver/efuse/efuse.c b/code/sdk/drivers/drivers/driver/efuse/efuse.c index d2ea93b3a..43cd9f6df 100644 --- a/code/sdk/drivers/drivers/driver/efuse/efuse.c +++ b/code/sdk/drivers/drivers/driver/efuse/efuse.c @@ -13,6 +13,8 @@ #include "soc_osal.h" #include "errcode.h" #include "tcxo.h" +#include "pmu_ldo.h" +#include "hal_pmu_vdd.h" #include "hal_efuse.h" #include "efuse_porting.h" @@ -101,11 +103,22 @@ errcode_t uapi_efuse_write_bit(uint32_t byte_number, uint8_t bit_pos) return ERRCODE_INVALID_PARAM; } + uint8_t old_level = 0; + pmu_vdd0p8_power_vget(&old_level); + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(HAL_PMU_VDD0P8_1P0_0P925V); + } hal_efuse_region_t region = hal_efuse_get_region(byte_number); if (hal_funcs->write_op(byte_number, (uint8_t)bit(bit_pos), region) == ERRCODE_SUCC) { + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_SUCC; } + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_FAIL; } #endif @@ -126,16 +139,28 @@ static errcode_t efuse_write_param_check(uint32_t byte_number, const uint8_t *bu errcode_t uapi_efuse_write_buffer(uint32_t byte_number, const uint8_t *buffer, uint16_t length) { errcode_t ret; + uint8_t old_level; ret = efuse_write_param_check(byte_number, buffer, length); if (ret != ERRCODE_SUCC) { return ERRCODE_EFUSE_INVALID_PARAM; } + + pmu_vdd0p8_power_vget(&old_level); + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(HAL_PMU_VDD0P8_1P0_0P925V); + } hal_efuse_funcs_t *hal_funcs = hal_efuse_get_funcs(); if (hal_funcs->write_buffer_op(byte_number, buffer, length) != ERRCODE_SUCC) { + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_FAIL; } + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_SUCC; } diff --git a/code/sdk/include/middleware/services/bts/br/bts_spp.h b/code/sdk/include/middleware/services/bts/br/bts_spp.h index daf182915..a32df6eab 100644 --- a/code/sdk/include/middleware/services/bts/br/bts_spp.h +++ b/code/sdk/include/middleware/services/bts/br/bts_spp.h @@ -285,6 +285,26 @@ int spp_get_remote_addr(int client_id, bd_addr_t *remote_addr); */ int spp_write(int client_id, const char *data, const unsigned int len); +/** + * @if Eng + * @brief Config client write data retry max times. + * @attention NULL. + * @param [in] retry_times Indicate the retry max times when write operation failed, + retry interval is 5ms. + * @retval ERRCODE_BT_SUCCESS The operation success. + * @par Dependency: + * @li bts_spp.h + * @else + * @brief 配置spp写重试最大次数 + * @attention NULL. + * @param [in] retry_times 入参,用来指定写操作失败时重试的最大次数,重试间隔为5ms。 + * @retval ERRCODE_BT_SUCCESS 操作成功。 + * @par 依赖: + * @li bts_spp.h + * @endif + */ +errcode_bt_t spp_write_retry_times_config(uint32_t retry_times); + /** * @if Eng * @brief Callback function for connection event. diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml index 91cdbc7a6..313b390d6 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml index 584bf5c4a..665f6d647 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml @@ -3,8 +3,8 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml index 85db15016..19e319a3c 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml @@ -27,7 +27,7 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml index a591e4055..db2c7c3ac 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml index a62c26346..cab6261f5 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml @@ -8,33 +8,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml index 241e15687..4b8d4f600 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml @@ -3,93 +3,96 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml index 4a02f3641..c1212bf06 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml @@ -25,48 +25,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml index 4efd77217..e31002fb4 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml @@ -4,41 +4,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml index 8666eca75..bc7f62c33 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml @@ -1,58 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml index 673f2b37d..f99e42766 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml index 6fc4b2347..c61c8df17 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml index a5a003547..46914236c 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml @@ -2,7 +2,7 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml index 781eaee31..59e58c89e 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml @@ -1,4 +1,5 @@ - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_vector.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_vector.cpp.xml index e61663e83..2cfdeb793 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_vector.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_vector.cpp.xml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml index dfbff856e..10e05ef92 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml @@ -1,12 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a index e1f042420..d7d528e72 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a index 998125c83..1f80e3f6c 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a index 1c2cbe046..d39ba8da8 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a index 398a9485a..df98f9c07 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a index 0e9fc5d89..00c9b7b82 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a index 5956ff4dc..3ea479a7e 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_audio_manager_wrapper.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_audio_manager_wrapper.a index 4fe7d6606..6a8d77eb0 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_audio_manager_wrapper.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_audio_manager_wrapper.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a index b485c2498..4fa8b0583 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a index f00910a5c..e77c74bcb 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a differ diff --git a/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c b/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c index 3e2deaa99..d4fc8a307 100644 --- a/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c +++ b/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c @@ -14,6 +14,7 @@ #include "pm_lpc.h" #include "pm_core.h" #include "pm_clocks.h" +#include "clocks_config.h" #include "arch_encoding.h" #include "arch_barrier.h" #include "debug_print.h" @@ -29,7 +30,11 @@ #define PM_SLEEP_TRACE_SEL_TAG(val) (writew(PM_SLEEP_SEL_TRACE, val)) #define PM_SLEEP_SEL_EVENT 0x777 #define PM_SLEEP_TRACE_DEF_VAL 0x5a5a -#define PM_OS_US_TO_MS 1000 +#define PM_OS_US_TO_MS 1000 +#define RTC_TIMER_INT_STATUS 0x57024010 +#define PM_RTC_LOAD_COUNT_REG 0x57024000 +#define PM_RTC_CUR_ALERT_US 64000000 +#define PM_RTC_LOAD_THRESHOLD_MS (CLOCK_32K_CALI_FREQ / 50) enum { PM_SLEEP_STATE_IDLE, @@ -286,6 +291,7 @@ void pm_enter_sleep(uint32_t sleep_ms_val) uint32_t status; uint32_t sleep_ms = sleep_ms_val; uint32_t rtc_times = 0; + uint32_t rtc_times_alert = 0; if ((g_pm_mcu_dynamic_power_flag == 1) || hal_ipc_get_core_clr_sts(CORES_BT_CORE)) { return; } @@ -293,11 +299,15 @@ void pm_enter_sleep(uint32_t sleep_ms_val) return; } uapi_rtc_get_current_time_us(0, &rtc_times); + if (rtc_times > PM_RTC_CUR_ALERT_US) { + rtc_times_alert = rtc_times; + rtc_times = rtc_porting_cycle_2_us(readl(PM_RTC_LOAD_COUNT_REG)); + } if (rtc_times < PM_OS_US_TO_MS && rtc_times > 0) { return; } rtc_times /= PM_OS_US_TO_MS; - if (sleep_ms > rtc_times && rtc_times != 0 && sleep_ms <= g_pm_sleep_threshold) { + if (sleep_ms > rtc_times && rtc_times != 0) { sleep_ms = rtc_times; } if (sleep_ms <= PM_SLEEP_THRESHOLD_WFI_ONLY_MS || pm_get_sleep_veto()) { @@ -314,7 +324,8 @@ void pm_enter_sleep(uint32_t sleep_ms_val) pm_enter_deepsleep_set_flag(); status = pm_os_irq_lock(); - if ((sleep_ms <= g_pm_sleep_threshold) || pm_get_sleep_veto()) { + if ((sleep_ms <= g_pm_sleep_threshold) || pm_get_sleep_veto() || readl(RTC_TIMER_INT_STATUS) == 1 || + ((readl(PM_RTC_LOAD_COUNT_REG) < PM_RTC_LOAD_THRESHOLD_MS) && (rtc_times_alert > PM_RTC_CUR_ALERT_US))) { pm_enter_deepsleep_cancel_flag(); pm_enter_light_sleep(); } else { @@ -345,8 +356,6 @@ void pm_set_mcu_dynamic_power_flag(uint8_t flag) void uapi_pm_enter_sleep(void) { - uint32_t status = pm_os_irq_lock(); uint32_t sleep_ms = pm_os_get_sleep_ms(); pm_enter_sleep(sleep_ms); - pm_os_irq_restore(status); } diff --git a/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c b/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c index e5e78e0dd..3f22e584c 100644 --- a/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c +++ b/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c @@ -42,10 +42,14 @@ static void pm_tickless_compensate_os_ticks(uint32_t ticks) g_exit_sleep_time = pm_core_get_count(); // freq:32768 uint64_t sleep_time = ((g_exit_sleep_time - g_entry_sleep_time) * PM_OS_TICKS_PER_S) + g_32k_time_calibrate; uint32_t actual_sleep_time = (uint32_t)(sleep_time / CLOCK_32K_CALI_FREQ); - g_32k_time_calibrate = actual_sleep_time & 0x7FFF; + g_32k_time_calibrate = actual_sleep_time % CLOCK_32K_CALI_FREQ; if (actual_sleep_time > ticks) { +#ifdef __FREERTOS__ pm_os_compensate_sleep_ticks(ticks); +#else + pm_os_compensate_sleep_ticks(actual_sleep_time); +#endif } else { pm_os_compensate_sleep_ticks(actual_sleep_time); } diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-cli/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-cli/libgfx_rm.a index 092677d93..63d672421 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-cli/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-cli/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-ser/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-ser/libgfx_rm.a index 8786cac43..74583e317 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-ser/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-ser/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-r/libgfx_rm.a index b6b63fe41..aa0af424c 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js/libgfx_rm.a index 8b2b0dfa2..12f9d8bda 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target1-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target1-r/libgfx_rm.a index ed958f390..31469a250 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target1-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target1-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target1/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target1/libgfx_rm.a index c280d0c6e..db7f01bdd 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target1/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target1/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target3-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target3-r/libgfx_rm.a index f105334cc..9c0d1c625 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target3-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target3-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target3/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target3/libgfx_rm.a index 845e3f0fd..e760f591b 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target3/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target3/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target4-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target4-r/libgfx_rm.a index 7d7a1bada..4b903f50d 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target4-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target4-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target4/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target4/libgfx_rm.a index 5580c0d26..3e494cf2e 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target4/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target4/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target5-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target5-r/libgfx_rm.a index 438f33fdd..78dec6975 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target5-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target5-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-target5/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-target5/libgfx_rm.a index b35a02b11..09dadb7af 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-target5/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-target5/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-xts/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-xts/libgfx_rm.a index 354b20356..95aa23b1a 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-xts/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-xts/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/testsuite-brandy-sdk/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/testsuite-brandy-sdk/libgfx_rm.a index 2831b001b..5d4c95a1f 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/testsuite-brandy-sdk/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/testsuite-brandy-sdk/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c b/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c index 1b9854719..2a1de2302 100644 --- a/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c @@ -659,6 +659,10 @@ td_s32 dpu_layer_set_pos(drv_dpu_layer_id layer_id, td_s32 pos_x, td_s32 pos_y) return DRV_ERR_DPU_OPERATION_NOT_SUPPORT; } + if ((layer_dev->run_info.pos_x == pos_x) && (layer_dev->run_info.pos_y == pos_y)) { + return EXT_SUCCESS; + } + osal_spin_lock_irqsave(&layer_dev->layer_lock, &flag); layer_dev->update_flag = TD_TRUE; layer_dev->run_info.pos_x = pos_x; diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-cli/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-cli/libdisplay_gfx.a index d2e5513b2..ebcb8f594 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-cli/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-cli/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-ser/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-ser/libdisplay_gfx.a index 66a278136..37177c5a3 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-ser/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-auto-ota-ser/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a index a9dbb4530..40adc6ff8 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a index 6726e6672..258ad0d5d 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a index bdaac2af8..e882def35 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a index 7eacc042e..3f235e5e7 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a index 7fd8f9f11..132d4ec5e 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c b/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c index 6f95f71de..fde932976 100644 --- a/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c +++ b/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c @@ -57,6 +57,8 @@ typedef struct { } AddrInfo; TryToFreeImgCallback g_tryToFreeImgCallback = NULL; +TryToFreeFontCacheCallback g_tryToFreeFontCacheCallback = NULL; + #if ENABLE_GMMU static bool g_gmmuAllocated[FB_COUNT] = {false, false}; struct gmmu_buf_struct g_gmmuMem = { 0 }; @@ -228,14 +230,23 @@ static int32_t AllocMem(const AllocInfo *info, BufferHandle **handle) } uint8_t *addr = LosAllocMem(pool, (uint32_t)(buffer->size)); - if (((info->usage & HBM_USE_MEM_YUV) != HBM_USE_MEM_YUV) && - (pool == g_poolId) && (g_tryToFreeImgCallback != NULL)) { + if ((pool == g_poolId) && (g_tryToFreeImgCallback != NULL)) { while (addr == NULL) { if (g_tryToFreeImgCallback()) { DISP_LOGW("Success to free image during AllocMem size: %u\n", buffer->size); addr = LosAllocMem(pool, (uint32_t)(buffer->size)); } else { - DISP_LOGE("Failed to AllocMem size: %u and no image can be free\n", buffer->size); + DISP_LOGE("Failed to AllocMem size: %u, and no image can be free\n", buffer->size); + break; + } + } + } else if ((pool == g_fontPoolId) && (g_tryToFreeFontCacheCallback != NULL)) { + while (addr == NULL) { + if (g_tryToFreeFontCacheCallback()) { + DISP_LOGW("Success to free font cache during AllocMem size: %u\n", buffer->size); + addr = LosAllocMem(pool, (uint32_t)(buffer->size)); + } else { + DISP_LOGE("Failed to AllocMem size: %u, and no font cache can be free\n", buffer->size); break; } } @@ -275,7 +286,7 @@ static void FreeMem(BufferHandle *handle) #endif } } else if (((handle->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) || - ((handle->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH)){ + ((handle->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH)) { LosFreeMem(g_fontPoolId, handle->virAddr); } else { LosFreeMem(g_poolId, handle->virAddr); @@ -290,6 +301,11 @@ static void RegisterTryToFreeImgCallback(TryToFreeImgCallback callback) g_tryToFreeImgCallback = callback; } +static void RegisterTryToFreeFontCacheCallback(TryToFreeFontCacheCallback callback) +{ + g_tryToFreeFontCacheCallback = callback; +} + int32_t GrallocInitialize(GrallocFuncs **funcs) { CHECK_NULLPOINTER_RETURN_VALUE(funcs, DISPLAY_NULL_PTR); @@ -310,6 +326,7 @@ int32_t GrallocInitialize(GrallocFuncs **funcs) gFuncs->AllocMem = AllocMem; gFuncs->FreeMem = FreeMem; gFuncs->RegisterTryToFreeImgCallback = RegisterTryToFreeImgCallback; + gFuncs->RegisterTryToFreeFontCacheCallback = RegisterTryToFreeFontCacheCallback; *funcs = gFuncs; #if ENABLE_GMMU diff --git a/code/sdk/middleware/services/gui/lvgl/brandy-target1/liblvgl_proprietary_mini.a b/code/sdk/middleware/services/gui/lvgl/brandy-target1/liblvgl_proprietary_mini.a index 1f4a4954c..fd65577a2 100644 Binary files a/code/sdk/middleware/services/gui/lvgl/brandy-target1/liblvgl_proprietary_mini.a and b/code/sdk/middleware/services/gui/lvgl/brandy-target1/liblvgl_proprietary_mini.a differ diff --git a/code/sdk/middleware/services/gui/lvgl/brandy-target5/liblvgl_proprietary.a b/code/sdk/middleware/services/gui/lvgl/brandy-target5/liblvgl_proprietary.a index 728bf6fe8..5e5c4ed87 100644 Binary files a/code/sdk/middleware/services/gui/lvgl/brandy-target5/liblvgl_proprietary.a and b/code/sdk/middleware/services/gui/lvgl/brandy-target5/liblvgl_proprietary.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-cli/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-cli/libuikit_ext.a index 61df03b92..16edf01e9 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-cli/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-cli/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-ser/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-ser/libuikit_ext.a index acbd6f027..411fad866 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-ser/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-auto-ota-ser/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a index b35257668..6f04c269e 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a index f7e6a1640..5e8a29d5c 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a index 728ec08e8..2c76ed485 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h index 699ef700b..be79d8983 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h @@ -39,6 +39,7 @@ #include "gfx_utils/heap_base.h" #include "graphic_config.h" #include "hals/gralloc_engines.h" +#include "graphic_mutex.h" #if ENABLE_IMAGE_PACKER namespace OHOS { @@ -144,6 +145,7 @@ private: std::unordered_map bufMap_; ImageNode longTermList_; ImageNode shortTermList_; + GraphicMutex listMutex_; ImageCacheManager() { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h index de6afb630..1fb3b4272 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h @@ -286,6 +286,13 @@ public: */ void CancelBuffer(SurfaceBuffer* buffer) override; + /** + * @brief Prepare video buffers. This should be called before playing video. + * @since 1.0 + * @version 1.0 + */ + void PrepareBuffers(); + void ClearBuffers(); SurfaceBuffer* GetBackBuf(); @@ -308,6 +315,7 @@ protected: List freeList_; List dirtyList_; IBufferConsumerListener* consumerListener_; + std::shared_ptr waitPrepareBuffer_; }; } // end namespace #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h index d4c923382..e02a80fc8 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h @@ -95,6 +95,7 @@ protected: #endif private: + void SetTextInnner(const char* text); uint16_t textId_ = FontGlobalManager::INVALID_TEXT_ID; #if ENABLE_SHAPING bool isNeedShaping_ = 0; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h index 75a1ee805..91257014d 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h @@ -31,6 +31,7 @@ #include "components/ui_swipe_view.h" #include "components/card_swipe.h" #include "components_ext/hor_swipe_view.h" +#include "components_ext/ver_swipe_view.h" namespace OHOS { /** @@ -39,7 +40,8 @@ namespace OHOS { * @since 1.0 * @version 1.0 */ -class UICrossView : public UIViewGroup, public UISwipeView::OnSwipeListener { +class UICrossView : public UIViewGroup, public UISwipeView::OnSwipeListener, + public VerSwipeView::OnMoveChildListener { public: UICrossView(const UICrossView &) = delete; UICrossView &operator=(const UICrossView &) = delete; @@ -77,6 +79,7 @@ public: return &instance; } + void OnMoveChild(UISwipeView& view, int16_t xOffset, int16_t yOffset) override; void OnSwipe(UISwipeView& view) override; bool OnDragStartEvent(const DragEvent& event) override; bool OnDragEvent(const DragEvent& event) override; @@ -234,13 +237,11 @@ private: static constexpr uint16_t INVALID_VIEW_INDEX = 0xff; bool loop_ = false; bool enableScreenCap_ = false; - bool gaussianBlurEnable_ = false; int swipeDirect_ = 0; - int pullIndex_ = 0; int16_t hDragStartIndex_ = INVALID_VIEW_INDEX; int16_t vBlankIndex_ = INVALID_VIEW_INDEX; UIView* vBlankView_ = nullptr; - UISwipeView vertical_; + VerSwipeView vertical_; HorSwipeView horizontal_; UIView* tailView_ = nullptr; UISwipeView::OnSwipeListener *swipeListener_ = nullptr; @@ -250,7 +251,6 @@ private: void RemoveAllInner(UISwipeView& view); void ProcessRes(void); - void VertSetGausBlur(uint16_t direct); void HorHandleCardEvent(int16_t index, uint16_t scrollStage); void VertHandleCardEvent(uint16_t scrollStage); }; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h index aeb9dc42b..d7a506f04 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h @@ -179,6 +179,8 @@ public: void DumpImgInfo() override; + std::string GetGuiInfo() const override; + private: UILiteSurfaceView(const UILiteSurfaceView&) = delete; UILiteSurfaceView &operator=(const UILiteSurfaceView&) = delete; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h index f7f5b2619..ee1e649e1 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h @@ -141,7 +141,7 @@ public: */ void HidePOI(uint16_t tag, bool isHide = true); void SetX(int16_t x) override; - void SetY(int16_t x) override; + void SetY(int16_t y) override; private: POIInfo* pois_ = nullptr; @@ -151,7 +151,6 @@ private: bool needUpdate_ = false; ImageInfo cacheInfo_ = {{0}}; MapSVGParser parser_; - char* filePath_ = nullptr; PathDetail* pathArray_ = nullptr; uint8_t pathCount_ = 0; RoadDetail* roadArray_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h index 7401eadf2..aa5bcb573 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h @@ -319,8 +319,8 @@ private: bool switchModeWithAnim_ = false; bool alignWithAnim_ = false; UIView* coverPreviousItem_ = nullptr; - uint16_t itemWidth_ = 0; - uint16_t itemHeight_ = 0; + uint16_t itemWidth_ = 1; + uint16_t itemHeight_ = 1; uint8_t mirrorOpa_ = 100; float radius_ = 0.0f; float perimeter_ = 0.0f; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp index f0d3f0521..332ffe523 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp @@ -17,10 +17,12 @@ #include "hals/gralloc_engines.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_math.h" +#include "graphic_service.h" + namespace OHOS { LiteSurface::LiteSurface() : bufferCount_(0), queueSize_(0), size_(0), width_(0), height_(0), strideAlignment_(0), format_(PIXEL_FMT_BUTT), - consumerListener_(nullptr) + consumerListener_(nullptr), waitPrepareBuffer_(std::make_shared(false)) { } @@ -51,6 +53,17 @@ void LiteSurface::ClearBuffers() lock_.Unlock(); } +void LiteSurface::PrepareBuffers() +{ + if (bufferCount_ != 0) { + GRAPHIC_LOGD("Already prepared buffers, bufferCount_ is %u", bufferCount_); + return; + } + for (uint8_t i = 0; i < queueSize_; i++) { + AddBuffer(); + } +} + void LiteSurface::AddBuffer() { if (queueSize_ == bufferCount_) { @@ -101,12 +114,21 @@ bool LiteSurface::CanRequest(uint8_t wait) goto END; } if (bufferCount_ < queueSize_) { - AddBuffer(); - res = true; - if (freeList_.IsEmpty()) { - GRAPHIC_LOGE("Cannot request buffer: freeList is empty."); - res = false; + bool waitPrepareBuffer = *waitPrepareBuffer_; + if (!waitPrepareBuffer) { + std::weak_ptr wp = waitPrepareBuffer_; + GraphicService::GetInstance()->PostGraphicEvent([this, wp]() { + if (!wp.expired()) { + PrepareBuffers(); + *waitPrepareBuffer_ = false; + } + }); + *waitPrepareBuffer_ = true; + GRAPHIC_LOGE("Post PrepareBuffers Event. BufferCount: %d, QueueSize: %d.", bufferCount_, queueSize_); + } else { + GRAPHIC_LOGW("Waiting Preparing buffer!"); } + res = false; goto END; } if (wait) { @@ -119,9 +141,13 @@ END: BufferItem* LiteSurface::GetBufferItem(const SurfaceBuffer* buffer) { + if (buffer == nullptr) { + return nullptr; + } + ListNode* cur = buffers_.Head(); while (cur != buffers_.End()) { - if (cur->data_->buffer->addr == buffer->addr) { + if ((cur->data_->buffer == buffer) && (cur->data_->buffer->addr == buffer->addr)) { return cur->data_; } cur = cur->next_; @@ -240,9 +266,12 @@ SurfaceBuffer* LiteSurface::AcquireBuffer() SurfaceBuffer* surfaceBuffer = dirtyList_.Front(); dirtyList_.PopFront(); BufferItem* bufferItem = GetBufferItem(surfaceBuffer); - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_ACQUIRE; + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Acquired buffer is invalid: %p", surfaceBuffer); + lock_.Unlock(); + return nullptr; } + bufferItem->state = BufferState::BUFFER_STATE_ACQUIRE; lock_.Unlock(); return surfaceBuffer; } @@ -253,30 +282,30 @@ SurfaceBuffer* LiteSurface::AcquireBuffer() bool LiteSurface::ReleaseBuffer(SurfaceBuffer* buffer) { lock_.Lock(); - if (buffer != nullptr) { - freeList_.PushBack(buffer); - BufferItem* bufferItem = GetBufferItem(buffer); - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_RELEASE; - } - cond_.Signal(); + BufferItem* bufferItem = GetBufferItem(buffer); + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Release invalid buffer: %p", buffer); lock_.Unlock(); - return true; + return false; } + bufferItem->state = BufferState::BUFFER_STATE_RELEASE; + freeList_.PushBack(buffer); cond_.Signal(); lock_.Unlock(); - return false; + return true; } int32_t LiteSurface::FlushBuffer(SurfaceBuffer* buffer) { lock_.Lock(); - dirtyList_.PushBack(buffer); - BufferItem* bufferItem = GetBufferItem(buffer); - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_FLUSH; + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Flush invalid buffer: %p", buffer); + lock_.Unlock(); + return -1; } + bufferItem->state = BufferState::BUFFER_STATE_FLUSH; + dirtyList_.PushBack(buffer); if (consumerListener_ != nullptr) { consumerListener_->OnBufferAvailable(); } @@ -302,10 +331,12 @@ SurfaceBuffer* LiteSurface::RequestBuffer(uint8_t wait) freeList_.PopFront(); BufferItem* bufferItem = GetBufferItem(buffer); - - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_REQUEST; + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Requested buffer is invalid: %p", buffer); + lock_.Unlock(); + return nullptr; } + bufferItem->state = BufferState::BUFFER_STATE_REQUEST; lock_.Unlock(); return buffer; } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp index bcc9a3636..218847319 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp @@ -115,6 +115,8 @@ bool UICustomHexagonsList::OnRotateStartEvent(const RotateEvent& event) rotateCenterIndexInNormal_ = static_cast(focusIndex); } } + SetTouchable(false); + SetDraggable(false); return UIView::OnRotateStartEvent(event); } @@ -186,6 +188,8 @@ bool UICustomHexagonsList::OnRotateEndEvent(const RotateEvent& event) SetReboundMode(ReboundMode::CENTER_IMG_ON_SCR_CENTER); } + SetTouchable(true); + SetDraggable(true); return UIView::OnRotateEndEvent(event); } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp index b1aba5c57..c474a8840 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp @@ -50,14 +50,7 @@ UILiteSurfaceView::~UILiteSurfaceView() DisplayDev::GetInstance()->CloseLayer(LAYER_1); DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, false); } - if (lastFlushedBuffer_ != nullptr) { - surface_->ReleaseBuffer(lastFlushedBuffer_); - lastFlushedBuffer_ = nullptr; - } - if (currentBuffer_ != nullptr) { - surface_->ReleaseBuffer(currentBuffer_); - currentBuffer_ = nullptr; - } + surface_->UnregisterConsumerListener(); LiteMGfxEngine::GetInstance()->ClearHardwareLayer(this); GraphicService::GetInstance()->PostGraphicEvent([] { @@ -249,6 +242,7 @@ void UILiteSurfaceView::BlitBitmapToFb(BufferInfo& gfxDstBuffer, const Rect& inv BlendOption blendOption; #if UIKIT_SKIP_LINE blendOption.transMap.Scale(Vector2{2.0, 2.0}, Vector2{0, 0}); // 2.0: scale 2 + blendOption.transMap.Translate(Vector2(GetRect().GetX(), GetRect().GetY())); #endif blendOption.opacity = OPA_OPAQUE; blendOption.mode = BLEND_SRC_OVER; @@ -306,13 +300,12 @@ void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidated style.bgColor_ = colorKey_; } - if (!(layerRect_ == GetRect())) { - layerRect_ = GetRect(); - AdjustArea(layerRect_); - Rect dirtyRect(0, 0, layerRect_.GetWidth() - 1, layerRect_.GetHeight() - 1); - DisplayDev::GetInstance()->SetLayerPositon(LAYER_1, layerRect_.GetX(), layerRect_.GetY()); - DisplayDev::GetInstance()->SetLayerDirtyRegion(LAYER_1, dirtyRect); - } + layerRect_ = GetRect(); + AdjustArea(layerRect_); + Rect dirtyRect(0, 0, layerRect_.GetWidth() - 1, layerRect_.GetHeight() - 1); + DisplayDev::GetInstance()->SetLayerPositon(LAYER_1, layerRect_.GetX(), layerRect_.GetY()); + DisplayDev::GetInstance()->SetLayerDirtyRegion(LAYER_1, dirtyRect); + BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, style, OPA_OPAQUE); } @@ -386,4 +379,19 @@ void UILiteSurfaceView::DumpImgInfo() PrintImgInfo(info); } } + +std::string UILiteSurfaceView::GetGuiInfo() const +{ + const int len = 256; + char *buf = new (std::nothrow) char[len]; + if (buf == nullptr) { + return std::string(""); + } + memset_s(buf, len, 0, len); + sprintf_s(buf, len, "stopped %d layerinit %d flushCnt %u lastbuf %p curbuf %p colorKey %x preView %p", + isStopped_, isLayerInit_, flushCount_, lastFlushedBuffer_, currentBuffer_, colorKey_.full, preView_); + std::string str(buf); + delete []buf; + return str; +} } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp index 1e487d13d..ce7ded250 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp @@ -225,6 +225,7 @@ void UISweepClock::CalculateRedrawArea(const Rect& current, Hand& hand, bool clo int16_t right = left + hand.width_ - 1; int16_t top = hand.position_.y + current.GetTop(); int16_t bottom = top + hand.height_ - 1; + int16_t compensationDistance = hand.width_ / 2; Rect handRect(left, top, right, bottom); TransformMap backwardMap(handRect); Vector2 pivot; @@ -240,6 +241,8 @@ void UISweepClock::CalculateRedrawArea(const Rect& current, Hand& hand, bool clo if (!clockInit) { /* Prevent old images from being residued */ redraw.Join(redraw, hand.target_); + redraw.SetRect(redraw.GetLeft() - compensationDistance, redraw.GetTop() - compensationDistance, + redraw.GetRight() + compensationDistance, redraw.GetBottom() + compensationDistance); InvalidateRect(redraw); } } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h index 8c23ed21e..8939b4183 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h @@ -75,16 +75,6 @@ public: */ void SwipeStart(void); - /* * - * @brief Get state of scroll animator. - * @since 1.0 - * @version 1.0 - */ - uint8_t GetScrollState() - { - return scrollAnimator_.GetState(); - } - private: bool enableScreenCap_ = false; CardSwipe* swipeCallback_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ver_swipe_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ver_swipe_view.h new file mode 100644 index 000000000..cbea964b6 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ver_swipe_view.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: VerSwipeView + * Author: + * Create: 2024-11 + */ + +#ifndef UI_VER_SWIPE_VIEW_H +#define UI_VER_SWIPE_VIEW_H +#include "components/ui_swipe_view.h" + +namespace OHOS { +class VerSwipeView : public UISwipeView { +public: + /** + * @brief Represents a listener for moving children. + * + * This is an inner class of VerSwipeView. + * It contains a callback function to be invoked when the swipe view moves children. + * + * @since 1.0 + * @version 1.0 + */ + class OnMoveChildListener : public HeapBase { + public: + OnMoveChildListener() {} + virtual ~OnMoveChildListener() {} + virtual void OnMoveChild(UISwipeView& view, int16_t xOffset, int16_t yOffset) = 0; + }; + + /* * + * @brief A constructor used to create the VerSwipeView instance. + * @since 1.0 + * @version 1.0 + */ + VerSwipeView() {} + + /* * + * @brief A destructor used to delete the VerSwipeView instance. + * @since 1.0 + * @version 1.0 + */ + ~VerSwipeView() override {} + + /** + * @brief Obtains the listener set for moving child event. + * + * @return Returns the move child listener. + * @since 1.0 + * @version 1.0 + */ + OnMoveChildListener*& GetOnMoveChildListener() + { + return onMoveChildListener_; + } + + /** + * @brief Sets the listener that contains a callback to be invoked upon moving child. + * + * @param onMoveChildListener Indicates the listener to set. + * @since 1.0 + * @version 1.0 + */ + void SetOnMoveChildListener(OnMoveChildListener* onMoveChildListener) + { + onMoveChildListener_ = onMoveChildListener; + } + +protected: + void MoveChildByOffset(int16_t xOffset, int16_t yOffset) override + { + UISwipeView::MoveChildByOffset(xOffset, yOffset); + if (onMoveChildListener_ != nullptr) { + onMoveChildListener_->OnMoveChild(*this, xOffset, yOffset); + } + } + +private: + OnMoveChildListener* onMoveChildListener_ = nullptr; +}; +} +#endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dock/lite_key_device.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dock/lite_key_device.cpp index 0871cd669..7860c0fc8 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dock/lite_key_device.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dock/lite_key_device.cpp @@ -17,6 +17,10 @@ #include "components/root_view.h" #include "gfx_utils/input_event_info.h" #include "lite_input_distributer.h" +#ifdef SUPPORT_AT_OHOSFWK +#include "graphic_service.h" +#include "modules/keyinput/keyinput.h" +#endif namespace OHOS { bool LiteKeyDevice::Read(DeviceData& data) @@ -32,6 +36,11 @@ void LiteKeyDevice::DispatchEvent(const DeviceData& data) } KeyEvent event({data.keyId, data.state}); RootView::GetInstance()->OnKeyEvent(event); +#ifdef SUPPORT_AT_OHOSFWK + if (!GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::ACELite::KeyListener::GetInstance()->OnKeyEvent(event); + } +#endif } bool LiteKeyDevice::IsEventEmpty() diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h index ddd3c8a52..956c131dc 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h @@ -45,6 +45,8 @@ public: uint8_t* GetCacheData(uint8_t fontId, uint32_t unicode); + bool TryToFreeFontCache(); + private: struct FontInfo { uint8_t fontId; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h index 4f015d8c6..74f8be7de 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h @@ -45,6 +45,8 @@ public: pointData_.PushBack(data); } + bool TryToFreeFontCache() override; + private: float size_ = 0; UIFontHWCache* pathCache_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp index 5b29de28b..c40188782 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp @@ -431,10 +431,6 @@ void DisplayDev::SetLayerPositon(uint8_t layerId, int16_t x, int16_t y) return; } - if (layer_[layerId].pos.x == x && layer_[layerId].pos.y == y) { - return; - } - layer_[layerId].pos.x = x; layer_[layerId].pos.y = y; if (layerFuncs_->SetLayerSize != nullptr) { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp index 084dfed50..aca7b257a 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp @@ -21,6 +21,7 @@ #include "gfx_utils/graphic_log.h" #include "securec.h" #include "common/image_cache_manager.h" +#include "font/ui_font.h" #include "hals/gralloc_engines.h" namespace OHOS { @@ -37,6 +38,11 @@ static bool TryToFreeImage() return ImageCacheManager::GetInstance().TryToFreeImage(); } +static bool TryToFreeFontCache() +{ + return UIFont::GetInstance()->TryToFreeFontCache(); +} + bool GrallocEngines::Init() { if (grallocFuncs_ != nullptr) { @@ -47,6 +53,7 @@ bool GrallocEngines::Init() return false; } grallocFuncs_->RegisterTryToFreeImgCallback(TryToFreeImage); + grallocFuncs_->RegisterTryToFreeFontCacheCallback(TryToFreeFontCache); return true; } @@ -64,6 +71,7 @@ bool GrallocEngines::AllocBuffer(const AllocInfo& info, GrallocBuffer& buffer) #endif #ifdef __LITEOS__ OsMemInfoPrint(reinterpret_cast(MEM_POOL_UI_OTHER)); + OsMemInfoPrint(reinterpret_cast(MEM_POOL_UI_FONT)); #endif return false; } @@ -118,7 +126,7 @@ void GrallocEngines::FreeBuffer(uint8_t* virAddr) } #if ENABLE_MEMORY_CHECK -void GrallocEngines::DumpMem() +void GrallocEngines::DumpMem(bool dumpDetails) { int32_t fontCacheSize = 0; int32_t imageCacheSize = 0; @@ -128,6 +136,7 @@ void GrallocEngines::DumpMem() int32_t yuvCacheSize = 0; int32_t fontCount = 0; int32_t fontMax = 0; + int32_t pathCnt = 0; printf("current gralloc allocate memory:\n"); for (auto it : g_buffers) { if ((it.second->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) { @@ -140,42 +149,57 @@ void GrallocEngines::DumpMem() } if (it.second->usage == HBM_USE_ASSIGN_SIZE) { imageCacheSize += it.second->size; - printf(" image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_MULTI_IMG) == HBM_USE_MEM_MULTI_IMG) { imageCacheSize += it.second->size; - printf(" multi image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" multi image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH) { pathCacheSize += it.second->size; - printf(" path addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" path addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } + pathCnt++; continue; } if ((it.second->usage & HBM_USE_MEM_FB) == HBM_USE_MEM_FB) { fbSize += it.second->size; - printf(" fb addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" fb addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_BUFMAP) == HBM_USE_MEM_BUFMAP) { mapBufferSize += it.second->size; - printf(" mapbuffer addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" mapbuffer addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_YUV) == HBM_USE_MEM_YUV) { - printf(" yuv addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); yuvCacheSize += it.second->size; + if (dumpDetails) { + printf(" yuv addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_JPEG_DATA) == HBM_USE_MEM_JPEG_DATA) { - printf(" jpeg addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); yuvCacheSize += it.second->size; + if (dumpDetails) { + printf(" jpeg addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } } - printf("total size: font %d (count: %d, max: %d), image %d, path %d, fb %d, mapbuffer:%d, yuv %d\n", - fontCacheSize, fontCount, fontMax, imageCacheSize, pathCacheSize, fbSize, mapBufferSize, yuvCacheSize); + printf("total size: font %d (count: %d, max: %d), image %d, path %d (count: %d), fb %d, mapbuffer:%d, yuv %d\n", + fontCacheSize, fontCount, fontMax, imageCacheSize, pathCacheSize, pathCnt, fbSize, mapBufferSize, yuvCacheSize); } void GrallocEngines::SetMemMonitor(bool enable) diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h index 138bad1b5..e83c50691 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h @@ -42,7 +42,7 @@ public: bool AllocBufferOnce(const AllocInfo& info, GrallocBuffer& buffer); void FreeBuffer(uint8_t* virAddr); #if ENABLE_MEMORY_CHECK - void DumpMem(); + void DumpMem(bool dumpDetails = false); void SetMemMonitor(bool enable); #endif private: diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp index e23737aa3..a4d3de698 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp @@ -74,7 +74,6 @@ void UITestCoverflow2::TearDown() coverflow_ = nullptr; } lastIndex_ = 0; - lastPage_ = nullptr; addImage_ = nullptr; if (label_ != nullptr) { delete label_; @@ -124,7 +123,6 @@ void UITestCoverflow2::UITestCoverflow2001() imageSub->SetTouchable(true); imageSub->SetOnClickListener(this); coverflow_->Add(page); - lastPage_ = page; } CreateAddButton(); CreateTitleLabel(); @@ -186,8 +184,7 @@ bool UITestCoverflow2::OnClick(UIView& view, const ClickEvent& event) imageSub->SetSrc(src); imageSub->SetTouchable(true); imageSub->SetOnClickListener(this); - coverflow_->Insert(lastPage_, page); - lastPage_ = page; + coverflow_->Insert(nullptr, page); } else { UITransformGroup* page = dynamic_cast(view.GetParent()); UIView* child = page->GetChildrenHead(); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h index 6cb1d9051..0b4bc1804 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h @@ -48,7 +48,6 @@ private: UILabel* label_ = nullptr; UIImageView* addImage_ = nullptr; uint16_t lastIndex_ = 0; - UITransformGroup* lastPage_ = nullptr; }; } // namespace OHOS #endif // UI_TEST_COVERFLOW_VIEW_2_H diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.cpp index eb7936847..836bba03b 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.cpp @@ -206,10 +206,8 @@ bool UITestSlipflow::OnScroll(int16_t distance) minOffset = distance; } } - if (newCenterIndex != lastIndex_) { - lastIndex_ = newCenterIndex; - label_->SetText(slipflow_->GetViewByIndex(lastIndex_)->GetViewId()); - } + lastIndex_ = newCenterIndex; + label_->SetText(slipflow_->GetViewByIndex(lastIndex_)->GetViewId()); Rect curViewRect = slipflow_->GetViewByIndex(lastIndex_)->GetOrigRect(); int16_t centerMid = curViewRect.GetLeft() + curViewRect.GetWidth() / DIVISOR_TWO; diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp index ec59ffcc8..f81ece011 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp @@ -69,6 +69,9 @@ UIView::UIView() UIView::~UIView() { +#if ENABLE_ROTATE_INPUT + ClearFocus(); +#endif ClearBackgroundBlur(); if (parent_ != nullptr) { GRAPHIC_LOGE("UIView::~UIView failed, parent is not nullptr! Need to remove from parent component first"); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp index 090a2bdd9..7480c6d99 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp @@ -19,6 +19,7 @@ #include "components/root_view.h" #include "gfx_utils/graphic_log.h" +#include "gfx_utils/vector.h" namespace OHOS { UIViewGroup::UIViewGroup() @@ -239,6 +240,35 @@ void UIViewGroup::GetTargetView(const Point& point, UIView** last) } } +static void CalculatedHexagonalRegion(Polygon polygon, Graphic::Vector& vertexes) +{ + vertexes.PushBack({(polygon[0].x_ + polygon[1].x_) / 2, (polygon[0].y_ + polygon[1].y_) / 2}); + vertexes.PushBack({polygon[1].x_ + (polygon[2].x_ - polygon[1].x_) * 1 / 3, + polygon[1].y_ + (polygon[2].y_ - polygon[1].y_) * 1 / 3}); + vertexes.PushBack({polygon[1].x_ + (polygon[2].x_ - polygon[1].x_) * 2 / 3, + polygon[1].y_ + (polygon[2].y_ - polygon[1].y_) * 2 / 3}); + vertexes.PushBack({(polygon[2].x_ + polygon[3].x_) / 2, (polygon[2].y_ + polygon[3].y_) / 2}); + vertexes.PushBack({polygon[3].x_ + (polygon[0].x_ - polygon[3].x_) * 1 / 3, + polygon[3].y_ + (polygon[0].y_ - polygon[3].y_) * 1 / 3}); + vertexes.PushBack({polygon[3].x_ + (polygon[0].x_ - polygon[3].x_) * 2 / 3, + polygon[3].y_ + (polygon[0].y_ - polygon[3].y_) * 2 / 3}); +} +static bool CalculatedPointInRegion(Point point, Graphic::Vector& vertexes) +{ + bool isInPolygon = false; + int j = 0; + for (int i = 0; i < vertexes.Size(); i++) { + int16_t sx = vertexes[i].x; + int16_t sy = vertexes[i].y; + j = (i + 1) % vertexes.Size(); + int16_t tx = vertexes[j].x; + int16_t ty = vertexes[j].y; + if (((point.y > sy) && (point.y <= ty)) || ((point.y > ty) && (point.y <= sy))) { + isInPolygon ^= (sx + (tx - sx) * (point.y - sy) / (ty - sy) > point.x); + } + } + return isInPolygon; +} void UIViewGroup::GetTargetView(const Point& point, UIView** current, UIView** target) { if ((current == nullptr) || (target == nullptr)) { @@ -269,7 +299,15 @@ void UIViewGroup::GetTargetView(const Point& point, UIView** current, UIView** t if (!view->IsViewGroup()) { rect = view->GetRect(); if (rect.IsContains(point)) { + bool isInPolygon = true; + if (view->GetParent()->GetViewType() == UI_ICOSAHEDRON_VIEW) { + Graphic::Vector vertex(6); // 6: point number + CalculatedHexagonalRegion(view->GetTransformMap().GetPolygon(), vertex); + isInPolygon = CalculatedPointInRegion(point, vertex); + } + if (isInPolygon) { view->GetTargetView(point, current, target); + } } } else { UIViewGroup* viewGroup = static_cast(view); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp index 21175a255..81cf6344f 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp @@ -12,9 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "dock/rotate_input_device.h" #include "dock/focus_manager.h" +#ifdef SUPPORT_AT_OHOSFWK +#include "graphic_service.h" +#include "modules/keyinput/keyinput.h" +#endif #if ENABLE_ROTATE_INPUT namespace { @@ -23,12 +26,13 @@ constexpr int16_t ROTATE_INPUT_THRESHOLD = 1; #else constexpr int16_t ROTATE_INPUT_THRESHOLD = 10; #endif -} +} // namespace namespace OHOS { -RotateInputDevice::RotateInputDevice() : rotateStart_(false), threshold_(ROTATE_INPUT_THRESHOLD), cachedRotation_(0) {} +RotateInputDevice::RotateInputDevice() : rotateStart_(false), threshold_(ROTATE_INPUT_THRESHOLD), cachedRotation_(0) +{} -void RotateInputDevice::DispatchEvent(const DeviceData& data) +void RotateInputDevice::DispatchEvent(const DeviceData &data) { bool cachedToRotate = false; if (data.rotate == 0 || rotateStart_) { @@ -44,34 +48,47 @@ void RotateInputDevice::DispatchEvent(const DeviceData& data) return; } - UIView* view = FocusManager::GetInstance()->GetFocusedView(); - if (view == nullptr) { - return; +#ifdef SUPPORT_AT_OHOSFWK + if (data.rotate != 0) { + if (!GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::ACELite::RotateListener::GetInstance()->OnRotateEvent(data.rotate); + } } +#endif - UIView* par = view; - while (par->GetParent() != nullptr) { - if (!par->IsVisible()) { + UIView *view = FocusManager::GetInstance()->GetFocusedView(); + if (view != nullptr) { + UIView *par = view; + while (par->GetParent() != nullptr) { + if (!par->IsVisible()) { + return; + } + par = par->GetParent(); + } + if (par->GetViewType() != UI_ROOT_VIEW) { return; } - par = par->GetParent(); - } - if (par->GetViewType() != UI_ROOT_VIEW) { - return; } if (MATH_ABS(data.rotate) < threshold_ && !rotateStart_ && !cachedToRotate) { return; } if (data.rotate == 0 && rotateStart_) { - view->OnRotateEndEvent(0); + if (view != nullptr) { + view->OnRotateEndEvent(0); + } rotateStart_ = false; return; } if (!rotateStart_) { - view->OnRotateStartEvent(data.rotate); + if (view != nullptr) { + view->OnRotateStartEvent(data.rotate); + } + } + if (view != nullptr) { + view->OnRotateEvent(data.rotate); } - view->OnRotateEvent(data.rotate); + rotateStart_ = true; } -} // namespace OHOS +} // namespace OHOS #endif diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font.cpp index 1736ccb8d..b9da9649b 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font.cpp @@ -72,6 +72,14 @@ void UIFont::SetFont(BaseFont* font) } } +bool UIFont::TryToFreeFontCache() +{ + if (instance_ == nullptr) { + return false; + } + return instance_->TryToFreeFontCache(); +} + bool UIFont::GetGlyphPathData(uint32_t unicode, uint8_t shapingFont, GlyphPathData& data) { bool ret = false; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h index 87fcdeb34..c532a50fc 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h @@ -348,6 +348,18 @@ public: } } + void ClearBlurView(UIView* view) + { + if (blurView_ == view) { + blurView_ = nullptr; + } + } + + UIView* GetBlurView() + { + return blurView_; + } + void SetSnapshotFlag(bool flag) { isSnapshot_ = flag; @@ -358,13 +370,6 @@ public: return isSnapshot_; } - void ClearBlurView(UIView* view) - { - if (blurView_ == view) { - blurView_ = nullptr; - } - } - void Add(UIView* view) override { appView_.Add(view); diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h index 56a67f3c1..537350663 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h @@ -88,6 +88,11 @@ public: return false; } + virtual bool TryToFreeFontCache() + { + return false; + } + /** * @brief Get bitmap for specific unicode * diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h index f612a96af..a00a9882b 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h @@ -143,6 +143,12 @@ public: */ bool GetGlyphPathData(uint32_t unicode, uint8_t shapingFont, GlyphPathData& data); + /** + * @brief Try to free mem used for font cache by LRU rule. This is only applicable for UIFontHWVector. + * + */ + bool TryToFreeFontCache(); + /** * @brief Get bitmap for specific unicode * diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/CMakeLists.txt b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/CMakeLists.txt new file mode 100644 index 000000000..d41c771e0 --- /dev/null +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/CMakeLists.txt @@ -0,0 +1,70 @@ +#=============================================================================== +# @brief cmake file +# Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. +#=============================================================================== + +enable_language(CXX) + +set(COMPONENT_NAME "js_audio_capturer") + +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/recording_module.cpp +) + +set(PUBLIC_HEADER + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../utils/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../interfaces/kits + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworks/buffersource/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworks/player_control/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworks/player_control/decoder + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworks/player_control/player + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworks/player_control/sink + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworks/player_control/source + ${ROOTDIR}/middleware/services/media/foundation/audiomanager/interfaces/kits/audiomanager + ${ROOTDIR}/middleware/services/media/foundation/audiomanager/interfaces/kits/audiocommon + ${ROOTDIR}/middleware/services/media/foundation/audiomanager/audioservice/include + ${ROOTDIR}/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include + ${ROOTDIR}/middleware/services/media/foundation/audiomanager/frameworks/audioutils/include + ${ROOTDIR}/open_source/openharmony/drivers/peripheral/format/interfaces/include + ${ROOTDIR}/middleware/services/gui/uikit/surface/interfaces/kits + ${ROOTDIR}/middleware/services/gui/uikit/utils/interfaces/kits + ${ROOTDIR}/open_source/openharmony/drivers/peripheral/codec/interfaces/include + ${ROOTDIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include + ${ROOTDIR}/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits + ##${ROOTDIR}/middleware/services/media/foundation/sample +) + +set(CCDEFINES ${CCDEFINES} "_GNU_SOURCE" "_XOPEN_SOURCE=700" "UNSUPPORT_AUDIO_DECODER") +set(PRIVATE_DEFINES + ${CCDEFINES} +) + +set(PUBLIC_DEFINES +) + +# use this when you want to add ccflags like -include xxx +set(COMPONENT_PUBLIC_CCFLAGS +) + +set(COMPONENT_FLAGS ${ccflags}) +list(REMOVE_ITEM COMPONENT_FLAGS -std=gnu99 -std=c99 -std=gnu11 -std=c11) +list(APPEND COMPONENT_FLAGS -std=c++11 -Wno-unused-parameter -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-undef -Wno-bitwise-op-parentheses -Wno-shift-op-parentheses -nostdlibinc -Wno-typedef-redefinition) +set(COMPONENT_CCFLAGS + ${COMPONENT_FLAGS} +) + +set(WHOLE_LINK + true +) + +set(MAIN_COMPONENT + false +) + +set(LIBRARY_OUTPUT_PATH ${BIN_DIR}/${CHIP}/libs/media/${BOARD}_${APPLICATION}) + +build_component() diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp new file mode 100644 index 000000000..0bf6663a7 --- /dev/null +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp @@ -0,0 +1,490 @@ +/* +* Copyright (c) CompanyNameMagicTag. 2021-2021. All rights reserved. +* Description: audio capture wrapper +* Author: Media Software Group +* Create: 2021-09-13 +*/ + +#include "recording_module.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef SUPPORT_SYS_PRCTL +#include +#endif +#include +#include +#include "securec.h" +#include "media_errors.h" +#include "audio_manager.h" +#include "media_log.h" +#include "media_thread_adapt.h" +#include "msg_center_protocol.h" +#include "cmsis_os2.h" +#include "audio_capturer.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +using namespace OHOS::Media; +using namespace OHOS::Audio; +using namespace::Audio; +using Audio::InterruptListener; +using Audio::AudioInterrupt; +using Audio::AudioManager; +#define PLAYER_CONTROL_CMD_LEN 20 +#define READ_RETRY_TIME_US 10000 +#define READ_COUNT_MAX 1000 +#define GET_AUDIO_TIME_INTERVAL_TIMES 100 +#define MAX_ARGC 5 +#define PATH_STR_SIZE 64 + +typedef struct { + size_t framesize; + uint8_t *buffer; + AudioCapturer *audioCap; + AudioCodecFormat audioFormat; + bool bThreadRun; +} AudioSourceInput; + +struct NameAudioFormat { + std::string name; + AudioCodecFormat audioFormat; +}; + +typedef struct TagTestSample { + char control[PLAYER_CONTROL_CMD_LEN]; + bool needStop; + AudioInterrupt interrupt; + MediaThreadIdHandle audioCaptureProcess; +} TestSample; + +struct SampleAudioCapturerInfo { + /** Audio source type */ + AudioSourceType inputSource = AUDIO_MIC; + /** Audio codec format */ + AudioCodecFormat audioFormat = AUDIO_DEFAULT; + /** Sampling rate */ + int32_t sampleRate = 0; + /** Number of audio channels */ + int32_t channelCount = 0; + /** Bit rate */ + int32_t bitRate = 0; + /** Audio stream type */ + AudioStreamType streamType = TYPE_MEDIA; + /** Bit width */ + AudioBitWidth bitWidth = BIT_WIDTH_16; + /** Session id */ + AudioSession sessionID = AUDIO_SESSION_ID_NONE; +}; + +static bool g_interruptHintStop = false; +static std::shared_ptr g_audioCap; +static NameAudioFormat g_audioCodecFormat[] = { + {"mp3", MP3}, + {"ape", APE}, + {"msbc", mSBC}, + {"vorbis", VORBIS}, + {"flac", FLAC}, + {"opus", OPUS}, + {"g726", G726}, + {"g711u", G711U}, + {"g711a", G711A}, + {"aaceld", AAC_ELD}, + {"silk", SILK}, + {"pcm", PCM} +}; + +class CaptureInterruptListener : public InterruptListener { +public: + CaptureInterruptListener() {}; + ~CaptureInterruptListener() override {}; + + void OnInterrupt(int32_t type, int32_t hint) override + { + MEDIA_INFO_LOG("CaptureInterruptListener OnInterrupt, type:%d, hint:%d", type, hint); + + if (type == INTERRUPT_TYPE_BEGIN && hint == INTERRUPT_HINT_PAUSE) { + MEDIA_INFO_LOG("OnInterrupt pause not supported"); + } + if (type == INTERRUPT_TYPE_END && hint == INTERRUPT_HINT_RESUME) { + MEDIA_INFO_LOG("OnInterrupt resume not supported"); + } + if (type == INTERRUPT_TYPE_BEGIN && hint == INTERRUPT_HINT_STOP) { + g_interruptHintStop = true; + } + if (type == INTERRUPT_TYPE_END && hint == INTERRUPT_HINT_STOP) { + MEDIA_INFO_LOG("OnInterrupt stop not supported"); + } + } +}; + +static AudioSourceInput g_audioSourceProcessInput; +static AudioManager& g_amInstance = AudioManager::GetInstance(); +static TestSample g_sample; +static std::shared_ptr g_captureInterruptListener; +extern osMessageQueueId_t g_pcm_stream_msg_queue_id; + +static void* AudioCaptureProcess(void* arg) +{ + int32_t readCnt = 0; + Timestamp timeStamp; + g_audioSourceProcessInput.bThreadRun = true; + pcm_stream_queue_msg msg = {MSGCENTER_TYPE_ID_XIAODU_SEND_PCM_STREAM, NULL, 0}; + while (!g_sample.needStop && !g_interruptHintStop) { + int32_t ret = g_audioCap->Read(g_audioSourceProcessInput.buffer, g_audioSourceProcessInput.framesize, false); + if (ret == -1) { + MEDIA_ERR_LOG("audioCap Read failed:0x%x", ret); + continue; + } + if (ret == ERR_RETRY_READ) { + usleep(READ_RETRY_TIME_US); + continue; + } + + if (ret == 0) { + continue; + } + msg.len = ret; + msg.data = (uint8_t *)malloc(msg.len); /* 消费者释放内存 */ + if (msg.data == NULL) { + MEDIA_ERR_LOG("malloc fail. len = %d", msg.len); + break; + } + (void)memcpy_s(msg.data, msg.len, g_audioSourceProcessInput.buffer, msg.len); + + errcode_t res = osMessageQueuePut(g_pcm_stream_msg_queue_id, &msg, 0, 0); + if (res != osOK) { + MEDIA_ERR_LOG("put pcm stream fail, len = %d, res = 0x%x", msg.len, res); + break; + } + + readCnt++; + if (readCnt % GET_AUDIO_TIME_INTERVAL_TIMES == 0) { + if (g_audioCap->GetAudioTime(timeStamp, Timestamp::Timebase::MONOTONIC)) { + MEDIA_INFO_LOG("read %d frames timestamp seconds:%ld, nanoseconds:%ld", + readCnt, timeStamp.time.tv_sec, timeStamp.time.tv_nsec); + } + } + MEDIA_INFO_LOG("audioCap Read readCnt = %d, size = %d", readCnt, ret); + } + + if (!g_audioCap->Stop()) { + MEDIA_ERR_LOG("Stop failed"); + } + if (!g_audioCap->Release()) { + MEDIA_ERR_LOG("Release failed"); + } + + delete g_audioSourceProcessInput.buffer; + g_audioSourceProcessInput.buffer = nullptr; + + if (g_amInstance.DeactivateAudioInterrupt(g_sample.interrupt) != 0) { + MEDIA_ERR_LOG("deactivate audio interrupt failed"); + } + g_audioCap.reset(); + g_audioSourceProcessInput.bThreadRun = false; + MEDIA_INFO_LOG("AudioCaptureProcess end"); + return NULL; +} + +static void AudioCaptureGetFormat(const char **argv, AudioCodecFormat &audioFormat) +{ + char formatType[10]; + if (strncpy_s(formatType, sizeof(formatType), argv[0x1], strlen(argv[0x1])) != 0) { + MEDIA_ERR_LOG("strncpy_s failed"); + } + std::string inputFormat = formatType; + for (size_t i = 0; i < (sizeof(g_audioCodecFormat) / sizeof(g_audioCodecFormat[0])); i++) { + if (inputFormat == g_audioCodecFormat[i].name) { + audioFormat = g_audioCodecFormat[i].audioFormat; + MEDIA_INFO_LOG("[AudioCaptureSample] set audioFormat %s", g_audioCodecFormat[i].name.c_str()); + } + } +} + +static int32_t AudioCaptureGetInfo(const char **argv, SampleAudioCapturerInfo &audioCapturerInfo, std::string &filePath) +{ + AudioCaptureGetFormat(argv, audioCapturerInfo.audioFormat); + audioCapturerInfo.sampleRate = atoi(argv[0x2]); /* 2: samplerate */ + MEDIA_INFO_LOG("set capture parameter sampleRate:%d", audioCapturerInfo.sampleRate); + audioCapturerInfo.channelCount = atoi(argv[0x3]); /* 3: channel */ + MEDIA_INFO_LOG("set capture parameter channel:%d", audioCapturerInfo.channelCount); + audioCapturerInfo.bitWidth = (AudioBitWidth)atoi(argv[0x4]); /* 4: bitWidth */ + MEDIA_INFO_LOG("set capture parameter bitWidth:%d", audioCapturerInfo.bitWidth); + MEDIA_INFO_LOG("input argv[5]:%s.", argv[5]); /* 5: filePath */ + + if (strlen(argv[0x5]) < PATH_MAX) { + filePath = argv[0x5]; + } else { + MEDIA_ERR_LOG("input path too long"); + return -1; + } + return 0; +} + +static int32_t HandleAudioCaptureCmd(int32_t argc, const char **argv) +{ + if (argc == 1 && argv[0] != nullptr) { + if (memcpy_s(g_sample.control, PLAYER_CONTROL_CMD_LEN, + argv[0], strlen(argv[0]) + 1) != EOK) { + MEDIA_ERR_LOG("memcpy_s failed"); + } + MEDIA_INFO_LOG("audio_capture argv[0]: %s.", argv[0]); + if ((strncmp(g_sample.control, "stop", strlen("stop")) == 0)) { + if (g_audioSourceProcessInput.bThreadRun) { + g_sample.needStop = true; + MEDIA_INFO_LOG("set g_sample.needStop:%d", g_sample.needStop); + MediaThreadJoin(&g_sample.audioCaptureProcess); + } else { + MEDIA_INFO_LOG("bThreadRun:%d no need stop", g_audioSourceProcessInput.bThreadRun); + } + MEDIA_INFO_LOG("stop command excute success"); + return 0; + } else if ((strncmp(g_sample.control, "mute", strlen("mute")) == 0)) { + MEDIA_INFO_LOG("mute detected call SetMicrophoneMute(true)"); + if (!g_amInstance.SetMicrophoneMute(true)) { + MEDIA_ERR_LOG("SetMicrophoneMute failed"); + } + if (!g_amInstance.IsMicrophoneMute()) { + MEDIA_ERR_LOG("IsMicrophoneMute return not true"); + } + MEDIA_INFO_LOG("mute cmd out"); + } else if ((strncmp(g_sample.control, "unmute", strlen("unmute")) == 0)) { + MEDIA_INFO_LOG("unmute detected call SetMicrophoneMute(false)"); + if (!g_amInstance.SetMicrophoneMute(false)) { + MEDIA_ERR_LOG("SetMicrophoneMute failed"); + } + if (g_amInstance.IsMicrophoneMute()) { + MEDIA_ERR_LOG("IsMicrophoneMute return not false"); + } + MEDIA_INFO_LOG("unmute cmd out"); + } else { + MEDIA_ERR_LOG("[AudioCaptureSample]control cmd not supported:%s do nothing", g_sample.control); + return 0; + } + } + return 0; +} + +static void ConvertCaptureInfo(AudioCapturerInfo &dts, const SampleAudioCapturerInfo &src) +{ + dts.inputSource = src.inputSource; + dts.audioFormat = src.audioFormat; + dts.sampleRate = src.sampleRate; + dts.channelCount = src.channelCount; + dts.streamType = src.streamType; + dts.bitWidth = src.bitWidth; + dts.sessionID = src.sessionID; +} + +static int32_t AudioCaptureSetInfo(SampleAudioCapturerInfo audioCapturerInfo) +{ + AudioCapturerInfo info = {}; + ConvertCaptureInfo(info, audioCapturerInfo); + if (g_audioCap->SetCapturerInfo(info) != 0) { + MEDIA_ERR_LOG("Can't SetCapturerInfo"); + return -1; + } + size_t frameCount = g_audioCap->GetFrameCount(); + if (!frameCount) { + MEDIA_ERR_LOG("Can't GetFrameCount"); + (void)g_audioCap->Release(); + return -1; + } + MEDIA_INFO_LOG("GetFrameCount:%d", frameCount); + g_audioSourceProcessInput.framesize = frameCount * info.channelCount * info.bitWidth / 8; /* 8: byte width */ + g_audioSourceProcessInput.buffer = new uint8_t[g_audioSourceProcessInput.framesize]; + if (g_audioSourceProcessInput.buffer == nullptr) { + (void)g_audioCap->Release(); + return -1; + } + if (!g_audioCap->Start()) { + MEDIA_ERR_LOG("Can't Start"); + delete g_audioSourceProcessInput.buffer; + g_audioSourceProcessInput.buffer = nullptr; + (void)g_audioCap->Release(); + return -1; + } + return 0; +} + +static int32_t ActivateAudioInterrupt(AudioSession &sessionId) +{ + g_amInstance = AudioManager::GetInstance(); + g_amInstance.Initialize(); + sessionId = g_amInstance.MakeSessionId(); + if (sessionId == AUDIO_SESSION_ID_NONE) { + MEDIA_ERR_LOG("session is none"); + return -1; + } + MEDIA_INFO_LOG("sessionId:%d", sessionId); + g_captureInterruptListener = std::make_shared(); + g_sample.interrupt = { AUDIO_STREAM_VOICE_ASSISTANT, sessionId, g_captureInterruptListener }; + + if (g_amInstance.ActivateAudioInterrupt(g_sample.interrupt) == INTERRUPT_FAILED) { + MEDIA_ERR_LOG("ActivateAudioInterrupt failed"); + return -1; + } + return 0; +} + + +static int32_t CheckInputParam(int32_t argc, const char **argv) +{ + if (argc != 0x6) { // must be 6 parameters + MEDIA_ERR_LOG("argc:%d is invalid, must be 6 parameters", argc); + return -1; + } + + return 0; +} + + +int MakeAudioDir(const char *dir) +{ + if (strlen(dir) >= PATH_STR_SIZE) { + return -1; + } + int i, len; + char str[PATH_STR_SIZE]; + if (strncpy_s(str, PATH_STR_SIZE, dir, strlen(dir)) != 0) { + MEDIA_ERR_LOG("copy path error"); + return -1; + } + len = strlen(str); + for (i = 0; i < len; i++) { + if (str[i] == '/') { + str[i] = '\0'; + if (access(str, F_OK) != 0) { + (void)mkdir(str, 0755); + } + str[i] = '/'; + } + } + if (len > 0 && access(str, F_OK) != 0) { + (void)mkdir(str, 0755); + } + return 0; +} + + + +int32_t AudioCaptureStart_sample(int32_t argc, const char **argv) +{ + errcode_t res; + for (int32_t i = 0; i < argc; i++) { + MEDIA_INFO_LOG("argv[%d]:%s", i, argv[i]); + } + int32_t ret = CheckInputParam(argc, argv); + if (ret != 0) { + return ret; + } + + std::string filePath = ""; + g_sample.needStop = false; + g_interruptHintStop = false; + SampleAudioCapturerInfo audioCapturerInfo = {}; + + ret = AudioCaptureGetInfo(argv, audioCapturerInfo, filePath); + if (ret != 0) { + return ret; + } + + AudioSession sessionId = AUDIO_SESSION_ID_NONE; + ret = ActivateAudioInterrupt(sessionId); + if (ret != 0) { + return ret; + } + g_audioCap = std::make_shared(); + if (g_audioCap == nullptr || g_audioCap.get() == nullptr) { + MEDIA_ERR_LOG("audio capture is nullptr"); + (void)g_amInstance.DeactivateAudioInterrupt(g_sample.interrupt); + return -1; + } + + ret = MakeAudioDir("/user/log/xiaodu"); + if (ret != 0) { + MEDIA_ERR_LOG("dir path is invalid"); + return -1; + } + + audioCapturerInfo.sessionID = sessionId; + audioCapturerInfo.inputSource = AUDIO_MIC; + audioCapturerInfo.streamType = AUDIO_STREAM_VOICE_ASSISTANT; + ret = AudioCaptureSetInfo(audioCapturerInfo); + if (ret != 0) { + g_audioCap.reset(); + (void)g_amInstance.DeactivateAudioInterrupt(g_sample.interrupt); + return ret; + } + + /* send record start */ + res = msg_center_xiaodu_start_record(MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_START_RECORD, NULL, 0); + if (res != ERRCODE_SUCC) { + MEDIA_ERR_LOG("send start fail.\r\n"); + return res; + } + + /* create pcm stream task for transfer */ + ret = pcm_stream_create_task(); + if (ret != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } + + MediaThreadattr attr = { "AudioCaptureTask", 0x2000, THREAD_SCHED_INVALID, 0, false }; + g_sample.audioCaptureProcess = MediaThreadCreate(AudioCaptureProcess, NULL, &attr); + if (g_sample.audioCaptureProcess == nullptr) { + MEDIA_ERR_LOG("thread create failed"); + return -1; + } + return 0; +} + + +#ifdef __cplusplus +}; + +namespace OHOS { +namespace ACELite { + +JSIValue AudioCapturerModule::Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + const char *pars[6] = {"","","16000","1","16","/user/log/xiaodu/xiaodu.pcm"}; + return JSI::CreateBoolean(AudioCaptureStart_sample(6,pars)); +} + +JSIValue AudioCapturerModule::Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + g_sample.needStop = true; + MediaThreadJoin(&g_sample.audioCaptureProcess); + g_sample.audioCaptureProcess = nullptr; + return JSI::CreateBoolean(0); +} + +void AudioCapturerModule::ExceptionStop(void) +{ + if (g_sample.needStop == false) { + g_sample.needStop = true; + } +} + +void InitAudioCapturerModule(JSIValue exports) +{ + JSI::SetModuleAPI(exports, "Start", AudioCapturerModule::Start); + JSI::SetModuleAPI(exports, "Stop", AudioCapturerModule::Stop); +} + +} +} + +#endif diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h new file mode 100644 index 000000000..7e8e8ffd6 --- /dev/null +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h @@ -0,0 +1,59 @@ +/* +* Copyright (c) CompanyNameMagicTag. 2021-2021. All rights reserved. +* Description: audio capture wrapper +* Author: Media Software Group +* Create: 2021-09-13 +*/ + +#ifndef AUDIOCAPTURER_MODULE_H +#define AUDIOCAPTURER_MODULE_H + +#include +#include "jsi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t AudioCaptureSample(int32_t argc, const char *argv[]); + + +#ifdef __cplusplus +}; +#endif + +namespace OHOS { +namespace ACELite { +class AudioCapturerModule final : public MemoryHeap { +public: + /** + * constructor + */ + AudioCapturerModule() = default; + + /** + * desconstructor + */ + ~AudioCapturerModule() = default; + /** + * Start + */ + static JSIValue Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * Stop + */ + static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + handle exception + */ + static void ExceptionStop(void); +}; + +void InitAudioCapturerModule(JSIValue exports); +} +} + + +#endif diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c index 4afc7dec8..b0a66c82b 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c @@ -146,7 +146,7 @@ AudioSession AudioServiceAcquireAudioSessionId(void) bool AudioServiceSetVolume(AudioStreamType streamType, int32_t volume) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); if (volume < VOLUME_MIN || volume > VOLUME_MAX) { return false; } @@ -193,7 +193,7 @@ int32_t AudioServiceGetMaxVolume(AudioStreamType streamType) bool AudioServiceMute(AudioStreamType streamType) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); int32_t ret = StreamMgrSetMute(streamType, true); if (ret != AUDIO_SUCCESS) { return false; @@ -203,7 +203,7 @@ bool AudioServiceMute(AudioStreamType streamType) bool AudioServiceUnMute(AudioStreamType streamType) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); int32_t ret = StreamMgrSetMute(streamType, false); if (ret != AUDIO_SUCCESS) { return false; @@ -213,37 +213,37 @@ bool AudioServiceUnMute(AudioStreamType streamType) bool AudioServiceIsMute(AudioStreamType streamType) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrIsMute(streamType); } bool AudioServiceSetMasterMute(bool isMute) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrSetMasterMute(isMute); } bool AudioServiceIsMasterMute(void) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrIsMasterMute(); } bool AudioServiceSetMicrophoneMute(bool isMute) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrSetMicrophoneMute(isMute); } bool AudioServiceIsMicrophoneMute(void) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrIsMicrophoneMute(); } bool AudioServiceSetRingerMode(AudioRingMode mode) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrSetRingerMode(mode); } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c index af22a8ca3..70b90c0b7 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c @@ -43,7 +43,7 @@ typedef struct { static StreamTypeMap g_mapStreamType[] = { { AUDIO_STREAM_MUSIC, AUDIO_IN_MEDIA }, { AUDIO_STREAM_NOTIFICATION, AUDIO_IN_MEDIA }, - { AUDIO_STREAM_VOICE_ASSISTANT, AUDIO_IN_MEDIA }, + { AUDIO_STREAM_VOICE_ASSISTANT, AUDIO_IN_COMMUNICATION }, { AUDIO_STREAM_VOICE_RECORD, AUDIO_IN_MEDIA }, { AUDIO_STREAM_A2DP_MUSIC, AUDIO_IN_MEDIA }, { AUDIO_STREAM_VOICE_CALL, AUDIO_IN_COMMUNICATION }, @@ -343,7 +343,7 @@ static int32_t LoadAudioAdapter(const struct AudioAdapterDescriptor *descs, int3 ALOGE("Adapter name:%s InitAllPorts failed", (desc == NULL) ? "unknow" : desc->adapterName); manager->UnloadAdapter(manager, adapter); g_audioHalDesc.audioAdapterDesc[adapterIndex].audioAdapter = NULL; - continue; + return AUDIO_ERROR; } g_audioHalDesc.audioAdapterDesc[adapterIndex].desc = desc; adapterIndex++; diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c index ccc6cc1c0..a74f018eb 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c @@ -55,6 +55,10 @@ typedef struct { static InterruptMgrContext g_interruptMgrCtx; +static AudioStreamType g_notSupportHandleException[] = { + AUDIO_STREAM_VOICE_ASSISTANT, +}; + static int64_t GetNowTimeUs(void) { struct timeval tv; @@ -524,7 +528,7 @@ bool InterruptMgrCreateStream(AudioSession sessionID, const AudioStreamDescripto ALOGD("CreateStream interruptEl->isInterrupted:%d", interruptEl->isInterrupted); ALOGD("CreateStream interruptEl->sessionID:%d", interruptEl->sessionID); ALOGD("CreateStream interruptEl->streamType:0x%x", interruptEl->streamType); - if (!interruptEl->isInterrupted && interruptEl->sessionID == sessionID && + if (interruptEl->sessionID == sessionID && interruptEl->streamType == streamDesc->streamType) { /* 先把 streamDesc copy 到 streamDesc 中 */ interruptEl->routedStreamDesc.streamDesc = *streamDesc; @@ -887,6 +891,17 @@ int32_t InterruptMgrRemove(const InterruptElement *interruptEl) } return ret; } +static bool CheckStreamTypeSupportHandleException(AudioStreamType streamType) +{ + for (uint32_t i = 0; i < sizeof(g_notSupportHandleException) / + sizeof(g_notSupportHandleException[0]); i++) { + if (g_notSupportHandleException[i] == streamType) { + return false; + } + } + return true; +} + static void InterruptMgrHandleExceptionInner(List *list, bool isOutPut) { int64_t nowTimeUs = GetNowTimeUs(); @@ -913,7 +928,8 @@ static void InterruptMgrHandleExceptionInner(List *list, bool isOutPut) ALOGI("interruptToCreateTimeOutException:%d destroyToDeactiveTimeOutException:%d sessionID:%u streamType:0x%x", interruptToCreateTimeOutException, destroyToDeactiveTimeOutException, interruptEl->sessionID, interruptEl->streamType); - if (interruptToCreateTimeOutException || destroyToDeactiveTimeOutException) { + if ((interruptToCreateTimeOutException || destroyToDeactiveTimeOutException) && + CheckStreamTypeSupportHandleException(interruptEl->streamType)) { /* 栈顶 是 后台流,说明是被打断的应用 重新获取 interrupt,需要回调打断结束的信息 */ ResumeInterruptStream(interruptEl, list, isOutPut); it = ListIterErase(list, it); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c index ee7b0c506..e88c9b515 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c @@ -5,8 +5,10 @@ * Create: 2021-04-21 */ +#include "stream_manager.h" #include #include +#include "securec.h" #include "policy_manager.h" #include "source_handle.h" #include "track_handle.h" @@ -22,7 +24,9 @@ #include "nv.h" #endif #include "media_thread_adapt.h" -#include "stream_manager.h" +#ifdef SUPPORT_SET_DSP_CLOCK_FREQ +#include "hifi_clock_freq_manager.h" +#endif #define LOG_MODULE_NAME "StreamMgr" #ifdef __cplusplus @@ -144,7 +148,7 @@ static int32_t WriteValueByKey(StreamTypeHashId typeHashId, float typeVolume) ALOGI("typeName[%s], typeVolume[%.3f]", typeName[typeHashId], typeVolume); char typeVolumeStr[MAX_FLOAT_TO_CHAR_NUM] = { 0 }; int32_t ret = sprintf_s(typeVolumeStr, MAX_FLOAT_TO_CHAR_NUM, - "%d", (int32_t)(typeVolume * THOUSAND)); // int - str + "%d", (int32_t)(typeVolume * THOUSAND)); // int - str if (ret == AUDIO_ERROR) { return AUDIO_ERROR; } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c index 8f0729494..bc2895aaa 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c @@ -14,6 +14,9 @@ #include "securec.h" #include "media_thread_adapt.h" #include "track_handle.h" +#ifdef SUPPORT_SET_DSP_CLOCK_FREQ +#include "hifi_clock_freq_manager.h" +#endif #ifdef __cplusplus #if __cplusplus @@ -748,9 +751,12 @@ int32_t SetTrackMute(uintptr_t handle, bool mute) TrackHandleContext *context = (TrackHandleContext *)handle; CHK_NULL_RETURN(context, AUDIO_ERROR, "track handle is NULL"); // 状态 - if (context->state == IDLE || context->state == STOP) { + if (context->state == STOP) { ALOGE("track[%d] state is wrong, mute fail", context->streamId); return AUDIO_BAD_STATE; + } else if (context->state == IDLE) { + context->mute = mute; + return AUDIO_SUCCESS; } // 调南向 int32_t ret = context->render->volume.SetMute((AudioHandle)context->render, mute); diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp index 4d38e1786..02845c8d2 100644 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp @@ -43,7 +43,7 @@ const uint32_t GET_BUFFER_TIMEOUT_MS = 0u; const uint32_t RENDER_FULL_SLEEP_TIME_US = 10000u; // 1. waiting app response playback complete callback event // 2. waiting interval time for loop playback -const uint32_t RENDER_EOS_SLEEP_TIME_US = 1000000u; +const uint32_t RENDER_EOS_SLEEP_TIME_US = 3000000u; const uint32_t WAIT_BUFFER_EMPTY_SLEEP_TIME_US = 1000000u; const uint32_t DECODER_DEFAULT_WIDTH = 1920; const uint32_t DECODER_DEFAULT_HEIGHT = 1080; @@ -615,6 +615,11 @@ int32_t PlayerControl::OnPlayControlEvent(void *priv, const EventCbType event) c PlayerControl *player = static_cast(priv); player->RecordLastPosition(); return HI_SUCCESS; + } else if (event == EVNET_AUDIO_RUNNING_ERR || + event == EVNET_VIDEO_RUNNING_ERR) { + PlayerControlError playerError = PLAYERCONTROL_ERROR_AUD_PLAY_FAIL; + EventCallback(PLAYERCONTROL_EVENT_ERROR, &playerError); + return HI_SUCCESS; } PalayControlEventItem item; @@ -755,6 +760,7 @@ static AvCodecMime TransformCodecFormatToAvCodecMime(CodecFormat format) return mime; } +#ifndef UNSUPPORT_VIDEO_DECODER static void GetCurVideoSolution(const FormatFileInfo &info, uint32_t &width, uint32_t &height) { for (int i = 0; i < HI_DEMUXER_RESOLUTION_CNT; i++) { @@ -765,6 +771,7 @@ static void GetCurVideoSolution(const FormatFileInfo &info, uint32_t &width, uin } } } +#endif #ifndef UNSUPPORT_AUDIO_DECODER static std::string GetAudioNameByAvCodecMime(AvCodecMime mime) @@ -1160,6 +1167,11 @@ void PlayerControl::GetRenderFullSleepThresholdTime(AudioCodecFormat codecFormat void PlayerControl::DataSchPreProcess(PlayerControl *play, bool *isContinue) { + if (play->hasRenderAudioEos_) { + int32_t info = PLAYERCONTROL_ERROR_AUD_PLAY_FAIL; + play->EventCallback(PLAYERCONTROL_EVENT_ERROR, &info); + MEDIA_ERR_LOG("player waiting for the EOS callback timed out."); + } play->DoSeekIfNeed(); play->renderSleepTime_ = 0; @@ -1996,8 +2008,7 @@ int32_t PlayerControl::AyncSeek(int64_t seekTime) { CHECK_NULL_RETURN(playerSource_, HI_FAILURE, "playerSource_ nullptr"); int64_t seekTimeInMs = seekTime; - int32_t ret = DecoderAndSinkReset(); - CHECK_FAILED_RETURN(ret, HI_SUCCESS, ret, "DecoderAndSinkReset failed"); + int32_t ret = 0; ClearCachePacket(); if (fmtFileInfo_.s32UsedVideoStreamIndex != HI_DEMUXER_NO_MEDIA_STREAM) { ret = playerSource_->Seek(fmtFileInfo_.s32UsedVideoStreamIndex, seekTimeInMs, FORMAT_SEEK_MODE_BACKWARD_KEY); diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp index 98a0e8bf5..15ee9ebb6 100644 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp @@ -431,6 +431,7 @@ JSIValue AudioModule::StreamTypeSetter(const JSIValue thisVal, const JSIValue *a } double streamType = JSI::ValueToNumber(args[0]); g_streamType = (AudioStreamType)streamType; + AudioPlayer::GetInstance()->SetStreamType(g_streamType); return JSI::CreateBoolean(true); } diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp index 209f7b077..50595ed33 100644 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp @@ -308,6 +308,10 @@ bool AudioPlayer::Play() MEDIA_ERR_LOG("audio src is required."); return false; } + if (player_->SetAudioStreamType(streamType_) != 0) { + MEDIA_ERR_LOG("fail to SetAudioStreamType streamType = %x.", streamType_); + return false; + } if (player_->Play() != 0) { MEDIA_ERR_LOG("fail to play audio."); return false; @@ -509,11 +513,15 @@ bool AudioPlayer::SetVolume(double volume) bool AudioPlayer::SetStreamType(AudioStreamType streamType) { + streamType_ = streamType; + if (player_ == NULL || player_->IsPlaying()) { + MEDIA_ERR_LOG("player is NULL or not playing!"); + return false; + } if (player_->SetAudioStreamType(streamType) != 0) { MEDIA_ERR_LOG("fail to SetAudioStreamType streamType = %x.", streamType); return false; } - streamType_ = streamType; return true; } diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp index f8c0b9093..ff5b7f8c2 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp @@ -192,27 +192,40 @@ static int32_t VideoPlay(MediaVideoPlay *videoPlay) return MEDIA_ERR; } videoPlay->player_->SetPlayerCallback(callback); - int32_t ret = videoPlay->player_->Play(); - if (ret != 0) { - MEDIA_ERR_LOG("play failed\n"); - (void)videoPlay->player_->Reset(); - (void)videoPlay->player_->Release(); - return MEDIA_ERR; - } - videoPlay->player_->EnableSingleLooping(videoPlay->isLoop_); + int32_t ret = 0; MediaMutexLock(videoPlay->mutex_); - videoPlay->isPlayed_ = true; - if (videoPlay->button_ != nullptr) { - videoPlay->button_->SetText("Pause"); + if (!videoPlay->isPause_) { + ret = videoPlay->player_->Play(); + if (ret != 0) { + goto EXIT; + } + videoPlay->player_->EnableSingleLooping(videoPlay->isLoop_); + if (videoPlay->button_ != nullptr) { + videoPlay->button_->SetText("Pause"); + } } + videoPlay->isPlayed_ = true; while (!videoPlay->isPlaybackCompleted_ && !videoPlay->isPlaybackStopped_ && !videoPlay->interruptHintStop_ && !videoPlay->playError_) { MediaThreadCondWait(videoPlay->cond_, videoPlay->mutex_); + if (videoPlay->isResume_) { + ret = videoPlay->player_->Play(); + if (ret != 0) { + goto EXIT; + } + videoPlay->isResume_ = false; + } } MediaMutexUnLock(videoPlay->mutex_); return 0; +EXIT: + MEDIA_ERR_LOG("play failed\n"); + (void)videoPlay->player_->Reset(); + (void)videoPlay->player_->Release(); + MediaMutexUnLock(videoPlay->mutex_); + return MEDIA_ERR; } static void VideoStopAndExit(MediaVideoPlay *videoPlay) @@ -421,6 +434,13 @@ int32_t MediaVideoPlay::StartVideoPlay(void) MEDIA_INFO_LOG("video play is not stop, can not start!"); return MEDIA_OK; } + + // prepare buffers which are used to playing video + LiteSurface* liteSurface = dynamic_cast(surface_); + if (liteSurface != nullptr) { + liteSurface->PrepareBuffers(); + } + isEntered_ = true; ResetVideoPlayState(); MediaThreadattr attr = { "VideoPlayThread", 0x2000, THREAD_SCHED_INVALID, 0, true }; @@ -440,15 +460,17 @@ int32_t MediaVideoPlay::StartVideoPlay(void) int32_t MediaVideoPlay::PauseVideoPlay(void) { MediaMutexLock(mutex_); - if (player_ == NULL) { - MEDIA_ERR_LOG("can not pause play"); + if (!isEntered_ ||isPlaybackStopped_ || + isPlaybackCompleted_ || interruptHintStop_ || + isPause_) { + MEDIA_ERR_LOG("current state is invaild, can not pause play"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { - MEDIA_ERR_LOG("current state is stop, can not pause play"); + isPause_ = true; + if (player_ == nullptr || !isPlayed_ ) { MediaMutexUnLock(mutex_); - return MEDIA_ERR; + return MEDIA_OK; } int32_t ret = player_->Pause(); if (ret != MEDIA_OK) { @@ -456,7 +478,6 @@ int32_t MediaVideoPlay::PauseVideoPlay(void) MediaMutexUnLock(mutex_); return MEDIA_ERR; } - isPause_ = true; MediaMutexUnLock(mutex_); return ret; } @@ -464,40 +485,69 @@ int32_t MediaVideoPlay::PauseVideoPlay(void) int32_t MediaVideoPlay::ResumeVideoPlay(void) { MediaMutexLock(mutex_); - if (player_ == NULL) { - MEDIA_ERR_LOG("can not resume play"); + if (!isEntered_ || isPlaybackStopped_ || + isPlaybackCompleted_ || interruptHintStop_ || + !isPause_) { + MEDIA_ERR_LOG("current state is invaild, can not resume play"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { - MEDIA_ERR_LOG("current state is stop, can not resume play"); + isPause_ = false; + if (player_ == nullptr || !isPlayed_) { + MediaMutexUnLock(mutex_); + return MEDIA_OK; + } + isResume_ = true; + MediaThreadCondSignal(cond_); + MediaMutexUnLock(mutex_); + return MEDIA_OK; +} + +int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) +{ + MediaMutexLock(mutex_); + if (player_ == nullptr) { + MEDIA_ERR_LOG("can not get dump info!"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - int32_t ret = player_->Play(); + int32_t ret = player_->DumpInfo(playerInfo); if (ret != MEDIA_OK) { - MEDIA_ERR_LOG("resume failed"); + MEDIA_ERR_LOG("get dump info failed"); MediaMutexUnLock(mutex_); return ret; } - isPause_ = false; MediaMutexUnLock(mutex_); return ret; } -int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) +int32_t MediaVideoPlay::SeekVideoPlay(int64_t mSeconds) { MediaMutexLock(mutex_); - if (player_ == NULL) { - MEDIA_ERR_LOG("can not get dump info!"); + if (player_ == nullptr) { + MEDIA_ERR_LOG("can not seek!"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - int32_t ret = player_->DumpInfo(playerInfo); + int32_t ret = player_->Rewind(mSeconds, PLAYER_SEEK_CLOSEST_SYNC); if (ret != MEDIA_OK) { - MEDIA_ERR_LOG("get dump info failed"); + MEDIA_ERR_LOG("video player seek failed!"); + } + MediaMutexUnLock(mutex_); + return ret; +} + +int32_t MediaVideoPlay::GetCurrentPosition(int64_t *currentPosition) +{ + MediaMutexLock(mutex_); + if (player_ == nullptr) { + MEDIA_ERR_LOG("can not get current play position!"); MediaMutexUnLock(mutex_); - return ret; + return MEDIA_ERR; + } + int32_t ret = player_->GetCurrentTime(*currentPosition); + if (ret != MEDIA_OK) { + MEDIA_ERR_LOG("video player get current play position failed!"); } MediaMutexUnLock(mutex_); return ret; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h index 549ec2245..eced6624f 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h @@ -35,6 +35,8 @@ public: int32_t PauseVideoPlay(void); int32_t ResumeVideoPlay(void); int32_t GetDumpInfo(PlayerDebugInfo *playerInfo); + int32_t SeekVideoPlay(int64_t mSeconds); + int32_t GetCurrentPosition(int64_t *currentPosition); void SetVideoPlayLoop(bool isLoop); void SetSyncExitMode(bool isSyncExitMode); bool IsSyncExitMode(void); @@ -50,6 +52,7 @@ public: MediaThreadCondHandle cond_ = nullptr; MediaThreadIdHandle threadHandle_ = nullptr; UILabelButton *button_ = nullptr; + bool isResume_ = false; bool isPause_ = false; bool isPlayed_ = false; bool isLoop_ = true; diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c index 997f4ba59..f62a3cdf6 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c @@ -47,6 +47,8 @@ extern "C" { #define CAST_SND_PORT_NUM 1 +#define BT_DETACH_FAIL_RETRY_TIMES 3 + #define MAX_KEY_STR_LEN 10 #define MAX_BUF_LEN 1024 @@ -1322,19 +1324,37 @@ static int32_t AudioSDKStopInternal(const SubPortTrackContext *portTrackCtx) return MEDIA_HAL_OK; } +#if defined(BT_HAL_SUPPORT) && defined(SUPPORT_BREDR) +static int32_t BtDetachHandle(const SubPortTrackContext *portTrackCtx, bt_audio_port_params portParam) +{ + int32_t count = 0; + td_u32 btRet = MEDIA_HAL_OK; + while (count < BT_DETACH_FAIL_RETRY_TIMES) { + btRet = bt_detach_audio_port(portTrackCtx->btStreamHandle, &portParam); + if (btRet == MEDIA_HAL_OK) { + MEDIA_HAL_LOGI(MODULE_NAME, "bt detach audio port success!"); + return MEDIA_HAL_OK; + } + count++; + MEDIA_HAL_LOGE(MODULE_NAME, "bt detach audio port retry ret = %x, count: %d", count, btRet); + } + return MEDIA_HAL_ERR; +} +#endif + static int32_t BluetoothDetachInternal(const SubPortTrackContext *portTrackCtx) { + int32_t ret = MEDIA_HAL_OK; #if defined(BT_HAL_SUPPORT) && defined(SUPPORT_BREDR) if (portTrackCtx->isHandlePublicResource) { bt_audio_port_params portParam = {}; portParam.port_type = A2DP; portParam.share_mem_id = portTrackCtx->outputAdpHandle; - td_u32 btRet = bt_detach_audio_port(portTrackCtx->btStreamHandle, &portParam); - CHK_FAILED_NO_RETURN(btRet, MEDIA_HAL_OK, "bt detach audio port failed"); + ret = BtDetachHandle(portTrackCtx, portParam); } #endif MEDIA_HAL_LOGD(MODULE_NAME, "success"); - return MEDIA_HAL_OK; + return ret; } static int32_t AudioSDKDetachInternal(const SubPortTrackContext *portTrackCtx) @@ -2586,15 +2606,15 @@ static int32_t BluetoothAttach(SubPortContext *portCtx, SubPortTrackContext *por static int32_t BluetoothDetach(const SubPortContext *portCtx, const SubPortTrackContext *portTrackCtx) { + int32_t ret = MEDIA_HAL_OK; #if defined(BT_HAL_SUPPORT) && defined(SUPPORT_BREDR) bt_audio_port_params portParam = {}; portParam.port_type = A2DP; portParam.share_mem_id = portCtx->outputAdpHandle; - td_u32 btRet = bt_detach_audio_port(portTrackCtx->btStreamHandle, &portParam); - CHK_FAILED_RETURN(btRet, MEDIA_HAL_OK, MEDIA_HAL_ERR, "bt detach audio port failed"); + ret = BtDetachHandle(portTrackCtx, portParam); #endif MEDIA_HAL_LOGD(MODULE_NAME, "success"); - return MEDIA_HAL_OK; + return ret; } static int32_t SingletonResourceStartInternal(const SubPortContext *portCtx, SubPortTrackContext *portTrackCtx) diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c index d560c86b1..6c94753f2 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c @@ -95,7 +95,8 @@ static SubPortTrackInCapabilities g_caps[] = { { AUDIO_IN_MEDIA, AUDIO_FORMAT_SBC, 16000, 1 }, { AUDIO_IN_MEDIA, AUDIO_FORMAT_PCM_16_BIT, 16000, 1 }, { AUDIO_IN_COMMUNICATION, AUDIO_FORMAT_mSBC, 16000, 1 }, - { AUDIO_IN_COMMUNICATION, AUDIO_FORMAT_PCM_16_BIT, 8000, 1} + { AUDIO_IN_COMMUNICATION, AUDIO_FORMAT_PCM_16_BIT, 8000, 1}, + { AUDIO_IN_COMMUNICATION, AUDIO_FORMAT_PCM_16_BIT, 16000, 1 }, }; static bool IsSupported(const struct PortPluginAttr *inputAttr) @@ -247,10 +248,8 @@ static int32_t AudioSDKOpenInternal(SubPortTrackInContext *portTrackInCtx) aencAttr.param.samples_per_frame = ((uint32_t)inputAttrTemp.sampleRate) / SAMPLERATE_TO_PTNUMPERFRM; aencAttr.param.private_data = NULL; aencAttr.param.private_data_size = 0; - MEDIA_HAL_LOGI(MODULE_NAME, "audioFormat: 0x%x, sampleRate: %d, channelCount: %u, bitWidth: %u", inputAttrTemp.audioFormat, inputAttrTemp.sampleRate, inputAttrTemp.channelCount, inputAttrTemp.bitWidth); - ret = AudioSDKAencOpen(&portTrackInCtx->aencHandle, aencAttr); if (ret != MEDIA_HAL_OK) { MEDIA_HAL_LOGE(MODULE_NAME, "aenc open failed"); @@ -503,7 +502,6 @@ static int32_t CheckParam(SubPortTrackInContext *portTrackInCtx, uint8_t *buffer MEDIA_HAL_LOGE(MODULE_NAME, "memcpy_s failed"); return MEDIA_HAL_ERR; } - int64_t sec = 0; int64_t nsec = 0; int32_t ret = MediaHalConvertUSecToSecAndNSec(audioStream.pts, &sec, &nsec); diff --git a/code/sdk/middleware/utils/dfx/panic/private/panic.c b/code/sdk/middleware/utils/dfx/panic/private/panic.c index b625429c6..290f4c036 100644 --- a/code/sdk/middleware/utils/dfx/panic/private/panic.c +++ b/code/sdk/middleware/utils/dfx/panic/private/panic.c @@ -40,7 +40,11 @@ #include "tcxo.h" #include "pm.h" #endif +#ifdef CFG_DRIVERS_NANDFLASH #include "nandflash_config.h" +#endif +#include "preserve.h" +#include "exception_dump.h" #define NON_OS_ENTER_MAX_NUM 8 #define MAX_STR_LEN 64 @@ -284,6 +288,7 @@ void panic_deal(panic_id_t origin, uint32_t code, uint32_t caller) nand_driver_init(SPEED_SLOW); set_trans_type(TRANS_BY_CPU_SINGLE_LINE); #if defined(SAVE_EXC_INFO) && (CONFIG_DFX_SUPPORT_FILE_SYSTEM == DFX_YES) + dump_all_to_file(); save_preserve_file_to_nand(); #endif #endif diff --git a/code/sdk/middleware/utils/dfx/preserve/public/preserve.h b/code/sdk/middleware/utils/dfx/preserve/public/preserve.h index 8d735faca..40104d855 100644 --- a/code/sdk/middleware/utils/dfx/preserve/public/preserve.h +++ b/code/sdk/middleware/utils/dfx/preserve/public/preserve.h @@ -118,6 +118,8 @@ void save_preserve_file_to_nand(void); void save_btram_file_to_nand(void); void save_btrace_file_to_nand(void); + +void save_preserve_file_to_nand(void); #endif /** * @} diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-cli/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-cli/libx_vfs_private.a index db39f8950..6bec01c28 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-cli/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-cli/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-ser/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-ser/libx_vfs_private.a index 267892cb8..3da90b6aa 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-ser/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-ser/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-r/libx_vfs_private.a index 9146a5dce..cddab4546 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js/libx_vfs_private.a index 2098718fa..6feed1e55 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target1-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target1-r/libx_vfs_private.a index c16ef2d2a..36cd9f18c 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target1-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target1-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target1/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target1/libx_vfs_private.a index 8887b3960..cb3516467 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target1/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target1/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target3-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target3-r/libx_vfs_private.a index 28509d7d8..a9187ba9c 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target3-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target3-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target3/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target3/libx_vfs_private.a index 62cc55efa..9a350e451 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target3/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target3/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target4-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target4-r/libx_vfs_private.a index 1b52c1cab..d8caaac95 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target4-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target4-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target4/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target4/libx_vfs_private.a index 52a644215..4f1ddcedd 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target4/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target4/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target5-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target5-r/libx_vfs_private.a index d72897d9a..dad2c06b7 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target5-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target5-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-target5/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-target5/libx_vfs_private.a index ccd115868..91ee8ea53 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-target5/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-target5/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-xts-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-xts-r/libx_vfs_private.a index 676565ccc..bae965784 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-xts-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-xts-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-xts/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-xts/libx_vfs_private.a index ba6e1a289..d5bfc75a6 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-xts/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-xts/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/testsuite-brandy-sdk/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/testsuite-brandy-sdk/libx_vfs_private.a index f822bc1fb..0990207a7 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/testsuite-brandy-sdk/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/testsuite-brandy-sdk/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-cli/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-cli/libfs_yaffs2.a index 48a9e7223..ea1e07b3d 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-cli/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-cli/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-ser/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-ser/libfs_yaffs2.a index ab44f1be7..6c956716c 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-ser/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-auto-ota-ser/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a index a2818eef3..d8a248b6e 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a index 673fa280a..aaa672c05 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a index cdcd1dee1..f3d477bd3 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a index b63f085ef..01a9633c2 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a index 1f73c2d00..9fd76a429 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a index 310edb4b8..131150fbe 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a index 724d09fde..a6e6a37dd 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a index e721b85d1..18bb63927 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a index 382fb4f70..be91e78ae 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a index 01de1d883..4091e928c 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a index b287371a6..1af46b849 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a index f813e1e24..ff0d4fab7 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a index d20893e77..6a32e5c11 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a differ diff --git a/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h b/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h index 892af1d7e..f2f4e7459 100644 --- a/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h +++ b/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h @@ -44,6 +44,8 @@ extern "C" { #endif typedef bool (*TryToFreeImgCallback)(void); +typedef bool (*TryToFreeFontCacheCallback)(void); + /** * @brief Defines pointers to the memory driver functions. */ @@ -143,6 +145,8 @@ typedef struct { int32_t (*InvalidateCache)(BufferHandle* handle); void (*RegisterTryToFreeImgCallback)(TryToFreeImgCallback callback); + + void (*RegisterTryToFreeFontCacheCallback)(TryToFreeFontCacheCallback callback); } GrallocFuncs; /** diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-cli/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-cli/libams.a index 92afaee65..55615b9da 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-cli/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-cli/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-ser/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-ser/libams.a index 170ebf3e1..e5f69d4da 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-ser/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-auto-ota-ser/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a index c2cf773f6..eae8d083f 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a index 90472024e..0bcb746fa 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt index 321df8bc4..0abd35cfa 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt @@ -223,6 +223,7 @@ set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput ) if("JS_ENABLE" IN_LIST DEFINES) @@ -286,6 +287,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/version_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/router_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/sample_module.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/keyinput/keyinput.cpp ) endif() diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h index be06b85da..1667ee1c2 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h @@ -219,6 +219,7 @@ enum { KEYWORD(PLACEHOLDER_COLOR, placeholderColor) // placeholder-color of edittext #endif // FEATURE_COMPONENT_EDITTEXT KEYWORD(PROGRESS, progress) // progress tag name + KEYWORD(ORIENTATION, text-orientation) // text rotation #ifdef FEATURE_COMPONENT_QRCODE KEYWORD(QRCODE, qrcode) // qrcode tag name #endif diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-cli/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-cli/libace.a index 1285d7577..9af210185 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-cli/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-cli/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-ser/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-ser/libace.a index b3f4d3f9f..5897328ce 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-ser/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-ser/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a index d75a78751..d4c567f44 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a index 7360ab4ab..9228bb950 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.cpp index cb9d8a2de..cf799bda4 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.cpp @@ -1308,17 +1308,11 @@ bool Component::RegisterCommonEventListener(UIView &view, return false; } } - SetKeyInputEventListener(view, funcValue, eventTypeId); return true; } void Component::ReleaseCommonEventListeners() { - RootView *rootView = RootView::GetInstance(); - if (rootView != nullptr && rootView->GetOnKeyActListener() == onKeyInputListener_) { - rootView->ClearOnKeyActListener(); - } - ACE_DELETE(onKeyInputListener_); ACE_DELETE(onClickListener_); ACE_DELETE(onLongPressListener_); #ifdef JS_TOUCH_EVENT_SUPPORT diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp index 1615474c2..662cfb3cd 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp @@ -256,7 +256,7 @@ bool ViewOnSwipeListener::OnDrag(UIView& view, const DragEvent& event) { UNUSED(view); UNUSED(event); - HILOG_DEBUG(HILOG_MODULE_ACE, "OnDrag received"); + // HILOG_DEBUG(HILOG_MODULE_ACE, "OnDrag received"); return isStopPropagation_; } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp index 2b0992e55..3949d4232 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp @@ -85,6 +85,9 @@ bool TextComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrVa uiLabel_.SetRollSpeed(speed); break; } + case K_ORIENTATION: + SetTextRotateAngle(uiLabel_, attrValue); + break; default: { return false; } @@ -180,6 +183,26 @@ void TextComponent::SetTextColor(UILabel &label, const AppStyleItem *styleItem) } } +void TextComponent::SetTextRotateAngle(UILabel &label, jerry_value_t attrValue) +{ + char *angle = MallocStringOf(attrValue); + if (!strcmp(angle, "up")) { + // Rotate to the "up" position (full rotation) + rotateAngle_ = 360; + } else if (!strcmp(angle, "down")) { + // Rotate to the "down" position (inverted) + rotateAngle_ = 180; + } else if (!strcmp(angle, "left")) { + // Rotate to the "left" position (counter-clockwise) + rotateAngle_ = 270; + } else if (!strcmp(angle, "right")) { + // Rotate to the "right" position (clockwise) + rotateAngle_ = 90; + } + ACE_FREE(angle); + label.Rotate(rotateAngle_, Vector2(label.GetWidth()/2, label.GetHeight()/2)); +} + void TextComponent::SetTextSize(const AppStyleItem *styleItem) { fontSize_ = GetStylePixelValue(styleItem); diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h index 11f151a3d..0afe6ed33 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h @@ -55,11 +55,14 @@ private: void SetTextLetterSpace(UILabel& label, const AppStyleItem* styleItem) const; // parse js text line height style to ui_label void SetTextLineHeight(UILabel& label, const AppStyleItem* styleItem) const; + // parse js text rotate angle style to ui_label + void SetTextRotateAngle(UILabel &label, jerry_value_t attrValue); UILabel uiLabel_; uint8_t fontSize_; char* fontFamily_; char* textValue_; uint8_t overflowMode_; + uint16_t rotateAngle_ = 0; }; } // namespace ACELite } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp index c166a79cf..4bf175963 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp @@ -324,7 +324,8 @@ static void ExecuteSendMsgToJS(void *data) HILOG_INFO(HILOG_MODULE_ACE, "ExecuteSendMsgToJS type = %d flag = %d", type, flag); if (!flag) { if ((!CheckIsJsValueFunction(fail)) || (!CheckIsJsValueDefined(context))) { - HILOG_ERROR(HILOG_MODULE_ACE, "Error in ExecuteSendMsgToJS. Invalid params detected!"); + HILOG_ERROR(HILOG_MODULE_ACE, "ExecuteSendMsgToJS Callback or Context is nullptr!"); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); AdapterFree(msgBody); return; } @@ -333,7 +334,8 @@ static void ExecuteSendMsgToJS(void *data) OHOS::ACELite::JSI::ReleaseValue(dataInfo); } else { if ((!CheckIsJsValueDefined(context)) || (!CheckIsJsValueFunction(success))) { - HILOG_ERROR(HILOG_MODULE_ACE, "Error in ExecuteSendMsgToJS. Invalid params detected!"); + HILOG_ERROR(HILOG_MODULE_ACE, "ExecuteSendMsgToJS Callback or Context is nullptr!"); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); AdapterFree(msgBody); return; } @@ -638,7 +640,7 @@ JSIValue BaiduMapComponentModule::poi_nearby_search(const JSIValue thisVal, cons { HILOG_INFO(HILOG_MODULE_ACE, "poi_nearby_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "poi_nearby_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "poi_nearby_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI); poi_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -658,7 +660,7 @@ JSIValue BaiduMapComponentModule::route_riding_search(const JSIValue thisVal, co { HILOG_INFO(HILOG_MODULE_ACE, "route_riding_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "route_riding_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "route_riding_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH); route_riding_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -680,7 +682,7 @@ JSIValue BaiduMapComponentModule::route_walking_search(const JSIValue thisVal, c { HILOG_INFO(HILOG_MODULE_ACE, "route_walking_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "route_walking_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "route_walking_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH); route_walking_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -702,7 +704,7 @@ JSIValue BaiduMapComponentModule::route_transit_search(const JSIValue thisVal, c { HILOG_INFO(HILOG_MODULE_ACE, "route_transit_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "route_transit_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "route_transit_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH); route_transit_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -724,7 +726,7 @@ JSIValue BaiduMapComponentModule::auth_license(const JSIValue thisVal, const JSI { HILOG_INFO(HILOG_MODULE_ACE, "auth_license"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "auth_license : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "auth_license : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE); auth_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -745,7 +747,7 @@ JSIValue BaiduMapComponentModule::getGeolocation(const JSIValue thisVal, const J { HILOG_INFO(HILOG_MODULE_ACE, "getGeolocation"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "getGeolocation : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "getGeolocation : %s", data); ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION); geo_location_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); @@ -762,7 +764,7 @@ JSIValue BaiduMapComponentModule::naviInit(const JSIValue thisVal, const JSIValu { HILOG_INFO(HILOG_MODULE_ACE, "naviInit"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "naviInit : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "naviInit : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT); nav_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -934,7 +936,7 @@ JSIValue BaiduMapComponentModule::poi_sug_search(const JSIValue thisVal, const J { HILOG_INFO(HILOG_MODULE_ACE, "poi_sug_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "poi_sug_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "poi_sug_search : %s", data); ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH); poi_sug_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1033,7 +1035,7 @@ JSIValue BaiduMapComponentModule::Geocode_search(const JSIValue thisVal, const J { HILOG_INFO(HILOG_MODULE_ACE, "Geocode_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "Geocode_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "Geocode_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH); geocode_search_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1054,7 +1056,7 @@ JSIValue BaiduMapComponentModule::Regeocode_search(const JSIValue thisVal, const { HILOG_INFO(HILOG_MODULE_ACE, "Regeocode_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "Regeocode_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "Regeocode_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH); regeocode_search_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1078,7 +1080,7 @@ JSIValue BaiduMapComponentModule::Destroy_page(const JSIValue thisVal, const JSI { HILOG_INFO(HILOG_MODULE_ACE, "Destroy_page"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "Destroy_page : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "Destroy_page : %s", data); msg_center_vector_navi_req_destroy_page( MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_PAGE, data, strlen(data)); ace_free(data); @@ -1092,7 +1094,7 @@ JSIValue BaiduMapComponentModule::onBTConnect(const JSIValue thisVal, const JSIV { HILOG_INFO(HILOG_MODULE_ACE, "onBTConnect"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "onBTConnect : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "onBTConnect : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED); bt_connect_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1111,7 +1113,7 @@ JSIValue BaiduMapComponentModule::NaviDestroy(const JSIValue thisVal, const JSIV { HILOG_INFO(HILOG_MODULE_ACE, "exitNavigation"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "exitNavigation : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "exitNavigation : %s", data); msg_center_vector_navi_req_destroy_from_watch( MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_FROM_WATCH, data, strlen(data)); ace_free(data); @@ -1124,11 +1126,11 @@ JSIValue BaiduMapComponentModule::NaviDestroy(const JSIValue thisVal, const JSIV JSIValue BaiduMapComponentModule::StopAnswer(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) { HILOG_INFO(HILOG_MODULE_ACE, "StopAnswer"); - char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "StopAnswer : %s \n", data); - msg_center_xiaodu_send_stop_answer(MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_SEND_JS_EXIT, data, strlen(data)); - ace_free(data); - return JSI::CreateBoolean(true); + uint8_t data = (uint8_t)JSI::GetNumberProperty(args[0], "data"); + HILOG_INFO(HILOG_MODULE_ACE, "StopAnswer : %d", data); + uint32_t ret = msg_center_xiaodu_send_stop_answer( + MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_SEND_JS_EXIT, &data, sizeof(data)); + return (ret == ERRCODE_SUCC) ? JSI::CreateBoolean(true) : JSI::CreateBoolean(false); } JSIValue BaiduMapComponentModule::MapInit(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp index 4f3a16e7f..3fc7f1ddc 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp @@ -157,6 +157,7 @@ JSIValue DisplayModule::GetMode(const JSIValue thisVal, const JSIValue *args, ui } else { FailCallBack(thisVal, args[0], ret); } + JSI::ReleaseValue(result); return JSI::CreateUndefined(); } @@ -209,6 +210,7 @@ JSIValue DisplayModule::GetValue(const JSIValue thisVal, const JSIValue *args, u } else { FailCallBack(thisVal, args[0], ret); } + JSI::ReleaseValue(result); return JSI::CreateUndefined(); } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp new file mode 100644 index 000000000..6c47db112 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp @@ -0,0 +1,445 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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 "keyinput.h" +#include "js_async_work.h" +#include "adapter.h" +#include "js_ability_impl.h" +#include "ace_log.h" + +typedef struct : public OHOS::HeapBase { + char *msgBody; + uint16_t status; +} KeyMsgParams; + +typedef struct : public OHOS::HeapBase { + int16_t rotate; +} RotateMsgParams; + +namespace OHOS { +namespace ACELite { +KeyNotifyCallback KeyInputModule::notifyCallback_ = nullptr; +OHOS::ACELite::JSIValue keyCallback = nullptr; +OHOS::ACELite::JSIValue rotateCallback = nullptr; +OHOS::ACELite::JSIValue context = nullptr; +OHOS::ACELite::JSIValue onClickCallback = nullptr; +OHOS::ACELite::JSIValue onPressCallback = nullptr; + +static bool CheckIsJsValueDefined(OHOS::ACELite::JSIValue jsValue) +{ + if (jsValue == nullptr) { + return false; + } + + if (OHOS::ACELite::JSI::ValueIsUndefined(jsValue)) { + return false; + } + + return true; +} + +static void ReleaseJsValue(OHOS::ACELite::JSIValue &jsValue) +{ + if (CheckIsJsValueDefined(jsValue)) { + OHOS::ACELite::JSI::ReleaseValue(jsValue); + jsValue = OHOS::ACELite::JSI::CreateUndefined(); + } + return; +} + +static int32_t ACECopyStr(char **destStr, const char *srcStr) +{ + if (destStr == nullptr || srcStr == nullptr) { + return -1; + } + + uint32_t length = strlen(srcStr) + 1; + *destStr = static_cast(AdapterMalloc(length)); + if (*destStr == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to allocate memory for destination string"); + return -1; + } + + if (memset_s(*destStr, length, 0, length) != EOK) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to set memory for destination string"); + AdapterFree(*destStr); + return -1; + } + if (memcpy_s(*destStr, length, srcStr, length) != EOK) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to copy source string to destination string"); + AdapterFree(*destStr); + return -1; + } + + return 0; +} + +static void ExecuteSendKeyMsgToJS(void *data) +{ + KeyMsgParams *params = static_cast(data); + if (params == nullptr) { + return; + } + + char *msgBody = params->msgBody; + uint16_t status = params->status; + OHOS::ACELite::JSIValue dataInfo = OHOS::ACELite::JSI::CreateObject(); + OHOS::ACELite::JSI::SetStringProperty(dataInfo, "keyName", msgBody); + + switch (status) { + case InputDevice::STATE_PRESS: + if (onPressCallback != nullptr && context != nullptr) { + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(onPressCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + } + break; + case InputDevice::STATE_RELEASE: + if (onClickCallback != nullptr && context != nullptr) { + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(onClickCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + } + break; + default: + break; + } + + if (keyCallback != nullptr && context != nullptr) { + OHOS::ACELite::JSI::SetNumberProperty(dataInfo, "status", status); + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(keyCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + } + + OHOS::ACELite::JSI::ReleaseValue(dataInfo); + AdapterFree(msgBody); + delete params; + params = nullptr; + return; +} + +static void ExecuteSendRotateMsgToJS(void *data) +{ + RotateMsgParams *params = static_cast(data); + if (params == nullptr) { + return; + } + + int16_t rotate = params->rotate; + delete params; + params = nullptr; + OHOS::ACELite::JSIValue dataInfo = OHOS::ACELite::JSI::CreateObject(); + OHOS::ACELite::JSI::SetNumberProperty(dataInfo, "rotate", rotate); + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(rotateCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); + return; +} + +JSIValue KeyInputModule::SetKeyListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + bool ret = false; + ReleaseKeyCallback(); + if (argsNum > 0) { + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + keyCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + if ((!JSI::ValueIsUndefined(keyCallback)) && JSI::ValueIsFunction(keyCallback)) { + ret = true; + } else { + HILOG_DEBUG(HILOG_MODULE_ACE, "setKeyListener: unset listener."); + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "setKeyListener failed, argsNum is %d.", argsNum); + } + return JSI::CreateBoolean(ret); +} + +void KeyInputModule::ReleaseKeyCallback() +{ + ReleaseJsValue(keyCallback); + keyCallback = nullptr; + return; +} + +JSIValue KeyInputModule::SetRotateListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + bool ret = false; + ReleaseRotateCallbacks(); + if (argsNum > 0) { + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + rotateCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + if ((!JSI::ValueIsUndefined(rotateCallback)) && JSI::ValueIsFunction(rotateCallback)) { + RotateListener::GetInstance()->SetRegister(true); + ret = true; + // you could enable rotary encoder's driver here. + } else { + HILOG_DEBUG(HILOG_MODULE_ACE, "setRotateListener: unset listener."); + // you could disable rotary encoder's driver here. + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "setRotateListener failed, argsNum is %d.", argsNum); + // you could disable rotary encoder's driver here. + } + return JSI::CreateBoolean(ret); +} + +void KeyInputModule::ReleaseRotateCallbacks() +{ + OHOS::ACELite::RotateListener::GetInstance()->SetRegister(false); + ReleaseJsValue(rotateCallback); + rotateCallback = nullptr; + return; +} + +void OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback callback) +{ + notifyCallback_ = callback; +} + +KeyNotifyCallback OHOS::ACELite::KeyInputModule::GetNotifyKeyListener(void) +{ + return notifyCallback_; +} + +void KeyInputModule::DefineProperty( + JSIValue target, const char *propName, JSIFunctionHandler getter, JSIFunctionHandler setter) +{ + JSPropertyDescriptor descriptor; + descriptor.getter = getter; + descriptor.setter = setter; + JSI::DefineNamedProperty(target, propName, descriptor); +} + +JSIValue KeyInputModule::OnClickSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + bool ret = false; + if (argsNum > 0) { + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + onClickCallback = OHOS::ACELite::JSI::AcquireValue(args[0]); + if (JSI::ValueIsUndefined(onClickCallback) || !JSI::ValueIsFunction(onClickCallback)) { + ReleaseOnClickCallbacks(); + } else { + ret = true; + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "OnClickSetter failed, argsNum is %d.", argsNum); + } + return JSI::CreateBoolean(ret); +} + +JSIValue KeyInputModule::OnClickGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + return (onClickCallback == nullptr) ? JSI::CreateUndefined() : onClickCallback; +} + +void KeyInputModule::ReleaseOnClickCallbacks() +{ + ReleaseJsValue(onClickCallback); + onClickCallback = nullptr; + return; +} + +JSIValue KeyInputModule::OnPressSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + bool ret = false; + if (argsNum > 0) { + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + onPressCallback = OHOS::ACELite::JSI::AcquireValue(args[0]); + if (JSI::ValueIsUndefined(onPressCallback) || !JSI::ValueIsFunction(onPressCallback)) { + ReleaseOnPressCallbacks(); + } else { + ret = true; + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "OnPressSetter failed, argsNum is %d.", argsNum); + } + return JSI::CreateBoolean(ret); +} + +JSIValue KeyInputModule::OnPressGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + return (onPressCallback == nullptr) ? JSI::CreateUndefined() : onPressCallback; +} + +void KeyInputModule::ReleaseOnPressCallbacks() +{ + ReleaseJsValue(onPressCallback); + onPressCallback = nullptr; + return; +} + +void KeyInputModule::OnDestroy() +{ + // you could disable rotary encoder's driver here. + ReleaseKeyCallback(); + ReleaseRotateCallbacks(); + ReleaseOnClickCallbacks(); + ReleaseOnPressCallbacks(); + ReleaseJsValue(context); + context = nullptr; +} + +void InitKeyInputModule(JSIValue exports) +{ + JSI::SetModuleAPI(exports, "setKeyListener", KeyInputModule::SetKeyListener); + JSI::SetModuleAPI(exports, "setRotateListener", KeyInputModule::SetRotateListener); + + KeyInputModule::DefineProperty(exports, "onClick", KeyInputModule::OnClickGetter, KeyInputModule::OnClickSetter); + KeyInputModule::DefineProperty(exports, "onPress", KeyInputModule::OnPressGetter, KeyInputModule::OnPressSetter); + JSI::SetOnDestroy(exports, KeyInputModule::OnDestroy); +} + +} // namespace ACELite +} // namespace OHOS + +bool OHOS::ACELite::KeyListener::HasRegister() +{ + if (keyCallback != nullptr || onClickCallback != nullptr || onPressCallback != nullptr) { + return true; + } + return false; +} + +void OHOS::ACELite::KeyListener::SendToJS(const KeyEvent &event) +{ + if (!OHOS::ACELite::KeyListener::HasRegister()) { + return; + } + + char *type = "UNKNOWN"; + switch (event.GetKeyId()) { + case static_cast(ZliteKeyCode::ZLITE_KEY_POWER): + type = "POWER"; + break; + case static_cast(ZliteKeyCode::ZLITE_KEY_FUNC): + type = "FUNCTION"; + break; + default: + break; + } + int32_t ret = KeySendMsgToJS(type, event.GetState()); + if (ret != 0) { + HILOG_ERROR(HILOG_MODULE_ACE, "KeyListener: OnKeyEvent send event error"); + } +} + +void OHOS::ACELite::KeyListener::OnKeyEvent(const KeyEvent &event) +{ + // Prioritize handling notification events + KeyNotifyCallback notifyCallback = KeyInputModule::GetNotifyKeyListener(); + if (notifyCallback != nullptr) { + // If the upper layer does not notify, continue executing the JS event + if (notifyCallback(event.GetKeyId(), event.GetState())) { + return; + } + } + switch (event.GetState()) { + case InputDevice::STATE_PRESS: + isPress_ = true; + SendToJS(event); + break; + case InputDevice::STATE_LONG_PRESS: + isLongPress_ = true; + OnKeyLongPress(event); + break; + case InputDevice::STATE_RELEASE: + OnRelease(event); + break; + default: + break; + } +} + +void OHOS::ACELite::KeyListener::OnRelease(const KeyEvent &event) +{ + if (OHOS::ACELite::KeyListener::HasRegister()) { + SendToJS(event); + } else if (isPress_ && !isLongPress_) { + if (event.GetKeyId() == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { + JsAppContext::GetInstance()->TerminateAbility(); + } + } + isPress_ = false; +} + +void OHOS::ACELite::KeyListener::OnKeyLongPress(const KeyEvent &event) +{ + if (isLongPress_) { + if (event.GetKeyId() == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { + NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT); + } + } + // we don't handle isLongPress & isRelease, so reset isLongPress_ to false here. + isLongPress_ = false; +} + +void OHOS::ACELite::RotateListener::OnRotateEvent(const RotateEvent &event) +{ + if (!OHOS::ACELite::RotateListener::HasRegister()) { + return; + } + int ret = RotateSendMsgToJS(event.GetRotate()); + if (ret != 0) { + HILOG_ERROR(HILOG_MODULE_ACE, "RotateListener: OnRotateEvent send event error"); + } +} + +int32_t KeySendMsgToJS(const char *msgBody, uint16_t status) +{ + KeyMsgParams *params = new KeyMsgParams(); + if (params == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to allocate memory for params"); + return -1; + } + params->status = status; + int32_t copyRet = OHOS::ACELite::ACECopyStr(¶ms->msgBody, msgBody); + + if (copyRet != 0) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to copy msgBody"); + AdapterFree(params->msgBody); + delete params; + params = nullptr; + return copyRet; + } + + bool ret = OHOS::ACELite::JsAsyncWork::DispatchAsyncWork( + OHOS::ACELite::ExecuteSendKeyMsgToJS, static_cast(params)); + if (!ret) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to dispatch async work"); + AdapterFree(params->msgBody); + delete params; + params = nullptr; + return -1; + } + + return 0; +} + +int32_t RotateSendMsgToJS(int16_t rotate) +{ + RotateMsgParams *params = new RotateMsgParams(); + if (params == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to allocate memory for params"); + return -1; + } + params->rotate = rotate; + bool ret = OHOS::ACELite::JsAsyncWork::DispatchAsyncWork( + OHOS::ACELite::ExecuteSendRotateMsgToJS, static_cast(params)); + if (!ret) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to dispatch async work"); + delete params; + params = nullptr; + return -1; + } + return 0; +} diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h new file mode 100644 index 000000000..1f4fd1df4 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) CompanyNameMagicTag. 2024-2025. All rights reserved. + * Description: keyinput wrapper + * Author: SoftwarePlatform Group + * Create: 2024-09-29 + */ + +#ifndef OHOS_ACELITE_KEYINPUT_MODULE_H +#define OHOS_ACELITE_KEYINPUT_MODULE_H + +#include "jsi.h" +#include "events/key_event.h" +#include "events/rotate_event.h" +#include "dock/input_device.h" +#include "common/key_code.h" +typedef bool (*KeyNotifyCallback)(uint16_t keyID, uint8_t state); + +namespace OHOS { +namespace ACELite { +class KeyInputModule : public MemoryHeap { +public: + KeyInputModule() = default; + ~KeyInputModule() = default; + static JSIValue SetKeyListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue SetRotateListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static void SetNotifyKeyListener(KeyNotifyCallback callback); + static KeyNotifyCallback GetNotifyKeyListener(void); + static void DefineProperty(JSIValue target, const char *propName, JSIFunctionHandler getter, JSIFunctionHandler setter); + static JSIValue OnClickGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue OnClickSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue OnPressGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue OnPressSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static void OnDestroy(); + +private: + static KeyNotifyCallback notifyCallback_; + static void ReleaseKeyCallback(); + static void ReleaseRotateCallbacks(); + static void ReleaseOnClickCallbacks(); + static void ReleaseOnPressCallbacks(); +}; + +void InitKeyInputModule(JSIValue exports); + +class KeyListener { +public: + static KeyListener *GetInstance() + { + static KeyListener instance; + return &instance; + } + + void OnKeyEvent(const KeyEvent &event); + + bool HasRegister(); + + void SendToJS(const KeyEvent &event); + +private: + KeyListener() : isPress_(false), isLongPress_(false){}; + ~KeyListener() = default; + void OnRelease(const KeyEvent &event); + void OnKeyLongPress(const KeyEvent &event); + bool isPress_; + bool isLongPress_; +}; + +class RotateListener { +public: + static RotateListener *GetInstance() + { + static RotateListener instance; + return &instance; + } + + void OnRotateEvent(const RotateEvent &event); + + bool HasRegister() + { + return isRegister_; + } + void SetRegister(bool isRegister) + { + isRegister_ = isRegister; + } + +private: + RotateListener() : isRegister_(false){}; + ~RotateListener() = default; + bool isRegister_; +}; + +} // namespace ACELite +} // namespace OHOS +int32_t KeySendMsgToJS(const char *msgBody, uint16_t type); +int32_t RotateSendMsgToJS(int16_t rotate); +#endif diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h index 2779e85a7..d7e585d57 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h @@ -76,6 +76,7 @@ extern void InitLocaleModule(JSIValue exports); #endif extern void InitNetWorkModule(JSIValue exports); +extern void InitKeyInputModule(JSIValue exports); // #ifdef FEATURE_ACELITE_SYSTEM_CAPABILITY // extern void InitCapabilityModule(JSIValue exports); // #endif @@ -134,6 +135,7 @@ const Module OHOS_MODULES[] = { // {"capability", InitCapabilityModule}, // #endif {"network", InitNetWorkModule}, + {"keyinput", InitKeyInputModule}, }; } // namespace ACELite } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-cli/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-cli/libbms.a index 31498c238..b8859c61d 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-cli/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-cli/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-ser/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-ser/libbms.a index d117e4c9f..843ba3f3c 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-ser/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-auto-ota-ser/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a index 3ad0d2547..265db3d5c 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a index fc9b21e1c..238abfeb8 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h index 78c3d95bb..11b26a66a 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h @@ -216,6 +216,9 @@ enum AppexecfwkErrors { /** Failed to parse the label of the ability. */ ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_LABEL_ERROR, + /** Failed to parse the srcPath of the ability. */ + ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_SRCPATH_ERROR, + /** Failed to parse the description of the ability. */ ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_DESCRIPTION_ERROR, diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h index 3ca315402..d2067a18d 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h @@ -100,6 +100,7 @@ const char PROFILE_KEY_MODULE_ABLLITY_DESCRIPTION[] = "description"; const char PROFILE_KEY_MODULE_ABILITY_LABEL[] = "label"; const char PROFILE_KEY_MODULE_ABILITY_ICON[] = "icon"; const char PROFILE_KEY_MODULE_ABILITY_TYPE[] = "type"; +const char PROFILE_KEY_MODULE_ABILITY_SRCPATH[] = "srcPath"; const char PROFILE_KEY_MODULE_ABILITY_LAUNCHTYPE[] = "launchType"; const char PROFILE_KEY_MODULE_ABILITY_VISIBLE[] = "visible"; const char PROFILE_KEY_MODULE_ABILITY_DEVICE_CAP[] = "deviceCapability"; @@ -157,7 +158,13 @@ const char JSON_PATH[] = APP_BASE_DIR"user/ace/etc/bundles/"; const char JSON_PATH_NO_SLASH_END[] = APP_BASE_DIR"user/ace/etc/bundles"; // store bundle permissions for IAM const char PERMISSIONS_PATH[] = APP_BASE_DIR"user/ace/etc/permissions"; +// Original IDE version const char ASSET_JS_PATH[] = "/assets/js/default"; +// IDE version 5.0 and above +const char ASSET_JS_PATH_MAIN[] = "/assets/js/MainAbility"; +// IDE version below 5.0 +const char ASSET_JS_PATH_DEFAULT[] = "/assets/js/default"; +const char ASSET_PATH[] = "/assets/js/"; const char ICON_NAME[] = "/icon.bin"; const char SMALL_ICON_NAME[] = "/icon_small.bin"; const char DEFAULT_ICON_SETTING[] = "$media:icon"; @@ -227,6 +234,7 @@ struct BundleProfile { char *vendor; char *label; char *iconPath; + char *srcPath; ProfileVersion profileVersion; ProfileApiVersion profileApiVersion; ModuleInfo moduleInfo; diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h index 7afeaf57d..0e9fd02a2 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h @@ -69,7 +69,7 @@ private: uint8_t SwitchErrorCode(int32_t errorCode); uint8_t AddBundleResList(const char *bundleName, uint32_t labelId, uint32_t iconId); uint8_t MoveRawFileToDataPath(const BundleInfo *bundleInfo); - uint8_t TransformJsToBc(const char *codePath, InstallRecord &record); + uint8_t TransformJsToBc(const char *codePath, InstallRecord &record, char *jsPath); }; #define FREE_PRO_RESOURCE(fp, permissions, bundleInfo) \ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h index d9f5eec50..de9e3c9ac 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h @@ -105,7 +105,7 @@ private: void APP_QueryAppInfo(const char *appDir, AppInfoList *list); void APP_InsertAppInfo(char *filePath, AppInfoList *list); void APP_FreeAllAppInfo(const AppInfoList *list); - void InstallPreBundle(List systemPathList, InstallerCallback installerCallback); + void InstallPreBundle(List &systemPathList, InstallerCallback installerCallback); GtBundleInstaller *installer_; BundleMap *bundleMap_; diff --git a/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h b/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h new file mode 100644 index 000000000..7e8e8ffd6 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h @@ -0,0 +1,59 @@ +/* +* Copyright (c) CompanyNameMagicTag. 2021-2021. All rights reserved. +* Description: audio capture wrapper +* Author: Media Software Group +* Create: 2021-09-13 +*/ + +#ifndef AUDIOCAPTURER_MODULE_H +#define AUDIOCAPTURER_MODULE_H + +#include +#include "jsi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t AudioCaptureSample(int32_t argc, const char *argv[]); + + +#ifdef __cplusplus +}; +#endif + +namespace OHOS { +namespace ACELite { +class AudioCapturerModule final : public MemoryHeap { +public: + /** + * constructor + */ + AudioCapturerModule() = default; + + /** + * desconstructor + */ + ~AudioCapturerModule() = default; + /** + * Start + */ + static JSIValue Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * Stop + */ + static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + handle exception + */ + static void ExceptionStop(void); +}; + +void InitAudioCapturerModule(JSIValue exports); +} +} + + +#endif diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-cli/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-cli/libjerryscript.a index 20d9f7dea..2b98ed388 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-cli/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-cli/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-ser/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-ser/libjerryscript.a index 6d294cacc..0d6a49b0b 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-ser/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-auto-ota-ser/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a index 009009cc3..c3950703e 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a index 016f9c8a7..e515f5fe7 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp index 439832093..2f6f2359b 100644 --- a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp @@ -71,19 +71,29 @@ int GetFullPath(const char* uri, char* fullPath, int len) JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag = false) { - JSIValue undefValue = JSI::CreateUndefined(); - if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { - return undefValue; - } - FuncParams* params = new(std::nothrow) FuncParams(); - if (params == nullptr) { - return undefValue; + JSIValue retValue = JSI::CreateUndefined(); + + if (args != nullptr && argsNum > 0 && NativeapiCommon::IsValidJSIValue(args, argsNum)) { + FuncParams* params = new(std::nothrow) FuncParams(); + if (params != nullptr) { + params->thisVal = JSI::AcquireValue(thisVal); + params->args = JSI::AcquireValue(args[0]); + params->flag = flag; + + bool isSuccess = JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + if (!isSuccess) { + JSI::ReleaseValue(params->thisVal); + JSI::ReleaseValue(params->args); + delete params; + retValue = JSI::CreateErrorWithCode(-1, "Async work dispatch failed"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Failed to allocate FuncParams"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Invalid arguments"); } - params->thisVal = JSI::AcquireValue(thisVal); - params->args = JSI::AcquireValue(args[0]); - params->flag = flag; - JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); - return undefValue; + return retValue; } void ExecuteCopyFile(void* data) diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp index b7c4676e6..2e4c00933 100644 --- a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp @@ -99,21 +99,31 @@ int DeleteValueInner(const char* dataPath, const char* key) } JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, - uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag) + uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag = false) { - JSIValue undefValue = JSI::CreateUndefined(); - if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { - return undefValue; - } - FuncParams* params = new(std::nothrow) FuncParams(); - if (params == nullptr) { - return undefValue; + JSIValue retValue = JSI::CreateUndefined(); + + if (args != nullptr && argsNum > 0 && NativeapiCommon::IsValidJSIValue(args, argsNum)) { + FuncParams* params = new(std::nothrow) FuncParams(); + if (params != nullptr) { + params->thisVal = JSI::AcquireValue(thisVal); + params->args = JSI::AcquireValue(args[0]); + params->flag = flag; + + bool isSuccess = JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + if (!isSuccess) { + JSI::ReleaseValue(params->thisVal); + JSI::ReleaseValue(params->args); + delete params; + retValue = JSI::CreateErrorWithCode(-1, "Async work dispatch failed"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Failed to allocate FuncParams"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Invalid arguments"); } - params->thisVal = JSI::AcquireValue(thisVal); - params->args = JSI::AcquireValue(args[0]); - params->flag = flag; - JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); - return undefValue; + return retValue; } void ExecuteGet(void* data) diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c index 70cbdc606..a53fe42a9 100644 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c @@ -13,6 +13,7 @@ #include "bts_le_gap.h" #include "bts_feature.h" #include "bts_a2dp_source.h" +#include "bts_spp.h" #include "bts_br_gap.h" #include "bts_avrcp_controller.h" #include "sample_common.h" @@ -66,6 +67,7 @@ typedef enum { BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, /* 35 设置搜到参数 */ BTSRV_SAMPLE_GAP_SET_SERVICE_TASK_PRIORITY, /* 36 设置BT_SERVICE_TASK优先级 */ BTSRV_SAMPLE_GAP_SET_FLOW_LIMIT, /* 37 设置流控限制字节数 */ + BTSRV_SAMPLE_GAP_SET_SPP_WRITE_RETRY_MAX, /* 38 设置spp写入重试最大次数 */ } btsrv_gap_sample_cmd_id; typedef enum { @@ -1229,6 +1231,17 @@ static void btsrv_sample_cmd_set_flow_limit(const char **params, int32_t params_ bts_sample_log("bts set flow limit ret:0x%x limit:%d\n", ret, flow_limit); } +static void btsrv_sample_cmd_set_spp_write_retry_max(const char **params, int32_t params_cnt) +{ + if (params_cnt != 1) { /* 1:参数个数 */ + bts_sample_log("params_cnt error! need one param!\n"); + return; + } + uint32_t retry_max = (uint32_t)atoi(params[0]); + errcode_t ret = spp_write_retry_times_config(retry_max); + bts_sample_log("bts set spp write retry max ret:0x%x max:%u\n", ret, retry_max); +} + btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { /* 0 */ { BTSRV_SAMPLE_GAP_ENABLE_BLE, btsrv_sample_cmd_enable_ble }, @@ -1284,6 +1297,7 @@ btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { { BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, btsrv_sample_cmd_set_filter_device_class }, { BTSRV_SAMPLE_GAP_SET_SERVICE_TASK_PRIORITY, btsrv_sample_cmd_set_service_task_priority}, { BTSRV_SAMPLE_GAP_SET_FLOW_LIMIT, btsrv_sample_cmd_set_flow_limit}, + { BTSRV_SAMPLE_GAP_SET_SPP_WRITE_RETRY_MAX, btsrv_sample_cmd_set_spp_write_retry_max}, }; void btsrv_gap_sample_cmd(uint32_t cmd_id, const char **params, int32_t params_cnt) diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c index 2d1480596..396875cf6 100644 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c @@ -1500,9 +1500,9 @@ static void sample_gap_ble_scan_result_cbk(const gap_scan_result_data_t *scan_re bts_sample_log_no_header("scan_result_data is null \n"); return; } - bts_sample_log("addr_type: %u addr:0x%02x:**:**:**:%02x:%02x.\r\n", scan_result_data->addr.type, - scan_result_data->addr.addr[BT_INDEX_0], scan_result_data->addr.addr[BT_INDEX_4], - scan_result_data->addr.addr[BT_INDEX_5]); + bts_sample_log("event_type:%u addr_type: %u addr:0x%02x:**:**:**:%02x:%02x adv_len:%u.\r\n", + scan_result_data->event_type, scan_result_data->addr.type, scan_result_data->addr.addr[BT_INDEX_0], + scan_result_data->addr.addr[BT_INDEX_4], scan_result_data->addr.addr[BT_INDEX_5], scan_result_data->adv_len); } static void sample_gap_ble_conn_state_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_ble_conn_state_t conn_state, diff --git a/code/sdk/protocol/bt/host/bt/bts/sdk/src/inc/sdk_general_gap.h b/code/sdk/protocol/bt/host/bt/bts/sdk/src/inc/sdk_general_gap.h index abd8b7634..9111c9955 100644 --- a/code/sdk/protocol/bt/host/bt/bts/sdk/src/inc/sdk_general_gap.h +++ b/code/sdk/protocol/bt/host/bt/bts/sdk/src/inc/sdk_general_gap.h @@ -31,6 +31,7 @@ extern "C" { #define BT_AT_TGAP_PRIMARY_ADV_INTERVAL_MAX 96 /* 0x0060, 60.000ms, U:0.625 */ #define BT_AT_TGAP_PRIMARY_ADV_CHANNEL_MAP 0x7 #define BT_AT_EXT_ADV_PHYS_1M 0x01 /* HCI_PRIMARY_ADVERTISING_PHY_1M */ +#define BT_AT_FILTER_DUPLICATES_ENABLE 0x01 /* HCI_FILTER_DUPLICATES_DUPLICATE_FILTERING_ENABLED */ #define BT_AT_GAP_LE_EXT_ADV_FLAG_OWN_ADDR 16 enum { diff --git a/code/sdk/tools/bin/xts_tools/PCID.json b/code/sdk/tools/bin/xts_tools/PCID.json new file mode 100644 index 000000000..5f364f7c3 --- /dev/null +++ b/code/sdk/tools/bin/xts_tools/PCID.json @@ -0,0 +1,9 @@ +{ + "api_version": 0, + "manufacturer_id": 0, + "system_type": "mini", + "syscap": { + "os": ["SystemCapability.Developtools.Syscap", "SystemCapability.Security.Cipher", "SystemCapability.Security.Huks.Core", "SystemCapability.Security.Huks.Extension"], + "private": [] + } +} diff --git a/code/sdk/tools/bin/xts_tools/PCID.sc b/code/sdk/tools/bin/xts_tools/PCID.sc new file mode 100644 index 000000000..fea83e049 Binary files /dev/null and b/code/sdk/tools/bin/xts_tools/PCID.sc differ diff --git a/code/sdk/tools/bin/xts_tools/syscap_tool_bin/syscap_tool b/code/sdk/tools/bin/xts_tools/syscap_tool_bin/syscap_tool new file mode 100644 index 000000000..f32ca1a0b Binary files /dev/null and b/code/sdk/tools/bin/xts_tools/syscap_tool_bin/syscap_tool differ diff --git a/jsapp/keyinput_sample/.gitignore b/jsapp/keyinput_sample/.gitignore new file mode 100644 index 000000000..82dc42bd4 --- /dev/null +++ b/jsapp/keyinput_sample/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +/entry/.preview +.cxx diff --git a/jsapp/keyinput_sample/build.gradle b/jsapp/keyinput_sample/build.gradle new file mode 100644 index 000000000..5e5275d7b --- /dev/null +++ b/jsapp/keyinput_sample/build.gradle @@ -0,0 +1,38 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.4.2' + classpath 'com.huawei.ohos:decctest:1.2.4.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } +} diff --git a/jsapp/keyinput_sample/entry/.gitignore b/jsapp/keyinput_sample/entry/.gitignore new file mode 100644 index 000000000..3543521e9 --- /dev/null +++ b/jsapp/keyinput_sample/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/jsapp/keyinput_sample/entry/build.gradle b/jsapp/keyinput_sample/entry/build.gradle new file mode 100644 index 000000000..e61770fa0 --- /dev/null +++ b/jsapp/keyinput_sample/entry/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + testImplementation 'junit:junit:4.13' +} +decc { + supportType = ['html','xml'] +} diff --git a/jsapp/keyinput_sample/entry/proguard-rules.pro b/jsapp/keyinput_sample/entry/proguard-rules.pro new file mode 100644 index 000000000..f7666e475 --- /dev/null +++ b/jsapp/keyinput_sample/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/config.json b/jsapp/keyinput_sample/entry/src/main/config.json new file mode 100644 index 000000000..e3933c991 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/config.json @@ -0,0 +1,40 @@ +{ + "app": { + "bundleName": "com.example.keyinput_sample", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "deviceType": [ + "liteWearable" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "name": "default", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "type": "page" + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/keyinput/keyinput", + "pages/list_scrollToEnd/list_scrollToEnd", + "pages/rotation/rotation" + ], + "name": "default" + } + ] + } +} \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/app.js b/jsapp/keyinput_sample/entry/src/main/js/default/app.js new file mode 100644 index 000000000..6d060ffe5 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/i18n/en-US.json b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/i18n/zh-CN.json b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..8d369c9d7 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,42 @@ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} + +.listcontainer{ + width: 80%; + height: 60%; + justify-content: center; + align-items: center; + background-color: black; + flex-direction: column; +} + +.listitem{ + width: 100%; + height: 80px; + flex-direction: column; + background-color: black; + justify-content: center; +} + +.btn{ + width: 100%; + height: 70px; + font-size: 24px; + text-align:center; + text-align-vertical: center; + color: black; + background-color: grey; +} + diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..41b2076f4 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,7 @@ +
+ + + {{$item.title}} + + +
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..8a875e646 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,30 @@ +import app from "@system.app" +import router from '@system.router'; + +export default { + data: { + pages: [ + { + title: "keyinput Listener", + path: "pages/keyinput/keyinput" + }, + { + title: "List scrollToEnd", + path: "pages/list_scrollToEnd/list_scrollToEnd" + } + ] + }, + onShow() { + + }, + onClick(item){ + router.replace({ + uri:item, + }) + }, + swipe(e){ + if (e.direction == "right" && e.distance > 200) { + app.terminate() + } + } +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.css new file mode 100644 index 000000000..3ef4e822c --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.css @@ -0,0 +1,12 @@ +.container { + width: 454px; + height: 454px; + justify-content: center; + align-items: center; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.hml new file mode 100644 index 000000000..cd062ec03 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.hml @@ -0,0 +1,5 @@ +
+ + register KeyListener & RotateListener + +
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.js new file mode 100644 index 000000000..60c9e5f3d --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.js @@ -0,0 +1,31 @@ +import key from '@system.keyinput'; +import router from '@system.router'; + +function Rotatecallback(data) { + console.info("Rotatecallback : " + JSON.stringify(data)) +} + +export default { + data: { + Test:"Test" + }, + onShow() { + let that = this + key.setKeyListener({ + "callback": function(data){ + console.info("Keycallback data : "+JSON.stringify(data)+" Test : "+that.Test) + } + }) + key.setRotateListener({ + "callback": Rotatecallback + }) + }, + swipe(e){ + console.info(" swipe "+JSON.stringify(e)) + if (e.direction == "right") { + router.replace({ + uri: 'pages/index/index', + }) + } + } +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.css new file mode 100644 index 000000000..7a53bddbb --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.css @@ -0,0 +1,37 @@ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; +} + +.listcontainer{ + width: 80%; + height: 60%; + justify-content: center; + align-items: center; + background-color: pink; + flex-direction: column; +} + +.listitem{ + width: 100%; + flex-direction: column; + background-color: green; +} + +.btn{ + width: 100%; + font-size: 24px; + text-align:left; + color: black; + background-color: grey; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.hml new file mode 100644 index 000000000..412c99799 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.hml @@ -0,0 +1,9 @@ +
+
+ + + {{$item}} + + +
+
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.js new file mode 100644 index 000000000..d243142f1 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.js @@ -0,0 +1,39 @@ +import router from '@system.router'; + +export default { + data: { + isShow:true, + todolist: [ + "add list item 1", + ], + listid:0, + scrollid:0 + }, + onShow() { + this.listid = setInterval(() => { + if (this.todolist[0].length < 1050) { + console.info(" this.todolist[0].length < 1050 ") + let temp = this.todolist[0] + "add list item 1"; + this.todolist[0] = temp; + this.todolist = this.todolist; + } else { + console.info(" this.todolist[0].length > 1050 ") + } + }, 2500) + this.scrollid = setInterval(() => { + const list = this.$refs.list; + list.scrollToEnd(this.code); + }, 1000) + }, + swipe(e) { + if (e.direction == "right" && e.distance > 200) { + router.replace({ + uri: 'pages/index/index', + }) + } + }, + onHide(){ + clearInterval(this.listid); + clearInterval(this.scrollid); + } +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.css new file mode 100644 index 000000000..77816c988 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.css @@ -0,0 +1,9 @@ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + display: flex; + flex-direction: row; +} + diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.hml new file mode 100644 index 000000000..8384a9e16 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.hml @@ -0,0 +1,20 @@ +
+ + + + {{$item.title}} 111 + + + +
+ 1 +
+
+ 2 +
+
+ 3 +
+
+ +
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.js new file mode 100644 index 000000000..e90911fe8 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.js @@ -0,0 +1,78 @@ +import router from '@system.router'; + +export default { + data: { + picker_data: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"], + todolist: [ + { + title: 'aaa', + }, + { + title: 'bbb' + }, + { + title: 'ccc' + }, + { + title: 'ddd' + }, + { + title: 'eee' + }, + { + title: 'fff' + }, + { + title: 'ggg' + }, + { + title: 'hhh' + }, + { + title: 'iii' + }, + { + title: 'jjj' + }, + { + title: 'kkk' + }, + ], + }, + fun_list() { + console.info("fun_list") + const list = this.$refs.list; + list.rotation({ + "focus": true + }) + }, + fun_pickerview() { + console.info("fun_pickerview") + const pickerview = this.$refs.pickerview; + pickerview.rotation({ + "focus": true + }) + }, + fun_swiper() { + console.info("fun_pickerview") + const swiper = this.$refs.swiper; + swiper.rotation({ + "focus": true + }) + }, + fun_slider() { + console.info("fun_slider") + const slider = this.$refs.slider; + slider.rotation({ + "focus": true + }) + }, + swipe(e) { + if (e.direction == "right" && e.distance > 200) { + router.replace({ + uri: 'pages/index/index', + }) + } + } +} + diff --git a/jsapp/keyinput_sample/entry/src/main/resources/base/element/string.json b/jsapp/keyinput_sample/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..2be18c1ab --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + } + ] +} diff --git a/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon.png b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon.png new file mode 100644 index 000000000..ce307a882 Binary files /dev/null and b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon.png differ diff --git a/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon_small.png b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon_small.png new file mode 100644 index 000000000..0ed5fea2d Binary files /dev/null and b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon_small.png differ diff --git a/jsapp/keyinput_sample/gradle.properties b/jsapp/keyinput_sample/gradle.properties new file mode 100644 index 000000000..3966a047e --- /dev/null +++ b/jsapp/keyinput_sample/gradle.properties @@ -0,0 +1,13 @@ +# Project-wide Gradle settings. +# IDE (e.g. DevEco Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# If the Chinese output is garbled, please configure the following parameter. +# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false. +# more information see https://docs.gradle.org/current/userguide/performance.html +# org.gradle.parallel=false +# org.gradle.jvmargs=-Dfile.encoding=GBK \ No newline at end of file diff --git a/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.jar b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..490fda857 Binary files /dev/null and b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.jar differ diff --git a/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.properties b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..f59159e86 --- /dev/null +++ b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jsapp/keyinput_sample/gradlew b/jsapp/keyinput_sample/gradlew new file mode 100644 index 000000000..2fe81a7d9 --- /dev/null +++ b/jsapp/keyinput_sample/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/jsapp/keyinput_sample/gradlew.bat b/jsapp/keyinput_sample/gradlew.bat new file mode 100644 index 000000000..62bd9b9cc --- /dev/null +++ b/jsapp/keyinput_sample/gradlew.bat @@ -0,0 +1,103 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jsapp/keyinput_sample/settings.gradle b/jsapp/keyinput_sample/settings.gradle new file mode 100644 index 000000000..28d595f2f --- /dev/null +++ b/jsapp/keyinput_sample/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/patch_602_1029_to_1126.txt b/patch_602_1029_to_1126.txt new file mode 100644 index 000000000..198a3584c --- /dev/null +++ b/patch_602_1029_to_1126.txt @@ -0,0 +1,87 @@ +【补丁名称】patch_602_1029_to_1126 +【基础版本】b602 + 0521 + 0626 + 7020 + 0812 + 0911 + 1009 + 1029 +【修复问题】 +BT合入内容: +1、新增需求:提供配置SPP数传重试次数的功能。 + +PLT合入内容 +1、 问题描述:解决客户打开双击宏后,概率性单击按键上报双击事件问题。 + 测试建议:powerkey双击场景验证,库上默认没有打开双击宏 +2、 问题描述:gettimeofday底层调用接口修改,删除冗余算法。。 + 测试建议:不同步时间的情况下,压测系统时间误差 +3、 代码优化:低功耗流程优化 + 测试建议:压测深睡场景 +4、 维测优化:panic函数流程中增加trace&mem导出 + +AUDIO&MEDIA合入内容 +1、 问题描述:概率性初始化失败,导致音频播放失败。 + 测试场景:媒体初始化加载某一个插件失败以后,再进行媒体的初始化 +2、 问题描述:手表连接蓝牙耳机播放蓝牙音乐时来电,挂断后会导致音乐无法恢复。 + 测试场景:蓝牙sink音乐+来电铃声+蓝牙通话,通话打断音乐以后,通话结束以后,音乐恢复 +3、 问题描述:视频表盘弹窗概率性出现视频黑帧 + 测试场景:视频表盘场景,视频还未完全起播就灭屏;视频表盘+视频弹窗场景 +4、 问题描述:蓝牙通话的场景,来电铃声的时候需要静音通话,有时候静音无效。 + 测试场景:蓝牙通话的场景,来电铃声的时候需要静音通话,有时候静音无效 +5、 需求描述:实现音视频播放时进度条拖动需求 + 测试场景:音视频播放的时候,都可以调用seek接口进行跳转 +6、 问题描述:解决音乐播放完DSP无法进入低功耗的问题 + 测试场景:本地音乐播放 +7、 问题描述:JS敲木鱼设置音量不生效 + 测试场景:js敲木鱼的音频播放,在播放前进行音量和流类型的设置,在真正播放的时候生效 +8、 问题描述: 不停推送微信消息会出现音频播放失败的问题 + 测试场景,在播放蓝牙sink音乐的时候,不停的推送微信消息 +9、 问题描述:录音打断sink音乐,结束录音后sink音乐无法恢复。 + 测试场景:先播放蓝牙sink音乐再起小度语音会打断sink音乐,小度语音退出以后,sink音乐会恢复 + +GUI合入内容 +1、 问题描述:解决视频特定场景的停播问题 + 测试建议:图形内存严重不足时起播视频,视频起播后调用Stop后重新设置视频源再起播 +2、 问题描述:解决CrossView上下滑动高斯模糊消失问题 + 测试建议:一级表盘界面,向一个方向拖动一段距离后,快速反向滑动然后松手,确认反向拉出的界面是否有正常的高斯模糊效果 +3、 问题描述:解决地图相关的显示和内存问题 + 测试建议:测试地图业务 +4、 问题描述:解决局部视频滑动以及亮灭屏后显示问题 + 测试建议:在一级卡片中播放位于非[0,0]的局部视频,测试左右滑动和量灭屏 +5、 问题描述:解决UIRollerView移除最后一个控件后挂死问题 + 测试建议:NativeJS示例页面,点击进入滚筒后点击页面底部,反复点击remove至到控件被全部移除 + +OHOS合入内容 +1、 新增需求:JS应用名支持动态切换语言。 + 测试建议:使用AT命令测试切换语言场景:AT^OHOSFWK_CHANGE_LANGUAGE=en-US,退出applist,再进入后应用名切换为中文。 +2、 新增需求:兼容IDE5.0和2.1版本安装包。 + 安装不同版本IDE(IDE5.0和2.1)编译出的安装包,测试安装是否正常。 +3、 新增需求:添加一个AT命令用于切换语言。 + 测试建议:使用AT命令切换语言AT^OHOSFWK_CHANGE_LANGUAGE=en-US +4、 新增需求:增加最大应用数量,从30修改为60 +5、 新增需求:List 滑动到底部功能添加,以及滑动底部功能js sample代码,示例代码:jsapp/keyinput_sample +6、 代码优化:听书新增streamType API;文心一言设置getApp获取回调,item高度自适应 +7、 代码优化:swiper滑动频繁触发OnDrag原生日志影响流畅度,屏蔽OnDrag原生日志 +8、 代码优化:rotate focus获取焦点,再隐藏控件挂死问题 。示例代码:jsapp/keyinput_sample +9、 新增需求:keyinput 模块,扩展社区标准接口onClick, onPress + +10、新增需求:支持跑马灯功能,跑马灯文本支持旋转功能合 + 测试建议:使用jsapp.zip的marqueesample源码编译出bin,板端安装应用进行测试 +11、新增需求: 新增支持点击power键正常关闭notify。 + 测试建议:js应用下 闹钟notifyshowing时 点击power键正常关闭notify。参考代码:application\wearable\service\msg_center\src\msg_center_customer.cpp +12、代码优化:js安装命令解决内存泄露 + 开发建议:客户参考js安装回调ReceiveCallback中,调用AdapterFree + + +【修改影响】NA + +【使用方法】 + 1、合入0521补丁 + 2、合入0626补丁 + 3、合入0720补丁 + 4、合入0812补丁 + 5、合入0911补丁 + 6、合入1009补丁 + 7、合入1029补丁 + 8、合入1126补丁(包含1029到1126之间所有调试补丁) + +【自测情况】 + 自验证范围: + 全功能冒烟 + 自验证target: + Native-js、target3 rc版本 +【是否合入版本】根据测试结果确定