From: SnickerSun Date: Tue, 10 Sep 2024 12:03:18 +0000 (+0800) Subject: patch_0615sdk_to_0906 X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~420 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F935%2F1;p=mirrors%2FFD230.git patch_0615sdk_to_0906 --- diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h b/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h index 9213fda76..9ddab5cb4 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h @@ -66,6 +66,11 @@ public: uint16_t GetCurSlicePriority(void) { return curSlicePriority_; } + void StartSlice(const uint16_t sliceId, const uint16_t priority); + void ResumeSlice(const uint16_t priority = gSliceDefaultPriority); + void PauseSlice(); + void StopSlice(); + protected: Ability() = default; virtual ~Ability() = default; @@ -94,10 +99,6 @@ protected: SliceTransition sliceTransition_; osal_atomic transitionCount_{0}; - void ResumeSlice(const uint16_t priority = gSliceDefaultPriority); - void StartSlice(const uint16_t sliceId, const uint16_t priority); - - void StopSlice(bool needPause = false); void PostChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority); ListsNode* Find(const uint16_t sliceId); diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySlice.h b/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySlice.h index 54e4dfb41..deaaf924f 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySlice.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySlice.h @@ -20,12 +20,18 @@ #include "wearable_log.h" namespace OHOS { +enum class SliceState : uint8_t { + UNINITIALIZED, + START, + RESUME, + PAUSE, + STOP +}; template - class AbilitySlice : public Slice { public: AbilitySlice() - :view_(nullptr), presenter_(nullptr) {} + :view_(nullptr), presenter_(nullptr), state_(SliceState::UNINITIALIZED) {} ~AbilitySlice() {} void OnStart() override @@ -45,10 +51,14 @@ public: view_->OnStart(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Slice %s OnStart", typeid(presenter_).name()); presenter_->OnStart(); + state_ = SliceState::START; } void OnResume() override { + if ((state_ != SliceState::START) && (state_ != SliceState::PAUSE)) { // avoid repeated resume + return; + } if (presenter_ != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Slice %s OnResume", typeid(presenter_).name()); presenter_->OnResume(); @@ -56,14 +66,19 @@ public: if (view_ != nullptr) { view_->Draw(); } + state_ = SliceState::RESUME; } void OnPause() override { + if (state_ != SliceState::RESUME) { // avoid repeated pause + return; + } if (presenter_ != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Slice %s OnPause", typeid(presenter_).name()); presenter_->OnPause(); } + state_ = SliceState::PAUSE; } void OnStop() override @@ -81,6 +96,7 @@ public: delete presenter_; presenter_ = nullptr; } + state_ = SliceState::STOP; } UIViewGroup* GetSliceContainer() override @@ -98,6 +114,7 @@ private: V* view_; P* presenter_; + SliceState state_; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h b/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h index b86eaa4cd..8e4bb9321 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h @@ -18,6 +18,8 @@ #include "components/root_view.h" #include "KeyInputListener.h" +#include "dock/focus_manager.h" + namespace OHOS { template @@ -59,6 +61,7 @@ public: { // Ensure that key listener is disabled during transition if exist RootView::GetInstance()->ClearOnKeyActListener(); + FocusManager::GetInstance()->ClearFocus(); } /** diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp index 51f01bdcb..4cbe171c0 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp @@ -46,7 +46,7 @@ void Ability::StartSlice(const uint16_t sliceId, const uint16_t priority) if (node == nullptr) { return; } - InputDeviceManager::GetInstance()->ClearPressableViews(); + InputDeviceManager::GetInstance()->ClearInputDeviceState(); Slice* nextSlice = node->value_.proxy->CreateSlice(); if (nextSlice == nullptr) { return; @@ -93,39 +93,49 @@ ListsNode* Ability::Find(const uint16_t sliceId) void Ability::ChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) { - if (osal_atomic_read(&transitionCount_) <= 0) { - osal_atomic_inc(&transitionCount_); + if (type == TransitionType::TRANSITION_INVALID) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&Ability::PostChangeSlice, this, targetSliceId, type, priority)); + } else { + if (osal_atomic_read(&transitionCount_) <= 0) { + osal_atomic_inc(&transitionCount_); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(&Ability::PostChangeSlice, this, targetSliceId, + type, priority)); + } else { + GRAPHIC_LOGE("ChangeSlice failed! targetSliceId = %u, transitionCount_ = %d", + targetSliceId, osal_atomic_read(&transitionCount_)); + } } } void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) { +#ifdef JS_ENABLE + ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); + if (elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0) { + OHOS::AbilityMsClient::GetInstance().ForceStop(elementName->bundleName); + targetSliceIdFromJS_ = targetSliceId; + if (type != TransitionType::TRANSITION_INVALID) { + osal_atomic_dec(&transitionCount_); + } + return; + } +#endif + bool useTransition = sliceTransition_.SetTransitionType(type); bool isCurSnapshotEnabled = sliceTransition_.IsCurrentSnapshotEnabled(); - if (curSlice_.slice != nullptr) { - curSlice_.slice->OnPause(); - } + PauseSlice(); if (!useTransition) { StopSlice(); } else if (isCurSnapshotEnabled) { if (!sliceTransition_.SaveCurrentSnapshot(curSlice_.slice->GetSliceContainer())) { useTransition = false; + osal_atomic_dec(&transitionCount_); } StopSlice(); } // slice页面跳转,先onstop,再onstart.在一个线程同步执行绘制,不会出现闪屏现象 -#ifdef JS_ENABLE - ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); - if (elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0) { - OHOS::AbilityMsClient::GetInstance().ForceStop(elementName->bundleName); - targetSliceIdFromJS_ = targetSliceId; - osal_atomic_dec(&transitionCount_); - return; - } -#endif StartSlice(targetSliceId, priority); if (useTransition) { @@ -138,7 +148,6 @@ void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type, if (curSlice_.slice != nullptr) { curSlice_.slice->OnResume(); } - osal_atomic_dec(&transitionCount_) ; } } @@ -163,33 +172,33 @@ void Ability::OnTransitionEnd() void Ability::ResumeSlice(const uint16_t priority) { - uint16_t targetSliceId = gSliceInvalid; - if (targetSliceIdFromJS_ != 0) { - targetSliceId = targetSliceIdFromJS_; - targetSliceIdFromJS_ = 0; - } else if (allSlices_.empty()) { - targetSliceId = defaultSliceId_; + if (curSlice_.slice != nullptr) { + curSlice_.slice->OnResume(); } else { - targetSliceId = GetCurSliceId(); + GRAPHIC_LOGE("No valid slice to resume"); } - StartSlice(targetSliceId, priority); +} + +void Ability::PauseSlice() +{ if (curSlice_.slice != nullptr) { - curSlice_.slice->OnResume(); + curSlice_.slice->OnPause(); + } else { + GRAPHIC_LOGE("No valid slice to pause"); } } -void Ability::StopSlice(bool needPause) +void Ability::StopSlice() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "Ability::StopSlice"); if (curSlice_.slice != nullptr) { - if (needPause) { - curSlice_.slice->OnPause(); - } curSlice_.slice->OnStop(); curSlice_.sliceId = gSliceInvalid; delete curSlice_.slice; curSlice_.slice = nullptr; curSlicePriority_ = gSliceDefaultPriority; + } else { + GRAPHIC_LOGE("No valid slice to stop"); } } } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp index ce1e07b5b..fccb32483 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/NativeAbility.cpp @@ -70,7 +70,17 @@ void NativeAbility::ResumeAbility(uint16_t priority) { GraphicService::GetInstance()->SetNativeUIRunning(true); NotificationManager::GetInstance()->SetNativeUIRunning(true); - Ability::ResumeSlice(priority); + uint16_t targetSliceId = gSliceInvalid; + if (targetSliceIdFromJS_ != 0) { + targetSliceId = targetSliceIdFromJS_; + targetSliceIdFromJS_ = 0; + } else if (allSlices_.empty()) { + targetSliceId = defaultSliceId_; + } else { + targetSliceId = GetCurSliceId(); + } + StartSlice(targetSliceId, priority); + ResumeSlice(priority); nativeAbilityState_ = STATE_ACTIVE; #ifdef JS_ENABLE Want want; // initialize want which is not used actually @@ -96,7 +106,8 @@ void NativeAbility::StopAbility() { GraphicService::GetInstance()->SetNativeUIRunning(false); NotificationManager::GetInstance()->SetNativeUIRunning(false); - Ability::StopSlice(true); + PauseSlice(); + StopSlice(); nativeAbilityState_ = STATE_INACTIVE; #ifdef JS_ENABLE SliteAbility::OnBackground(); diff --git a/code/sdk/application/wearable/nativeapp/CMakeLists.txt b/code/sdk/application/wearable/nativeapp/CMakeLists.txt index b72b2d42e..9f25e9776 100644 --- a/code/sdk/application/wearable/nativeapp/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeapp/CMakeLists.txt @@ -114,8 +114,10 @@ set(SOURCES ${UI_SAMPLE_ROOT}/components/ui_test_keyboard/ui_test_keyboard.cpp ${UI_SAMPLE_ROOT}/components/ui_test_hexagons_list/ui_test_hexagons_list.cpp ${UI_SAMPLE_ROOT}/components/ui_test_coverflow/ui_test_coverflow.cpp + ${UI_SAMPLE_ROOT}/components/ui_test_slipflow/ui_test_slipflow.cpp ${UI_SAMPLE_ROOT}/components/ui_test_kaleidoscope/ui_test_kaleidoscope.cpp ${UI_SAMPLE_ROOT}/components/ui_test_roller_view/ui_test_roller_view.cpp + ${UI_SAMPLE_ROOT}/components/ui_test_emoji/ui_test_emoji.cpp ) diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index a936166ec..3f9578d93 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -39,7 +39,6 @@ #include "BluetoothPresenter.h" #include "PlayersModel.h" #include "HealthModel.h" -#include "PresenterTask.h" #include "MainCompassPresenter.h" #include "MainCompassView.h" #include "CallerLogModel.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h index b37d8b8d9..d3a539b31 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h @@ -123,7 +123,7 @@ private: void ListStyleOnStop(); ApplistAdapter *listAdapter_{nullptr}; UIList *contentList_{nullptr}; - UIView::OnDragListener *dragListener{nullptr}; + UIView::OnDragListener *dragListener_{nullptr}; /* for hexagons style */ void HexagonsStyleOnStart(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp index 46110966f..9a784b717 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp @@ -32,14 +32,18 @@ ApplistView::~ApplistView() delete contentList_; contentList_ = nullptr; } - if (dragListener != nullptr) { - delete dragListener; - dragListener = nullptr; + if (dragListener_ != nullptr) { + delete dragListener_; + dragListener_ = nullptr; } if (hexagonsList_ != nullptr) { delete hexagonsList_; hexagonsList_ = nullptr; } + if (footballList_ != nullptr) { + delete footballList_; + footballList_ = nullptr; + } if (callback_ != nullptr) { delete callback_; callback_ = nullptr; @@ -131,26 +135,11 @@ void ApplistView::ListStyleOnStart() contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS); contentList_->SetYScrollBarVisible(true); - dragListener = new AppListOnDragListener(); - if (dragListener == nullptr) { + dragListener_ = new AppListOnDragListener(); + if (dragListener_ == nullptr) { return; } - contentList_->SetOnDragListener(dragListener); - uint16_t startIndex = 0; - int16_t headY = 0; - if (presenter_->GetStartIndex() >= presenter_->GetListItemNum()) { - startIndex = presenter_->GetListItemNum() - 1; - headY = VERTICAL_RESOLUTION / NUM_2; - } else { - startIndex = presenter_->GetStartIndex(); - headY = presenter_->GetHeadItemY(); - if (headY == 0) { - headY = VERTICAL_RESOLUTION / NUM_2; - } - } - contentList_->SetStartIndex(startIndex); - contentList_->SetAdapter(listAdapter_); - contentList_->ScrollBy(headY); + contentList_->SetOnDragListener(dragListener_); AddViewToRootContainer(contentList_); } @@ -265,6 +254,21 @@ void ApplistView::RefreshAppList(void) } else if (style == AppListStyle::HEXAGONS_STYLE) { hexagonsList_->LayoutChildren(true); } else { + uint16_t startIndex = 0; + int16_t headY = 0; + if (presenter_->GetStartIndex() >= presenter_->GetListItemNum()) { + startIndex = presenter_->GetListItemNum() - 1; + headY = VERTICAL_RESOLUTION / NUM_2; + } else { + startIndex = presenter_->GetStartIndex(); + headY = presenter_->GetHeadItemY(); + if (headY == 0) { + headY = VERTICAL_RESOLUTION / NUM_2; + } + } + contentList_->SetAdapter(listAdapter_); + contentList_->ScrollTo(startIndex); + contentList_->ScrollBy(headY); contentList_->RefreshList(); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp index dd0f29346..7253ed754 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp @@ -224,8 +224,6 @@ void BluetoothEarPhoneView::BtEnable() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable Bt is Discovering"); return; } else { - results = gap_br_set_bt_scan_mode(GAP_SCAN_MODE_NONE, 0); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_set_bt_scan_mode results %d", results); results = gap_br_set_inquiry_paramters(DEVICE_MAJOR_CLASS_AUDIO_VIDEO, 0); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_set_inquiry_paramters results %d", results); results = gap_br_start_discovery(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp index 484d3c905..85be8f267 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -504,6 +504,11 @@ void BluetoothModel::SetAdvStartState(bool state) int BluetoothModel::ConnectRemoteDevice(const bd_addr_t *addr) { + /* 恢厂后耳机连接要开启BT广播否则会导致AVRCP无法音量控制 */ + bool ret = gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE, 60); + if (!ret) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectRemoteDevice gap_br_set_bt_scan_mode ret = 0x%x", ret); + } errcode_t retVal = gap_connect_remote_device(addr); (void)memcpy_s(&remoteConnectAddr, sizeof(bd_addr_t), addr, sizeof(bd_addr_t)); return retVal; @@ -846,13 +851,15 @@ void GapAclStateChangedCallback(const bd_addr_t *bdAddr, gap_acl_state_t state, WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "addr: %02x%02x%02x%02x%02x%02x", bdAddr->addr[5], bdAddr->addr[4], bdAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ - if ((gap_get_device_class(bdAddr) & 0x200) != 0) { + static bd_addr_t gapAclConnectAddr{0}; /* 连接后保存手机地址,手表清除手机配对后查询不到class比较手机地址 */ + if ((gap_get_device_class(bdAddr) & 0x200) != 0 || memcmp(gapAclConnectAddr.addr, bdAddr->addr, BD_ADDR_LEN) == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback: Mobile Phone Device"); if (state == GAP_ACL_STATE_DISCONNECTED) { /* 通知msg_center,ble状态仍用bt状态,此处不区分 */ SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, nullptr, 0); SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, nullptr, 0); } else if (state == GAP_ACL_STATE_CONNECTED) { + (void)memcpy_s(gapAclConnectAddr.addr, BD_ADDR_LEN, bdAddr->addr, BD_ADDR_LEN); SendMsgToMsgCenterService(BT_CONNECTED_TO_MSGCENTER, 0, nullptr, 0); SendMsgToUIService(BT_CONNECTED_TO_UI, 0, nullptr, 0); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h index b56bfeec4..0bec380c6 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h @@ -35,6 +35,12 @@ static constexpr const char *DROPDOWN_CLICK_ALARM = "dropdownclickalarm"; static constexpr const char *DROPDOWN_CLICK_SETTING = "dropdownclicksetting"; constexpr uint16_t VERTICAL_STATUS = 1; constexpr uint16_t HORIZONTAL_STATUS = 0; +enum class MainPresenterState { + START, + RESUME, + PAUSE, + STOP, +}; class MainViewSample; class MainPresenterSample : public Presenter, public ModelListenerSample, @@ -45,6 +51,9 @@ public: ~MainPresenterSample() override; static MainPresenterSample *GetInstance(void); + void OnStart() override; + void OnPause() override; + void OnResume() override; void OnStop() override; void Notify() override; bool OnClick(UIView& view, const ClickEvent& event) override; @@ -65,6 +74,8 @@ public: bool IsFromSetCardView(void) const; void SetFromSetCardView(bool isFrom); uint8_t GetFromCardId(void); + MainPresenterState GetMainPresenterState(); + private: void ProcessDataNotify(void); void SetCircleProgress(void); @@ -75,6 +86,7 @@ private: int64_t playerMusicDuration_{0}; int64_t playerProgressValue_{0}; bool isCompassSensorOpened_{false}; + MainPresenterState mainPresenterState_ = MainPresenterState::STOP; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h index 6444c4fe6..3484cb6e8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h @@ -19,13 +19,13 @@ #include "common/task.h" namespace OHOS { -class ModelListenerSample : public HeapBase { +class ModelListenerSample : public Task { public: ModelListenerSample(); virtual ~ModelListenerSample(); virtual void Notify(void) = 0; virtual void OnTickEvent(void) {}; - void Callback(); + void Callback() override; }; } #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp index 2f5e8e09b..33fd0ec41 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -21,7 +21,6 @@ #include #include #include "ModelDialDataFactory.h" -#include "PresenterTask.h" #include "DialModelTime.h" #include "DialViewGroup.h" #include "ui_service.h" @@ -63,13 +62,38 @@ MainPresenterSample *MainPresenterSample::GetInstance(void) return g_pMainPresenterSample; } +void MainPresenterSample::OnStart() +{ + mainPresenterState_ = MainPresenterState::START; +} + +void MainPresenterSample::OnPause() +{ + mainPresenterState_ = MainPresenterState::PAUSE; +} + +void MainPresenterSample::OnResume(void) +{ + Presenter::OnResume(); + mainPresenterState_ = MainPresenterState::RESUME; + // Set current page again to invoke OnActive method. + uint8_t curCardId = view_->GetHorCurrentCard(); + view_->SwitchToCard(curCardId); +} + void MainPresenterSample::OnStop(void) { + mainPresenterState_ = MainPresenterState::STOP; if (isCompassSensorOpened_) { CompassModel::GetInstance()->CloseCompassSensor(); } } +MainPresenterState MainPresenterSample::GetMainPresenterState(void) +{ + return mainPresenterState_; +} + bool MainPresenterSample::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); @@ -133,7 +157,7 @@ void MainPresenterSample::SetPage(int8_t id) void MainPresenterSample::SetTaskPeroid(CardId cardId) { if (cardId == COMPASS) { - PresenterTask::GetInstance()->SetPeriod(DEFAULT_TASK_PERIOD); + SetPeriod(DEFAULT_TASK_PERIOD); } else if (cardId == WATCH_FACE) { uint32_t time; DialSetting &setting = GetDialSetting(); @@ -142,11 +166,11 @@ void MainPresenterSample::SetTaskPeroid(CardId cardId) } else { time = DEFAULT_TASK_PERIOD; } - PresenterTask::GetInstance()->SetPeriod(time); + SetPeriod(time); } else if (cardId == MUSIC_PLAYER) { - PresenterTask::GetInstance()->SetPeriod(PLAYER_PERIOD); + SetPeriod(PLAYER_PERIOD); } else { - PresenterTask::GetInstance()->SetPeriod(MAX_PERIOD); + SetPeriod(MAX_PERIOD); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp index ab4844c3d..26c67fb1f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp @@ -14,20 +14,17 @@ */ #include "ModelListenerSample.h" -#include "PresenterTask.h" #include "wearable_log.h" namespace OHOS { ModelListenerSample::ModelListenerSample() { - PresenterTask::GetInstance()->SetModelListener(this); - PresenterTask::GetInstance()->Init(); + Init(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ModelListenerSample::ModelListenerSample"); } ModelListenerSample::~ModelListenerSample() { - PresenterTask::GetInstance()->Deinit(); - PresenterTask::GetInstance()->SetModelListener(nullptr); + Deinit(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ModelListenerSample::~ModelListenerSample"); } 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 7adfcf7d5..02ed56751 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 @@ -11,6 +11,7 @@ #ifdef SUPPORT_OHOSFWK #include "ui_screennotify.h" #endif +#include "MainPresenterSample.h" namespace OHOS { static DialVideoView* g_video = nullptr; @@ -384,6 +385,11 @@ void DialViewGroup::CoverEnd(bool isCovered) void DialViewGroup::OnActive(void) { + MainPresenterSample* mainPresenter = MainPresenterSample::GetInstance(); + if ((mainPresenter == nullptr) || (mainPresenter->GetMainPresenterState() != MainPresenterState::RESUME)) { + return; + } + if (video_ != nullptr) { if (video_->IsPaused()) { video_->ResumePlay(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp index 447857b9c..5f3d0bd9a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp @@ -374,10 +374,7 @@ static void AudioDn(void) // 建立音频下行通路 AudioDnStart(); - if (g_audioState == AUDIO_STREAM_START_DN) { - // 同步音量 - SyncVolume(); - } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[AudioDn] audioState:%d", g_audioState); } @@ -648,6 +645,8 @@ static void ScoStateChanged(const bd_addr_t &bdAddr, hfp_sco_connect_state_t sta } break; case HFP_SCO_STATE_CONNECTED: + // 同步音量 + SyncVolume(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoStateChanged] SCO connected!"); break; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp index 417e91da3..8fb0336cb 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp @@ -63,6 +63,9 @@ void notify_screen_on_event(void) callback(SCREEN_STATUS_ON); } ChangeToHomeView(); + if (GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::NativeAbility::GetInstance().ResumeSlice(); // ensure that don't resume twice if switch to home + } } void notify_screen_off_event(void) @@ -70,6 +73,9 @@ void notify_screen_off_event(void) for (auto callback : g_callback) { callback(SCREEN_STATUS_OFF); } + if (GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::NativeAbility::GetInstance().PauseSlice(); + } } void set_back_to_home_interval(uint32_t time_sec) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/test_case_list_adapter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/test_case_list_adapter.cpp index 6e8b19239..d2161b62d 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/test_case_list_adapter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/test_case_list_adapter.cpp @@ -85,13 +85,13 @@ public: rootContainer->Add(tempView); g_keyListener = RootView::GetInstance()->GetOnKeyActListener(); RootView::GetInstance()->SetOnKeyActListener(nullptr); - if (backBtn_ == nullptr) { - backBtn_ = new TransparentBackButton(); - backBtn_->SetPosition(0, 202, 50, 50); // 0: x position, 202: y position, 50: width and height - } - backBtn_->SetViewId(view.GetViewId()); - rootContainer->Add(backBtn_); } + if (backBtn_ == nullptr) { + backBtn_ = new TransparentBackButton(); + backBtn_->SetPosition(0, 202, 50, 50); // 0: x position, 202: y position, 50: width and height + } + backBtn_->SetViewId(view.GetViewId()); + rootContainer->Add(backBtn_); rootContainer->Invalidate(); return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp b/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp index 917e5b57c..ec06b8da7 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp @@ -32,8 +32,10 @@ #include "ui_test_hexagons_list/ui_test_hexagons_list.h" #include "ui_test_video_play/ui_test_video_play.h" #include "ui_test_coverflow/ui_test_coverflow.h" +#include "ui_test_slipflow/ui_test_slipflow.h" #include "ui_test_kaleidoscope/ui_test_kaleidoscope.h" #include "ui_test_roller_view/ui_test_roller_view.h" +#include "ui_test_emoji/ui_test_emoji.h" namespace OHOS { void UITestGroup::AddTestCase(TestCaseInfo testCaseInfo) @@ -59,6 +61,7 @@ void UITestGroup::SetUpTestCase() testCaseList_->PushBack(TestCaseInfo{"消息", new UITestMessage()}); testCaseList_->PushBack(TestCaseInfo{"呼吸效果", new UITestBreath()}); testCaseList_->PushBack(TestCaseInfo{"覆盖流", new UITestCoverflow()}); + testCaseList_->PushBack(TestCaseInfo{"滑动流", new UITestSlipflow()}); testCaseList_->PushBack(TestCaseInfo{"万花筒", new UITestKaleidoscope()}); testCaseList_->PushBack(TestCaseInfo{"滚筒", new UITestRollerView()}); @@ -69,6 +72,7 @@ void UITestGroup::SetUpTestCase() #if ENABLE_SOFT_KEYBOARD testCaseList_->PushBack(TestCaseInfo{"软键盘", new UITestKeyboard()}); #endif + testCaseList_->PushBack(TestCaseInfo{"表情包显示", new UITestEmoji()}); testCaseList_->PushBack(TestCaseInfo{"视频播放", new UITestVideoPlay()}); testCaseList_->PushBack(TestCaseInfo{"足球效果", new UITestIcosahedron()}); } diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 5e70121d7..17c37cf75 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -6,16 +6,6 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/key/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits @@ -26,15 +16,7 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext - ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audio_player/interfaces/kits - ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiomanager - ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiocommon ${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}/middleware/utils/fs/include/fs - ${ROOT_DIR}/include/middleware/services/bts/br - ${ROOT_DIR}/include/middleware/services/bts/common ) set(SOURCES 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 9d0ead17f..62a5c5173 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 f692a4e73..2b5b7beb7 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 a385e03bf..5cacaef02 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 b2689b410..7db680c24 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/msg_center_customer.h b/code/sdk/application/wearable/service/msg_center/include/msg_center_customer.h new file mode 100644 index 000000000..b150c522a --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/msg_center_customer.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) CompanyNameMagicTag. + * 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. + */ + +#ifndef MSG_CENTER_CUSTOMER_H +#define MSG_CENTER_CUSTOMER_H + +#include +#include "service.h" +#include "iunknown.h" +#include "broadcast_feature.h" +#include "graphic_service.h" +#include "jsi/jsi_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef JS_ENABLE +void StartJsApp(char *bundleName); +void StopJsApp(char *bundleName); +void MsgCenterReportBtStatusToJS(uint16_t msgId); +#endif + +#ifdef __cplusplus +} +#endif +#endif // MSG_CENTER_CUSTOMER_H 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 65aadbae7..4dca29565 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 @@ -23,6 +23,9 @@ #include "element_name.h" #include "want.h" #include "msg_center.h" +#include "msg_center_msg.h" +#include "msg_center_protocol.h" +#include "baidumap.h" #include "common_def.h" namespace OHOS { @@ -206,6 +209,76 @@ bool MsgCenterNotifyProc(const Topic topic, Request* req) return false; } +#ifdef JS_ENABLE +void StartJsApp(char *bundleName) +{ + ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); + if (topAbility == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "topAbility is null"); + return; + } + + if (strcmp(topAbility->bundleName, bundleName) == 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is active", bundleName); + return; + } + // If the alarm notification is being processed, we need to disable the alarm notification first. + if (OHOS::NotificationManager::GetInstance()->GetNotifyPriority() == PRIORITY_TWO && + OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Alarm notification needs to be disabled first."); + AlarmClockModel::GetInstance()->AlarmGetClockNum(); + OHOS::AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); + OHOS::NotificationManager::GetInstance()->StopNotify(); + } + Want *want = new Want(); + memset_s(want, sizeof(Want), 0, sizeof(Want)); + + ElementName startElement = {}; + startElement.abilityName = (char *)"default"; + startElement.bundleName = bundleName; + startElement.deviceId = nullptr; + SetWantElement(want, startElement); + + StartAbility(want); + + delete want; +} + +void StopJsApp(char *bundleName) +{ + ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); + if (topAbility == nullptr) { + WEARABLE_LOGE(HILOG_MODULE_AAFWK, "topAbility is null"); + return; + } + + if (strcmp(topAbility->bundleName, bundleName) != 0) { + WEARABLE_LOGE(HILOG_MODULE_AAFWK, "%s is not top active", bundleName); + return; + } + + int token = 0; + OHOS::AbilityMsClient::GetInstance().TerminateAbility(token); +} + +void MsgCenterReportBtStatusToJS(uint16_t msgId) +{ + ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); + if (!(elementName != nullptr && strcmp(elementName->bundleName, "com.huawei.launcher") != 0)) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "JS is not on top, ignore report"); + return; + } + + if (msgId == BT_DISCONNECTED_TO_MSGCENTER) { + BaidumapSendMsgToJS("0", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED); + } else if (msgId == BT_CONNECTED_TO_MSGCENTER) { + BaidumapSendMsgToJS("1", MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED); + } else { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "unexpected msgId %d", msgId); + } +} +#endif + #ifdef __cplusplus } #endif diff --git a/code/sdk/application/wstp/at_service/graphic/sample/gpu_sample.c b/code/sdk/application/wstp/at_service/graphic/sample/gpu_sample.c index 5f7a6cb93..4f1a92d11 100644 --- a/code/sdk/application/wstp/at_service/graphic/sample/gpu_sample.c +++ b/code/sdk/application/wstp/at_service/graphic/sample/gpu_sample.c @@ -250,6 +250,28 @@ static td_void wstp_gpu_screen_cap(int argc, const char *argv[]) } } +static td_void dfx_hide_layer_proc(int argc, const char *argv[]) +{ + if (argc < 1) { + printf("need input layer_id: 0/1\n"); + return; + } + + td_u32 layer_id = (td_u32)strtoul(argv[0], TD_NULL, 10); /* 10: index */ + uapi_dpu_hide_layer(layer_id); +} + +static td_void dfx_show_layer_proc(int argc, const char *argv[]) +{ + if (argc < 1) { + printf("need input layer_id: 0/1\n"); + return; + } + + td_u32 layer_id = (td_u32)strtoul(argv[0], TD_NULL, 10); /* 10: index */ + uapi_dpu_show_layer(layer_id); +} + td_void wstp_gpu_sample_process(int argc, char *argv[]) { if (argc < 1) { @@ -264,6 +286,10 @@ td_void wstp_gpu_sample_process(int argc, char *argv[]) wstp_gpu_screen_cap(argc - 1, argv + 1); } else if (strcmp((char *)argv[0], "dpu_proc") == 0) { dfx_get_proc_info(argc - 1, argv + 1); + } else if (strcmp((char *)argv[0], "dpu_hide") == 0) { + dfx_hide_layer_proc(argc - 1, argv + 1); + } else if (strcmp((char *)argv[0], "dpu_show") == 0) { + dfx_show_layer_proc(argc - 1, argv + 1); } else if (strcmp((char *)argv[0], "dpu_print") == 0) { dfx_dpu_print(argc - 1, argv + 1); } else if (strcmp((char *)argv[0], "dpu_save_fb") == 0) { diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index c1ca9d63e..daa0411db 100644 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -26,7 +26,7 @@ target = { 'pm_service', 'pm_brandy', 'cmn_header', 'at_cmd', 'graphic_at_service', 'app_at_service', 'audio_at_service', 'media_at_service', 'bt_manager_at_service', "audio_proc", "audio_dump", "audio_probe", "gpu_proc", 'bts_header'], - 'ram_component_set': ['bgh', 'media_mini', 'gpu', 'graphic_lvgl_mini', 'dfx_set'], + 'ram_component_set': ['bgh', 'media_mini', 'gpu', 'graphic_lvgl_mini', 'bgh_audio', 'dfx_set'], 'image_analysis': True, 'dsp_version': 'mini', 'packet': True, diff --git a/code/sdk/build/config/target_config/brandy/param_sector/param_sector_16M.json b/code/sdk/build/config/target_config/brandy/param_sector/param_sector_16M.json new file mode 100644 index 000000000..bd4ec2fc0 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/param_sector/param_sector_16M.json @@ -0,0 +1,58 @@ +{ + "Partition_Tbl":{ + "image_id" : "0x4B87A52D", + "stru_ver" : "0x00010000", + "version" : "0x00000000", + "param_info_description" : [ + "Address Constraints: flash type must fill with relative address, RAM regions must fill with absolute address.", + "Item ID Constraints: ssb type: 0x00 ~ 0x0F, Relative address, Size", + " root public key and signature: 0x10 ~ 0x1F, Relative address, Size", + " firmware on flash: 0x20 ~ 0x2F, Relative address, Size", + " data on flash: 0x30 ~ 0x3F, Relative address, Size", + + "Fixed item id: 0x00: ssb", + " 0x01: ssb_backup", + " 0x10: configure RootPubKey", + " 0x11: signature certificate", + " 0x12: ssb image signature", + " 0x13: signature certificate backup", + " 0x14: ssb image backup signature", + " 0x15: algorithm signature", + " 0x16: recovery signature", + " 0x17: bt_image signature", + " 0x18: dsp_main_image signature", + " 0x19: dsp_overlay_image signature", + " 0x1A: acpu_image signature", + " 0x20: recovery", + " 0x21: bt_image", + " 0x22: dsp_main_image", + " 0x23: dsp_overlay_image", + " 0x24: acpu_image", + " 0x30: nv_data", + " 0x31: fota_data" + ], + "param_info" : [ + ["0x00", "0x00000000", "0x00020000"], + ["0x01", "0x00020000", "0x00020000"], + ["0x10", "0x00040000", "0x00001000"], + ["0x11", "0x00041000", "0x00001000"], + ["0x12", "0x00042000", "0x00001000"], + ["0x13", "0x00043000", "0x00001000"], + ["0x14", "0x00044000", "0x00001000"], + ["0x15", "0x00045000", "0x00001000"], + ["0x16", "0x00046000", "0x00001000"], + ["0x17", "0x00047000", "0x00001000"], + ["0x18", "0x00048000", "0x00001000"], + ["0x19", "0x00049000", "0x00001000"], + ["0x1a", "0x0004A000", "0x00001000"], + ["0x20", "0x00B80000", "0x00100000"], + ["0x21", "0x00090000", "0x00070000"], + ["0x22", "0x00100000", "0x000C0000"], + ["0x23", "0x001C0000", "0x001C0000"], + ["0x24", "0x00380000", "0x00800000"], + ["0x30", "0x00C80000", "0x00004000"], + ["0x31", "0x00C84000", "0x00003000"] + ] + }, + "Output_file_prefix":"AIoT" +} diff --git a/code/sdk/build/script/cmake_builder.py b/code/sdk/build/script/cmake_builder.py index 1a22b3258..9e0eb9f00 100644 --- a/code/sdk/build/script/cmake_builder.py +++ b/code/sdk/build/script/cmake_builder.py @@ -157,7 +157,11 @@ class CMakeBuilder(BuildEnvironment): print("copy file.bin to application dir over!\n") if env.get('packet'): - self.pack_fwpkg(env.get('chip'), target) + defines = env.get("defines") + if "CFG_FLASH_SIZE=16" in defines: + self.pack_fwpkg(env.get('chip'), target, "0x1000000") + else: + self.pack_fwpkg(env.get('chip'), target, "0x800000") if not run_custom_cmd(env, target, 'build_post'): self.print_build_result(target, 1) @@ -363,11 +367,11 @@ class CMakeBuilder(BuildEnvironment): print(f"ERROR! :{bin1} is not same with {bin2}") sys.exit(1) - def pack_fwpkg(self, chip, target_name): + def pack_fwpkg(self, chip, target_name, flash_size): # bin packet all in one packet_script_path = os.path.join(pkg_tools_path, 'packet.py') print("packet ing...") - errcode = exec_shell([self.python_path, packet_script_path, chip, target_name], None, True) + errcode = exec_shell([self.python_path, packet_script_path, chip, target_name, flash_size], None, True) if errcode != 0: print("packet error!") self.print_build_result(target_name, errcode) diff --git a/code/sdk/drivers/boards/brandy_evb/memory_config/include/flash_16M.h b/code/sdk/drivers/boards/brandy_evb/memory_config/include/flash_16M.h new file mode 100644 index 000000000..adf6a5125 --- /dev/null +++ b/code/sdk/drivers/boards/brandy_evb/memory_config/include/flash_16M.h @@ -0,0 +1,183 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2022-2023. All rights reserved. + * Description: Default memory configurations + * Author: @CompanyNameTag + */ + +#ifndef FLASH_16M_H +#define FLASH_16M_H + +/* + * ********************* FLASH ALLOCATION ********************* + * Flash is shared between the cores, and also handles a limited number of + * non-volatile storage areas. + * + * Flash is split into 2 main areas + * IMAGE Area + * Managed by the BT core + * This contains, in order from the bottom of Flash: + * SSB - SSB image starting at the bottom of flash. Variable size depending on the SSB on the chip that + * the package is loaded on. The values in this file only apply to the SSB built with this file. + * RECOVERY_Image - starts in the page after the SSB. + * BT_Image - starts in the page after the RECOVERY_Image + * DSP_Image - starts in the page after the BT_Image + * APP_Image - starts in the page after the DSP_Image + * System On-demand region - dynamically allocated flash for FOTA etc + * NV Area + * Ends at the last page of flash, is configurable in size above a minimum allocation. + * NV Area, of 12 pages, is allocated, from the lowest address: + * 8 pages of general use (pages are not fixed and self-identifying), consisting of + * 1 Page for Asset Store defragmentation + * 3 pages for Asset Store + * 2 Pages for App and DSP Core KV defragmentation + * 1 page for DSP Core KV + * 1 page for App Core KV + * 2 pages for BT core use (last 2 pages in Flash) + * 1 page for BT Core KV + * 1 page for BT Core KV defragmentation + */ + +#define FLASH_START 0x70000000 +#define FLASH_LENGTH 0x1000000 +#define FLASH_MAX_END (FLASH_START + FLASH_LENGTH) + +#define FLASH_PAGE_SIZE 4096 +/* APP ITCM config */ +#define MCU_ITCM_END (APP_ITCM_ORIGIN + APP_ITCM_LENGTH) + +#define SSB_BOOT_RAM_ORIGIN APP_ITCM_ORIGIN +#define SSB_BOOT_RAM_LENGTH APP_ITCM_LENGTH + +/* ----------------------------------------------------------------------------------------------------------------- */ +/* IMAGE Area Defines */ +/* MCU SSB Region */ +#define SSB_FLASH_REGION_PAGES (SSB_IMAGE_PAGES + 5) +#define KV_PAGES 0 +#define SSB_FLASH_REGION_START (FLASH_START) +#define SSB_FLASH_REGION_LENGTH (SSB_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define SSB_VECTORS_LOAD_ORIGIN (SSB_FLASH_REGION_START) +#define SSB_VERSION_LOAD_ORIGIN (SSB_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) +#define SSB_CHANGEID_LOAD_ORIGIN (SSB_VERSION_LOAD_ORIGIN + VERSION_LENGTH) + +#define SSB_PROGRAM_ORIGIN (SSB_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) +#define SSB_PROGRAM_LENGTH ((SSB_FLASH_REGION_LENGTH) - (APP_VECTORS_LENGTH + VERSION_LENGTH + CHANGE_ID_LENGTH)) + +/* MCU SSB BACK-UP Region */ +#define SSB_BACKUP_FLASH_REGION_PAGES 32 +#define SSB_BACKUP_FLASH_REGION_START (SSB_FLASH_REGION_START + SSB_FLASH_REGION_LENGTH + KV_PAGES * FLASH_PAGE_SIZE) +#define SSB_BACKUP_FLASH_REGION_LENGTH (SSB_BACKUP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* SEC_BOOT Region for Signature Certificate */ +#define SEC_BOOT_FLASH_REGION_PAGES 15 +#define SEC_BOOT_FLASH_REGION_START (SSB_BACKUP_FLASH_REGION_START + SSB_BACKUP_FLASH_REGION_LENGTH) +#define SEC_BOOT_FLASH_REGION_LENGTH (SEC_BOOT_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define PARTITION_TABLE_REGSION_PAGE 1 +#define PARTITION_TABLE_REGION_START (SEC_BOOT_FLASH_REGION_START + SEC_BOOT_FLASH_REGION_LENGTH) +#define PARTITION_TABLE_REGION_LENGTH (PARTITION_TABLE_REGSION_PAGE * FLASH_PAGE_SIZE) + +/* DTB Region */ +#define DTB_FLASH_REGION_PAGES (DTB_IMAGE_PAGES) +#define DTB_FLASH_REGION_START (PARTITION_TABLE_REGION_START + PARTITION_TABLE_REGION_LENGTH) +#define DTB_FLASH_REGION_LENGTH (DTB_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* RESERVE Region */ +#define RESERVE_FLASH_REGION_PAGES (RESERVE_IMAGE_PAGES) +#define RESERVE_FLASH_REGION_START (DTB_FLASH_REGION_START + DTB_FLASH_REGION_LENGTH) +#define RESERVE_FLASH_REGION_LENGTH (RESERVE_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* BT Region */ +#define BT_FLASH_REGION_PAGES (BT_IMAGE_PAGES) +#define BT_FLASH_REGION_START (RESERVE_FLASH_REGION_START + RESERVE_FLASH_REGION_LENGTH) +#define BT_FLASH_REGION_LENGTH (BT_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define BT_BUILD_INFO_ORIGIN (BT_FLASH_REGION_START) +#define BT_VECTORS_LOAD_ORIGIN (BT_BUILD_INFO_ORIGIN + BUILD_INFO_LENGRH) +#define BT_VERSION_LOAD_ORIGIN (BT_VECTORS_LOAD_ORIGIN + BT_VECTORS_LENGTH) +#define BT_CHANGEID_LOAD_ORIGIN (BT_VERSION_LOAD_ORIGIN + VERSION_LENGTH) +#define DSP_CHANGEID_LOAD_ORIGIN (BT_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) + +/* Fill 4 byte to align flash 8 byte */ +#define BT_PROGRAM_ORIGIN (DSP_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) +#define BT_PROGRAM_LENGTH ((BT_FLASH_REGION_LENGTH) - (BT_VECTORS_LENGTH + \ + VERSION_LENGTH + CHANGE_ID_LENGTH + CHANGE_ID_LENGTH)) + +/* DSP Region */ +#define DSP_FLASH_REGION_PAGES (HIFI0_IMAGE_PAGES) +#define DSP_FLASH_REGION_START (BT_FLASH_REGION_START + BT_FLASH_REGION_LENGTH) +#define DSP_FLASH_REGION_LENGTH (DSP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* DSP1 Region */ +#define DSP_CODEC_FLASH_REGION_PAGES (HIFI0_CODEC_PAGES) +#define DSP_CODEC_FLASH_REGION_START (DSP_FLASH_REGION_START + DSP_FLASH_REGION_LENGTH) +#define DSP_CODEC_FLASH_REGION_LENGTH (DSP_CODEC_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* APP Region */ +#define APP_FLASH_REGION_PAGES (APP_IMAGE_PAGES) +#define APP_FLASH_REGION_START (DSP_CODEC_FLASH_REGION_START + DSP_CODEC_FLASH_REGION_LENGTH) +#define APP_FLASH_REGION_LENGTH (APP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* RECOVERY Region */ +#define RECOVERY_FLASH_REGION_PAGES (RECOVERY_IMAGE_PAGES) +#define RECOVERY_FLASH_REGION_START (APP_FLASH_REGION_START + APP_FLASH_REGION_LENGTH) +#define RECOVERY_FLASH_REGION_LENGTH (RECOVERY_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define RECOVERY_VECTORS_LOAD_ORIGIN (RECOVERY_FLASH_REGION_START) +#define RECOVERY_VERSION_LOAD_ORIGIN (RECOVERY_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) +#define RECOVERY_CHANGEID_LOAD_ORIGIN (RECOVERY_VERSION_LOAD_ORIGIN + VERSION_LENGTH) + +#define RECOVERY_PROGRAM_ORIGIN (RECOVERY_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) +#define RECOVERY_PROGRAM_LENGTH ((RECOVERY_FLASH_REGION_LENGTH) - \ + (APP_VECTORS_LENGTH + VERSION_LENGTH + CHANGE_ID_LENGTH)) + +/* NV data Region */ +#define NV_FLASH_REGION_PAGES (NV_IMAGE_PAGES) +#define NV_FLASH_REGION_START (RECOVERY_FLASH_REGION_START + RECOVERY_FLASH_REGION_LENGTH) +#define NV_FLASH_REGION_LENGTH (NV_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* Fota data Region */ +#define FOTA_FLASH_REGION_PAGES (FOTA_IMAGE_PAGES) +#define FOTA_FLASH_REGION_START (NV_FLASH_REGION_START + NV_FLASH_REGION_LENGTH) +#define FOTA_FLASH_REGION_LENGTH (FOTA_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define APP_VECTORS_LOAD_ORIGIN (APP_FLASH_REGION_START) +#define APP_VERSION_LOAD_ORIGIN (APP_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) + +#define APP_PROGRAM_ORIGIN (APP_VERSION_LOAD_ORIGIN + VERSION_LENGTH) +#define APP_PROGRAM_LENGTH ((APP_FLASH_REGION_LENGTH) - (APP_VECTORS_LENGTH + VERSION_LENGTH)) + +/* cores image flash region start */ +#define FLASH_CORE_IMAGES_START (FLASH_START + SSB_FLASH_REGION_LENGTH + SSB_BACKUP_FLASH_REGION_LENGTH + \ + SEC_BOOT_FLASH_REGION_LENGTH + \ + KV_PAGES * FLASH_PAGE_SIZE + PARTITION_TABLE_REGION_LENGTH) +/* ----------------------------------------------------------------------------------------------------------------- */ +/* KV Region Defines */ +/* Minimum System Configuration pages in FLASH reserved */ +#define SYSTEM_RESERVED_FLASH_PAGES 0 +/* Minimum reserved Non Volatile storage + Config Data. */ +#define FLASH_RESERVED_LENGTH (SYSTEM_RESERVED_FLASH_PAGES * FLASH_PAGE_SIZE) + +/* + * ********************* SEC BOOT REGION ********************* + */ +#define MCU_ROOT_PUBKEY_START SEC_BOOT_FLASH_REGION_START +#define MCU_SUB_PUBKEY_START (MCU_ROOT_PUBKEY_START + FLASH_PAGE_SIZE) +#define MCU_SSB_IMAGE_SIGN_START (MCU_SUB_PUBKEY_START + FLASH_PAGE_SIZE) +#define MCU_SUB_PUBKEY_BACKUP_START (MCU_SSB_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_SSB_IMAGE_SIGN_BACKUP_START (MCU_SUB_PUBKEY_BACKUP_START + FLASH_PAGE_SIZE) + +#define MCU_SEC_BOOT_SIGN_BACKUP_START MCU_SUB_PUBKEY_BACKUP_START +#define MCU_SEC_BOOT_SIGN_BACKUP_LEN (2 * FLASH_PAGE_SIZE) + +#define MCU_CFCT_START (MCU_SEC_BOOT_SIGN_BACKUP_START + MCU_SEC_BOOT_SIGN_BACKUP_LEN) +#define MCU_CFCT_LEN FLASH_PAGE_SIZE + +#define MCU_RECOVERY_IMAGE_SIGN_START (MCU_CFCT_START + MCU_CFCT_LEN) +#define MCU_BT_IMAGE_SIGN_START (MCU_RECOVERY_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_DSP_IMAGE_SIGN_START (MCU_BT_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_DSP1_IMAGE_SIGN_START (MCU_DSP_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_APP_IMAGE_SIGN_START (MCU_DSP1_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_PARTITION_TABLE_SIGN_START (MCU_APP_IMAGE_SIGN_START + FLASH_PAGE_SIZE) + +#endif \ No newline at end of file diff --git a/code/sdk/drivers/boards/brandy_evb/memory_config/include/flash_8M.h b/code/sdk/drivers/boards/brandy_evb/memory_config/include/flash_8M.h new file mode 100644 index 000000000..f616baf37 --- /dev/null +++ b/code/sdk/drivers/boards/brandy_evb/memory_config/include/flash_8M.h @@ -0,0 +1,183 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2022-2023. All rights reserved. + * Description: Default memory configurations + * Author: @CompanyNameTag + */ + +#ifndef FLASH_8M_H +#define FLASH_8M_H + +/* + * ********************* FLASH ALLOCATION ********************* + * Flash is shared between the cores, and also handles a limited number of + * non-volatile storage areas. + * + * Flash is split into 2 main areas + * IMAGE Area + * Managed by the BT core + * This contains, in order from the bottom of Flash: + * SSB - SSB image starting at the bottom of flash. Variable size depending on the SSB on the chip that + * the package is loaded on. The values in this file only apply to the SSB built with this file. + * RECOVERY_Image - starts in the page after the SSB. + * BT_Image - starts in the page after the RECOVERY_Image + * DSP_Image - starts in the page after the BT_Image + * APP_Image - starts in the page after the DSP_Image + * System On-demand region - dynamically allocated flash for FOTA etc + * NV Area + * Ends at the last page of flash, is configurable in size above a minimum allocation. + * NV Area, of 12 pages, is allocated, from the lowest address: + * 8 pages of general use (pages are not fixed and self-identifying), consisting of + * 1 Page for Asset Store defragmentation + * 3 pages for Asset Store + * 2 Pages for App and DSP Core KV defragmentation + * 1 page for DSP Core KV + * 1 page for App Core KV + * 2 pages for BT core use (last 2 pages in Flash) + * 1 page for BT Core KV + * 1 page for BT Core KV defragmentation + */ + +#define FLASH_START 0x70000000 +#define FLASH_LENGTH 0x800000 +#define FLASH_MAX_END (FLASH_START + FLASH_LENGTH) + +#define FLASH_PAGE_SIZE 4096 +/* APP ITCM config */ +#define MCU_ITCM_END (APP_ITCM_ORIGIN + APP_ITCM_LENGTH) + +#define SSB_BOOT_RAM_ORIGIN APP_ITCM_ORIGIN +#define SSB_BOOT_RAM_LENGTH APP_ITCM_LENGTH + +/* ----------------------------------------------------------------------------------------------------------------- */ +/* IMAGE Area Defines */ +/* MCU SSB Region */ +#define SSB_FLASH_REGION_PAGES (SSB_IMAGE_PAGES + 5) +#define KV_PAGES 0 +#define SSB_FLASH_REGION_START (FLASH_START) +#define SSB_FLASH_REGION_LENGTH (SSB_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define SSB_VECTORS_LOAD_ORIGIN (SSB_FLASH_REGION_START) +#define SSB_VERSION_LOAD_ORIGIN (SSB_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) +#define SSB_CHANGEID_LOAD_ORIGIN (SSB_VERSION_LOAD_ORIGIN + VERSION_LENGTH) + +#define SSB_PROGRAM_ORIGIN (SSB_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) +#define SSB_PROGRAM_LENGTH ((SSB_FLASH_REGION_LENGTH) - (APP_VECTORS_LENGTH + VERSION_LENGTH + CHANGE_ID_LENGTH)) + +/* MCU SSB BACK-UP Region */ +#define SSB_BACKUP_FLASH_REGION_PAGES 32 +#define SSB_BACKUP_FLASH_REGION_START (SSB_FLASH_REGION_START + SSB_FLASH_REGION_LENGTH + KV_PAGES * FLASH_PAGE_SIZE) +#define SSB_BACKUP_FLASH_REGION_LENGTH (SSB_BACKUP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* SEC_BOOT Region for Signature Certificate */ +#define SEC_BOOT_FLASH_REGION_PAGES 15 +#define SEC_BOOT_FLASH_REGION_START (SSB_BACKUP_FLASH_REGION_START + SSB_BACKUP_FLASH_REGION_LENGTH) +#define SEC_BOOT_FLASH_REGION_LENGTH (SEC_BOOT_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define PARTITION_TABLE_REGSION_PAGE 1 +#define PARTITION_TABLE_REGION_START (SEC_BOOT_FLASH_REGION_START + SEC_BOOT_FLASH_REGION_LENGTH) +#define PARTITION_TABLE_REGION_LENGTH (PARTITION_TABLE_REGSION_PAGE * FLASH_PAGE_SIZE) + +/* DTB Region */ +#define DTB_FLASH_REGION_PAGES (DTB_IMAGE_PAGES) +#define DTB_FLASH_REGION_START (PARTITION_TABLE_REGION_START + PARTITION_TABLE_REGION_LENGTH) +#define DTB_FLASH_REGION_LENGTH (DTB_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* RECOVERY Region */ +#define RECOVERY_FLASH_REGION_PAGES (RECOVERY_IMAGE_PAGES) +#define RECOVERY_FLASH_REGION_START (DTB_FLASH_REGION_START + DTB_FLASH_REGION_LENGTH) +#define RECOVERY_FLASH_REGION_LENGTH (RECOVERY_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define RECOVERY_VECTORS_LOAD_ORIGIN (RECOVERY_FLASH_REGION_START) +#define RECOVERY_VERSION_LOAD_ORIGIN (RECOVERY_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) +#define RECOVERY_CHANGEID_LOAD_ORIGIN (RECOVERY_VERSION_LOAD_ORIGIN + VERSION_LENGTH) + +#define RECOVERY_PROGRAM_ORIGIN (RECOVERY_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) +#define RECOVERY_PROGRAM_LENGTH ((RECOVERY_FLASH_REGION_LENGTH) - \ + (APP_VECTORS_LENGTH + VERSION_LENGTH + CHANGE_ID_LENGTH)) + +/* RESERVE Region */ +#define RESERVE_FLASH_REGION_PAGES (RESERVE_IMAGE_PAGES) +#define RESERVE_FLASH_REGION_START (RECOVERY_FLASH_REGION_START + RECOVERY_FLASH_REGION_LENGTH) +#define RESERVE_FLASH_REGION_LENGTH (RESERVE_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* BT Region */ +#define BT_FLASH_REGION_PAGES (BT_IMAGE_PAGES) +#define BT_FLASH_REGION_START (RESERVE_FLASH_REGION_START + RESERVE_FLASH_REGION_LENGTH) +#define BT_FLASH_REGION_LENGTH (BT_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define BT_BUILD_INFO_ORIGIN (BT_FLASH_REGION_START) +#define BT_VECTORS_LOAD_ORIGIN (BT_BUILD_INFO_ORIGIN + BUILD_INFO_LENGRH) +#define BT_VERSION_LOAD_ORIGIN (BT_VECTORS_LOAD_ORIGIN + BT_VECTORS_LENGTH) +#define BT_CHANGEID_LOAD_ORIGIN (BT_VERSION_LOAD_ORIGIN + VERSION_LENGTH) +#define DSP_CHANGEID_LOAD_ORIGIN (BT_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) + +/* Fill 4 byte to align flash 8 byte */ +#define BT_PROGRAM_ORIGIN (DSP_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) +#define BT_PROGRAM_LENGTH ((BT_FLASH_REGION_LENGTH) - (BT_VECTORS_LENGTH + \ + VERSION_LENGTH + CHANGE_ID_LENGTH + CHANGE_ID_LENGTH)) + +/* DSP Region */ +#define DSP_FLASH_REGION_PAGES (HIFI0_IMAGE_PAGES) +#define DSP_FLASH_REGION_START (BT_FLASH_REGION_START + BT_FLASH_REGION_LENGTH) +#define DSP_FLASH_REGION_LENGTH (DSP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* DSP1 Region */ +#define DSP_CODEC_FLASH_REGION_PAGES (HIFI0_CODEC_PAGES) +#define DSP_CODEC_FLASH_REGION_START (DSP_FLASH_REGION_START + DSP_FLASH_REGION_LENGTH) +#define DSP_CODEC_FLASH_REGION_LENGTH (DSP_CODEC_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* APP Region */ +#define APP_FLASH_REGION_PAGES (APP_IMAGE_PAGES) +#define APP_FLASH_REGION_START (DSP_CODEC_FLASH_REGION_START + DSP_CODEC_FLASH_REGION_LENGTH) +#define APP_FLASH_REGION_LENGTH (APP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* NV data Region */ +#define NV_FLASH_REGION_PAGES (NV_IMAGE_PAGES) +#define NV_FLASH_REGION_START (APP_FLASH_REGION_START + APP_FLASH_REGION_LENGTH) +#define NV_FLASH_REGION_LENGTH (NV_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +/* Fota data Region */ +#define FOTA_FLASH_REGION_PAGES (FOTA_IMAGE_PAGES) +#define FOTA_FLASH_REGION_START (NV_FLASH_REGION_START + NV_FLASH_REGION_LENGTH) +#define FOTA_FLASH_REGION_LENGTH (FOTA_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) + +#define APP_VECTORS_LOAD_ORIGIN (APP_FLASH_REGION_START) +#define APP_VERSION_LOAD_ORIGIN (APP_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) + +#define APP_PROGRAM_ORIGIN (APP_VERSION_LOAD_ORIGIN + VERSION_LENGTH) +#define APP_PROGRAM_LENGTH ((APP_FLASH_REGION_LENGTH) - (APP_VECTORS_LENGTH + VERSION_LENGTH)) + +/* cores image flash region start */ +#define FLASH_CORE_IMAGES_START (FLASH_START + SSB_FLASH_REGION_LENGTH + SSB_BACKUP_FLASH_REGION_LENGTH + \ + SEC_BOOT_FLASH_REGION_LENGTH + \ + KV_PAGES * FLASH_PAGE_SIZE + PARTITION_TABLE_REGION_LENGTH) +/* ----------------------------------------------------------------------------------------------------------------- */ +/* KV Region Defines */ +/* Minimum System Configuration pages in FLASH reserved */ +#define SYSTEM_RESERVED_FLASH_PAGES 0 +/* Minimum reserved Non Volatile storage + Config Data. */ +#define FLASH_RESERVED_LENGTH (SYSTEM_RESERVED_FLASH_PAGES * FLASH_PAGE_SIZE) + +/* + * ********************* SEC BOOT REGION ********************* + */ +#define MCU_ROOT_PUBKEY_START SEC_BOOT_FLASH_REGION_START +#define MCU_SUB_PUBKEY_START (MCU_ROOT_PUBKEY_START + FLASH_PAGE_SIZE) +#define MCU_SSB_IMAGE_SIGN_START (MCU_SUB_PUBKEY_START + FLASH_PAGE_SIZE) +#define MCU_SUB_PUBKEY_BACKUP_START (MCU_SSB_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_SSB_IMAGE_SIGN_BACKUP_START (MCU_SUB_PUBKEY_BACKUP_START + FLASH_PAGE_SIZE) + +#define MCU_SEC_BOOT_SIGN_BACKUP_START MCU_SUB_PUBKEY_BACKUP_START +#define MCU_SEC_BOOT_SIGN_BACKUP_LEN (2 * FLASH_PAGE_SIZE) + +#define MCU_CFCT_START (MCU_SEC_BOOT_SIGN_BACKUP_START + MCU_SEC_BOOT_SIGN_BACKUP_LEN) +#define MCU_CFCT_LEN FLASH_PAGE_SIZE + +#define MCU_RECOVERY_IMAGE_SIGN_START (MCU_CFCT_START + MCU_CFCT_LEN) +#define MCU_BT_IMAGE_SIGN_START (MCU_RECOVERY_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_DSP_IMAGE_SIGN_START (MCU_BT_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_DSP1_IMAGE_SIGN_START (MCU_DSP_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_APP_IMAGE_SIGN_START (MCU_DSP1_IMAGE_SIGN_START + FLASH_PAGE_SIZE) +#define MCU_PARTITION_TABLE_SIGN_START (MCU_APP_IMAGE_SIGN_START + FLASH_PAGE_SIZE) + +#endif \ No newline at end of file diff --git a/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config_common.h b/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config_common.h index f2316ac23..0bd5d254e 100644 --- a/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config_common.h +++ b/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config_common.h @@ -127,177 +127,19 @@ #endif /* - * ********************* FLASH ALLOCATION ********************* - * Flash is shared between the cores, and also handles a limited number of - * non-volatile storage areas. - * - * Flash is split into 2 main areas - * IMAGE Area - * Managed by the BT core - * This contains, in order from the bottom of Flash: - * SSB - SSB image starting at the bottom of flash. Variable size depending on the SSB on the chip that - * the package is loaded on. The values in this file only apply to the SSB built with this file. - * RECOVERY_Image - starts in the page after the SSB. - * BT_Image - starts in the page after the RECOVERY_Image - * DSP_Image - starts in the page after the BT_Image - * APP_Image - starts in the page after the DSP_Image - * System On-demand region - dynamically allocated flash for FOTA etc - * NV Area - * Ends at the last page of flash, is configurable in size above a minimum allocation. - * NV Area, of 12 pages, is allocated, from the lowest address: - * 8 pages of general use (pages are not fixed and self-identifying), consisting of - * 1 Page for Asset Store defragmentation - * 3 pages for Asset Store - * 2 Pages for App and DSP Core KV defragmentation - * 1 page for DSP Core KV - * 1 page for App Core KV - * 2 pages for BT core use (last 2 pages in Flash) - * 1 page for BT Core KV - * 1 page for BT Core KV defragmentation - */ - -#define FLASH_START 0x70000000 -#define FLASH_LENGTH 0x800000 -#define FLASH_MAX_END (FLASH_START + FLASH_LENGTH) - -#define FLASH_PAGE_SIZE 4096 -/* APP ITCM config */ -#define MCU_ITCM_END (APP_ITCM_ORIGIN + APP_ITCM_LENGTH) - -#define SSB_BOOT_RAM_ORIGIN APP_ITCM_ORIGIN -#define SSB_BOOT_RAM_LENGTH APP_ITCM_LENGTH - -/* ----------------------------------------------------------------------------------------------------------------- */ -/* IMAGE Area Defines */ -/* MCU SSB Region */ -#define SSB_FLASH_REGION_PAGES (SSB_IMAGE_PAGES + 5) -#define KV_PAGES 0 -#define SSB_FLASH_REGION_START (FLASH_START) -#define SSB_FLASH_REGION_LENGTH (SSB_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -#define SSB_VECTORS_LOAD_ORIGIN (SSB_FLASH_REGION_START) -#define SSB_VERSION_LOAD_ORIGIN (SSB_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) -#define SSB_CHANGEID_LOAD_ORIGIN (SSB_VERSION_LOAD_ORIGIN + VERSION_LENGTH) - -#define SSB_PROGRAM_ORIGIN (SSB_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) -#define SSB_PROGRAM_LENGTH ((SSB_FLASH_REGION_LENGTH) - (APP_VECTORS_LENGTH + VERSION_LENGTH + CHANGE_ID_LENGTH)) - -/* MCU SSB BACK-UP Region */ -#define SSB_BACKUP_FLASH_REGION_PAGES 32 -#define SSB_BACKUP_FLASH_REGION_START (SSB_FLASH_REGION_START + SSB_FLASH_REGION_LENGTH + KV_PAGES * FLASH_PAGE_SIZE) -#define SSB_BACKUP_FLASH_REGION_LENGTH (SSB_BACKUP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* SEC_BOOT Region for Signature Certificate */ -#define SEC_BOOT_FLASH_REGION_PAGES 15 -#define SEC_BOOT_FLASH_REGION_START (SSB_BACKUP_FLASH_REGION_START + SSB_BACKUP_FLASH_REGION_LENGTH) -#define SEC_BOOT_FLASH_REGION_LENGTH (SEC_BOOT_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -#define PARTITION_TABLE_REGSION_PAGE 1 -#define PARTITION_TABLE_REGION_START (SEC_BOOT_FLASH_REGION_START + SEC_BOOT_FLASH_REGION_LENGTH) -#define PARTITION_TABLE_REGION_LENGTH (PARTITION_TABLE_REGSION_PAGE * FLASH_PAGE_SIZE) - -/* DTB Region */ -#define DTB_FLASH_REGION_PAGES (DTB_IMAGE_PAGES) -#define DTB_FLASH_REGION_START (PARTITION_TABLE_REGION_START + PARTITION_TABLE_REGION_LENGTH) -#define DTB_FLASH_REGION_LENGTH (DTB_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* RECOVERY Region */ -#define RECOVERY_FLASH_REGION_PAGES (RECOVERY_IMAGE_PAGES) -#define RECOVERY_FLASH_REGION_START (DTB_FLASH_REGION_START + DTB_FLASH_REGION_LENGTH) -#define RECOVERY_FLASH_REGION_LENGTH (RECOVERY_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -#define RECOVERY_VECTORS_LOAD_ORIGIN (RECOVERY_FLASH_REGION_START) -#define RECOVERY_VERSION_LOAD_ORIGIN (RECOVERY_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) -#define RECOVERY_CHANGEID_LOAD_ORIGIN (RECOVERY_VERSION_LOAD_ORIGIN + VERSION_LENGTH) - -#define RECOVERY_PROGRAM_ORIGIN (RECOVERY_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) -#define RECOVERY_PROGRAM_LENGTH ((RECOVERY_FLASH_REGION_LENGTH) - \ - (APP_VECTORS_LENGTH + VERSION_LENGTH + CHANGE_ID_LENGTH)) - -/* RESERVE Region */ -#define RESERVE_FLASH_REGION_PAGES (RESERVE_IMAGE_PAGES) -#define RESERVE_FLASH_REGION_START (RECOVERY_FLASH_REGION_START + RECOVERY_FLASH_REGION_LENGTH) -#define RESERVE_FLASH_REGION_LENGTH (RESERVE_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* BT Region */ -#define BT_FLASH_REGION_PAGES (BT_IMAGE_PAGES) -#define BT_FLASH_REGION_START (RESERVE_FLASH_REGION_START + RESERVE_FLASH_REGION_LENGTH) -#define BT_FLASH_REGION_LENGTH (BT_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -#define BT_BUILD_INFO_ORIGIN (BT_FLASH_REGION_START) -#define BT_VECTORS_LOAD_ORIGIN (BT_BUILD_INFO_ORIGIN + BUILD_INFO_LENGRH) -#define BT_VERSION_LOAD_ORIGIN (BT_VECTORS_LOAD_ORIGIN + BT_VECTORS_LENGTH) -#define BT_CHANGEID_LOAD_ORIGIN (BT_VERSION_LOAD_ORIGIN + VERSION_LENGTH) -#define DSP_CHANGEID_LOAD_ORIGIN (BT_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) - -/* Fill 4 byte to align flash 8 byte */ -#define BT_PROGRAM_ORIGIN (DSP_CHANGEID_LOAD_ORIGIN + CHANGE_ID_LENGTH) -#define BT_PROGRAM_LENGTH ((BT_FLASH_REGION_LENGTH) - (BT_VECTORS_LENGTH + \ - VERSION_LENGTH + CHANGE_ID_LENGTH + CHANGE_ID_LENGTH)) - -/* DSP Region */ -#define DSP_FLASH_REGION_PAGES (HIFI0_IMAGE_PAGES) -#define DSP_FLASH_REGION_START (BT_FLASH_REGION_START + BT_FLASH_REGION_LENGTH) -#define DSP_FLASH_REGION_LENGTH (DSP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* DSP1 Region */ -#define DSP_CODEC_FLASH_REGION_PAGES (HIFI0_CODEC_PAGES) -#define DSP_CODEC_FLASH_REGION_START (DSP_FLASH_REGION_START + DSP_FLASH_REGION_LENGTH) -#define DSP_CODEC_FLASH_REGION_LENGTH (DSP_CODEC_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* APP Region */ -#define APP_FLASH_REGION_PAGES (APP_IMAGE_PAGES) -#define APP_FLASH_REGION_START (DSP_CODEC_FLASH_REGION_START + DSP_CODEC_FLASH_REGION_LENGTH) -#define APP_FLASH_REGION_LENGTH (APP_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* NV data Region */ -#define NV_FLASH_REGION_PAGES (NV_IMAGE_PAGES) -#define NV_FLASH_REGION_START (APP_FLASH_REGION_START + APP_FLASH_REGION_LENGTH) -#define NV_FLASH_REGION_LENGTH (NV_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -/* Fota data Region */ -#define FOTA_FLASH_REGION_PAGES (FOTA_IMAGE_PAGES) -#define FOTA_FLASH_REGION_START (NV_FLASH_REGION_START + NV_FLASH_REGION_LENGTH) -#define FOTA_FLASH_REGION_LENGTH (FOTA_FLASH_REGION_PAGES * FLASH_PAGE_SIZE) - -#define APP_VECTORS_LOAD_ORIGIN (APP_FLASH_REGION_START) -#define APP_VERSION_LOAD_ORIGIN (APP_VECTORS_LOAD_ORIGIN + APP_VECTORS_LENGTH) - -#define APP_PROGRAM_ORIGIN (APP_VERSION_LOAD_ORIGIN + VERSION_LENGTH) -#define APP_PROGRAM_LENGTH ((APP_FLASH_REGION_LENGTH) - (APP_VECTORS_LENGTH + VERSION_LENGTH)) - -/* cores image flash region start */ -#define FLASH_CORE_IMAGES_START (FLASH_START + SSB_FLASH_REGION_LENGTH + SSB_BACKUP_FLASH_REGION_LENGTH + \ - SEC_BOOT_FLASH_REGION_LENGTH + \ - KV_PAGES * FLASH_PAGE_SIZE + PARTITION_TABLE_REGION_LENGTH) -/* ----------------------------------------------------------------------------------------------------------------- */ -/* KV Region Defines */ -/* Minimum System Configuration pages in FLASH reserved */ -#define SYSTEM_RESERVED_FLASH_PAGES 0 -/* Minimum reserved Non Volatile storage + Config Data. */ -#define FLASH_RESERVED_LENGTH (SYSTEM_RESERVED_FLASH_PAGES * FLASH_PAGE_SIZE) - -/* - * ********************* SEC BOOT REGION ********************* - */ -#define MCU_ROOT_PUBKEY_START SEC_BOOT_FLASH_REGION_START -#define MCU_SUB_PUBKEY_START (MCU_ROOT_PUBKEY_START + FLASH_PAGE_SIZE) -#define MCU_SSB_IMAGE_SIGN_START (MCU_SUB_PUBKEY_START + FLASH_PAGE_SIZE) -#define MCU_SUB_PUBKEY_BACKUP_START (MCU_SSB_IMAGE_SIGN_START + FLASH_PAGE_SIZE) -#define MCU_SSB_IMAGE_SIGN_BACKUP_START (MCU_SUB_PUBKEY_BACKUP_START + FLASH_PAGE_SIZE) - -#define MCU_SEC_BOOT_SIGN_BACKUP_START MCU_SUB_PUBKEY_BACKUP_START -#define MCU_SEC_BOOT_SIGN_BACKUP_LEN (2 * FLASH_PAGE_SIZE) - -#define MCU_CFCT_START (MCU_SEC_BOOT_SIGN_BACKUP_START + MCU_SEC_BOOT_SIGN_BACKUP_LEN) -#define MCU_CFCT_LEN FLASH_PAGE_SIZE - -#define MCU_RECOVERY_IMAGE_SIGN_START (MCU_CFCT_START + MCU_CFCT_LEN) -#define MCU_BT_IMAGE_SIGN_START (MCU_RECOVERY_IMAGE_SIGN_START + FLASH_PAGE_SIZE) -#define MCU_DSP_IMAGE_SIGN_START (MCU_BT_IMAGE_SIGN_START + FLASH_PAGE_SIZE) -#define MCU_DSP1_IMAGE_SIGN_START (MCU_DSP_IMAGE_SIGN_START + FLASH_PAGE_SIZE) -#define MCU_APP_IMAGE_SIGN_START (MCU_DSP1_IMAGE_SIGN_START + FLASH_PAGE_SIZE) -#define MCU_PARTITION_TABLE_SIGN_START (MCU_APP_IMAGE_SIGN_START + FLASH_PAGE_SIZE) + * norflash 分区修改会导致已商用版本OTA失败,此处修改需谨慎 + * norflash修改请同时修改以下文件: + * 分区表配置: + * 16M:build\config\target_config\brandy\param_sector\param_sector_16M.json + * 8M:build\config\target_config\brandy\param_sector\param_sector.json + * 打包脚本: + * tools\pkg\chip_packet\brandy\packet.py +*/ +#if defined(CFG_FLASH_SIZE) && (CFG_FLASH_SIZE == 16) +#include "flash_16M.h" +#else +#include "flash_8M.h" +#endif /* * ********************* RAM ALLOCATION ********************* diff --git a/code/sdk/drivers/boards/brandy_evb/product/product_evb4_standard.h b/code/sdk/drivers/boards/brandy_evb/product/product_evb4_standard.h index 01676ca7c..b0f51d579 100644 --- a/code/sdk/drivers/boards/brandy_evb/product/product_evb4_standard.h +++ b/code/sdk/drivers/boards/brandy_evb/product/product_evb4_standard.h @@ -25,6 +25,15 @@ #else #define ENABLE_LOW_POWER NO #endif +#if defined(CFG_FLASH_SIZE) && (CFG_FLASH_SIZE == 16) +#define DTB_IMAGE_PAGES 0 +#define RECOVERY_IMAGE_PAGES 256 +#define RESERVE_IMAGE_PAGES 64 +#define BT_IMAGE_PAGES 112 +#define HIFI0_IMAGE_PAGES 192 +#define HIFI0_CODEC_PAGES 448 +#define APP_IMAGE_PAGES 2048 +#else #define DTB_IMAGE_PAGES 0 #define RECOVERY_IMAGE_PAGES 64 #define RESERVE_IMAGE_PAGES 0 @@ -32,6 +41,7 @@ #define HIFI0_IMAGE_PAGES 112 #define HIFI0_CODEC_PAGES 320 #define APP_IMAGE_PAGES 1353 +#endif #define NV_IMAGE_PAGES 4 #define FOTA_IMAGE_PAGES 3 #define FOTA_IMAGE_START 0x770000 diff --git a/code/sdk/drivers/drivers/driver/button/button.c b/code/sdk/drivers/drivers/driver/button/button.c index 2a65e79c6..6e0fb2a0c 100644 --- a/code/sdk/drivers/drivers/driver/button/button.c +++ b/code/sdk/drivers/drivers/driver/button/button.c @@ -55,6 +55,7 @@ timer_handle_t g_button_timer = {0}; timer_handle_t g_gpio_button_timer = {0}; button_info_t g_button_info = {0}; bool g_timer_is_running = false; +bool g_gpio_timer_is_running = false; msg_send_callback_t g_msg_send_cb = NULL; static const char* g_state_str[PRESSED_MAX] = { @@ -107,14 +108,14 @@ static void button_send_msg(uint8_t pin_group, button_press_state_t state) static void button_timer_start(void) { bool start = false; - if (!g_timer_is_running) { - g_timer_is_running = true; + if (!g_gpio_timer_is_running) { + g_gpio_timer_is_running = true; start = true; } if (start) { - uapi_rtc_stop(g_button_timer); - uapi_rtc_start(g_button_timer, BUTTON_TIMER_INTERVAL, button_debounced_timer_callback, 0); + uapi_rtc_stop(g_gpio_button_timer); + uapi_rtc_start(g_gpio_button_timer, BUTTON_TIMER_INTERVAL, button_debounced_timer_callback, 0); } } @@ -127,8 +128,8 @@ static void button_timer_start_check_released(void) } if (start) { - uapi_rtc_stop(g_gpio_button_timer); - uapi_rtc_start(g_gpio_button_timer, BUTTON_CHECK_RELEADSED, button_check_released_timer_callback, 0); + uapi_rtc_stop(g_button_timer); + uapi_rtc_start(g_button_timer, BUTTON_CHECK_RELEADSED, button_check_released_timer_callback, 0); } } @@ -214,7 +215,7 @@ static void button_debounced_handler(void) static void button_debounced_timer_callback(uint32_t data) { unused(data); - g_timer_is_running = false; + g_gpio_timer_is_running = false; button_debounced_handler(); diff --git a/code/sdk/include/middleware/services/bts/common/bts_def.h b/code/sdk/include/middleware/services/bts/common/bts_def.h index cd14ba170..3f13d861a 100644 --- a/code/sdk/include/middleware/services/bts/common/bts_def.h +++ b/code/sdk/include/middleware/services/bts/common/bts_def.h @@ -158,6 +158,31 @@ typedef struct { @else UUID字段。 @endif */ } bt_uuid_t; +/** + * @if Eng + * @brief Set BT_SERVICE_TASK priority. + * @par Set BT_SERVICE_TASK priority. + * @attention please invoke this function before @ref enable_bt_stack function is invoked. + * @param [in] task_priority task priority, range is 0 to 31, 0 is highest priority, 31 is lowest priority. + * @retval #ERRCODE_BT_SUCCESS Excute successfully. + * @retval #Other Error code, @ref errcode_bt_t + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief 设置BT_SERVICE_TASK任务优先级。 + * @par 设置BT_SERVICE_TASK任务优先级。 + * @attention 请在调用@ref enable_bt_stack函数前调用该函数。 + * @param [in] 任务优先级, 0为最大优先级,31为最小优先级. + * @retval #ERRCODE_BT_SUCCESS 执行成功。 + * @retval #Other 错误码, @ref errcode_bt_t + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_bt_t bts_set_service_task_priority(uint16_t task_priority); + /** * @} */ diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml index 814768b37..6f2125eb7 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml @@ -1,10 +1,10 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml index 616ce6daf..28ed32c4c 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml index f56cf39f9..fa5cf37a2 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.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/btsrv_task.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_task.c.xml index 7f8007ae6..8528e7ad3 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_task.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_task.c.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ 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 076b14e7e..a62c26346 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,8 +8,8 @@ - - + + diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml index 83155ae4e..49ddc91b0 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml @@ -1,11 +1,11 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml index 879879367..3b901a57d 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml index b28742c84..88a168085 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml index 1bdf5bd87..a7ee87dff 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.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/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 fdff0566e..4a02f3641 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 @@ -1,72 +1,72 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml index b988bc94b..28083bd5e 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml @@ -1,4 +1,4 @@ - - - + + + \ 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 2dca10644..8666eca75 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,52 +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/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 cf81c8609..a5a003547 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 @@ -3,5 +3,6 @@ - + + \ 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..3970f5004 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_icosahedron_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_icosahedron_view.cpp.xml index c474fb166..7b69562ed 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_icosahedron_view.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_icosahedron_view.cpp.xml @@ -1,2 +1,2 @@ - + \ 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_map_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_map_view.cpp.xml index ee2cc76b0..0a05ed538 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_map_view.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_map_view.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 2645a8d50..dfbff856e 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,12 @@ - - - - - - - - - - - + + + + + + + + + + + \ 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_slipflow_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_slipflow_view.cpp.xml new file mode 100644 index 000000000..9bd50c7f8 --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_slipflow_view.cpp.xml @@ -0,0 +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_transform_group.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_transform_group.cpp.xml index a9391cb37..31f789946 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_transform_group.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_transform_group.cpp.xml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml index 7f6cc4dac..703646e25 100644 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml @@ -1,4199 +1,493 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4214,190 +508,2992 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4461,30 +3557,175 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4492,142 +3733,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4635,81 +3784,935 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml index 1d994423b..8c40a46d5 100644 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml @@ -1,14 +1,14 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml index 6eb0daf48..426ed7d71 100644 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml @@ -1,12 +1,15 @@ - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_brandy_service.a index 5dcf2947a..2f7fe6886 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_sdk.a index 988e4d22b..931954ef0 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/ble/libbt_host_sdk.a differ 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 c923e8388..9d310fc9a 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 1d6ea9c6b..9c92fe590 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 6cff1f723..da0d58711 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/ble/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/libbt_host_brandy_service.a index c801ba331..b5b913e9e 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/libbt_host_sdk.a index ef91dfbdb..ec7c94afe 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/ble/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 e5a939067..4b79ee068 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 2588cf0ee..41fde51d6 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 66083eab8..9659fde30 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/ble/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/libbt_host_brandy_service.a index fc9e57338..7a6b67815 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/libbt_host_sdk.a index 2dfb4baa1..c36868d77 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/ble/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 new file mode 100644 index 000000000..cd93153fa Binary files /dev/null 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 765188d0b..831fb4bb6 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 586801171..e01c92c7e 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/dfx/include/log_def_gui.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h index eadd45120..79f1bf86f 100644 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h @@ -426,6 +426,7 @@ typedef enum { KALEIDOSCOPE_UTILS_CPP, UI_COVERFLOW_VIEW_CPP, UI_COVERFLOW_VIEW2_CPP, + UI_SLIPFLOW_VIEW_CPP, UI_ROLLER_VIEW_CPP, UI_ICOSAHEDRON_VIEW_CPP, UI_MAP_VIEW_CPP, diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h index 8b3f7e812..a2fdf075c 100644 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h @@ -134,6 +134,7 @@ typedef enum { CONSOLE_MODULE_CPP, DATE_TIME_FORMAT_MODULE_CPP, FEATURE_ABILITY_MODULE_CPP, + IMAGE_MODULE_CPP, INTL_MODULE_CPP, JSTEST_MODULE_CPP, LOCALIZATION_MODULE_CPP, diff --git a/code/sdk/middleware/chips/brandy/nv/include/nv_config.h b/code/sdk/middleware/chips/brandy/nv/include/nv_config.h index facd7a5f1..f053e883c 100644 --- a/code/sdk/middleware/chips/brandy/nv/include/nv_config.h +++ b/code/sdk/middleware/chips/brandy/nv/include/nv_config.h @@ -6,20 +6,22 @@ #ifndef NV_CONFIG_H #define NV_CONFIG_H +#include "memory_config.h" + #define NV_TASKS_MAX_NUM 64 /* 可支持的NV保存任务的最大数(多核系统使用) */ #define NV_NORMAL_KVALUE_MAX_LEN 4060 /* 普通NV的最大数据长度 */ #define NV_ENCRYPTED_KVALUE_MAX_LEN 4048 /* 加密NV的最大数据长度 */ /* Flash 物理地址起始和结束 */ -#define FLASH_PHYSICAL_ADDR_START 0x70000000 -#define FLASH_PHYSICAL_ADDR_END 0x80000000 +#define FLASH_PHYSICAL_ADDR_START (FLASH_START) +#define FLASH_PHYSICAL_ADDR_END (FLASH_START + FLASH_LENGTH) #define KV_PAGE_SIZE FLASH_PAGE_SIZE /* NV运行区默认起始地址(物理地址) */ -#define KV_STORE_START_ADDR (FLASH_PHYSICAL_ADDR_START + 0x7F9000) +#define KV_STORE_START_ADDR (NV_FLASH_REGION_START) /* NV运行区page数 */ -#define KV_STORE_DATA_PAGE_NUM 4 +#define KV_STORE_DATA_PAGE_NUM (NV_FLASH_REGION_PAGES) /* NV运行区默认长度(不包含备份区) */ #define KV_STORE_DATA_SIZE (KV_STORE_DATA_PAGE_NUM * KV_PAGE_SIZE) 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 98aad0f3c..92c8bb5bb 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 7e9664860..baf722076 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 233713761..85b431a68 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 dca10b6ad..7411120e2 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 61dc15b50..8059e516b 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 3af87ac26..768b5c0d6 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 43f524979..e430844cb 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 05af921d9..fc7c3a97c 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 f632565ca..500afae37 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 a1266400f..7b52b7767 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 15a174c0a..bddc5000d 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 66afa3e61..1ce97fedb 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 9d89ff0c0..4453319fa 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 3759f6229..c32a0544a 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/vau/list/vau_list.c b/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c index 2998aad7d..61021a3a7 100644 --- a/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c +++ b/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c @@ -344,6 +344,7 @@ static td_void vau_list_timeout_resume(td_void) } vau_mem_check_psram_addr(); + vau_dfx_proc_read(0, TD_NULL); #ifdef CONFIG_VAU_DFX_DEBUG if (vau_dfx_check_mask(VAU_DBG_MASK_PRINT_ERROR_REG)) { vau_hal_apb_print_all_reg(); diff --git a/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h b/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h index ebde7319c..d7600008a 100644 --- a/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h +++ b/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h @@ -179,4 +179,6 @@ #define DRAW_MAX_CNT 640 #endif +#define CAPABILITY_HW_SUPPORT_EMOJI 1 + #endif // GRAPHIC_HARDWARE_CONFIG_H 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 3668c7cef..99a7ae7e5 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 fae8c1299..8d6cd4b8b 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 bfd8fe068..ea88cf1ff 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 399cda1c8..0150b7e07 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 53db6957b..1b6dc9e3e 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 0d6d7233f..1bd2b56ac 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 708cf1c3f..a9b510bf7 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 a2b331d0a..6f95f71de 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 @@ -228,13 +228,14 @@ static int32_t AllocMem(const AllocInfo *info, BufferHandle **handle) } uint8_t *addr = LosAllocMem(pool, (uint32_t)(buffer->size)); - if ((pool == g_poolId) && (g_tryToFreeImgCallback != NULL)) { + if (((info->usage & HBM_USE_MEM_YUV) != HBM_USE_MEM_YUV) && + (pool == g_poolId) && (g_tryToFreeImgCallback != NULL)) { while (addr == NULL) { if (g_tryToFreeImgCallback()) { - DISP_LOGW("Success to free image during AllocMem size:%d\n", buffer->size); + 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:%d 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; } } 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 16185b033..d42e8b0fe 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 8a2d21838..c4cf3ed53 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/CMakeLists.txt b/code/sdk/middleware/services/gui/uikit/CMakeLists.txt index 0e621de13..58b33c52e 100644 --- a/code/sdk/middleware/services/gui/uikit/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/uikit/CMakeLists.txt @@ -27,7 +27,6 @@ set(public_headers # set public configs set(public_configs -std=c++11 - -Wno-error -Wno-unused-parameter -fno-exceptions -fno-unwind-tables @@ -37,15 +36,9 @@ set(public_configs -Wno-shift-op-parentheses -nostdlibinc -Wno-missing-field-initializers - -Wno-inconsistent-missing-override - -Wno-overloaded-virtual - -Wno-inline-new-delete - -Wno-sign-compare -Wno-writable-strings -Wno-reorder-ctor - -Wno-missing-declarations -Wno-tautological-pointer-compare - -Wno-unused-private-field -Wno-unused-function -Werror=return-type ) @@ -170,18 +163,6 @@ set(COMPONENT_CCFLAGS ${public_configs} -Wno-c++11-narrowing -Wno-error=unused-function - -Wno-missing-field-initializers - -Wno-inconsistent-missing-override - -Wno-overloaded-virtual - -Wno-inline-new-delete - -Wno-sign-compare - -Wno-writable-strings - -Wno-reorder-ctor - -Wno-missing-declarations - -Wno-tautological-pointer-compare - -Wno-unused-private-field - -Wno-unused-function - -Werror=return-type ) set(WHOLE_LINK @@ -217,6 +198,7 @@ set(COMPONENT_SRC ${PROP_UI_SRC}/components_ext/ui_roller_view.cpp ${PROP_UI_SRC}/components_ext/ui_map_view.cpp ${PROP_UI_SRC}/components_ext/map_svg_parser.cpp + ${PROP_UI_SRC}/components_ext/ui_slipflow_view.cpp ${PROP_UI_SRC}/components_ext/ui_coverflow_view.cpp ${PROP_UI_SRC}/components_ext/ui_coverflow_view2.cpp ${PROP_UI_SRC}/components_ext/ui_icosahedron_view.cpp @@ -253,18 +235,6 @@ set(COMPONENT_CCFLAGS ${public_configs} -Wno-c++11-narrowing -Wno-error=unused-function - -Wno-missing-field-initializers - -Wno-inconsistent-missing-override - -Wno-overloaded-virtual - -Wno-inline-new-delete - -Wno-sign-compare - -Wno-writable-strings - -Wno-reorder-ctor - -Wno-missing-declarations - -Wno-tautological-pointer-compare - -Wno-unused-private-field - -Wno-unused-function - -Werror=return-type ) set(WHOLE_LINK 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 25824215b..ece9e6c28 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 e419e391a..ca2c1b81e 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 b35c2c1dd..4d44eb90b 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 e45aaf37a..21c2d4147 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 5423429d2..946cc5bbe 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/text_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h index 2287b8f57..f29ad3b61 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 @@ -93,6 +93,7 @@ protected: #endif private: + using Text::SetText; uint16_t textId_ = FontGlobalManager::INVALID_TEXT_ID; #if ENABLE_SHAPING bool isNeedShaping_ = 0; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/ui_emoji_table.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/ui_emoji_table.h new file mode 100644 index 000000000..ce3b1f056 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/ui_emoji_table.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2020-2021 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. + */ + +#ifndef UI_EMOJI_TABLE_H +#define UI_EMOJI_TABLE_H +#include "graphic_config.h" + +namespace OHOS { +constexpr char *EMOJI_PATH = RES_PATH"emoji.bin"; +const struct { + uint32_t unicode; + uint32_t resId; +} EMOJI_TABLE[] = { + {0x1f600, 0x100001}, + {0x1f601, 0x100002}, + {0x1f602, 0x100003}, + {0x1f603, 0x100004}, + {0x1f604, 0x100005}, + {0x1f605, 0x100006}, + {0x1f606, 0x100007}, + {0x1f607, 0x100008}, + {0x1f608, 0x100009}, + {0x1f609, 0x10000a}, + {0x1f60a, 0x10000b}, + {0x1f60b, 0x10000c}, + {0x1f60c, 0x10000d}, + {0x1f60d, 0x10000e}, + {0x1f60e, 0x10000f}, + {0x1f60f, 0x100010}, + {0x1f610, 0x100011}, + {0x1f611, 0x100012}, + {0x1f612, 0x100013}, + {0x1f613, 0x100014}, + {0x1f614, 0x100015}, + {0x1f615, 0x100016}, + {0x1f616, 0x100017}, + {0x1f617, 0x100018}, + {0x1f618, 0x100019}, + {0x1f619, 0x10001a}, + {0x1f61a, 0x10001b}, + {0x1f61b, 0x10001c}, + {0x1f61c, 0x10001d}, + {0x1f61d, 0x10001e}, + {0x1f61e, 0x10001f}, + {0x1f61f, 0x100020}, + {0x1f620, 0x100021}, + {0x1f621, 0x100022}, + {0x1f622, 0x100023}, + {0x1f623, 0x100024}, + {0x1f624, 0x100025}, + {0x1f625, 0x100026}, + {0x1f626, 0x100027}, + {0x1f627, 0x100028}, + {0x1f628, 0x100029}, + {0x1f629, 0x10002a}, +}; +} // OHOS + +#endif // UI_EMOJI_TABLE_H \ No newline at end of file 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 128e27107..aeba84c4f 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 @@ -27,6 +27,7 @@ #ifndef UI_CROSS_VIEW_H #define UI_CROSS_VIEW_H +#include #include "components/ui_swipe_view.h" #include "components/card_swipe.h" #include "components_ext/hor_swipe_view.h" @@ -218,6 +219,7 @@ public: } private: + using UIViewGroup::Remove; uint16_t blurRadius_ = 10; void UpdateCardPageIndex(); static constexpr uint16_t INVALID_VIEW_INDEX = 0xff; @@ -234,6 +236,7 @@ private: UIView* tailView_ = nullptr; UISwipeView::OnSwipeListener *swipeListener_ = nullptr; bool isNeedClip_ = false; + std::shared_ptr exists_; void RemoveAllInner(UISwipeView& view); void ProcessRes(void); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h index ed4717040..20cd6154d 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h @@ -205,6 +205,7 @@ protected: float scaleThresholdOfZeroFactor_{0.75f}; private: + using UIScrollView::Scale; void InitParametersAndImgIndex(); bool IsCenterInPolygons(const Vector2& offset = {0, 0}); Rect GetChildrenRegion(); 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..5e91bf623 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 @@ -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_slipflow_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_slipflow_view.h new file mode 100644 index 000000000..f07e85aa6 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_slipflow_view.h @@ -0,0 +1,253 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: UISlipFlow + * Author: + * Create: 2024-08 + */ + +#ifndef UI_SLIPFLOW_VIEW_H +#define UI_SLIPFLOW_VIEW_H +#include +#include +#include "gfx_utils/vector.h" +#include "components/ui_image_view.h" +#include "components/ui_label.h" +#include "components/ui_abstract_scroll.h" + +namespace OHOS { +struct TempXoffsetInfo { + int16_t tempMasterXoffset; + int16_t tempSlaveXoffset; + int16_t tempMasterYoffset; + int16_t tempSlaveYoffset; +}; + +class UISlipflowView : public UIAbstractScroll { +public: + explicit UISlipflowView(); + ~UISlipflowView() override; + + /** + * @brief Adds a child view. + * + * @param view Indicates the pointer to the child view to add. + * @since 1.0 + * @version 1.0 + */ + void Add(UIView* view) override; + + /** + * @brief remove a child view from slipflow. + * + * @param id Indicates the pointer to the child view to remove. + */ + void Remove(UIView* view) override; + + /** + * @brief Set page size. + * + * @param width setting page width. + * @param height setting page height. + */ + void SetPageSize(uint16_t width, uint16_t height); + + /** + * @brief Get page width. + */ + uint16_t GetPageWidth() const + { + return pageWidth_; + } + + /** + * @brief Get page height. + */ + uint16_t GetPageHeight() const + { + return pageHeight_; + } + + /** + * @brief Sets the index for the current tab. + * + * @param index Indicates the index of a view. + * @param needAnimator Specifies whether a flip animation is needed. false (default value) indicates a flip + * animation is not needed, and true indicates the opposite case. + * @since 1.0 + * @version 1.0 + */ + void SetCurrentPage(uint16_t index, bool needAnimator = false); + + /** + * @brief Obtains the current tab index. + * + * @return Returns the current tab index. + * @since 1.0 + * @version 1.0 + */ + uint16_t GetCurrentPage() const + { + return curIndex_; + } + + /** + * @brief Obtains the current view. + * + * @return Returns the current view. + * @since 1.0 + * @version 1.0 + */ + UIView* GetCurrentView() const + { + return curView_; + } + + /** + * @brief Obtains the component type. + * + * @return Returns the component type, as defined in {@link UIViewType}. + * @since 1.0 + * @version 1.0 + */ + UIViewType GetViewType() const override + { + return UI_SLIP_FLOW; + } + + /** + * @brief Obtains a view based on its index. + * + * @param Indicates the index of a view. + * @return Returns the view. + * @since 1.0 + * @version 1.0 + */ + UIView* GetViewByIndex(uint16_t index) const; + + /** + * @brief Indicates that the animation duration is 12 ticks. + * + * @since 1.0 + * @version 1.0 + */ + constexpr static uint16_t ANIMATOR_TIME = 12; + + /** + * @brief Sets the time for the page being animated. The page will go beyond the blank during this time. + * + * @param time Indicates the time of the page being animated. + * @since 1.0 + * @version 1.0 + */ + void SetAnimatorTime(uint16_t time); + + /** + * @brief Set the movement coefficient of the current page and the page on the right compared to other pages. + * + * @param coefficient The moving speed of the current page and the page on the right is coefficient times + * that of other pages. + * @since 1.0 + * @version 1.0 + */ + void SetMoveCoefficient(uint16_t coefficient); + + /** + * @fn void OnDragEvent(const DragEvent& event) override + * + * @brief realize drag event, Switch to specified view when drag + * + * @param event The drag event + */ + bool OnDragEvent(const DragEvent& event) override; + + /** + * @fn void OnDragStartEvent(const DragEvent& event) override + * + * @brief realize drag start event, Switch to specified view when drag start + * + * @param event The drag event start + */ + + bool OnDragStartEvent(const DragEvent& event) override; + + /** + * @fn void OnDragEndEvent(const DragEvent& event) override + * + * @brief realize drag end event, Switch to specified view when drag end + * + * @param event The drag event end + */ + bool OnDragEndEvent(const DragEvent& event) override; + + /** + * @brief Represents a listener for swipe of the slipflow view. + */ + class OnSlipflowScrollListener : public HeapBase { + public: + virtual bool OnScroll(int16_t distance) { return true; } + virtual void OnScrollUpStart() {}; + virtual void OnScrollUpEnd() {}; + virtual bool OnRemove(UIView* view) { return true; } + virtual void OnRefreshPageOpaScale(UIView* view, int16_t xOffset, int16_t yOffset) {} + virtual ~OnSlipflowScrollListener() {} + }; + + /** + * @brief Sets the listener that contains a callback to be invoked upon a swipe event. + * + * @param onSlipflowListener Indicates the listener to set. + * @since 1.0 + * @version 1.0 + */ + void SetOnSlipflowListener(OnSlipflowScrollListener* onSlipflowListener) + { + slipflowListener_ = onSlipflowListener; + } + + void SetDirection(uint8_t direction) = delete; + uint8_t GetDirection() const = delete; +protected: + void SortChild(); + bool DragXInner(int16_t distance) override; + bool DragYInner(int16_t distance) override; + void StopAnimator() override; + void RefreshCurrentView(int16_t distance, uint8_t dragDirection); + void SwitchToPage(int16_t dst, bool needAnimator = true); + void MoveChildByXOffset(int16_t xOffset); + void DeleteMoveChild(int16_t distance); + void SwipUpReleaseOperation(); + void SwipUpDeleteOperation(); + void SwipUpRebound(); + void CalculateInvalidate(); + +private: + void DeleteGroup(UIViewGroup* group); + void AddTempXoffsetInfo(); + void ResetTempOffsetInfo(); + bool CalCurViewInfo(); + void RefreshChildIndex(); + void RefreshScreen(); + void RefreshPageOpaScale(UIView* view); + int16_t GetPreViewOffsetToCenter(); + + OnSlipflowScrollListener* slipflowListener_; + Graphic::Vector pageTempOffsetInfo_; + int16_t totalTempXoffset_{0}; + int16_t totalTempYoffset_{0}; + int16_t xMoveCoefficient_; + int16_t yMoveCoefficient_; + bool isSwipUpDelete_{false}; + + uint16_t tickTime_; + uint16_t curIndex_; + UIView* curView_; + UIView* deleteView_; + uint16_t pageWidth_; + uint16_t pageHeight_; + UIView* lastView_; + uint16_t swipeMid_; + int8_t dragDirection_; + bool isSetPage_; +}; +} // namespace OHOS +#endif // UI_SLIPFLOW_VIEW_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_transform_group.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_transform_group.h index ade79f632..6ff2e112d 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_transform_group.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_transform_group.h @@ -60,6 +60,14 @@ public: * @version 1.0 */ void SetStyle(uint8_t key, int64_t value) override; + + /** + * @brief Called when a view is drawn. + * @param invalidatedArea Indicates the area to draw. + * @since 1.0 + * @version 1.0 + */ + void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; private: void ReMeasure() override; void DeleteMirrorView(); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/dfx/dfx_frame_trace.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/dfx/dfx_frame_trace.h index a7cf2ea79..c2519d10f 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/dfx/dfx_frame_trace.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/dfx/dfx_frame_trace.h @@ -64,6 +64,7 @@ enum class FrameTraceType { HW_DRAW_SUBMIT, HW_DRAW_FLUSH, HW_DRAW_WAIT, + HW_DRAW_ARC_RECT, DRAW_MAX }; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h index e1a266d62..241793d37 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h @@ -36,37 +36,14 @@ #define GRAPHIC_LITE_MEM_CHECK_H #include -#include -#include -#include #include #include "gfx_utils/mem_api.h" #include "graphic_thread.h" +#include "graphic_mutex.h" +#include "soc_osal.h" #if ENABLE_MEMORY_CHECK namespace OHOS { -/** - * @brief Mem opt, add or delete - * - */ -enum class Opt { - ADD, - DEL -}; - -/** - * @brief Memory record info. - * - */ -struct MemRecord { - int32_t size; - uintptr_t address; - Opt opt; - time_t time; - int32_t total; - struct MemRecord* next; -}; - /** * @brief Memory alloc info. * @@ -103,7 +80,7 @@ public: * @since 1.0 * @version 1.0 */ - int MemAdd(int size, uintptr_t address); + bool MemAdd(int size, uintptr_t address); /** * @brief Reduce dynamic memory. You can call it when reduce dynamic memory. @@ -112,7 +89,7 @@ public: * @since 1.0 * @version 1.0 */ - int MemDelete(uintptr_t address); + bool MemDelete(uintptr_t address); /** * @brief print current memory info @@ -138,32 +115,19 @@ public: leakSize_ = sz; } -#ifndef VERSION_IOT - void CollectMemory(uint32_t delayTime); - void SaveRecordInfo(); -#endif - private: MemCheck() {} ~MemCheck(); MemCheck(const MemCheck &) = delete; MemCheck &operator=(const MemCheck &) = delete; -#ifndef VERSION_IOT - bool InsertRecord(uintptr_t address, Opt opt, int32_t size, int32_t total); - bool CreateRecordFile(); - bool isBeyondTime(); -#endif - bool initSuc = false; - FILE* fp = nullptr; - MemRecord* recordHead = nullptr; - MemAllocInfo* allocHead = nullptr; - MemRecord* recordTail = nullptr; - MemAllocInfo* allocTail = nullptr; - time_t setTime_ = 0; - int32_t delayTime_ = 0; - ThreadId recordThreadId = nullptr; - int32_t totalSize = 0; + bool InitMemInfoList(); + void ClearMemInfoList(); + + MemAllocInfo* allocHead_ = nullptr; + MemAllocInfo* allocTail_ = nullptr; + GraphicMutex lock_; + osal_atomic totalCnt_; bool enableLeakCheck_ = false; MemAllocInfo *leakHead_ = nullptr; int16_t crashCnt_ = -1; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/CMakeLists.txt b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/CMakeLists.txt index a5bc7bd24..c73a3299a 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/CMakeLists.txt @@ -48,7 +48,6 @@ set(COMPONENT_PUBLIC_CCFLAGS set(COMPONENT_CCFLAGS -std=c++11 - -Wno-error -Wno-unused-parameter -fno-exceptions -fno-unwind-tables @@ -58,8 +57,6 @@ set(COMPONENT_CCFLAGS -Wno-shift-op-parentheses -nostdlibinc -Wno-missing-field-initializers - -Wno-inconsistent-missing-override - -Wno-overloaded-virtual -Wno-unused-function ) 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 82c36b1e0..f0d3f0521 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 @@ -95,7 +95,7 @@ void LiteSurface::AddBuffer() bool LiteSurface::CanRequest(uint8_t wait) { - bool res = true; + bool res = false; if (!freeList_.IsEmpty()) { res = true; goto END; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_abstract_soft_keyboard.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_abstract_soft_keyboard.cpp index 77c3e0c23..1fea1df9e 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_abstract_soft_keyboard.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_abstract_soft_keyboard.cpp @@ -25,7 +25,7 @@ Graphic::Vector UIAbstractSoftKeyboard::keyBtnAllocPool_; void UIAbstractSoftKeyboard::AllocKeyboardButton() { UIKeyboardButton* keyBtnArr = new UIKeyboardButton[DEFAULE_ALLOC_KEYBOARD_BUT_NUM]{}; - for (int i = 0; i < DEFAULE_ALLOC_KEYBOARD_BUT_NUM; i++) { + for (uint32_t i = 0; i < DEFAULE_ALLOC_KEYBOARD_BUT_NUM; i++) { keyBtnAllocPool_.PushBack(&keyBtnArr[i]); } } 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 2b578d746..bcc9a3636 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 @@ -120,7 +120,7 @@ bool UICustomHexagonsList::OnRotateStartEvent(const RotateEvent& event) bool UICustomHexagonsList::OnRotateEvent(const RotateEvent& event) { - float deltaScale = event.GetRotate() * ROTATE_SCALE_FACTOR; + float deltaScale = event.GetRotate() * ROTATE_SCALE_FACTOR * GetRotateFactor(); float targetScale = globalScale_ + deltaScale; Vector2 position = GetCurrentPosition(rotateCenterIndexInNormal_); Vector2 deltaDistance; 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 4cfd78f7b..1c93fb728 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 @@ -59,9 +59,11 @@ UILiteSurfaceView::~UILiteSurfaceView() currentBuffer_ = nullptr; } surface_->UnregisterConsumerListener(); - LiteMGfxEngine::GetInstance()->ClearHardwareLayer(); + LiteMGfxEngine::GetInstance()->ClearHardwareLayer(this); GraphicService::GetInstance()->PostGraphicEvent([] { - GraphicService::GetInstance()->EnableAsyncMode(true); + if (LiteMGfxEngine::GetInstance()->GetHardwareLayer() == nullptr) { + GraphicService::GetInstance()->EnableAsyncMode(true); + } }); if (preView_ != nullptr) { @@ -333,8 +335,10 @@ void UILiteSurfaceView::OnBufferAvailable() [&, ws] { if (!ws.expired()) { DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, false, 0); - LiteMGfxEngine::GetInstance()->ClearHardwareLayer(); - LiteMGfxEngine::GetInstance()->EnableAsyncMode(true); + LiteMGfxEngine::GetInstance()->ClearHardwareLayer(this); + if (LiteMGfxEngine::GetInstance()->GetHardwareLayer() == nullptr) { + GraphicService::GetInstance()->EnableAsyncMode(true); + } surface_->ClearBuffers(); currentBuffer_ = nullptr; lastFlushedBuffer_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_frame_trace.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_frame_trace.cpp index 3c5594d46..5e8bdd1b9 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_frame_trace.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_frame_trace.cpp @@ -36,6 +36,7 @@ static struct { {FrameTraceType::HW_DRAW_SUBMIT, "hw_submit"}, {FrameTraceType::HW_DRAW_FLUSH, "hw_flush"}, {FrameTraceType::HW_DRAW_WAIT, "hw_wait"}, + {FrameTraceType::HW_DRAW_ARC_RECT, "hw_arc_rect"}, }; uint64_t DfxFrameTrace::GetDuration(uint64_t start, uint64_t end) const diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.cpp index 72db48c0b..83ac11d41 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.cpp @@ -218,5 +218,87 @@ bool HWDrawUtils::ObtainCirclePath(const ArcInfo& arc, uint32_t& cmdNum, data[25] = center.y; // 25: data index return true; } + +bool HWDrawUtils::ObtainRectPathWithRadius(const Rect& rect, Path& path, int16_t radius) +{ + path.cmdNum = 10; // 10: Circle path command number is 10 + AllocInfo cmdInfo; + cmdInfo.expectedSize = sizeof(uint8_t) * path.cmdNum; + cmdInfo.usage = HBM_USE_ASSIGN_SIZE | HBM_USE_MEM_PATH; + GrallocBuffer cmdBuffer; + if (!GrallocEngines::GetInstance()->AllocBuffer(cmdInfo, cmdBuffer)) { + GRAPHIC_LOGE("Alloc buffer for cmd failed."); + return false; + } + path.cmds = (uint8_t *)cmdBuffer.virAddr; + + path.cmds[0] = CMD_MOVE_TO; + path.cmds[1] = CMD_LINE_TO; + path.cmds[2] = CMD_CUBIC_TO; // 2: cmd index + path.cmds[3] = CMD_LINE_TO; // 3: cmd index + path.cmds[4] = CMD_CUBIC_TO; // 4: cmd index + path.cmds[5] = CMD_LINE_TO; // 5: cmd index + path.cmds[6] = CMD_CUBIC_TO; // 6: cmd index + path.cmds[7] = CMD_LINE_TO; // 7: cmd index + path.cmds[8] = CMD_CUBIC_TO; // 8: cmd index + path.cmds[9] = CMD_CLOSE; // 9: cmd index + + path.dataNum = 34; // Circle path data number is 34 + if (!AllocBufferForData(path.dataNum, path.data)) { + GrallocEngines::GetInstance()->FreeBuffer(path.cmds); + path.cmds = nullptr; + return false; + } + GetFilledRoundRectData(path.data, radius, rect); + return true; +} + +void HWDrawUtils::GetFilledRoundRectData(float* data, uint16_t radius, const Rect& rect) +{ + float r = radius; + int16_t x1 = rect.GetLeft(); + int16_t y1 = rect.GetTop(); + int16_t x2 = rect.GetRight(); + int16_t y2 = rect.GetBottom(); + + data[0] = x1; + data[1] = y1 + r; + data[2] = x1; // 2: index + data[3] = y2 - r; // 3: index + + // 1 arc end point + data[8] = x1 + r; // 8: index + data[9] = y2 + 1; // 9: index + data[10] = x2 - r; // 10: index + data[11] = y2 + 1; // 11: index + + // 2 arc end point + data[16] = x2 + 1; // 16: index + data[17] = y2 - r; // 17: index + data[18] = x2 + 1; // 18: index + data[19] = y1 + r; // 19: index + + // 3 arc end point + data[24] = x2 - r; // 24: index + data[25] = y1; // 25: index + data[26] = x1 + r; // 26: index + data[27] = y1; // 27: index + + // 4 arc end point + data[32] = x1; // 32: index + data[33] = y1 + r; // 33: index + + Point center1 = {x1 + r, y2 - r}; + GetArcControlPoint(&data[2], center1, ARC_TO_BEZIER_90_DEG, -1); // 2: index + + Point center2 = {x2 - r, y2 - r}; + GetArcControlPoint(&data[10], center2, ARC_TO_BEZIER_90_DEG, -1); // 10: index + + Point center3 = {x2 - r, y1 + r}; + GetArcControlPoint(&data[18], center3, ARC_TO_BEZIER_90_DEG, -1); // 18: index + + Point center4 = {x1 + r, y1 + r}; + GetArcControlPoint(&data[26], center4, ARC_TO_BEZIER_90_DEG, -1); // 26: index +} } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.h index 1284abfd7..e0efe0225 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/draw/hw_draw_utils.h @@ -19,6 +19,7 @@ #include "graphic_config.h" #if ENABLE_VGU_ENGINE && CAPABILITY_HWDRAW_PATH #include "engines/gfx/gfx_engine_manager.h" +#include "common/graphic_hardware_types.h" namespace OHOS { class HWDrawUtils : public HeapBase { @@ -32,13 +33,14 @@ public: bool ObtainCirclePath(const ArcInfo& arc, uint32_t& cmdNum, uint8_t*& cmds, uint32_t& dataNum, float*& data); bool AllocBufferForData(uint16_t dataNum, float*& addr); void Obtain30DegSectorPath(const ArcInfo& arc, uint8_t* cmd, float* data); - + bool ObtainRectPathWithRadius(const Rect& rect, Path& path, int16_t radius); private: HWDrawUtils() {} virtual ~HWDrawUtils() {} int8_t GetArcData(float* arcData, const Point& center, uint16_t radius, float startAngle, float endAngle); void GetArcControlPoint(float* arcData, const Point& center, float mangicNum, int8_t neg); void ConvertCircularDegree(float& angle); + void GetFilledRoundRectData(float* data, uint16_t radius, const Rect& rect); }; } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h index aa19fe268..6bed8efec 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h @@ -16,6 +16,7 @@ #ifndef GRAPHIC_LITE_LITE_M_GFX_ENGINE_H #define GRAPHIC_LITE_LITE_M_GFX_ENGINE_H +#include "gfx_utils/list.h" #include "graphic_config.h" #include "display_type.h" #include "display_vgu.h" @@ -28,6 +29,7 @@ #include "gfx_utils/style.h" #include "gfx_utils/transform.h" #include "common/ihardware_view.h" +#include "common/graphic_hardware_types.h" namespace OHOS { struct EllipseInfo { @@ -44,6 +46,7 @@ struct AsyncSubmitInfo { class LiteMGfxEngine : public BaseGfxEngine { public: + using BaseGfxEngine::Flush; static LiteMGfxEngine* GetInstance() { static LiteMGfxEngine instance; @@ -133,13 +136,17 @@ public: { hardwareView_ = view; } + IHardwareView* GetHardwareLayer() { return hardwareView_; } - void ClearHardwareLayer() + + void ClearHardwareLayer(IHardwareView* view) { - hardwareView_ = nullptr; + if (hardwareView_ == view) { + hardwareView_ = nullptr; + } } bool HasPendingFrame() @@ -160,8 +167,13 @@ private: UIFree(nextBufferInfo_); nextBufferInfo_ = nullptr; } + ReleasePath(); } + void DrawRoundRect(BufferInfo& dst, const Rect& fillArea, const Style& style, const Rect& dirtyRect); + List pathList_ = {}; + void ReleasePath(); + BufferInfo* bufferInfo_ = nullptr; BufferInfo* nextBufferInfo_ = nullptr; @@ -178,7 +190,6 @@ private: uint16_t hwStrokePendingCnt_ = 0; IHardwareView* hardwareView_ {nullptr}; - void DrawRectWithBorder(BufferInfo& dst, const Rect& rect, const Style& style, OpacityType opacity); bool Convert2VGUBuffer(const BufferInfo& bufferInfo, VGUBuffer& buffer) const; void BlitImages(); void AddHwDraw(uint16_t cnt); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_option_box.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_option_box.h index 3463a67ab..288a85e1f 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_option_box.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_option_box.h @@ -58,7 +58,6 @@ private: OptionDragListener* listener_ = nullptr; Graphic::Vector options_; uint8_t currentOptionNum_ = 4; - uint16_t btnHeight_ = 0; uint16_t btnWidth_ = 0; int16_t moveDistance_ = 0; uint8_t selectedIndex_ = 0; 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 a49739c97..5b29de28b 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 @@ -200,7 +200,7 @@ bool DisplayDev::OpenLayer(uint8_t layerId, const LayerInfo& info, uint8_t buffe layer_[layerId].pos.x = 0; layer_[layerId].pos.y = 0; if (layerFuncs_->CreateLayer(devId_, &layer_[layerId].layerInfo, &layer_[layerId].layerHdl) != DISPLAY_SUCCESS) { - free(layer_[layerId].buffer); + UIFree(layer_[layerId].buffer); layer_[layerId].buffer = nullptr; layer_[layerId].layerHdl = 0; layer_[layerId].bufferCount = 0; @@ -234,7 +234,7 @@ void DisplayDev::CloseLayer(uint8_t layerId) return; } - free(layer_[layerId].buffer); + UIFree(layer_[layerId].buffer); layer_[layerId].buffer = nullptr; layer_[layerId].layerHdl = 0; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/lite_input_distributer.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/lite_input_distributer.cpp index ea497d58c..259a90e9d 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/lite_input_distributer.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/lite_input_distributer.cpp @@ -135,6 +135,18 @@ bool LiteInputDistributer::IsEventEmpty(InputDevType type) return true; } +void LiteInputDistributer::ClearEvent(InputDevType type) +{ + eventLock_.Lock(); + if (type == InputDevType::INDEV_TYPE_TOUCH) { + tpList_.clear(); + deviceData_.state = 0; + } else if (type == InputDevType::INDEV_TYPE_KEY) { + keyList_.clear(); + } + eventLock_.Unlock(); +} + #ifdef CONFIG_SUPPORTED_POWERMGR void LiteInputDistributer::SendEventToPM(const RawEvent& event) { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp index cb1c434f9..9725426b4 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp @@ -15,169 +15,162 @@ #include "gfx_utils/mem_check.h" #if ENABLE_MEMORY_CHECK -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "gfx_utils/graphic_log.h" -#include "hal_tick.h" -#include "securec.h" #include "hals/gralloc_engines.h" #ifdef __LITEOS__ #include "los_exc.h" #endif namespace OHOS { -using std::string; -const uint8_t OFFSET_TIME = 3; - MemCheck::~MemCheck() { - MemAllocInfo* allocPtr = allocHead; - while (allocPtr != nullptr && allocPtr->next != nullptr) { - MemAllocInfo* allocNote = allocPtr->next; - allocPtr->next = allocPtr->next->next; - free(allocNote); - allocNote = nullptr; + ClearMemInfoList(); +} + +void MemCheck::MemCheckInit() +{ + GRAPHIC_LOGI("MemCheck::MemCheckInit"); +} + +bool MemCheck::InitMemInfoList() +{ + if ((allocHead_ != nullptr) || (allocTail_ != nullptr)) { + GRAPHIC_LOGE("allocHead_ or allocTail_ is already inited."); + return false; } - MemRecord* recordPtr = recordHead; - while (recordPtr != nullptr && recordPtr->next != nullptr) { - MemRecord* recordNode = recordPtr->next; - recordPtr->next = recordPtr->next->next; - free(recordNode); - recordNode = nullptr; + MemAllocInfo* allocNode = (MemAllocInfo*)malloc(sizeof(MemAllocInfo)); + if (allocNode == nullptr) { + GRAPHIC_LOGE("malloc for allocNode failed!"); + return false; } - allocHead = nullptr; - recordHead = nullptr; + allocNode->address = 0; + allocNode->next = nullptr; + allocNode->size = 0; - if (fp != nullptr) { - fclose(fp); - fp = nullptr; - } + allocHead_ = allocNode; + allocTail_ = allocNode; + return true; } -void MemCheck::MemCheckInit() +void MemCheck::ClearMemInfoList() { - GRAPHIC_LOGI("MemCheck::MemCheckInit\n"); - MemRecord* recordNote = (MemRecord*)malloc(sizeof(MemRecord)); - if (recordNote == nullptr) { - initSuc = false; + if (allocHead_ == nullptr) { return; } - recordNote->address = 0; - recordNote->size = 0; - recordNote->total = 0; - recordNote->time = 0; - recordNote->next = nullptr; - recordHead = recordNote; - recordTail = recordNote; - MemAllocInfo* allocNote = (MemAllocInfo*)malloc(sizeof(MemAllocInfo)); - if (allocNote == nullptr) { - free(recordNote); - recordNote = nullptr; - initSuc = false; - return; + MemAllocInfo* allocPtr = allocHead_; + while (allocPtr != nullptr && allocPtr->next != nullptr) { + MemAllocInfo* allocNode = allocPtr->next; + allocPtr->next = allocPtr->next->next; + free(allocNode); + allocNode = nullptr; } - allocNote->address = 0; - allocNote->next = nullptr; - allocNote->size = 0; - allocHead = allocNote; - allocTail = allocNote; - initSuc = true; - return; + free(allocHead_); + allocHead_ = nullptr; + allocTail_ = nullptr; } void MemCheck::EnableLeakCheck(bool enable) { - enableLeakCheck_ = enable; - if (enableLeakCheck_) { + lock_.Lock(); + if (enableLeakCheck_ == enable) { + GRAPHIC_LOGE("Already set leak check: %d", enableLeakCheck_); + lock_.Unlock(); + return; + } + if (enable) { + if (!InitMemInfoList()) { + GRAPHIC_LOGE("EnableLeakCheck failed!"); + lock_.Unlock(); + return; + } leakCount_ = 0; leakHead_ = nullptr; + GRAPHIC_LOGP("-----Begin Memory Leak Check----"); } else { + GRAPHIC_LOGP("total count: %d", osal_atomic_read(&totalCnt_)); MemAllocInfo *info = leakHead_; for (; info != nullptr; info = info->next) { GRAPHIC_LOGE("leakcheck: [%d] addr %p size %d", info->count, info->address, info->size); } crashCnt_ = -1; leakSize_ = 0; + ClearMemInfoList(); + GRAPHIC_LOGP("-----End Memory Leak Check----"); } + enableLeakCheck_ = enable; + lock_.Unlock(); } -int MemCheck::MemAdd(int size, uintptr_t address) +bool MemCheck::MemAdd(int size, uintptr_t address) { - if (!initSuc) { - return -1; + osal_atomic_inc(&totalCnt_); + + lock_.Lock(); + if (!enableLeakCheck_) { + lock_.Unlock(); + return false; + } + + MemAllocInfo* allocNode = (MemAllocInfo*)malloc(sizeof(MemAllocInfo)); + if (allocNode == nullptr) { + GRAPHIC_LOGE("MemAdd malloc failed"); + lock_.Unlock(); + return false; } - MemAllocInfo* allocNote = (MemAllocInfo*)malloc(sizeof(MemAllocInfo)); - if (allocNote == nullptr) { - GRAPHIC_LOGE("MemAdd malloc failed\n"); - return -1; + allocNode->address = address; + allocNode->size = size; + allocNode->next = nullptr; + allocNode->count = -1; + + allocTail_->next = allocNode; + allocTail_ = allocNode; + + leakCount_++; + allocNode->count = leakCount_; + if (leakHead_ == nullptr) { + leakHead_ = allocNode; } - allocNote->address = address; - allocNote->size = size; - allocNote->next = nullptr; - allocNote->count = -1; - allocTail->next = allocNote; - allocTail = allocNote; - totalSize += allocNote->size; - if (enableLeakCheck_) { - leakCount_++; - allocNote->count = leakCount_; - if (leakHead_ == nullptr) { - leakHead_ = allocNote; + if (leakCount_ == crashCnt_) { + if (leakSize_ != allocNode->size) { + GRAPHIC_LOGE("size not right!"); } - if (leakCount_ == crashCnt_) { - if (leakSize_ != allocNote->size) { - GRAPHIC_LOGE("size not right!"); - } + lock_.Unlock(); #ifdef __LITEOS__ - LOS_Panic("mem leak here!\n"); + LOS_Panic("mem leak here!\n"); #endif - } } -#ifndef VERSION_IOT - if (!isBeyondTime()) { - if (!InsertRecord(address, Opt::ADD, size, totalSize)) { - return -1; - } - } -#endif - return 0; + lock_.Unlock(); + return true; } -int MemCheck::MemDelete(uintptr_t address) +bool MemCheck::MemDelete(uintptr_t address) { + osal_atomic_dec(&totalCnt_); + + lock_.Lock(); + if (!enableLeakCheck_) { + lock_.Unlock(); + return false; + } + if (address == 0) { GRAPHIC_LOGE("MemDelete address is nullptr\n"); - return -1; - } - if (!initSuc) { - return -1; + lock_.Unlock(); + return false; } - int32_t currNodeSize = 0; - MemAllocInfo* allocPtr = allocHead; + MemAllocInfo* allocPtr = allocHead_; while (allocPtr->next != nullptr) { if (allocPtr->next->address == address) { MemAllocInfo *cur = allocPtr->next; - leakHead_ = (enableLeakCheck_ && (leakHead_ == cur)) ? cur->next : leakHead_; - currNodeSize = allocPtr->next->size; - totalSize -= currNodeSize; + leakHead_ = (leakHead_ == cur) ? cur->next : leakHead_; MemAllocInfo* tmpInfo = allocPtr->next; allocPtr->next = allocPtr->next->next; if (allocPtr->next == nullptr) { - allocTail = allocPtr; + allocTail_ = allocPtr; } free(tmpInfo); tmpInfo = nullptr; @@ -185,144 +178,17 @@ int MemCheck::MemDelete(uintptr_t address) } allocPtr = allocPtr->next; } + lock_.Unlock(); -#ifndef VERSION_IOT - if (!isBeyondTime()) { - if (!InsertRecord(address, Opt::DEL, currNodeSize, totalSize)) { - return -1; - } - } -#endif - return 0; + return true; } void MemCheck::DumpMemInfo() { - int32_t total = 0; - int32_t count = 0; - int32_t max = 0; printf("current malloc/new memory:\n"); - MemAllocInfo* allocPtr = allocHead; - while (allocPtr->next != nullptr) { - total += allocPtr->next->size; - if (max < allocPtr->next->size) { - max = allocPtr->next->size; - } - count++; - allocPtr = allocPtr->next; - } - printf("total size: %d, max: %d, count: %d\n", total, max, count); + printf("total count: %d\n", osal_atomic_read(&totalCnt_)); printf("--------\n"); GrallocEngines::GetInstance()->DumpMem(); } - -#ifndef VERSION_IOT -bool MemCheck::isBeyondTime() -{ - time_t currTime = time((time_t *)nullptr); - if (currTime - setTime_ > delayTime_) { - return true; - } - return false; -} - -bool MemCheck::InsertRecord(uintptr_t address, Opt opt, int32_t size, int32_t total) -{ - MemRecord* recordNote = (MemRecord*)malloc(sizeof(MemRecord)); - if (recordNote == nullptr) { - GRAPHIC_LOGE("MemAdd malloc failed\n"); - return false; - } - recordNote->address = address; - recordNote->opt = opt; - recordNote->size = size; - recordNote->time = time(0); - recordNote->total = total; - recordNote->next = nullptr; - recordTail->next = recordNote; - recordTail = recordNote; - return true; -} - -static void* SaveMemInfo(void* arg) -{ - MemCheck::GetInstance()->SaveRecordInfo(); - return nullptr; -} - -void MemCheck::SaveRecordInfo() -{ - // sleep 1s, wait main thread set delaytime - sleep(1); - time_t currTime = time((time_t *)nullptr); - while ((currTime - setTime_) < (delayTime_ + OFFSET_TIME)) { - MemRecord* recordPtr = recordHead; - while (recordPtr->next != nullptr) { - MemRecord* recordNote = recordPtr->next; - recordPtr->next = recordPtr->next->next; - struct tm *sttm = localtime(&(recordNote->time)); - // 1900: year - fprintf(fp, "%04u-%02u-%02u %02u:%02u:%02u addr=0x%x %s size:%d total:%d\n", sttm->tm_year + 1900, - sttm->tm_mon+1, sttm->tm_mday, sttm->tm_hour, sttm->tm_min, sttm->tm_sec, recordNote->address, - recordNote->opt == Opt::ADD ? "add" : "del", recordNote->size, recordNote->total); - free(recordNote); - recordNote = nullptr; - } - recordTail = recordHead; - fflush(fp); - - sleep(2); // 2: sleep time - currTime = time((time_t *)nullptr); - } - fclose(fp); - fp = nullptr; - recordThreadId = nullptr; -} - -bool MemCheck::CreateRecordFile() -{ - char currPath[16] = "/user/mem/"; - if (access(currPath, F_OK) == -1) { - GRAPHIC_LOGD("dir %s not exist, create dir\n", currPath); - if (mkdir(currPath, 0777) != 0) { // 0777: permission mode - GRAPHIC_LOGE("create dir %s failed , errno = %d : %s\n", currPath, errno, strerror(errno)); - return false; - } - } - char path[20] = ""; - if (sprintf_s(path, sizeof(path), "%s%d", currPath, getpid()) == -1) { - GRAPHIC_LOGE("MemCheckInit sprintf_s failed\n"); - return false; - } - fp = fopen(path, "w+"); - if (fp == nullptr) { - GRAPHIC_LOGE("open mem file %s failed ,errno = %d : %s\n", path, errno, strerror(errno)); - return false; - } - return true; -} - -void MemCheck::CollectMemory(uint32_t delayTime) -{ - if (!initSuc) { - GRAPHIC_LOGE("Init failed!\n"); - return; - } - if (fp == nullptr && !CreateRecordFile()) { - return; - } - - if (recordThreadId == nullptr) { - recordThreadId = ThreadCreate(SaveMemInfo, nullptr, nullptr); - if (recordThreadId == nullptr) { - GRAPHIC_LOGE("create thread failed!!\n"); - return; - } - } - setTime_ = time(0); - delayTime_ = delayTime; - DumpMemInfo(); -} -#endif } // namespace OHOS #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h index fcae1dd8c..24707c003 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h @@ -172,19 +172,16 @@ private: uint8_t currentBufferId_[LAYER_MAX]; bool exitUlps_; - #ifdef LAYER_PF_ARGB1555 +#ifdef LAYER_PF_ARGB1555 const uint8_t layerBpp_ = 16; const PixelFormat layerPixFmt_ = PIXEL_FMT_RGBA_5551; - const ImagePixelFormat layerImgPixFmt_ = IMAGE_PIXEL_FORMAT_ARGB1555; - #elif defined LAYER_PF_ARGB8888 +#elif defined LAYER_PF_ARGB8888 const uint8_t layerBpp_ = 32; const PixelFormat layerPixFmt_ = PIXEL_FMT_RGBA_8888; - const ImagePixelFormat layerImgPixFmt_ = IMAGE_PIXEL_FORMAT_ARGB8888; - #elif defined LAYER_PF_RGB888 +#elif defined LAYER_PF_RGB888 const uint8_t layerBpp_ = 24; const PixelFormat layerPixFmt_ = PIXEL_FMT_RGB_888; - const ImagePixelFormat layerImgPixFmt_ = IMAGE_PIXEL_FORMAT_RGB888; - #endif +#endif }; } // namespace OHOS #endif // GRAPHIC_LITE_DISPLAY_DEV_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/lite_input_distributer.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/lite_input_distributer.h index e8c8a2516..d7d5bdc7b 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/lite_input_distributer.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/lite_input_distributer.h @@ -38,6 +38,7 @@ public: void GetEventData(DeviceData& data, InputDevType type); void SetEventData(const RawEvent& event); bool IsEventEmpty(InputDevType type); + void ClearEvent(InputDevType type); #ifdef CONFIG_SUPPORTED_POWERMGR void SendEventToPM(const RawEvent& event); #endif diff --git a/code/sdk/middleware/services/gui/uikit/res/emoji.bin b/code/sdk/middleware/services/gui/uikit/res/emoji.bin new file mode 100644 index 000000000..d04398593 Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/res/emoji.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/res/i18n.dat b/code/sdk/middleware/services/gui/uikit/res/i18n.dat new file mode 100644 index 000000000..39777c772 Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/res/i18n.dat differ diff --git a/code/sdk/middleware/services/gui/uikit/res/image_background_circle.bin b/code/sdk/middleware/services/gui/uikit/res/image_background_circle.bin new file mode 100644 index 000000000..6d5cf87ae Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/res/image_background_circle.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/res/kaleidoscope_circle.bin b/code/sdk/middleware/services/gui/uikit/res/kaleidoscope_circle.bin new file mode 100644 index 000000000..aebd991d6 Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/res/kaleidoscope_circle.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/res/planet_circle.bin b/code/sdk/middleware/services/gui/uikit/res/planet_circle.bin new file mode 100644 index 000000000..e8ed5d852 Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/res/planet_circle.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/res/rainbow_circle.bin b/code/sdk/middleware/services/gui/uikit/res/rainbow_circle.bin new file mode 100644 index 000000000..0e3830645 Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/res/rainbow_circle.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt b/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt index 4100ec8b3..07e22918c 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt @@ -61,7 +61,6 @@ set(COMPONENT_PUBLIC_CCFLAGS set(COMPONENT_CCFLAGS -std=c++11 - -Wno-error -Wno-unused-parameter -fno-exceptions -fno-unwind-tables @@ -71,15 +70,9 @@ set(COMPONENT_CCFLAGS -Wno-shift-op-parentheses -nostdlibinc -Wno-missing-field-initializers - -Wno-inconsistent-missing-override - -Wno-overloaded-virtual - -Wno-inline-new-delete - -Wno-sign-compare -Wno-writable-strings -Wno-reorder-ctor - -Wno-missing-declarations -Wno-tautological-pointer-compare - -Wno-unused-private-field -Werror=return-type ) diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.h index 5890f17be..965f205b8 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.h @@ -50,7 +50,6 @@ public: private: UILabel* label_ = nullptr; ColorType colorKey_; - Surface *surface_ = nullptr; UILiteSurfaceView* surfaceView_ = nullptr; VideoAnimatorCallback* callBack_ = nullptr; Animator* animator_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_draw_rect/ui_test_draw_rect.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_draw_rect/ui_test_draw_rect.cpp new file mode 100644 index 000000000..d01e8f8d8 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_draw_rect/ui_test_draw_rect.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 CompanyNameMagicTag. + * 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 "ui_test_draw_rect.h" +#include "hal_tick.h" + +namespace OHOS { +const static uint16_t RECT_WIDTH = 200; +const static uint16_t RECT_HEIGHT = 200; + +struct RectTest { + uint8_t borderOpa; + int16_t borderWidth; + int16_t radius; +}; + +static RectTest g_rectTestList[32] = { // 32: testcase size + {OPA_OPAQUE, 2, 7}, // 2, 7: borderWidth and radius + {OPA_OPAQUE, 2, 10}, // 2, 10: borderWidth and radius + {OPA_OPAQUE, 2, 20}, // 2, 20: borderWidth and radius + {OPA_OPAQUE, 2, 30}, // 2, 30: borderWidth and radius + {OPA_OPAQUE, 2, 40}, // 2, 40: borderWidth and radius + {OPA_OPAQUE, 2, 50}, // 2, 50: borderWidth and radius + {OPA_OPAQUE, 1, 50}, // 1, 50: borderWidth and radius + {OPA_OPAQUE, 3, 50}, // 3, 50: borderWidth and radius + {OPA_OPAQUE, 4, 50}, // 4, 50: borderWidth and radius + {OPA_OPAQUE, 48, 50}, // 48, 50: borderWidth and radius + {OPA_OPAQUE, 49, 50}, // 49, 50: borderWidth and radius + {OPA_OPAQUE, 50, 50}, // 50, 50: borderWidth and radius + {OPA_OPAQUE, 50, 100}, // 50, 100: borderWidth and radius + {OPA_OPAQUE, 0, 7}, // 0, 7: borderWidth and radius + {OPA_OPAQUE, 0, 50}, // 0, 50: borderWidth and radius + {OPA_OPAQUE, 0, 100}, // 0, 100: borderWidth and radius + {OPA_50, 2, 7}, // 2, 7: borderWidth and radius + {OPA_50, 2, 10}, // 2, 10: borderWidth and radius + {OPA_50, 2, 20}, // 2, 20: borderWidth and radius + {OPA_50, 2, 30}, // 2, 30: borderWidth and radius + {OPA_50, 2, 40}, // 2, 40: borderWidth and radius + {OPA_50, 2, 50}, // 2, 50: borderWidth and radius + {OPA_50, 1, 50}, // 1, 50: borderWidth and radius + {OPA_50, 3, 50}, // 3, 50: borderWidth and radius + {OPA_50, 4, 50}, // 4, 50: borderWidth and radius + {OPA_50, 48, 50}, // 48, 50: borderWidth and radius + {OPA_50, 49, 50}, // 49, 50: borderWidth and radius + {OPA_50, 50, 50}, // 50, 50: borderWidth and radius + {OPA_50, 50, 100}, // 50, 100: borderWidth and radius + {OPA_50, 0, 7}, // 0, 7: borderWidth and radius + {OPA_50, 0, 50}, // 0, 50: borderWidth and radius + {OPA_50, 0, 100}, // 0, 100: borderWidth and radius +}; + +void RectAnimatorCallback::Callback(UIView *view) +{ + if (lastRunTime_ == 0) { + lastRunTime_ = HALTick::GetInstance().GetTime(); + } + if (HALTick::GetInstance().GetElapseTime(lastRunTime_) > 3000) { // 3000: 3s, time elaps + view->Invalidate(); + view->SetStyle(STYLE_BORDER_OPA, g_rectTestList[curIndex_].borderOpa); + view->SetStyle(STYLE_BORDER_WIDTH, g_rectTestList[curIndex_].borderWidth); + view->SetStyle(STYLE_BORDER_RADIUS, g_rectTestList[curIndex_].radius); + curIndex_++; + printf("Test Rect[%u]: borderOpa = %d, borderWidth = %u, radius = %d\n", + curIndex_, g_rectTestList[curIndex_].borderOpa, + g_rectTestList[curIndex_].borderWidth, g_rectTestList[curIndex_].radius); + if (curIndex_ == 32) { // 32: testcase size + curIndex_ = 0; + } + view->Invalidate(); + lastRunTime_ = HALTick::GetInstance().GetTime(); + } +} + +void UITestDrawRect::SetUp() +{ + if (container_ == nullptr) { + container_ = new UIScrollView(); + container_->SetThrowDrag(true); + container_->SetHorizontalScrollState(false); + container_->Resize(Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + } + + if (rect_ == nullptr) { + rect_ = new UIView(); + } + rect_->SetPosition(100, 100); // 100 : x y position + rect_->Resize(RECT_WIDTH, RECT_HEIGHT); + rect_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); + rect_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + rect_->SetStyle(STYLE_BORDER_COLOR, Color::Red().full); + container_->Add(rect_); + + if (callback_ == nullptr) { + callback_ = new RectAnimatorCallback(rect_); + } + rectAnimator_ = callback_->GetAnimator(); +} + +void UITestDrawRect::TearDown() +{ + DeleteChildren(container_); + container_ = nullptr; + rect_ = nullptr; + if (callback_ != nullptr) { + delete callback_; + callback_ = nullptr; + } +} + +const UIView* UITestDrawRect::GetTestView() +{ + rectAnimator_->Start(); + return container_; +} +} diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_draw_rect/ui_test_draw_rect.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_draw_rect/ui_test_draw_rect.h new file mode 100644 index 000000000..d15aef8b6 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_draw_rect/ui_test_draw_rect.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 CompanyNameMagicTag. + * 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. + */ + +#ifndef UI_TEST_DRAW_RECT_H +#define UI_TEST_DRAW_RECT_H + +#include "ui_test.h" +#include "components/ui_scroll_view.h" +#include "animator/animator_manager.h" + +namespace OHOS { +class RectAnimatorCallback : public AnimatorCallback { +public: + explicit RectAnimatorCallback(UIView* view) + : animator_(new Animator(this, view, 1000, true)) {} // 1000:duration of animator_, in milliseconds. + + ~RectAnimatorCallback() override + { + if (animator_ != nullptr) { + delete animator_; + animator_ = nullptr; + } + } + + void Callback(UIView* view) override; + + Animator* GetAnimator() const + { + return animator_; + } + +protected: + int16_t curIndex_ = 0; + uint32_t lastRunTime_ = 0; + Animator* animator_; +}; + +class UITestDrawRect : public UITest { +public: + UITestDrawRect() {} + ~UITestDrawRect() override {} + void SetUp() override; + void TearDown() override; + const UIView* GetTestView() override; + +private: + UIView* rect_ = nullptr; + UIScrollView* container_ = nullptr; + RectAnimatorCallback* callback_ = nullptr; + Animator* rectAnimator_ = nullptr; +}; +} +#endif \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_emoji/ui_test_emoji.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_emoji/ui_test_emoji.cpp new file mode 100644 index 000000000..2394dfd5e --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_emoji/ui_test_emoji.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2022 CompanyNameMagicTag. + * 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 "ui_test_emoji.h" +#include "font/ui_font.h" + +namespace OHOS { + +void UITestEmoji::SetUp() +{ + if (container_ == nullptr) { + container_ = new UIScrollView(); + container_->SetThrowDrag(true); + container_->SetHorizontalScrollState(false); + container_->Resize(Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + x_ = START_X; + y_ = START_Y; + } +} + +void UITestEmoji::TearDown() +{ + DeleteChildren(container_); + container_ = nullptr; +} + +const UIView *UITestEmoji::GetTestView() +{ + TestLabel(); + TestArcLabel(); + return container_; +} + +void UITestEmoji::TestArcLabelDisplay(const std::string &title, const int16_t startAngle, const int16_t endAngle, + const UIArcLabel::TextOrientation orientation, UITextLanguageAlignment alignment) +{ + if (container_ != nullptr) { + UIArcLabel* label = new UIArcLabel(); + label->SetPosition(x_, y_); + label->SetArcTextCenter(CENTER_X, CENTER_Y + y_ + GAP); + label->SetArcTextRadius(RADIUS); + label->SetArcTextAngle(startAngle, endAngle); + label->SetArcTextOrientation(orientation); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); // 30: font size + label->SetText(title.c_str()); + label->SetStyle(STYLE_LETTER_SPACE, 10); // 10: space + label->SetStyle(STYLE_TEXT_COLOR, Color::Red().full); + label->SetAlign(alignment); + container_->Add(label); + y_ += (RADIUS * 2) + GAP; // 2: diameter + } +} + +void UITestEmoji::TestLabelDisplay(const std::string &title, UILabel::LineBreakMode mode) +{ + if (container_ == nullptr) { + return; + } + + UILabel *label = new UILabel; + label->SetPosition(x_, y_, WIDTH, HEIGHT); + label->SetLineBreakMode(static_cast(mode)); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); // 30: font size + label->SetText(title.c_str()); + + container_->Add(label); + y_ += HEIGHT + GAP; +} + +void UITestEmoji::TestArcLabel() +{ + std::string str = "\U0001F600\u4e52\U0001F609\u4e53\U0001F60f"; + int16_t startAngle = 0; + int16_t endAngle = 270; + UIArcLabel::TextOrientation orientation[] = { + UIArcLabel::TextOrientation::INSIDE, + UIArcLabel::TextOrientation::OUTSIDE + }; + UITextLanguageAlignment alignment[] = {TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER}; + constexpr int16_t lenOri = sizeof(orientation) / sizeof(orientation[0]); + constexpr int16_t lenAli = sizeof(alignment) / sizeof(alignment[0]); + for (int16_t i = 0; i < lenOri; ++i) { + for (int16_t j = 0; j < lenAli; ++j) { + TestArcLabelDisplay(str, startAngle, endAngle, orientation[i], alignment[j]); + } + } +} + +void UITestEmoji::TestLabel() +{ + using LineBreakMode = UILabel::LineBreakMode; + struct { + std::string str; + LineBreakMode mode; + } testCase[] = { + {"", LineBreakMode::LINE_BREAK_ADAPT}, + {"xxxxxxx\U0001F610\u4e52\U0001F600\u4e53\U0001F603yyyyyyyyy", LineBreakMode::LINE_BREAK_ADAPT}, + {"xxxxxxx\U0001F600\u4e52\U0001F605\u4e53\U0001F602yyyyyyyyy", LineBreakMode::LINE_BREAK_STRETCH}, + {"xxxxxxx\U0001F603\u4e52\U0001F604\u4e53\U0001F609yyyyyyyyy", LineBreakMode::LINE_BREAK_WRAP}, + {"xxxxxxx\U0001F608\u4e52\U0001F613\u4e53\U0001F60ayyyyyyyyy", LineBreakMode::LINE_BREAK_ELLIPSIS}, + {"xxxxxxx\U0001F607\u4e52\U0001F614\u4e53\U0001F60byyyyyyyyy", LineBreakMode::LINE_BREAK_MARQUEE}, + {"xxxxxxx\U0001F602\u4e52\U0001F615\u4e53\U0001F60cyyyyyyyyy", LineBreakMode::LINE_BREAK_OSCILLATION}, + {"xxxxxxx\U0001F601\u4e52\U0001F616\u4e53\U0001F60dyyyyyyyyy", LineBreakMode::LINE_BREAK_CLIP}, + }; + constexpr int len = sizeof(testCase) / sizeof(testCase[0]); + for (int i = 0; i < len; ++i) { + TestLabelDisplay(testCase[i].str, testCase[i].mode); + } +} +} diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_emoji/ui_test_emoji.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_emoji/ui_test_emoji.h new file mode 100644 index 000000000..a3e064ac7 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_emoji/ui_test_emoji.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 CompanyNameMagicTag. + * 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. + */ + +#ifndef UI_TEST_EMOJI_H +#define UI_TEST_EMOJI_H + +#include "ui_test.h" +#include "common/screen.h" +#include "components/ui_label.h" +#include "components/ui_arc_label.h" +#include "components/ui_scroll_view.h" + +namespace OHOS { +class UITestEmoji : public UITest { +public: + UITestEmoji() {} + ~UITestEmoji() override {} + void SetUp() override; + void TearDown() override; + const UIView *GetTestView() override; + +private: + constexpr static int16_t GAP = 40; + constexpr static int16_t CENTER_X = 150; + constexpr static int16_t CENTER_Y = 150; + constexpr static int16_t RADIUS = 100; + constexpr static int16_t WIDTH = 300; + constexpr static int16_t HEIGHT = 80; + constexpr static int16_t START_X = 100; + constexpr static int16_t START_Y = 100; + UIScrollView *container_ = nullptr; + int16_t x_ = START_X; + int16_t y_ = START_Y; + + void TestArcLabelDisplay(const std::string &title, const int16_t startAngle, const int16_t endAngle, + const UIArcLabel::TextOrientation orientation, UITextLanguageAlignment alignment); + void TestLabelDisplay(const std::string &title, UILabel::LineBreakMode mode); + void TestArcLabel(); + void TestLabel(); +}; +} +#endif // UI_TEST_EMOJI_H diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_icosahedron/ui_test_icosahedron.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_icosahedron/ui_test_icosahedron.cpp index 2d2352809..e07b3f806 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_icosahedron/ui_test_icosahedron.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_icosahedron/ui_test_icosahedron.cpp @@ -100,7 +100,9 @@ void UITestIcosahedron::TearDown() const UIView* UITestIcosahedron::GetTestView() { - enterAnimator_->Start(); + if (enterAnimator_ != nullptr) { + enterAnimator_->Start(); + } return container_; } } \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp index d91670d36..b24ec5963 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp @@ -33,7 +33,7 @@ void MenuItemAdapter::ClearText() while (node != nodeList_.End()) { if (node->data_) { if (node->data_->txt) { - UIFree(reinterpret_cast(node->data_->txt)); + UIFree(reinterpret_cast(const_cast(node->data_->txt))); node->data_->txt = nullptr; } UIFree(reinterpret_cast(node->data_)); @@ -83,7 +83,7 @@ void MenuItemAdapter::FreeNode(ItemNode* node) { if (node != nullptr) { if (node->txt) { - UIFree(reinterpret_cast(node->txt)); + UIFree(reinterpret_cast(const_cast(node->txt))); node->txt = nullptr; } UIFree(reinterpret_cast(node)); @@ -108,16 +108,18 @@ void MenuItemAdapter::SetData(const List* data) tmpNode->resId = node->data_->resId; uint32_t len = strlen(node->data_->txt); - tmpNode->txt = static_cast(UIMalloc(len + 1)); - if (tmpNode->txt == nullptr) { + char *txt = static_cast(UIMalloc(len + 1)); + if (txt == nullptr) { FreeNode(tmpNode); return; } - if (memcpy_s(tmpNode->txt, len + 1, node->data_->txt, len) != EOK) { + if (memcpy_s(txt, len + 1, node->data_->txt, len) != EOK) { + UIFree(txt); FreeNode(tmpNode); return; } - tmpNode->txt[len] = '\0'; + txt[len] = '\0'; + tmpNode->txt = txt; tmpNode->imgInfo = nullptr; nodeList_.PushBack(tmpNode); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.cpp index 99be36aa6..40b832ab1 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.cpp @@ -90,7 +90,7 @@ void ImageTextAdapter::ClearText() while (node != nodeList_.End()) { if (node->data_) { if (node->data_->txt) { - UIFree(reinterpret_cast(node->data_->txt)); + UIFree(reinterpret_cast(const_cast(node->data_->txt))); node->data_->txt = nullptr; } UIFree(reinterpret_cast(node->data_)); @@ -140,7 +140,7 @@ void ImageTextAdapter::FreeNode(ItemNode* node) { if (node != nullptr) { if (node->txt) { - UIFree(reinterpret_cast(node->txt)); + UIFree(reinterpret_cast(const_cast(node->txt))); node->txt = nullptr; } UIFree(reinterpret_cast(node)); @@ -165,16 +165,18 @@ void ImageTextAdapter::SetData(const List* data) tmpNode->resId = node->data_->resId; uint32_t len = strlen(node->data_->txt); - tmpNode->txt = static_cast(UIMalloc(len + 1)); - if (tmpNode->txt == nullptr) { + char *txt = static_cast(UIMalloc(len + 1)); + if (txt == nullptr) { FreeNode(tmpNode); return; } - if (memcpy_s(tmpNode->txt, len + 1, node->data_->txt, len) != EOK) { + if (memcpy_s(txt, len + 1, node->data_->txt, len) != EOK) { + UIFree(txt); FreeNode(tmpNode); return; } - tmpNode->txt[len] = '\0'; + txt[len] = '\0'; + tmpNode->txt = txt; tmpNode->imgInfo = nullptr; nodeList_.PushBack(tmpNode); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.h index f76993f50..baaa8fd1e 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_fps/image_text_adapter.h @@ -25,7 +25,7 @@ namespace OHOS { struct ItemNode { int resId; - char* txt; + const char* txt; ImageInfo* imgInfo; }; diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slider/ui_test_slider.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slider/ui_test_slider.h index 884a9b86b..ff1e0a8c0 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slider/ui_test_slider.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slider/ui_test_slider.h @@ -101,8 +101,6 @@ private: UILabelButton* dirR2LBtn_ = nullptr; UILabelButton* dirT2BBtn_ = nullptr; UILabelButton* dirB2TBtn_ = nullptr; - UILabelButton* imageBtn_ = nullptr; - UILabelButton* noImageBtn_ = nullptr; UILabelButton* setStyleBtn_ = nullptr; UILabelButton* getStyleBtn_ = nullptr; UILabelButton* incKnobWidthBtn_ = nullptr; 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 new file mode 100644 index 000000000..eb7936847 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.cpp @@ -0,0 +1,295 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: UITestSlip + * Author: + * Create: 2024-08 + */ + +#include "ui_test_slipflow.h" +#include "common/screen.h" +#include "font/ui_font.h" +#include "gfx_utils/graphic_math.h" +#include "gfx_utils/rect.h" +#include "common/image_cache_manager.h" + +namespace OHOS { +namespace { +struct FaceInfo { + const char* name; + const char* path; +} ; + +static constexpr uint8_t SLIPFLOW_MAX_PAGE_NUM = 6; +static FaceInfo g_faceInfo[SLIPFLOW_MAX_PAGE_NUM] = { + {"1 rainbow", RES_PATH"/rainbow_circle.bin"}, + {"2 kaleidoscope", RES_PATH"/kaleidoscope_circle.bin"}, + {"3 planet", RES_PATH"/planet_circle.bin"}, + {"4 rainbow", RES_PATH"/rainbow_circle.bin"}, + {"5 kaleidoscope", RES_PATH"/kaleidoscope_circle.bin"}, + {"6 planet", RES_PATH"/planet_circle.bin"} +}; +static constexpr const char* BACK_IMAGE_PATH = RES_PATH"/image_background_circle.bin"; + +static constexpr uint8_t SLIPFLOW_PRELOAD_PAGE_NUM = 3; +static constexpr int16_t LABEL_FONT_SIZE = 30; +static constexpr uint8_t DEFAULT_STEP = 10; +static constexpr uint16_t BUTTON_WIDTH = 60; +static constexpr uint16_t BUTTON_HEIGHT = 40; +static constexpr uint16_t BUTTON_GROUP_WIDTH = 300; +static constexpr uint16_t BUTTON_GROUP_HEIGHT = 80; +static constexpr uint8_t DIVISOR_TWO = 2; +static constexpr uint16_t PAGE_WIDTH = 200; +static constexpr uint16_t PAGE_HEIGHT = 200; +} // namespace + +void UITestSlipflow::SetUp() +{ + if (container_ == nullptr) { + container_ = new UIScrollView(); + container_->SetThrowDrag(true); + container_->SetHorizontalScrollState(false); + container_->Resize(Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + } +} + +void UITestSlipflow::TearDown() +{ + container_->Remove(slipflow_); + DeleteChildren(container_); + if (container_ != nullptr) { + container_ = nullptr; + } + delete slipflow_; + slipflow_ = nullptr; + + label_ = nullptr; + slipUpNoticelabel_ = nullptr; + lastIndex_ = 0; + showBtn_ = nullptr; + isShowBtnGrp_ = false; + btnGrp_ = nullptr; + loadNum_ = 0; + + imgWidthAddBtn_ = nullptr; + imgWidthSubBtn_ = nullptr; + + imgWidth_ = 200; // 200: default value + imgPadding_ = 50; // 50: default value + mirrorOpa_ = 30; // 30: default value + rotateAngle_ = 70.0f; // 70: default value +} + +const UIView* UITestSlipflow::GetTestView() +{ + UITestSlipflowView(); + return container_; +} + +void UITestSlipflow::CreateLabelButton(UILabelButton** btn, const char* tile, int16_t x, int16_t y) +{ + UILabelButton* tempBtn = nullptr; + if (tempBtn == nullptr) { + tempBtn = new UILabelButton(); + } + tempBtn->SetPosition(x, y, BUTTON_WIDTH, BUTTON_HEIGHT); + tempBtn->SetText(tile); + tempBtn->SetOnClickListener(this); + btnGrp_->Add(tempBtn); + *btn = tempBtn; +} + +void UITestSlipflow::InitButtonGroup() +{ + if (showBtn_ == nullptr) { + showBtn_ = new UIButton(); + showBtn_->SetPosition(202, 10, BUTTON_WIDTH, BUTTON_HEIGHT); // 202: x position 10: y position + showBtn_->SetStyleForState(STYLE_BACKGROUND_OPA, 0, UIButton::ButtonState::RELEASED); + showBtn_->SetStyleForState(STYLE_BACKGROUND_OPA, 0, UIButton::ButtonState::PRESSED); + showBtn_->SetOnClickListener(this); + container_->Add(showBtn_); + } + if (btnGrp_ == nullptr) { + btnGrp_ = new UIViewGroup(); + btnGrp_->SetPosition(77, 40, BUTTON_GROUP_WIDTH, BUTTON_GROUP_HEIGHT); // 77: x position 40: y position + btnGrp_->SetStyle(STYLE_BACKGROUND_OPA, 0); + btnGrp_->SetVisible(false); + container_->Add(btnGrp_); + } + CreateLabelButton(&imgWidthAddBtn_, "wid+", 0, 0); + CreateLabelButton(&imgWidthSubBtn_, "wid-", 60, 0); // 60: x position +} + +void UITestSlipflow::UITestSlipflowView() +{ + if (container_ != nullptr) { + if (slipflow_ == nullptr) { + slipflow_ = new UISlipflowView(); + } + slipflow_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + slipflow_->SetIntercept(true); + slipflow_->SetThrowDrag(true); + slipflow_->SetPageSize(PAGE_WIDTH, PAGE_HEIGHT); + slipflow_->SetOnSlipflowListener(this); + UITestSlipflowViewInitFlow(); + + if (label_ == nullptr) { + label_ = new UILabel(); + } + label_->SetPosition(127, 50, 200, 50); // 127 50 200 50: label position + label_->SetTextColor(Color::White()); + label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + lastIndex_ = slipflow_->GetCurrentPage(); + label_->SetText(g_faceInfo[lastIndex_].name); + label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); + if (slipUpNoticelabel_ == nullptr) { + slipUpNoticelabel_ = new UILabel(); + } + slipUpNoticelabel_->SetPosition(127, 400, 200, 50); // 127 400 200 50: label position + slipUpNoticelabel_->SetTextColor(Color::White()); + slipUpNoticelabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + slipUpNoticelabel_->SetText("继续上滑删除"); + slipUpNoticelabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); // 30 : font size + slipUpNoticelabel_->SetVisible(false); + container_->Add(slipflow_); + container_->Add(label_); + container_->Add(slipUpNoticelabel_); + InitButtonGroup(); + } +} + +void UITestSlipflow::UITestSlipflowViewInitFlow() +{ + for (uint8_t i = 0; i < SLIPFLOW_MAX_PAGE_NUM; i++) { + UIImageView* image = new UIImageView(); + ImageInfo* src = ImageCacheManager::GetInstance().LoadSingleRes(std::string(g_faceInfo[i].path)); + image->SetViewId(g_faceInfo[i].name); + image->SetSrc(src); + image->Resize(PAGE_WIDTH, PAGE_HEIGHT); + image->SetResizeMode(UIImageView::ImageResizeMode::FILL); + image->SetAutoEnable(false); + UIViewGroup* group = new UIViewGroup(); + group->SetViewId(g_faceInfo[i].name); + group->SetPosition(0, 0, PAGE_WIDTH, Screen::GetInstance().GetHeight()); + group->SetStyle(STYLE_BACKGROUND_OPA, 0); + group->SetDragParentInstead(true); + UIImageView* backImage = new UIImageView(); + backImage->SetSrc(ImageCacheManager::GetInstance().LoadSingleRes(std::string(BACK_IMAGE_PATH))); + backImage->Resize(PAGE_WIDTH, PAGE_HEIGHT); + backImage->SetResizeMode(UIImageView::ImageResizeMode::FILL); + backImage->SetAutoEnable(false); + group->Add(backImage); + group->Add(image); + slipflow_->Add(group); + backImage->LayoutCenterOfParent(); + image->LayoutCenterOfParent(); + loadNum_++; + } +} + +bool UITestSlipflow::OnScroll(int16_t distance) +{ + if (slipflow_->GetChildrenNumber() == 0) { + label_->SetText(""); + return true; + } + int16_t contMidX = static_cast(Screen::GetInstance().GetWidth() / DIVISOR_TWO); + int16_t minOffset = contMidX; + uint8_t newCenterIndex = lastIndex_; + for (uint8_t i = 0; i < slipflow_->GetChildrenNumber(); i++) { + Rect rect = slipflow_->GetViewByIndex(i)->GetOrigRect(); + int16_t x = rect.GetLeft(); + int16_t x1 = rect.GetRight(); + int16_t xMid = static_cast(x + (x1 - x + 1) / DIVISOR_TWO); + int16_t distance = MATH_ABS(xMid - contMidX); + if (distance < minOffset) { + newCenterIndex = i; + minOffset = distance; + } + } + if (newCenterIndex != lastIndex_) { + lastIndex_ = newCenterIndex; + label_->SetText(slipflow_->GetViewByIndex(lastIndex_)->GetViewId()); + } + + Rect curViewRect = slipflow_->GetViewByIndex(lastIndex_)->GetOrigRect(); + int16_t centerMid = curViewRect.GetLeft() + curViewRect.GetWidth() / DIVISOR_TWO; + int16_t offset = MATH_ABS(contMidX - centerMid); + if (offset > curViewRect.GetWidth() / DIVISOR_TWO) { + label_->SetStyle(STYLE_TEXT_OPA, 0); + } else { + uint8_t alpha = (uint8_t)((1.0f - ((float)offset / (curViewRect.GetWidth() / DIVISOR_TWO))) * OPA_OPAQUE); + label_->SetStyle(STYLE_TEXT_OPA, alpha); + } + return true; +} + +void UITestSlipflow::OnScrollUpStart() +{ + label_->SetVisible(false); + slipUpNoticelabel_->SetVisible(true); +} + +void UITestSlipflow::OnScrollUpEnd() +{ + OnScroll(0); + label_->SetVisible(true); + slipUpNoticelabel_->SetVisible(false); +} + +void UITestSlipflow::OnRefreshPageOpaScale(UIView* view, int16_t xOffset, int16_t yOffset) +{ + UIView* image = static_cast(view)->GetChildrenHead()->GetNextSibling(); + if (xOffset < 0) { + image->SetOpaScale(OPA_OPAQUE); + } else if (xOffset > slipflow_->GetPageWidth()) { + image->SetOpaScale(0); + } else { + uint8_t alpha = (uint8_t)(OPA_OPAQUE * (1.0f - ((float)xOffset / slipflow_->GetPageWidth()))); + image->SetOpaScale(alpha); + } + if (yOffset > 0) { + if (yOffset > (slipflow_->GetPageHeight() / DIVISOR_TWO)) { + image->SetOpaScale(OPA_OPAQUE * 0.4f); + } else { + uint8_t alpha = (uint8_t)(OPA_OPAQUE * + (1.0f - 0.6f * ((float)yOffset / (slipflow_->GetPageHeight() / DIVISOR_TWO)))); + image->SetOpaScale(alpha); + } + } +} + +bool UITestSlipflow::OnRemove(UIView* view) +{ + if (view == nullptr) { + return false; + } + UIViewGroup* group = static_cast(view); + UIView* curView = group->GetChildrenHead(); + UIView* deleteView = nullptr; + while (curView != nullptr) { + deleteView = curView; + curView = curView->GetNextSibling(); + group->Remove(deleteView); + delete deleteView; + deleteView = nullptr; + } + delete group; + group = nullptr; + return true; +} + +bool UITestSlipflow::OnClick(UIView& view, const ClickEvent& event) +{ + if (&view == showBtn_) { + btnGrp_->SetVisible(!btnGrp_->IsVisible()); + } else if (&view == imgWidthAddBtn_) { + imgWidth_ += DEFAULT_STEP; + slipflow_->SetPageSize(imgWidth_, imgWidth_); + } else if (&view == imgWidthSubBtn_) { + imgWidth_ -= DEFAULT_STEP; + slipflow_->SetPageSize(imgWidth_, imgWidth_); + } + slipflow_->Invalidate(); + return true; +} +} // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.h new file mode 100644 index 000000000..0a219ec29 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_slipflow/ui_test_slipflow.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: UITestSlip + * Author: + * Create: 2024-08 + */ + +#ifndef UI_TEST_SLIPFLOW_VIEW_H +#define UI_TEST_SLIPFLOW_VIEW_H + +#include "components/ui_slipflow_view.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label_button.h" +#include "animator/animator.h" +#include "ui_test.h" + +namespace OHOS { +class UITestSlipflow : public UITest, + public UISlipflowView::OnSlipflowScrollListener, public UIView::OnClickListener { +public: + UITestSlipflow() {} + ~UITestSlipflow() override {} + void SetUp() override; + void TearDown() override; + const UIView* GetTestView() override; + /** + * @brief Test display UISlipflow + */ + void UITestSlipflowView(); + void UITestSlipflowViewInitFlow(); + + bool OnScroll(int16_t distance) override; + void OnScrollUpStart() override; + void OnScrollUpEnd() override; + void OnRefreshPageOpaScale(UIView* view, int16_t xOffset, int16_t yOffset) override; + + bool OnRemove(UIView* view) override; + + bool OnClick(UIView& view, const ClickEvent& event) override; +private: + void InitButtonGroup(); + void CreateLabelButton(UILabelButton** btn, const char* tile, int16_t x, int16_t y); + + UIScrollView* container_ = nullptr; + UISlipflowView* slipflow_ = nullptr; + UILabel* label_ = nullptr; + UILabel* slipUpNoticelabel_ = nullptr; + uint16_t lastIndex_ = 0; + UIButton* showBtn_ = nullptr; + bool isShowBtnGrp_ = false; + UIViewGroup* btnGrp_ = nullptr; + uint8_t loadNum_ = 0; + UILabelButton* imgWidthAddBtn_ = nullptr; + UILabelButton* imgWidthSubBtn_ = nullptr; + uint16_t imgWidth_ = 200; // 200: default value + uint16_t imgPadding_ = 50; // 50: default value + uint8_t mirrorOpa_ = 30; // 30: default value + float rotateAngle_ = 70.0f; // 70: default value +}; +} // namespace OHOS +#endif // UI_TEST_SLIPFLOW_VIEW_H diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/test_case_list_adapter.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/test_case_list_adapter.cpp index ce6b1e7cd..156f248d3 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/test_case_list_adapter.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/test_case_list_adapter.cpp @@ -81,14 +81,14 @@ public: tempView->SetViewId(view.GetViewId()); tempView->SetPosition(tempView->GetX(), tempView->GetY()); rootView->Add(tempView); - if (backBtn_ == nullptr) { - backBtn_ = new TransparentBackButton(); - backBtn_->SetPosition(0, (Screen::GetInstance().GetHeight() - BACK_BUTTON_SIZE) / 2, // 2, half size - BACK_BUTTON_SIZE, BACK_BUTTON_SIZE); - } - backBtn_->SetViewId(view.GetViewId()); - rootView->Add(backBtn_); } + if (backBtn_ == nullptr) { + backBtn_ = new TransparentBackButton(); + backBtn_->SetPosition(0, (Screen::GetInstance().GetHeight() - BACK_BUTTON_SIZE) / 2, // 2, half size + BACK_BUTTON_SIZE, BACK_BUTTON_SIZE); + } + backBtn_->SetViewId(view.GetViewId()); + rootView->Add(backBtn_); rootView->Invalidate(); return true; } diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp index b62122c78..ef87d6344 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp @@ -21,6 +21,7 @@ #include "ui_test_chart/ui_test_chart_polyline.h" #include "ui_test_chart/ui_test_chart_pillar.h" #include "ui_test_draw/ui_test_draw.h" +#include "ui_test_draw_rect/ui_test_draw_rect.h" #include "ui_test_image/ui_test_image.h" #include "ui_test_image_fps/ui_test_image_fps.h" #include "ui_test_key/ui_test_key.h" @@ -83,6 +84,7 @@ #include "ui_test_kaleidoscope/ui_test_kaleidoscope.h" #include "ui_test_roller_view/ui_test_roller_view.h" #include "ui_test_transform_list/ui_test_scale_list.h" +#include "ui_test_emoji/ui_test_emoji.h" namespace OHOS { void UITestGroup::AddTestCase(TestCaseInfo testCaseInfo) @@ -167,12 +169,14 @@ void UITestGroup::SetUpTestCase() #endif testCaseList_->PushBack(TestCaseInfo{"画布", new UITestDraw()}); testCaseList_->PushBack(TestCaseInfo{"图片显示", new UITestImage()}); + testCaseList_->PushBack(TestCaseInfo{"矩形绘制", new UITestDrawRect()}); #if (ENABLE_IMAGE_PACKER && ENABLE_IMAGE_PACKER_TEST) testCaseList_->PushBack(TestCaseInfo{"图片打包", new UITestImageBin()}); #endif testCaseList_->PushBack(TestCaseInfo{"列表", new UITestList()}); testCaseList_->PushBack(TestCaseInfo{"滑动条", new UITestSlider()}); testCaseList_->PushBack(TestCaseInfo{"图片动画", new UITestImageFPS()}); + testCaseList_->PushBack(TestCaseInfo{"表情包显示", new UITestEmoji()}); } List& UITestGroup::GetTestCase() diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp index 3e1c2cb38..a1d44f4cc 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp @@ -17,6 +17,9 @@ #include "common/task_manager.h" #include "gfx_utils/graphic_log.h" #include "dock/pointer_input_device.h" +#include "dock/rotate_input_device.h" +#include "hals/lite_input_distributer.h" +#include "gfx_utils/input_event_info.h" namespace OHOS { InputDeviceManager* InputDeviceManager::GetInstance() @@ -94,4 +97,40 @@ void InputDeviceManager::ClearPressableViews() node = node->next_; } } + +void InputDeviceManager::ClearRotateState() +{ + ListNode* node = deviceList_.Begin(); + while (node != deviceList_.End()) { + RotateInputDevice* device = dynamic_cast(node->data_); + if (device != nullptr) { + device->ResetRotateState(); + } + node = node->next_; + } +} + +void InputDeviceManager::ClearInputDeviceState(InputDeviceManager::InputDeviceType type) +{ + switch (type) { + case InputDeviceManager::InputDeviceType::ALL: + InputDeviceManager::GetInstance()->ClearPressableViews(); + InputDeviceManager::GetInstance()->ClearRotateState(); + LiteInputDistributer::GetInstance()->ClearEvent(InputDevType::INDEV_TYPE_TOUCH); + LiteInputDistributer::GetInstance()->ClearEvent(InputDevType::INDEV_TYPE_KEY); + break; + case InputDeviceManager::InputDeviceType::POINT: + LiteInputDistributer::GetInstance()->ClearEvent(InputDevType::INDEV_TYPE_TOUCH); + InputDeviceManager::GetInstance()->ClearPressableViews(); + break; + case InputDeviceManager::InputDeviceType::ROTATE: + InputDeviceManager::GetInstance()->ClearRotateState(); + break; + case InputDeviceManager::InputDeviceType::KEY: + LiteInputDistributer::GetInstance()->ClearEvent(InputDevType::INDEV_TYPE_KEY); + default: + GRAPHIC_LOGE("Cannot clear state of the input device: %d!", type); + break; + } +} } // namespace OHOS \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_abstract_scroll.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_abstract_scroll.cpp index 7f0dc554c..00be014d4 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_abstract_scroll.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_abstract_scroll.cpp @@ -362,7 +362,7 @@ bool UIAbstractScroll::OnRotateEvent(const RotateEvent& event) bool UIAbstractScroll::OnRotateEndEvent(const RotateEvent& event) { - if (memset_s(lastDelta_, MAX_DELTA_SIZE, 0, MAX_DELTA_SIZE) != EOK) { + if (memset_s(lastDelta_, sizeof(lastDelta_), 0, sizeof(lastDelta_)) != EOK) { return UIView::OnRotateEndEvent(event); } diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_canvas.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_canvas.cpp index ef35024a7..29ec415d7 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_canvas.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_canvas.cpp @@ -21,6 +21,61 @@ #include "gfx_utils/graphic_log.h" namespace OHOS { +void Paint::Scale(float scaleX, float scaleY) +{ + this->scaleRadioX_ *= scaleX; + this->scaleRadioY_ *= scaleX; + if (rotateAngle_ > 0.0f || rotateAngle_ < 0) { + transfrom_.Rotate(-rotateAngle_ * UI_PI / BOXER); + transfrom_.Scale(scaleX, scaleY); + transfrom_.Rotate(rotateAngle_ * UI_PI / BOXER); + } else { + transfrom_.Scale(scaleX, scaleY); + } +} + +void Paint::Rotate(float angle) +{ + transfrom_.Rotate(angle * UI_PI / BOXER); + rotateAngle_ += angle; +} + +void Paint::Rotate(float angle, int16_t x, int16_t y) +{ + transfrom_.Translate(-x, -y); + transfrom_.Rotate(angle * UI_PI / BOXER); + rotateAngle_ += angle; + transfrom_.Translate(x, y); +} + +void Paint::Translate(int16_t x, int16_t y) +{ + transfrom_.Translate(x, y); + this->translationX_ += x; + this->translationY_ += y; +} + +void Paint::SetTransform(float scaleX, float shearX, float shearY, + float scaleY, int16_t transLateX, int16_t transLateY) +{ + transfrom_.Reset(); + rotateAngle_ = 0; + Transform(scaleX, shearX, shearY, scaleY, transLateX, transLateY); +} + +void Paint::Transform(float scaleX, float shearX, float shearY, float scaleY, int16_t transLateX, int16_t transLateY) +{ + this->translationX_ += transLateX; + this->translationY_ += transLateY; + transLateX += transfrom_.GetData()[2]; // 2: index + transLateY += transfrom_.GetData()[5]; // 5: index + transfrom_.Translate(-transfrom_.GetData()[2], -transfrom_.GetData()[5]); // 2 5: index + Scale(scaleX, scaleY); + transfrom_.Translate(transLateX, transLateY); + transfrom_.SetData(1, transfrom_.GetData()[1] + shearX); + transfrom_.SetData(3, transfrom_.GetData()[3] + shearY); // 3: index +} + UICanvas::UICanvasPath::~UICanvasPath() { points_.Clear(); @@ -395,33 +450,63 @@ void UICanvas::DrawImage(const Point& startPoint, const char* image, const Paint return; } - ImageParam* imageParam = new ImageParam; - if (imageParam == nullptr) { - GRAPHIC_LOGE("new ImageParam fail"); - return; + if (static_cast(paint.GetStyle()) & Paint::PaintStyle::FILL_STYLE) { + UIImageView* imageView = new UIImageView(); + if (imageView == nullptr) { + GRAPHIC_LOGE("new UIImageView fail"); + return; + } + imageView->SetPosition(startPoint.x, startPoint.y); + imageView->SetSrc(image); + + DrawCmd cmd; + cmd.paint = paint; + cmd.param = imageView; + cmd.DeleteParam = DeleteImageView; + cmd.DrawGraphics = DoDrawImage; + drawCmdList_.PushBack(cmd); + + Invalidate(); + SetStartPosition(startPoint); } - imageParam->image = new Image(); - if (imageParam->image == nullptr) { - delete imageParam; - imageParam = nullptr; +} + +void UICanvas::DrawImage(const Point& startPoint, const char* image, + const Paint& paint, int16_t width, int16_t height) +{ + if (image == nullptr) { return; } + if (static_cast(paint.GetStyle()) & Paint::PaintStyle::FILL_STYLE) { + UIImageView* imageView = new UIImageView(); + if (imageView == nullptr) { + GRAPHIC_LOGE("new UIImageView fail"); + return; + } + imageView->SetPosition(startPoint.x, startPoint.y); + imageView->SetSrc(image); + float scaleX = 1.0; + float scaleY = 1.0; + if (width > 0 && imageView->GetWidth() > 0) { + scaleX = (float)width / (float)imageView->GetWidth(); + } + if (height > 0 && imageView->GetHeight() > 0) { + scaleY = (float)height / (float)imageView->GetHeight(); + } + DrawCmd cmd; + cmd.paint = paint; + cmd.paint.Scale(scaleX, scaleY); + cmd.param = imageView; + cmd.DeleteParam = DeleteImageView; + cmd.DrawGraphics = DoDrawImage; + drawCmdList_.PushBack(cmd); - imageParam->image->SetSrc(image); - ImageHeader header = {0}; - imageParam->image->GetHeader(header); - imageParam->start = startPoint; - imageParam->height = header.height; - imageParam->width = header.width; - - DrawCmd cmd; - cmd.paint = paint; - cmd.param = imageParam; - cmd.DeleteParam = DeleteImageParam; - cmd.DrawGraphics = DoDrawImage; - drawCmdList_.PushBack(cmd); + Invalidate(); + SetStartPosition(startPoint); + } Invalidate(); + SetStartPosition(startPoint); } void UICanvas::DrawPath(const Paint& paint) @@ -674,21 +759,23 @@ void UICanvas::DoDrawImage(BufferInfo& gfxDstBuffer, if (param == nullptr) { return; } - ImageParam* imageParam = static_cast(param); - - if (imageParam->image == nullptr) { - return; - } - + UIImageView* imageView = static_cast(param); + Point startPos = {imageView->GetX(), imageView->GetY()}; Point start; - GetAbsolutePosition(imageParam->start, rect, style, start); - - Rect cordsTmp; - cordsTmp.SetPosition(start.x, start.y); - cordsTmp.SetHeight(imageParam->height); - cordsTmp.SetWidth(imageParam->width); - DrawImage::DrawCommon(gfxDstBuffer, cordsTmp, invalidatedArea, - imageParam->image->GetPath(), style, paint.GetOpacity()); + GetAbsolutePosition({startPos.x, startPos.y}, rect, style, start); + imageView->SetPosition(start.x, start.y); + if (!paint.GetTransAffine().IsIdentity()) { + float angle = paint.GetRotateAngle(); + imageView->Rotate(MATH_ROUND(angle), Vector2(0, 0)); + imageView->Translate(Vector3(paint.GetTranslateX(), paint.GetTranslateY(), 1)); + Vector2 scale(static_cast(paint.GetScaleX()), static_cast(paint.GetScaleY())); + imageView->Scale(scale, Vector2(0, 0)); + TransAffine affine = paint.GetTransAffine(); + imageView->Shear(Vector2(affine.GetData()[1], 0), Vector2(affine.GetData()[3], 0), + Vector2(0, 0)); + } + imageView->OnDraw(gfxDstBuffer, invalidatedArea); + imageView->SetPosition(startPos.x, startPos.y); } void UICanvas::DoDrawLabel(BufferInfo& gfxDstBuffer, diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp index 8c609f8fe..45faed83e 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp @@ -338,7 +338,6 @@ void UILabel::SetTextTransformMap(TransformMap& transMap) { InitLabelText(); labelText_->SetTransformMap(transMap); - SetTransformMap(transMap); } void UILabel::RefreshLabel() diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp index 35b3350ca..47c85fc66 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp @@ -254,6 +254,10 @@ bool UISwipeView::OnRotateStartEvent(const RotateEvent& event) bool UISwipeView::OnRotateEndEvent(const RotateEvent& event) { + if (memset_s(lastDelta_, sizeof(lastDelta_), 0, sizeof(lastDelta_)) != EOK) { + return UIView::OnRotateEndEvent(event); + } + uint8_t dir; if (direction_ == HORIZONTAL) { dir = (lastRotateLen_ >= 0) ? DragEvent::DIRECTION_LEFT_TO_RIGHT : DragEvent::DIRECTION_RIGHT_TO_LEFT; diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/focus_manager.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/focus_manager.cpp index 72b7944b8..ea660502d 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/focus_manager.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/focus_manager.cpp @@ -18,6 +18,7 @@ #include "components/root_view.h" #include "gfx_utils/graphic_math.h" #include "common/input_method_manager.h" +#include "common/input_device_manager.h" namespace OHOS { FocusManager* FocusManager::GetInstance() @@ -50,6 +51,7 @@ bool FocusManager::ClearFocus() lastFocusView_ = focusView_; focusView_->Blur(); focusView_ = nullptr; + InputDeviceManager::GetInstance()->ClearInputDeviceState(InputDeviceManager::InputDeviceType::ROTATE); return true; } diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp index 943688dea..eec3dbb07 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp @@ -273,22 +273,22 @@ void DrawUtils::DrawPixel(BufferInfo& gfxDstBuffer, } #if CAPABILITY_HWDRAW_LETTER_VECTOR -void DrawUtils::DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo) const +bool DrawUtils::DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo) const { UIFont* fontEngine = UIFont::GetInstance(); GlyphPathData path; if (!fontEngine->GetGlyphPathData(letterInfo.letter, letterInfo.shapingId, path)) { GRAPHIC_LOGD("GetGlyphPathData failed\n"); - return; + return false; } if ((path.width == 0) || (path.cmdsNum == 0)) { - return; + return false; } FontHeader head; if (UIFont::GetInstance()->GetCurrentFontHeader(head) != 0) { - return; + return false; } uint16_t letterW = path.width; @@ -305,7 +305,7 @@ void DrawUtils::DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetter } if ((posX + letterW < letterInfo.mask.GetLeft()) || (posX > letterInfo.mask.GetRight()) || (posY + letterH < letterInfo.mask.GetTop()) || (posY > letterInfo.mask.GetBottom())) { - return; + return false; } VGUMatrix3 matrix; @@ -343,8 +343,93 @@ void DrawUtils::DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetter LiteMGfxEngine::GetInstance()->FillPath(gfxDstBuffer, vguPath, letterInfo.mask, letterInfo.color, letterInfo.opa, &matrix); LiteMGfxEngine::GetInstance()->DeinitPath(vguPath); + return true; + } + return false; +} + +void Convert2BufferInfo(const ImageInfo &info, const Rect &inputRect, BufferInfo &bufferInfo) +{ + bufferInfo.rect = inputRect; + bufferInfo.virAddr = static_cast(const_cast(info.data)); +#if ENABLE_GFX_ENGINES || defined(VERSION_IOT) + bufferInfo.phyAddr = bufferInfo.virAddr; +#endif + bufferInfo.stride = static_cast( + ImageLoad::GetAlignedStride(info.header.width, info.header.compressMode, info.header.colorMode)); + bufferInfo.mode = static_cast(info.header.colorMode); + bufferInfo.width = info.header.width; + bufferInfo.height = info.header.height; +#ifdef VERSION_IOT + bufferInfo.compressMode = info.header.compressMode; +#endif + bufferInfo.color = 0; +} + +static void DrawEmoji(BufferInfo &gfxDstBuffer, const ImageInfo &info, const LabelLetterInfo &letterInfo) +{ + int16_t posX = letterInfo.pos.x; + int16_t posY = letterInfo.pos.y; + UIFont* fontEngine = UIFont::GetInstance(); + if (fontEngine == nullptr) { return; } + int16_t letterW = fontEngine->GetWidth(letterInfo.letter, letterInfo.shapingId); + int16_t letterH = fontEngine->GetHeight(); + BufferInfo src; + memset_s(&src, sizeof(src), 0, sizeof(src)); + Convert2BufferInfo(info, Rect(0, 0, info.header.width - 1, info.header.height - 1), src); + BlendOption blendOption; + blendOption.opacity = letterInfo.opa; + blendOption.transMap.SetTransMapRect(src.rect); + float scaleX = static_cast(letterW) / info.header.width; + float scaleY = static_cast(letterH) / info.header.height; + blendOption.transMap.Scale(Vector2{scaleX, scaleY}, Vector2{0, 0}); + blendOption.transMap.Translate(Vector2(posX, posY)); + Rect mask = letterInfo.mask; + if (!mask.Intersect(mask, blendOption.transMap.GetBoxRect())) { + return; + } + mask.SetLeft(mask.GetLeft() + 1); + mask.SetRight(mask.GetRight() - 1); + mask.SetTop(mask.GetTop() + 1); + mask.SetBottom(mask.GetBottom() - 1); + if (!mask.IsValid()) { + return; + } + blendOption.mode = BLEND_SRC_OVER; + BaseGfxEngine::GetInstance()->Blit(gfxDstBuffer, {0, 0}, src, mask, blendOption); +} + +static void DrawEmojiRotate(BufferInfo &gfxDstBuffer, const LabelLetterInfo &letterInfo, float rotateAngle) +{ + UIFont* fontEngine = UIFont::GetInstance(); + ImageInfo info; + if (!fontEngine->GetEmoji(letterInfo.letter, info)) { + return; + } + BufferInfo src; + Convert2BufferInfo(info, Rect(0, 0, info.header.width - 1, info.header.height - 1), src); + + int16_t letterW = fontEngine->GetWidth(letterInfo.letter, letterInfo.shapingId); + int16_t letterH = fontEngine->GetHeight(); + + float x = letterInfo.x; + float y = letterInfo.y; + Matrix4 mat; + Matrix4 rotate = Matrix4::Rotate(rotateAngle, + Vector3(0, 0, 0), Vector3(0, 0, 1)); + float scaleX = static_cast(letterW) / info.header.width; + float scaleY = static_cast(letterH) / info.header.height; + Matrix4 scale = Matrix4::Scale(Vector3(scaleX, scaleY, 0), Vector3(0, 0, 0)); + Matrix4 translateToCamera = Matrix4::Translate(Vector3(x, y, 0)); + mat = translateToCamera * rotate * scale; + + BlendOption blendOption; + blendOption.opacity = letterInfo.opa; + blendOption.transMap.SetMatrix(mat); + blendOption.mode = BLEND_SRC_OVER; + BaseGfxEngine::GetInstance()->Blit(gfxDstBuffer, {0, 0}, src, letterInfo.mask, blendOption); } void DrawUtils::DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo, @@ -353,7 +438,7 @@ void DrawUtils::DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo UIFont* fontEngine = UIFont::GetInstance(); GlyphPathData path; if (!fontEngine->GetGlyphPathData(letterInfo.letter, letterInfo.shapingId, path)) { - GRAPHIC_LOGD("GetGlyphPathData failed\n"); + DrawEmojiRotate(gfxDstBuffer, letterInfo, rotateAngle); return; } @@ -374,14 +459,7 @@ void DrawUtils::DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo Vector3(x, y - head.ascender, 0), Vector3(x, y - head.ascender, 1)); Matrix4 scale = Matrix4::Scale(Vector3(path.scale, path.scale, 1), Vector3(x, y, 0)); mat = rotate * scale; - Matrix4 translateFromCamera = Matrix4::Translate(Vector3(-x, -y, 0)); Matrix4 translateToCamera = Matrix4::Translate(Vector3(x, y, 0)); - Matrix4 perspectiveMatrix; - perspectiveMatrix[2][2] = 0.0f; - perspectiveMatrix[2][3] = -1.0f / 1000; // 1000: default camera distance - perspectiveMatrix = translateToCamera * (perspectiveMatrix * translateFromCamera); - - mat = perspectiveMatrix * mat; mat = mat * translateToCamera; const float* srcMat = mat.GetData(); @@ -411,21 +489,26 @@ void DrawUtils::DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo void DrawUtils::DrawLetter(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo) const { #if CAPABILITY_HWDRAW_LETTER_VECTOR - DrawLetterVectorPath(gfxDstBuffer, letterInfo); - return; + if (DrawLetterVectorPath(gfxDstBuffer, letterInfo)) { + return; + } #endif UIFont* fontEngine = UIFont::GetInstance(); GlyphNode node; const uint8_t* fontMap = fontEngine->GetBitmap(letterInfo.letter, node, letterInfo.shapingId); if (fontMap == nullptr) { + ImageInfo info; + if (fontEngine->GetEmoji(letterInfo.letter, info)) { + DrawEmoji(gfxDstBuffer, info, letterInfo); + } return; } uint16_t letterW = node.cols; uint16_t letterH = node.rows; int16_t posX; - int16_t posY = letterInfo.pos.y + letterInfo.fontSize - node.top - letterInfo.offsetY; + int16_t posY = letterInfo.pos.y; if (letterInfo.direct == TEXT_DIRECT_RTL) { /* RTL */ diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h index b548afe29..8637e5ad8 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h @@ -348,7 +348,7 @@ private: ColorMode destMode) const; #if CAPABILITY_HWDRAW_LETTER_VECTOR - void DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo) const; + bool DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo) const; #endif }; } // namespace OHOS 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..477065f79 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 @@ -154,6 +154,15 @@ uint8_t* UIFont::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t shapi return nullptr; } +bool UIFont::GetEmoji(uint32_t unicode, ImageInfo &unicodeInfo) +{ + UIFontVector* font = dynamic_cast(instance_); + if (font == nullptr) { + return false; + } + return font->GetEmoji(unicode, unicodeInfo); +} + uint16_t UIFont::GetWidth(uint32_t unicode, uint8_t shapingId) { int16_t result; diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font_vector.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font_vector.cpp index 03889157d..b8d268cf3 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font_vector.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font_vector.cpp @@ -20,6 +20,10 @@ #if ENABLE_MULTI_FONT #include "font/ui_multi_font_manager.h" #endif +#if CAPABILITY_HW_SUPPORT_EMOJI +#include "common/image_cache_manager.h" +#include "common/ui_emoji_table.h" +#endif namespace OHOS { UIFontVector::UIFontVector() @@ -48,6 +52,9 @@ UIFontVector::~UIFontVector() UnregisterFontInfo(DEFAULT_VECTOR_FONT_FILENAME); } delete bitmapCache_; +#if CAPABILITY_HW_SUPPORT_EMOJI + ImageCacheManager::GetInstance().UnloadAllInMultiRes(std::string{EMOJI_PATH}); +#endif } uint8_t UIFontVector::RegisterFontInfo(const char* ttfName, uint8_t shaping) @@ -159,6 +166,52 @@ int32_t UIFontVector::OpenVectorFont(uint8_t ttfId) return -1; } +bool UIFontVector::GetEmoji(uint32_t unicode, ImageInfo &unicodeInfo) +{ +#if CAPABILITY_HW_SUPPORT_EMOJI + constexpr int len = sizeof(EMOJI_TABLE) / sizeof(EMOJI_TABLE[0]); + int index = -1; + for (int i = 0; i < len; ++i) { + if (EMOJI_TABLE[i].unicode == unicode) { + index = i; + break; + } + } + if (index == -1) { + return false; + } + ImageInfo *info = ImageCacheManager::GetInstance().LoadOneInMultiRes(EMOJI_TABLE[index].resId, EMOJI_PATH); + if (info == nullptr) { + return false; + } + + memcpy_s(&unicodeInfo, sizeof(unicodeInfo), info, sizeof(ImageInfo)); + return true; +#else + return false; +#endif +} + +int16_t UIFontVector::GetEmojiHeight() +{ + return GetHeight(); +} + +uint16_t UIFontVector::GetEmojiWidth(uint32_t unicode, uint8_t fontId) +{ + ImageInfo info; + if (!GetEmoji(unicode, info)) { + return INVALID_RET_VALUE; + } + uint8_t old = GetBaseFontId(); + SetBaseFontId(fontId); + float h = GetEmojiHeight(); + SetBaseFontId(old); + float scale = h / info.header.height; + float w = scale * info.header.width; + return w; +} + bool UIFontVector::IsVectorFont() const { return true; @@ -310,7 +363,7 @@ int16_t UIFontVector::GetWidth(uint32_t unicode, uint8_t fontId) int8_t error = LoadGlyphIntoFace(fontId, unicode); if (error != RET_VALUE_OK) { - return INVALID_RET_VALUE; + return GetEmojiWidth(unicode, fontId); } SetFace(ftFaces_[fontId], unicode); return static_cast(ftFaces_[fontId]->glyph->advance.x / FONT_PIXEL_IN_POINT); diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h index bd89a1919..731f2cabf 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h @@ -26,6 +26,17 @@ namespace OHOS { */ class InputDeviceManager : public Task { public: +enum class InputDeviceType { + /** All registered input device*/ + ALL = 0, + /** Point input device */ + POINT = 1, + /** Key input device */ + KEY = 2, + /** Rotate input device */ + ROTATE = 3, +}; + /** * @brief Get instance of InputDeviceManager. * @returns Instance of InputDeviceManager @@ -54,9 +65,9 @@ public: void Clear(); /** - * Clear pressable views recorded in the pointer input device + * Clear state of input devices. */ - void ClearPressableViews(); + void ClearInputDeviceState(InputDeviceManager::InputDeviceType type = InputDeviceManager::InputDeviceType::ALL); void Callback() override; @@ -74,6 +85,16 @@ private: InputDeviceManager(InputDeviceManager&&) = delete; InputDeviceManager& operator=(InputDeviceManager&&) = delete; + /** + * Clear rotate state. + */ + void ClearRotateState(); + + /** + * Clear pressable views recorded in the pointer input device + */ + void ClearPressableViews(); + List deviceList_; }; } // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/dock/rotate_input_device.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/dock/rotate_input_device.h index b9dddd16a..07cc87c0a 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/dock/rotate_input_device.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/dock/rotate_input_device.h @@ -34,6 +34,11 @@ public: threshold_ = threshold; } + void ResetRotateState() + { + rotateStart_ = false; + } + protected: void DispatchEvent(const DeviceData& data) override; bool rotateStart_; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/font/ui_font_vector.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/font/ui_font_vector.h index 9e21e7d4d..e777127a7 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/font/ui_font_vector.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/font/ui_font_vector.h @@ -48,6 +48,9 @@ public: uint8_t UnregisterFontInfo(const UITextLanguageFontParam* fontsTable, uint8_t num) override; const UITextLanguageFontParam* GetFontInfo(uint8_t fontId) const override; int32_t OpenVectorFont(uint8_t ttfId) override; + bool GetEmoji(uint32_t unicode, ImageInfo &unicodeInfo); + int16_t GetEmojiHeight(); + uint16_t GetEmojiWidth(uint32_t unicode, uint8_t fontId); protected: bool freeTypeInited_; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_abstract_scroll.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_abstract_scroll.h index 6c95fb16d..57e7a5c1d 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_abstract_scroll.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_abstract_scroll.h @@ -336,6 +336,16 @@ public: void OnPostDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; + /** + * @brief Get state of scroll animator. + * @since 1.0 + * @version 1.0 + */ + uint8_t GetScrollState() + { + return scrollAnimator_.GetState(); + } + static constexpr uint8_t HORIZONTAL = 0; static constexpr uint8_t VERTICAL = 1; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_canvas.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_canvas.h index a2dece289..6f35a8dd2 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_canvas.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_canvas.h @@ -38,7 +38,9 @@ #include "common/image.h" #include "components/ui_label.h" +#include "components/ui_image_view.h" #include "gfx_utils/list.h" +#include "gfx_utils/trans_affine.h" namespace OHOS { /** @@ -57,7 +59,9 @@ public: */ Paint() : style_(PaintStyle::STROKE_FILL_STYLE), fillColor_(Color::Black()), - strokeColor_(Color::White()), opacity_(OPA_OPAQUE), strokeWidth_(2) {} + strokeColor_(Color::White()), opacity_(OPA_OPAQUE), strokeWidth_(2), + rotateAngle_(0), scaleRadioX_(1.0f), scaleRadioY_(1.0f), translationX_(0), + translationY_(0) {} /** * @brief A destructor used to delete the Paint instance. @@ -214,12 +218,133 @@ public: return opacity_; } + /* Zooms the current drawing to a larger or smaller size */ + void Scale(float scaleX, float scaleY); + + /** + * @brief get the x coordinate scale value + * @since 1.0 + * @version 1.0 + */ + float GetScaleX() const + { + return this->scaleRadioX_; + } + + /** + * @brief get the y coordinate scale value + * @since 1.0 + * @version 1.0 + */ + float GetScaleY() const + { + return this->scaleRadioY_; + } + + /** + * @brief Rotate current drawing + * @param angle rotate angle value. + * @since 1.0 + * @version 1.0 + */ + void Rotate(float angle); + + /** + * @brief Rotate current drawing + * @param angle rotate angle value. + * @param x translate x coordinate. + * @param y translate y coordinate. + * @since 1.0 + * @version 1.0 + */ + void Rotate(float angle, int16_t x, int16_t y); + + /** + * @brief Remap the (x, y) position on the canvas + * @param x translate x coordinate. + * @param y translate y coordinate. + * @since 1.0 + * @version 1.0 + */ + void Translate(int16_t x, int16_t y); + + /** + * @brief Gets the x position on the remapping canvas + * @since 1.0 + * @version 1.0 + */ + int16_t GetTranslateX() const + { + return this->translationX_; + } + + /** + * @brief Gets the Y position on the remapping canvas + * @since 1.0 + * @version 1.0 + */ + int16_t GetTranslateY() const + { + return this->translationY_; + } + + /** + * @brief Resets the current conversion to the identity matrix. Then run transform () + * @param scaleX scale x value. + * @param shearX shear x value. + * @param shearY shear y value. + * @param scaleY scale y value + * @param transLateX translate x coordinate. + * @param transLateY translate y coordinate. + * @since 1.0 + * @version 1.0 + */ + void SetTransform(float scaleX, float shearX, float shearY, float scaleY, int16_t transLateX, int16_t transLateY); + + /** + * @brief Resets the current conversion to the identity matrix. Then run transform () + * @param scaleX scale x value. + * @param shearX shear x value. + * @param shearY shear y value. + * @param scaleY scale y value + * @param transLateX translate x coordinate. + * @param transLateY translate y coordinate. + * @since 1.0 + * @version 1.0 + */ + void Transform(float scaleX, float shearX, float shearY, float scaleY, int16_t transLateX, int16_t transLateY); + + /** + * @brief Gets the Trans Affine + * @since 1.0 + * @version 1.0 + */ + TransAffine GetTransAffine() const + { + return transfrom_; + } + + /** + * @brief Gets the Rotate Angle + * @since 1.0 + * @version 1.0 + */ + float GetRotateAngle() const + { + return rotateAngle_; + } private: PaintStyle style_; ColorType fillColor_; ColorType strokeColor_; uint8_t opacity_; uint16_t strokeWidth_; + float rotateAngle_; // Rotation angle in degrees + float scaleRadioX_; + float scaleRadioY_; + int32_t translationX_; + int32_t translationY_; + TransAffine transfrom_; // matrix. }; /** @@ -420,6 +545,7 @@ public: */ void DrawImage(const Point& startPoint, const char* image, const Paint& paint); + void DrawImage(const Point& startPoint, const char* image, const Paint& paint, int16_t width, int16_t height); /** * @brief Defines the font style. */ @@ -631,13 +757,10 @@ protected: delete arcParam; } - static void DeleteImageParam(void* param) + static void DeleteImageView(void* param) { - ImageParam* imageParam = static_cast(param); - if (imageParam->image != nullptr) { - delete imageParam->image; - } - delete imageParam; + UIImageView* imageView = static_cast(param); + delete imageView; } static void DeleteLabel(void* param) diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h index 71d3d1318..b3c67ebc5 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h @@ -78,14 +78,14 @@ public: LINE_BREAK_MARQUEE, /** * The width and height of this label remain unchanged. - * If this text is too long, it will be scrolled back and forth to display. + * If this text is too long, it will be cropped to display. */ - LINE_BREAK_OSCILLATION, + LINE_BREAK_CLIP, /** * The width and height of this label remain unchanged. - * If this text is too long, it will be cropped to display. + * If this text is too long, it will be scrolled back and forth to display. */ - LINE_BREAK_CLIP, + LINE_BREAK_OSCILLATION, /** * Maximum value of the line break mode, which is used for validity check. */ diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h index 44294ca5a..1575769fb 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h @@ -114,6 +114,7 @@ enum UIViewType : uint8_t { UI_MENU_ITEM, UI_CARD_PAGE, UI_COVER_FLOW, + UI_SLIP_FLOW, UI_CROSS_VIEW, UI_BARCODE, UI_MAP_VIEW, 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..8589c3148 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 @@ -151,6 +151,8 @@ public: */ uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t shapingFont); + bool GetEmoji(uint32_t unicode, ImageInfo &unicodeInfo); + /** * @brief Indicates whether the current font library is a vector font library. * @return uint8_t: 0 BitmapFont 1 VectorFont diff --git a/code/sdk/middleware/services/gui/uikit/utils/frameworks/trans_affine.cpp b/code/sdk/middleware/services/gui/uikit/utils/frameworks/trans_affine.cpp new file mode 100644 index 000000000..808349747 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/utils/frameworks/trans_affine.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2020-2021 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 "gfx_utils/trans_affine.h" +#if ENABLE_CMATH +#include +#endif + +namespace OHOS { +const TransAffine& TransAffine::RectToParl(float x1, float y1, + float x2, float y2, + const float* parl) +{ + data_[0] = x2 - x1; + data_[3] = 0; // 3 : index + data_[1] = x2 - x1; + data_[4] = y2 - y1; // 4 : index + data_[2] = x1; // 2 : index + data_[5] = y1; // 5 : index + Invert(); + Multiply(TransAffine(parl[2] - parl[0], parl[3] - parl[1], // 2 3 : index + parl[4] - parl[0], parl[5] - parl[1], // 4 5 : index + parl[0], parl[1])); + return *this; +} + +const TransAffine& TransAffine::Multiply(const TransAffine& metrix) +{ + float t0 = data_[0] * metrix.data_[0] + data_[3] * metrix.data_[1]; // 3 : index + float t2 = data_[1] * metrix.data_[0] + data_[4] * metrix.data_[1]; // 4 : index + float t4 = data_[2] * metrix.data_[0] + data_[5] * metrix.data_[1] + metrix.data_[2]; // 2 5 : index + data_[3] = data_[0] * metrix.data_[3] + data_[3] * metrix.data_[4]; // 3 4 : index + data_[4] = data_[1] * metrix.data_[3] + data_[4] * metrix.data_[4]; // 3 4 5: index + data_[5] = data_[2] * metrix.data_[3] + data_[5] * metrix.data_[4] + metrix.data_[5]; // 2 3 4 5 : index + data_[0] = t0; + data_[1] = t2; + data_[2] = t4; // 2 : index + return *this; +} + +const TransAffine& TransAffine::Invert() +{ + float d = DeterminantReciprocal(); + + float t0 = data_[4] * d; // 4 : index + data_[4] = data_[0] * d; // 4 : index + data_[3] = -data_[3] * d; // 3 : index + data_[1] = -data_[1] * d; + + float t4 = -data_[2] * t0 - data_[5] * data_[1]; // 2 5 : index + data_[5] = -data_[2] * data_[3] - data_[5] * data_[4]; // 2 3 4 5 : index + + data_[0] = t0; + data_[2] = t4; // 2 : index + return *this; +} + +const TransAffine& TransAffine::Reset() +{ + data_[1] = 0; + data_[2] = 0; // 2 : index + data_[3] = 0; // 3 : index + data_[5] = 0; // 5 : index + data_[6] = 0; // 6 : index + data_[7] = 0; // 7 : index + data_[0] = 1; + data_[4] = 1; // 4 : index + data_[8] = 1; // 8 : index + return *this; +} + +bool TransAffine::IsIdentity() const +{ + return MATH_FLT_EQUAL(data_[0], 1.0f) && + MATH_FLT_EQUAL(data_[3], 0.0f) && // 3 : index + MATH_FLT_EQUAL(data_[1], 0.0f) && + MATH_FLT_EQUAL(data_[4], 1.0f) && // 4 : index + MATH_FLT_EQUAL(data_[2], 0.0f) && // 2 : index + MATH_FLT_EQUAL(data_[5], 0.0f); // 5 : index +} + +bool TransAffine::IsValid(float epsilon) const +{ + return (MATH_ABS(data_[0]) > epsilon) && (MATH_ABS(data_[4]) > epsilon); // 4 : index +} + +TransAffine TransAffine::TransAffineRotation(float angle) +{ +#if ENABLE_CMATH + return TransAffine(std::cos(angle), std::sin(angle), -std::sin(angle), std::cos(angle), 0.0f, 0.0f); +#else + return TransAffine(Sin(QUARTER_IN_DEGREE - angle), Sin(angle), -Sin(angle), Sin(QUARTER_IN_DEGREE - angle), + 0.0f, 0.0f); +#endif +} + +const TransAffine& TransAffine::Rotate(float angle) +{ +#if ENABLE_CMATH + float scaleXTemp = data_[0] * std::cos(angle) - data_[3] * std::sin(angle); // 3 : index + float shearXTemp = data_[1] * std::cos(angle) - data_[4] * std::sin(angle); // 4 : index + float translateXTemp = data_[2] * std::cos(angle) - data_[5] * std::sin(angle); // 5 : index + data_[3] = data_[0] * std::sin(angle) + data_[3] * std::cos(angle); // 3 : index + data_[4] = data_[1] * std::sin(angle) + data_[4] * std::cos(angle); // 4 : index + data_[5] = data_[2] * std::sin(angle) + data_[5] * std::cos(angle); // 5 : index +#else + float scaleXTemp = data_[0] * Sin(QUARTER_IN_DEGREE - angle) - data_[3] * Sin(angle); // 3 : index + float shearXTemp = data_[1] * Sin(QUARTER_IN_DEGREE - angle) - data_[4] * Sin(angle); // 4 : index + float translateXTemp = data_[2] * Sin(QUARTER_IN_DEGREE - angle) - data_[5] * Sin(angle); // 2 5 : index + data_[3] = data_[0] * Sin(angle) + data_[3] * Sin(QUARTER_IN_DEGREE - angle); // 3 : index + data_[4] = data_[1] * Sin(angle) + data_[4] * Sin(QUARTER_IN_DEGREE - angle); // 4 : index + data_[5] = data_[2] * Sin(angle) + data_[5] * Sin(QUARTER_IN_DEGREE - angle); // 2 5 : index +#endif + data_[0] = scaleXTemp; + data_[1] = shearXTemp; + data_[2] = translateXTemp; // 2 : index + return *this; +} +} // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h index 748c81d8b..e0a4e3767 100644 --- a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h @@ -75,13 +75,15 @@ static constexpr uint16_t THREE_QUARTER_IN_DEGREE = 270; /** A full rotation: 360 degrees */ static constexpr uint16_t CIRCLE_IN_DEGREE = 360; /** Pi value */ -static constexpr double UI_PI = 3.14159265358979; +static constexpr double UI_PI = 3.14159265358979f; static constexpr float ATAN2_P3 = -0.3258775; static constexpr float ATAN2_P5 = 0.1556117; static constexpr float ATAN2_P7 = -0.0443360; static constexpr float RADIAN_TO_ANGLE = 57.295779513; static constexpr float UI_FLT_EPSILON = 1E-5; static constexpr int16_t ORDER_MATRIX_4 = 4; +static constexpr float VERTEX_DIST_EPSILON = 1e-14; +static constexpr float BOXER = 180.0f; float Sin(float angle); float Acos(float value); diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/image_info.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/image_info.h index 681721b8c..536af1f9a 100644 --- a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/image_info.h +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/image_info.h @@ -38,7 +38,7 @@ #include #include "graphic_config.h" namespace OHOS { -#define MAX_IMG_PATH_LEN 64 +#define MAX_IMG_PATH_LEN 128 /** * @brief Defines image head node information. */ diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/trans_affine.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/trans_affine.h new file mode 100644 index 000000000..596043dea --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/trans_affine.h @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2020-2021 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. + */ +#ifndef GRAPHIC_LTE_TRANS_AFFINE_H +#define GRAPHIC_LTE_TRANS_AFFINE_H + +#include "gfx_utils/graphic_math.h" + +namespace OHOS { +const float affineEpsilon = 1e-14; +const uint16_t parlIndexSize = 6; +/** + * @brief Map source transformation + * @since 1.0 + * @version 1.0 + */ +class TransAffine : public Matrix3 { +public: + /** + * @brief Initialize to identity matrix + * @since 1.0 + * @version 1.0 + */ + TransAffine() : Matrix3() {} + /** + * @brief Custom matrix + * @since 1.0 + * @version 1.0 + */ + TransAffine(float v0, float v1, float v2, float v3, float v4, float v5) + : Matrix3(v0, v2, v4, v1, v3, v5, 0, 0, 1) {} + /** + * @brief Converts a rectangle to a parallelogram + * @since 1.0 + * @version 1.0 + */ + TransAffine(float x1, float y1, float x2, float y2, const float* parl) + { + RectToParl(x1, y1, x2, y2, parl); + } + + void SetData(int32_t index, float value) + { + data_[index] = value; + } + /** + * @brief Convert the original parallelogram to the target parallelogram + * @param x1 x-axis coordinate of the upper left corner of the rectangle + * @param y1 y-axis coordinate of the upper left corner of the rectangle + * @param x2 x-axis coordinates of the lower right corner of the rectangle + * @param y2 y-axis coordinates of the lower right corner of the rectangle + * @param parl Target parallelogram + * @since 1.0 + * @version 1.0 + */ + const TransAffine& RectToParl(float x1, float y1, + float x2, float y2, + const float* parl); + + /** + * @brief reset TransAffine + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Reset(); + + /** + * @brief Element offset + * @param deltaX x-axis offset + * @param deltaY y-axis offset + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Translate(float x, float y); + /** + * @brief Element rotation + * @param angle Rotate angle + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Rotate(float angle); + /** + * @brief Element Scale + * @param scale Overall amplification factor + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Scale(float scale); + /** + * @brief Element Scale + * @param x x-axis magnification factor + * @param y y-axis magnification factor + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Scale(float x, float y); + + /** + * @brief Transformation matrix multiplication + * @param metrix + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Multiply(const TransAffine& metrix); + + /** + * @brief Matrix flip + * @since 1.0 + * @version 1.0 + */ + const TransAffine& Invert(); + + const TransAffine& operator*=(const TransAffine& metrix) + { + return Multiply(metrix); + } + + /** + * @brief Convert x, y + * @param x x-coordinate + * @param y y-coordinate + * @since 1.0 + * @version 1.0 + */ + void Transform(float* x, float* y) const; + + /** + * @brief inverse transformation + * @param x x-coordinate + * @param y y-coordinate + * @since 1.0 + * @version 1.0 + */ + void InverseTransform(float* x, float* y) const; + + /** + * @brief Computes the reciprocal of a determinant + * @since 1.0 + * @version 1.0 + */ + float DeterminantReciprocal() const + { + float reciprocal = data_[0] * data_[4] - data_[3] * data_[1]; + if (reciprocal == 0) { + return VERTEX_DIST_EPSILON; + } + return 1.0f / reciprocal; + } + + /** + * @brief Check the matrix for degradation + * @since 1.0 + * @version 1.0 + */ + bool IsValid(float epsilon = affineEpsilon) const; + + /** + * @brief Check whether it is an identity matrix + * @since 1.0 + * @version 1.0 + */ + bool IsIdentity() const; + + /** + * @brief zoom + * @param x x-coordinate + * @param y y-coordinate + * @since 1.0 + * @version 1.0 + */ + void ScalingAbs(float* x, float* y) const; + + /** + * @brief Set rotation matrix + * @since 1.0 + * @version 1.0 + */ + static TransAffine TransAffineRotation(float angle); + + /** + * @brief Set scaling matrix + * @since 1.0 + * @version 1.0 + */ + static TransAffine TransAffineScaling(float x, float y) + { + return TransAffine(x, 0.0f, 0.0f, y, 0.0f, 0.0f); + } + + /** + * @brief Set scaling matrix + * @since 1.0 + * @version 1.0 + */ + static TransAffine TransAffineScaling(float scale) + { + return TransAffine(scale, 0.0f, 0.0f, scale, 0.0f, 0.0f); + } + /** + * @brief Set translation matrix + * @since 1.0 + * @version 1.0 + */ + static TransAffine TransAffineTranslation(float x, float y) + { + return TransAffine(1.0f, 0.0f, 0.0f, 1.0f, x, y); + } +}; + +inline void TransAffine::Transform(float* x, float* y) const +{ + float tmp = *x; + *x = tmp * data_[0] + *y * data_[1] + data_[2]; + *y = tmp * data_[3] + *y * data_[4] + data_[5]; +} + +inline void TransAffine::InverseTransform(float* x, float* y) const +{ + float reciprocal = DeterminantReciprocal(); + float a = (*x - data_[2]) * reciprocal; + float b = (*y - data_[5]) * reciprocal; + *x = a * data_[4] - b * data_[1]; + *y = b * data_[0] - a * data_[3]; +} + +inline const TransAffine& TransAffine::Translate(float deltaX, float deltaY) +{ + data_[2] += deltaX; + data_[5] += deltaY; + return *this; +} + +inline const TransAffine& TransAffine::Scale(float scaleX, float scaleY) +{ + data_[0] *= scaleX; + data_[1] *= scaleX; + data_[2] *= scaleX; + data_[3] *= scaleY; + data_[4] *= scaleY; + data_[5] *= scaleY; + return *this; +} + +inline const TransAffine& TransAffine::Scale(float scale) +{ + data_[0] *= scale; + data_[1] *= scale; + data_[2] *= scale; + data_[3] *= scale; + data_[4] *= scale; + data_[5] *= scale; + return *this; +} + +inline void TransAffine::ScalingAbs(float* x, float* y) const +{ + *x = Sqrt(data_[0] * data_[0] + data_[1] * data_[1]); + *y = Sqrt(data_[3] * data_[3] + data_[4] * data_[4]); +} +} // namespace OHOS +#endif 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 7100daa8e..6a621913a 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 @@ -47,6 +47,10 @@ static Audio::AudioManager& g_amInstance = Audio::AudioManager::GetInstance(); void TriggerEventListener(const AudioEventListener *listener) { + if (listener == nullptr) { + // listener is nullptr + return; + } if (!JsAsyncWork::DispatchAsyncWork(AsyncExecuteCallback, const_cast(listener))) { MEDIA_ERR_LOG("dispatch async work failed."); } 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 0c90b02f5..f81c673b4 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 @@ -174,7 +174,6 @@ static bool InitPlayerResources(MediaVideoPlay *videoPlay) videoPlay->player_ = player; videoPlay->isPlaybackCompleted_ = false; - videoPlay->isPlaybackStopped_ = false; videoPlay->interruptHintStop_ = false; videoPlay->playError_ = false; @@ -504,12 +503,6 @@ int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) int32_t MediaVideoPlay::StopVideoPlay(void) { MediaMutexLock(mutex_); - if (!isPlayed_) { - MEDIA_INFO_LOG("video play is not start,can not stop!"); - isPlaybackStopped_ = true; - MediaMutexUnLock(mutex_); - return MEDIA_OK; - } if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { if (isLoop_) { if (!isPlaybackCompleted_) { @@ -528,6 +521,7 @@ int32_t MediaVideoPlay::StopVideoPlay(void) MediaMutexUnLock(mutex_); if (isSyncExitMode_) { MediaThreadJoin(&threadHandle_); + isPlaybackStopped_ = false; dynamic_cast(surface_)->ClearBuffers(); // clear buffers safely in sync mode to reduce peak memory } play = nullptr; @@ -557,15 +551,6 @@ void MediaVideoPlay::SetSyncExitMode(bool isSyncExitMode) void MediaVideoPlay::DestroyVideoPlaySource(void) { - if (!isEntered_) { - if (isSyncExitMode_) { - MediaThreadJoin(&threadHandle_); - // clear buffers safely in sync mode to reduce peak memory - dynamic_cast(surface_)->ClearBuffers(); - } - MEDIA_ERR_LOG("video is not played\n"); - return; - } needSendBackgroundFrame_ = false; StopVideoPlay(); uint32_t count = 0; diff --git a/code/sdk/middleware/services/media/hal/codec/plugins/brandy/video_decoder/native_vdec_jpeg.c b/code/sdk/middleware/services/media/hal/codec/plugins/brandy/video_decoder/native_vdec_jpeg.c index 0526862c8..1aebeec82 100644 --- a/code/sdk/middleware/services/media/hal/codec/plugins/brandy/video_decoder/native_vdec_jpeg.c +++ b/code/sdk/middleware/services/media/hal/codec/plugins/brandy/video_decoder/native_vdec_jpeg.c @@ -389,14 +389,9 @@ static int32_t NativeJPEGSendStream(void *nativeVdecHdl, const InputInfo *vdecSt } if (NativeDecodeJpeg(jpegCtx, vdecStream, &curOutBuffer) != MEDIA_HAL_OK) { - GpuResetStart(); - int32_t ret = NativeDecodeJpeg(jpegCtx, vdecStream, &curOutBuffer); - GpuResetEnd(); - if (ret != MEDIA_HAL_OK) { - free(curOutBuffer.buffers); - MEDIA_HAL_LOGE(MODULE_NAME, "decode jpeg fail"); - return MEDIA_HAL_ERR; - } + free(curOutBuffer.buffers); + MEDIA_HAL_LOGE(MODULE_NAME, "decode jpeg fail"); + return MEDIA_HAL_ERR; } free(curOutBuffer.buffers); diff --git a/code/sdk/middleware/utils/codeloader/private/codeloader_execute_command_memory_commands.c b/code/sdk/middleware/utils/codeloader/private/codeloader_execute_command_memory_commands.c index 0fed0d7e9..1c71f18b8 100644 --- a/code/sdk/middleware/utils/codeloader/private/codeloader_execute_command_memory_commands.c +++ b/code/sdk/middleware/utils/codeloader/private/codeloader_execute_command_memory_commands.c @@ -372,42 +372,36 @@ static bool codeloader_command_processor_set_flash_limits_common_helper( bool ret_value = true; uint16_t apps_area_pages; - // Core Images always starts at end of the SSB. - start_address = (uint32_t)((uintptr_t)(g_hal_sectors_flash_region_end)); - // make sure we can never put system images in the Application Area - if ((start_address + ((bt_code_length + recovery_code_length + dsp_code_length + extern0_code_length) * - FLASH_PAGE_SIZE)) > APP_FLASH_REGION_START) { + // set recover region + start_address = RECOVERY_FLASH_REGION_START; + core_section_length = FLASH_PAGE_SIZE * recovery_code_length; + codeloader_command_set_core_region(CORE_IMAGES_RECOVERY, core_section_length, start_address); + + // set bt region + start_address = BT_FLASH_REGION_START; + core_section_length = FLASH_PAGE_SIZE * bt_code_length; + codeloader_command_set_core_region(CORE_IMAGES_BT, core_section_length, start_address); + + // set dsp region + start_address = DSP_FLASH_REGION_START; + core_section_length = FLASH_PAGE_SIZE * dsp_code_length; + codeloader_command_set_core_region(CORE_IMAGES_PROTOCOL, core_section_length, start_address); + + // set extern0 region + start_address = DSP_CODEC_FLASH_REGION_START; + core_section_length = FLASH_PAGE_SIZE * extern0_code_length; + codeloader_command_set_core_region(CORE_IMAGES_EXTERN0, core_section_length, start_address); + + // set apps region + apps_area_pages = (uint16_t)APP_FLASH_REGION_PAGES; + start_address = (uint32_t)APP_FLASH_REGION_START; + + // check apps images will fit into allocated area + if (apps_code_length > apps_area_pages) { ret_value = false; } else { - // set recover region - core_section_length = FLASH_PAGE_SIZE * recovery_code_length; - codeloader_command_set_core_region(CORE_IMAGES_RECOVERY, core_section_length, start_address); - start_address += core_section_length; - // set bt region - core_section_length = FLASH_PAGE_SIZE * bt_code_length; - codeloader_command_set_core_region(CORE_IMAGES_BT, core_section_length, start_address); - start_address += core_section_length; - - // set dsp region - core_section_length = FLASH_PAGE_SIZE * dsp_code_length; - codeloader_command_set_core_region(CORE_IMAGES_PROTOCOL, core_section_length, start_address); - start_address += core_section_length; - - // set extern0 region - core_section_length = FLASH_PAGE_SIZE * extern0_code_length; - codeloader_command_set_core_region(CORE_IMAGES_EXTERN0, core_section_length, start_address); - - // set apps region - apps_area_pages = (uint16_t)APP_FLASH_REGION_PAGES; - start_address = (uint32_t)APP_FLASH_REGION_START; - - // check apps images will fit into allocated area - if (apps_code_length > apps_area_pages) { - ret_value = false; - } else { - core_section_length = FLASH_PAGE_SIZE * apps_code_length; - codeloader_command_set_core_region(CORE_IMAGES_APPS, core_section_length, start_address); - } + core_section_length = FLASH_PAGE_SIZE * apps_code_length; + codeloader_command_set_core_region(CORE_IMAGES_APPS, core_section_length, start_address); } return ret_value; } 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 61cf44552..a7b75aa35 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 5fac9cafa..cab2ce375 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 5901eddd8..f9f0d5070 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 f4fbebb88..e6d0afe14 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 f8ba0657f..9402bdb7e 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 6ce3d03fc..4d76e6a42 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 cc9588c74..57399ae7f 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 8dd14c3a9..4f4a6c416 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 36ca02e27..ab84c1dd4 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 6ee0e3ea5..b183d95ed 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 8bcc0d23e..9274ef335 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 7e2deefcc..6c425925e 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 c2b85bf34..d33c5bf36 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 268a9462a..2a83ebaf3 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 0294bc400..816f312c7 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 fbcebfb09..cb3a6b057 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 ce9124803..ebd9382d4 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 e64ae8633..b7451217b 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 ff81d1f3b..eb8321317 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 3c4f9d47a..0b2922e28 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 6031c5aec..a0db7aac2 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 3b43688fc..cfbaf85e7 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 effdefac2..ef1632271 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 d5db7dda7..ec534d1f7 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 94043fd22..5a203be7f 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 8bc08d6de..61ca0a051 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 899b1db2d..a51052dc7 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 6c39d8b89..c1526456d 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 1c51ef8c9..8809fe684 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 bb71f6f23..e444993ac 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/middleware/utils/nv/nv_storage_lib/nv_async_store.c b/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.c index 97e2e0f3f..b81901ed8 100644 --- a/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.c +++ b/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.c @@ -52,6 +52,7 @@ static errcode_t nv_asynv_send_msg_to_write_flash(nv_key_map_t* cur_key) if (ret != OSAL_SUCCESS) { return ERRCODE_FAIL; } + cur_key->flush_flag = false; return ERRCODE_SUCC; } @@ -203,6 +204,7 @@ static errcode_t nv_async_store_init_keys_one_page(kv_page_handle_t *page) nv_psram_free(cur_key); return ERRCODE_FAIL; } + cur_key->flush_flag = true; (void)nv_async_hash_add(cur_key); } key_found = kv_page_find_next_key(page, NULL, &key); @@ -345,6 +347,8 @@ static errcode_t nv_async_msg_process(nv_queue_msg_handle_t *msg_data_t) } g_nv_async_flash_space = status.max_key_space; + /* 当前key已刷新到flush上 */ + msg_data->flush_flag = true; osal_sem_up(&nv_async_sem); return res; } @@ -387,14 +391,20 @@ static errcode_t nv_async_thread_msg_event_init(void) errcode_t nv_async_flush(void) { nv_queue_msg_handle_t msg_data_t; - uint32_t msg_data_size = sizeof(nv_queue_msg_handle_t); - uint8_t cur_queue_num = (uint8_t)osal_msg_queue_get_msg_num(g_nv_msg_queue_id); - - while (cur_queue_num > 0) { - (void)memset_s(&msg_data_t, msg_data_size, 0, msg_data_size); - osal_msg_queue_read_copy(g_nv_msg_queue_id, &msg_data_t, &msg_data_size, OSAL_MSGQ_NO_WAIT); - nv_async_msg_process(&msg_data_t); - cur_queue_num--; + CstlHashIterator it; + errcode_t res; + /* 遍历hash表,将当前还没刷新到flash上的NV刷新到flash */ + for (it = CstlHashIterBegin(g_hash_table); it != CstlHashIterEnd(g_hash_table); + it = CstlHashIterNext(g_hash_table, it)) { + nv_key_map_t *cur_data = (nv_key_map_t *)CstlHashIterValue(g_hash_table, it); + if (cur_data->flush_flag == false) { + msg_data_t.key_id = cur_data->key_id; + msg_data_t.key_ram_location = (uintptr_t)cur_data; + res = nv_async_msg_process(&msg_data_t); + if (res != ERRCODE_SUCC) { + nv_log_err("[NV] nv_async_flush fail! key_id=0x%x", msg_data_t.key_id); + } + } } return ERRCODE_SUCC; diff --git a/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.h b/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.h index 46a519229..782b0354e 100644 --- a/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.h +++ b/code/sdk/middleware/utils/nv/nv_storage_lib/nv_async_store.h @@ -16,10 +16,11 @@ extern "C" { typedef struct nv_key_map { uint16_t key_id; /* Key ID */ - uint16_t key_len : 13; /* Key length */ + uint16_t key_len : 12; /* Key length */ uint16_t permanent : 1; /* 是否是永久Key */ uint16_t encrypted : 1; /* 是否是加密Key */ uint16_t non_upgrade : 1; /* 是否不可以升级 */ + uint16_t flush_flag : 1; /* 是否已刷新到flash */ uint8_t kvalue[0]; /* key value */ } nv_key_map_t; diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt index 572bdff94..673d8e8eb 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt @@ -1,27 +1,27 @@ set(COMPONENT_NAME "i18n") set(PUBLIC_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/include + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/i18n/include ) set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/include - ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/i18n/include ) set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/data_resource.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/date_time_format.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/data_resource.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/date_time_data.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/date_time_format.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/date_time_format_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/locale_info.cpp ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/measure_format.cpp ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/measure_format_impl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/number_format.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/plural_format.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/number_data.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/number_format.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/number_format_impl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/plural_format.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/plural_format_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/plural_rules.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/date_time_data.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/date_time_format_impl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/number_data.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/number_format_impl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/plural_format_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/str_util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/src/week_info.cpp ) @@ -31,7 +31,6 @@ set(COMPONENT_PUBLIC_CCFLAGS set(COMPONENT_CCFLAGS -std=c++11 - -Wno-error -Wno-unused-parameter -fno-exceptions -fno-unwind-tables diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/date_time_data.h b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/date_time_data.h index 339ffa614..3964e4fdf 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/date_time_data.h +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/date_time_data.h @@ -62,6 +62,7 @@ private: char *amPmMarkers = nullptr; char timeSeparator = ':'; char defaultHour = 'H'; + const int CONFIG_MIN_SIZE = 2; }; } // namespace I18N } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/i18n_memory_adapter.h b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/i18n_memory_adapter.h index e3c3541ab..06dd00c67 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/i18n_memory_adapter.h +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/i18n_memory_adapter.h @@ -26,12 +26,12 @@ // memory operator define #include -inline void *I18nMalloc(size_t size) +inline static void *I18nMalloc(size_t size) { return malloc(size); } -inline void I18nFree(void *a) +inline static void I18nFree(void *a) { if (a != nullptr) { (void) free(a); diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/plural_format_impl.h b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/plural_format_impl.h index 322be42f1..5a45e092c 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/plural_format_impl.h +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include/plural_format_impl.h @@ -66,6 +66,7 @@ private: static constexpr int NUMBER_INFO_SIZE = 3; const double EPS = 1e-6; const int MAX_FRACTION_NUMBERS = 6; + const int DECIMALISM = 10; }; } // namespace I18N } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/data_resource.cpp b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/data_resource.cpp index 4459a93a3..1e9e0b1bd 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/data_resource.cpp +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/data_resource.cpp @@ -23,9 +23,9 @@ using namespace OHOS::I18N; using namespace std; #ifdef I18N_PRODUCT -static const char *gDataResourcePath = "system/i18n/i18n.dat"; +static const char *DATA_RESOURCE_PATH = "/user/res/i18n.dat"; #else -static const char *gDataResourcePath = "/storage/data/i18n.dat"; +static const char *DATA_RESOURCE_PATH = "/user/res/i18n.dat"; #endif DataResource::DataResource(const LocaleInfo *localeInfo) @@ -145,7 +145,7 @@ char *DataResource::BinarySearchString(uint32_t *indexArray, uint32_t length, ui bool DataResource::Init(void) { - int32_t infile = open(gDataResourcePath, O_RDONLY); + int32_t infile = open(DATA_RESOURCE_PATH, O_RDONLY); if (infile < 0) { return false; } diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_data.cpp b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_data.cpp index 3346b6e79..1adec5de6 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_data.cpp +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_data.cpp @@ -31,7 +31,7 @@ DateTimeData::DateTimeData(const char *amPmMarkers, const char *configs, const i } // size must >= 2, The first 2 element of configs need to be extracted, the first element // is the time separator and the second is the default hour. - if (configs && size >= 2) { + if (configs && size >= CONFIG_MIN_SIZE) { // 2 is the size of configs need to be extracted timeSeparator = configs[0]; defaultHour = configs[1]; } diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_format_impl.cpp b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_format_impl.cpp index cff3284a6..6491cccb6 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_format_impl.cpp +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/date_time_format_impl.cpp @@ -147,7 +147,8 @@ void DateTimeFormatImpl::Format(const time_t &cal, const string &zoneInfo, strin I18nStatus &status) const { const time_t adjust = cal + ParseZoneInfo(zoneInfo); - struct tm tmStruct = {0}; + struct tm tmStruct; + memset_s(&tmStruct, sizeof(tmStruct), 0, sizeof(tmStruct)); tm *tmPtr = &tmStruct; gmtime_r(&adjust, tmPtr); const tm time = *tmPtr; @@ -449,7 +450,8 @@ int8_t DateTimeFormatImpl::Get12HourTimeWithoutAmpm(const time_t &cal, const std return 0; } const time_t adjust = cal + ParseZoneInfo(zoneInfo); - struct tm tmStruct = { 0 }; + struct tm tmStruct; + memset_s(&tmStruct, sizeof(tmStruct), 0, sizeof(tmStruct)); tm *tmPtr = &tmStruct; gmtime_r(&adjust, tmPtr); const tm time = *tmPtr; diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/locale_info.cpp b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/locale_info.cpp index a9743bf3e..03c34aeb6 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/locale_info.cpp +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/locale_info.cpp @@ -19,19 +19,6 @@ #include "types.h" #include "locale_info.h" -static constexpr uint16_t OPT_LANG = 0x0001; -static constexpr uint16_t OPT_SCRIPT = 0x0002; -static constexpr uint16_t OPT_REGION = 0x0004; -static constexpr uint16_t OPT_EXTENSION = 0x0008; -static constexpr uint8_t TAG_COMMON = 0; -static constexpr uint8_t TAG_U = 1; -static constexpr uint8_t TAG_KEY = 2; -static constexpr uint8_t TAG_VALUE = 3; -static constexpr int LANGUAGE_MIN_LENGTH = 2; -static constexpr int LANGUAGE_MAX_LENGTH = 3; -static constexpr int REGION_LENGTH = 2; -static constexpr int SCRIPT_LENGTH = 4; - using namespace OHOS::I18N; void LocaleInfo::Init(const char *newLang, const char *newScript, const char *newRegion, int &status) diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/number_format_impl.cpp b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/number_format_impl.cpp index cfaa927af..0c13a0cca 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/number_format_impl.cpp +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/number_format_impl.cpp @@ -129,13 +129,9 @@ std::string NumberFormatImpl::InnerFormat(double num, bool hasDec, bool isShowGr } char buff[NUMBER_MAX] = { 0 }; bool isPercentDefault = isPercent && (defaultData->style.minDecimalLength < 0); - int len; double adjustNum = (num < 0) ? (-1 * num) : num; - if (isPercentDefault) { - len = static_cast(sprintf_s(buff, NUMBER_MAX, "%.f", adjustNum)); - } else { - len = static_cast(sprintf_s(buff, NUMBER_MAX, defaultData->style.numFormat, adjustNum)); - } + int len = isPercentDefault ? static_cast(sprintf_s(buff, NUMBER_MAX, "%.f", adjustNum)) : + static_cast(sprintf_s(buff, NUMBER_MAX, defaultData->style.numFormat, adjustNum)); // convert decimal to char and format if (len < 0) { status = IERROR; @@ -143,8 +139,7 @@ std::string NumberFormatImpl::InnerFormat(double num, bool hasDec, bool isShowGr } char *decimalNum = strchr(buff, NumberData::NUMBER_DECIMAL); int decLen = (decimalNum == nullptr) ? 0 : strlen(decimalNum); - int adjustIntLength = len - decLen; - int lastLen = isShowGroup ? (len + CountGroupNum(adjustIntLength, defaultData->style.isTwoGroup)) : len; + int lastLen = isShowGroup ? (len + CountGroupNum(len - decLen, defaultData->style.isTwoGroup)) : len; char *result = reinterpret_cast(I18nMalloc(lastLen + 1)); if (result == nullptr) { status = IERROR; diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/plural_format_impl.cpp b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/plural_format_impl.cpp index fef436e5e..6e6211c0d 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/plural_format_impl.cpp +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/src/plural_format_impl.cpp @@ -145,9 +145,9 @@ void PluralFormatImpl::ComputeDecimalInfo(double number, int integerNumber, int temp = round(temp); } if (temp - ((int)temp) < EPS) { - while (i > 1 && (int) temp % 10 == 0) { + while (i > 1 && (int) temp % DECIMALISM == 0) { // 10 means decimal i--; - temp /= 10; + temp /= DECIMALISM; // 10 means decimal } // 10 is base fractionNumber = (int)(temp - integerNumber * pow(10, i)); @@ -378,7 +378,7 @@ int PluralFormatImpl::ParseNumber(const std::string &rule, const int ruleSize, i // Parse number in the formula. while ((index < ruleSize) && (rule[index] != ' ') && (rule[index] != TO) && (rule[index] != COMMA)) { - num *= 10; // Calculate decimal value of the number. + num *= DECIMALISM; // 10 means decimal. Calculate decimal value of the number. num += rule[index] - '0'; index++; } diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include/locale_info.h b/code/sdk/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include/locale_info.h index 529778db1..109baa043 100644 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include/locale_info.h +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include/locale_info.h @@ -211,6 +211,18 @@ private: void SetFail(); void Init(const char *lang, const char *script, const char *region, int &status); const int CHAR_OFF = 48; + static constexpr uint16_t OPT_LANG = 0x0001; + static constexpr uint16_t OPT_SCRIPT = 0x0002; + static constexpr uint16_t OPT_REGION = 0x0004; + static constexpr uint16_t OPT_EXTENSION = 0x0008; + static constexpr uint8_t TAG_COMMON = 0; + static constexpr uint8_t TAG_U = 1; + static constexpr uint8_t TAG_KEY = 2; + static constexpr uint8_t TAG_VALUE = 3; + static constexpr int LANGUAGE_MIN_LENGTH = 2; + static constexpr int LANGUAGE_MAX_LENGTH = 3; + static constexpr int REGION_LENGTH = 2; + static constexpr int SCRIPT_LENGTH = 4; }; enum ESupportScript { 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 2ab7e66e2..0f17eae69 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 6e38999a7..14172b5f1 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 3f1b4e0e8..b9b8b7d53 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 8644b4ea7..895c5ed77 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 e1394a492..1d69afa74 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 @@ -275,6 +275,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/console_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/date_time_format_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/feature_ability_module.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/image_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/intl_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/jstest_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/localization_module.cpp diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h index 12c525fb3..887ccc085 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h @@ -20,7 +20,8 @@ #include "js_config.h" #include "non_copyable.h" #ifdef JS_TOUCH_EVENT_SUPPORT -#include "root_view.h" +#include "events/drag_event.h" +#include "events/key_event.h" #endif #include "graphic_config.h" #include "wrapper/js.h" 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 e25ed30fd..733b1539c 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 b0dd1e682..e98f9a7e6 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 f2d274fd6..8b4daff33 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 1311a23a4..6094369c6 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/canvas_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.cpp index 63cea7b39..6d9a3aded 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.cpp @@ -20,6 +20,8 @@ #include "js_fwk_common.h" #include "product_adapter.h" #include "securec.h" +#include "modules/presets/image_module.h" +#include "image_component.h" namespace OHOS { namespace ACELite { @@ -50,6 +52,11 @@ const char * const CanvasComponent::FUNC_ARC = "arc"; const char * const CanvasComponent::FUNC_CLOSEPATH = "closePath"; const char * const CanvasComponent::FUNC_STROKE = "stroke"; const char * const CanvasComponent::FUNC_CLEAR = "clear"; +const char * const CanvasComponent::FUNC_DRAWIMAGE = "drawImage"; +const char * const CanvasComponent::FUNC_TRANFORM = "transform"; +const char * const CanvasComponent::FUNC_SETTRANFORM = "setTransform"; +const char * const CanvasComponent::FUNC_ROTATE = "rotate"; +const char * const CanvasComponent::FUNC_SCALE = "scale"; // create canvas draw attribute-callback mapping const AttrMap CanvasComponent::attrMap_[] = { @@ -73,7 +80,12 @@ const MethodMap CanvasComponent::methodMap_[] = { {FUNC_ARC, Arc}, {FUNC_CLOSEPATH, ClosePath}, {FUNC_STROKE, Stroke}, - {FUNC_CLEAR, Clear} + {FUNC_CLEAR, Clear}, + {FUNC_DRAWIMAGE, DrawImage}, + {FUNC_TRANFORM, Transform}, + {FUNC_SETTRANFORM, SetTransform}, + {FUNC_ROTATE, Rotate}, + {FUNC_SCALE, Scale} }; CanvasComponent::CanvasComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager) @@ -824,6 +836,162 @@ jerry_value_t CanvasComponent::Stroke(const jerry_value_t func, return UNDEFINED; } +jerry_value_t CanvasComponent::DrawImage(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context)); + if (component == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get canvas component from js object failed")); + } + if (argsNum < ArgsCount::NUM_1) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: DrawImage arg error!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("canvas_component: DrawImage arg error!")); + } + char* imageName = nullptr; + int16_t startX = 0; + int16_t startY = 0; + int16_t width = -1; + int16_t height = -1; + if (ParseImageName(args, imageName, width, height) != UNDEFINED) { + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("parse Imagename function error")); + } + if (argsNum >= ArgsCount::NUM_2) { + startX = IntegerOf(args[ArgsIndex::IDX_1]); + } + if (argsNum >= ArgsCount::NUM_3) { + startY = IntegerOf(args[ArgsIndex::IDX_2]); + } + if (argsNum >= ArgsCount::NUM_4) { + width = IntegerOf(args[ArgsIndex::IDX_3]); + } + if (argsNum >= ArgsCount::NUM_5) { + height = IntegerOf(args[ArgsIndex::IDX_4]); + } + Point startLocat = {startX, startY}; + + if (width > 0 || height > 0) { + component->canvas_.DrawImage(startLocat, imageName, component->paint_, width, height); + } else { + component->canvas_.DrawImage(startLocat, imageName, component->paint_); + } + ACE_FREE(imageName); + return UNDEFINED; +} + +jerry_value_t CanvasComponent::Transform(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + if (argsNum < ArgsCount::NUM_6) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of rotate method parameter error!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("rotate method parameter error")); + } + + CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom)); + if (component == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get canvas component from js object failed")); + } + + float scaleX = FloatOf(args[ArgsIndex::IDX_0]); + float shearX = FloatOf(args[ArgsIndex::IDX_1]); + float shearY = FloatOf(args[ArgsIndex::IDX_2]); + float scaleY = FloatOf(args[ArgsIndex::IDX_3]); + int16_t translateX = IntegerOf(args[ArgsIndex::IDX_4]); + int16_t translateY = IntegerOf(args[ArgsIndex::IDX_5]); + component->paint_.Transform(scaleX, shearX, shearY, scaleY, translateX, translateY); + return UNDEFINED; +} + + +jerry_value_t CanvasComponent::SetTransform(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + if (argsNum < ArgsCount::NUM_6) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of rotate method parameter error!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("rotate method parameter error")); + } + + CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom)); + if (component == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get canvas component from js object failed")); + } + + float scaleX = FloatOf(args[ArgsIndex::IDX_0]); + float shearX = FloatOf(args[ArgsIndex::IDX_1]); + float shearY = FloatOf(args[ArgsIndex::IDX_2]); + float scaleY = FloatOf(args[ArgsIndex::IDX_3]); + int16_t translateX = IntegerOf(args[ArgsIndex::IDX_4]); + int16_t translateY = IntegerOf(args[ArgsIndex::IDX_5]); + component->paint_.SetTransform(scaleX, shearX, shearY, scaleY, translateX, translateY); + return UNDEFINED; +} + +jerry_value_t CanvasComponent::Rotate(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + if (argsNum < ArgsCount::NUM_1) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of rotate method parameter error!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("rotate method parameter error")); + } + + CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom)); + if (component == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get canvas component from js object failed")); + } + + float angle = FloatOf(args[ArgsIndex::IDX_0]); + component->paint_.Rotate(angle); + return UNDEFINED; +} + +jerry_value_t CanvasComponent::Scale(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + if (argsNum < ArgsCount::NUM_2) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of scale method parameter error!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("scale method parameter error")); + } + + CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom)); + if (component == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get canvas component from js object failed")); + } + + float scaleX = FloatOf(args[ArgsIndex::IDX_0]); + float scaleY = FloatOf(args[ArgsIndex::IDX_1]); + component->paint_.Scale(scaleX, scaleY); + return UNDEFINED; +} + jerry_value_t CanvasComponent::Clear(const jerry_value_t func, const jerry_value_t context, const jerry_value_t args[], @@ -843,6 +1011,67 @@ jerry_value_t CanvasComponent::Clear(const jerry_value_t func, return UNDEFINED; } +jerry_value_t CanvasComponent::ParseImageName(const jerry_value_t args[], + char*& imageName, + int16_t &width, + int16_t &height) +{ + ImageComponent* imageCom = nullptr; + const char *src = nullptr; + char* imageNameBuf = nullptr; + // The parameter is the file name + if (jerry_value_is_string(args[ArgsIndex::IDX_0])) { + imageNameBuf = MallocStringOf(args[ArgsIndex::IDX_0]); + if (imageNameBuf == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get imageName value failed"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get imageName value failed")); + } + imageName = imageNameBuf; + return UNDEFINED; + // Parameters are objects retrieved from HML + } else if (jerry_value_is_object(args[ArgsIndex::IDX_0])) { + void *nativePtr = nullptr; + jerry_get_object_native_pointer(args[ArgsIndex::IDX_0], &nativePtr, nullptr); + imageCom = reinterpret_cast(nativePtr); + if (imageCom != nullptr) { + src = imageCom->GetSrc(); + if (src == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get imagePath value failed"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get imagePath value failed")); + } + size_t strLen = strlen(src) + 1; + imageName = static_cast(ace_malloc(strLen)); + if (memcpy_s(imageName, strLen, src, strLen) != EOK) { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get imagePath value failed"); + return UNDEFINED; + } + return UNDEFINED; + } else { + // The argument is the object passed through the new Image() + imageName = GetImageObjectParam(args); + if (strlen(imageName) < 1) { + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get imageName value failed")); + } + return UNDEFINED; + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get imageName value failed"); + return jerry_create_error(JERRY_ERROR_TYPE, + reinterpret_cast("get imageName value failed")); + } + return UNDEFINED; +} + +char* CanvasComponent::GetImageObjectParam(const jerry_value_t args[]) +{ + jerry_value_t src = jerryx_get_property_str(args[ArgsIndex::IDX_0], ImageModule::attrSrc); + char* srcVal = MallocStringOf(src); + return srcVal; +} + void CanvasComponent::GetSubFont(const char *font, const uint8_t index, char *&subFont) const { if (font == nullptr || *font == '\0') { diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.h index e7a388d5c..4cd9b97c7 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/canvas_component.h @@ -173,11 +173,41 @@ private: const jerry_value_t args[], const jerry_length_t argsNum); + static jerry_value_t DrawImage(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + + static jerry_value_t Transform(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum); + + static jerry_value_t SetTransform(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum); + + static jerry_value_t ParseImageName(const jerry_value_t args[], + char*& imageName, + int16_t &width, + int16_t &height); static jerry_value_t Clear(const jerry_value_t func, const jerry_value_t context, const jerry_value_t args[], const jerry_length_t argsNum); + static jerry_value_t Rotate(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum); + + static jerry_value_t Scale(const jerry_value_t func, + const jerry_value_t dom, + const jerry_value_t args[], + const jerry_length_t argsNum); + + static char* GetImageObjectParam(const jerry_value_t args[]); UICanvas canvas_; jerry_value_t context_; Paint paint_; @@ -208,7 +238,12 @@ private: static const char * const FUNC_ARC; static const char * const FUNC_CLOSEPATH; static const char * const FUNC_STROKE; + static const char * const FUNC_DRAWIMAGE; + static const char * const FUNC_TRANFORM; + static const char * const FUNC_SETTRANFORM; static const char * const FUNC_CLEAR; + static const char * const FUNC_ROTATE; + static const char * const FUNC_SCALE; }; } // namespace ACELite } // namespace OHOS 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 554e82684..c5dded922 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 @@ -1314,6 +1314,11 @@ bool Component::RegisterCommonEventListener(UIView &view, void Component::ReleaseCommonEventListeners() { + RootView *rootView = RootView::GetInstance(); + if (rootView != nullptr) { + 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/component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.h index 354cea5f3..e1514de81 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.h @@ -544,11 +544,11 @@ private: void SetSwipeEventListener(UIView& view, jerry_value_t eventFunc, bool isStopPropagation); void SetRotateEventListener(UIView& view, jerry_value_t eventFunc); #ifdef JS_TOUCH_EVENT_SUPPORT - void SetTouchStartEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation); - void SetTouchMoveEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation); - void SetTouchEndEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation); - void SetTouchCancelEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation); - void SetKeyBoardEventListener(jerry_value_t eventFunc, bool isStopPropagation); + void SetTouchStartEventListener(UIView &view, jerry_value_t eventFunc, uint16_t eventTypeId); + void SetTouchMoveEventListener(UIView &view, jerry_value_t eventFunc, uint16_t eventTypeId); + void SetTouchEndEventListener(UIView &view, jerry_value_t eventFunc, uint16_t eventTypeId); + void SetTouchCancelEventListener(UIView &view, jerry_value_t eventFunc, uint16_t eventTypeId); + void SetKeyBoardEventListener(jerry_value_t eventFunc, uint16_t eventTypeId); #endif void SetKeyInputEventListener(UIView &view, jerry_value_t eventFunc, uint16_t eventTypeId); /** diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.cpp index f794b07ef..0dc4ad514 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.cpp @@ -32,6 +32,11 @@ ImageComponent::ImageComponent(jerry_value_t options, jerry_value_t children, Ap SetComponentName(K_IMAGE); } +const char *ImageComponent::GetSrc() +{ + return imageView_.GetPath(); +} + bool ImageComponent::CreateNativeViews() { // set default value diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.h index 0868e2162..26fe8c21b 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/image_component.h @@ -30,7 +30,8 @@ public: ImageComponent() = delete; ImageComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager); ~ImageComponent() override {} - + const char *GetSrc(); + protected: bool CreateNativeViews() override; UIView *GetComponentRootView() const override; diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h index 029514ff8..d59c8eb34 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h @@ -234,4 +234,9 @@ #endif #endif // (defined(ENABLE_ROTATE_INPUT) && (ENABLE_ROTATE_INPUT == 1)) +/** + * JS_TOUCH_EVENT_SUPPORT + */ +#define JS_TOUCH_EVENT_SUPPORT + #endif // OHOS_ACELITE_CONFIG_H 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 2f67e8788..5ec2c9253 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 @@ -503,120 +503,120 @@ bool setCallbackFunction(OHOS::ACELite::JSIValue callback,uint8_t type,bool isSu switch (type) { case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI: if (isSuccess) { - poi_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + poi_successCallback = callback; } else { - poi_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + poi_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE: if (isSuccess) { - auth_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + auth_successCallback = callback; } else { - auth_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + auth_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT: if (isSuccess) { - nav_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + nav_successCallback = callback; } else { - nav_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + nav_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH: if (isSuccess) { - poi_sug_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + poi_sug_successCallback = callback; } else { - poi_sug_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + poi_sug_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION: - geo_location_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + geo_location_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START: - route_plan_start_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + route_plan_start_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC: - route_plan_success_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + route_plan_success_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL: - route_plan_fail_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + route_plan_fail_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START: - navi_start_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + navi_start_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY: - navi_destroy_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + navi_destroy_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE: - road_guide_text_update_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + road_guide_text_update_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE: - road_guide_icon_update_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + road_guide_icon_update_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE: - remain_time_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + remain_time_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE: - remain_distance_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + remain_distance_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE: - remain_route_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + remain_route_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE: - gps_status_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + gps_status_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY: - route_far_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + route_far_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING: - route_plan_yawing_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + route_plan_yawing_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE: - reroute_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + reroute_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION: - arrivedest_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + arrivedest_Callback = callback; break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH: if (isSuccess) { - geocode_search_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + geocode_search_successCallback = callback; } else { - geocode_search_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + geocode_search_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH: if (isSuccess) { - regeocode_search_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + regeocode_search_successCallback = callback; } else { - regeocode_search_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + regeocode_search_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH: if (isSuccess) { - route_riding_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + route_riding_successCallback = callback; } else { - route_riding_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + route_riding_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH: if (isSuccess) { - route_walking_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + route_walking_successCallback = callback; } else { - route_walking_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + route_walking_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH: if (isSuccess) { - route_transit_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + route_transit_successCallback = callback; } else { - route_transit_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + route_transit_failCallback = callback; } break; case MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED: if (isSuccess) { - bt_connect_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + bt_connect_successCallback = callback; } else { - bt_connect_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + bt_connect_failCallback = callback; } break; default: @@ -649,6 +649,7 @@ JSIValue BaiduMapComponentModule::poi_nearby_search(const JSIValue thisVal, cons setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI,false); msg_center_vector_navi_req_poi(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -665,6 +666,7 @@ JSIValue BaiduMapComponentModule::route_riding_search(const JSIValue thisVal, co setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH,false); msg_center_vector_navi_req_route_riding_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -681,6 +683,7 @@ JSIValue BaiduMapComponentModule::route_walking_search(const JSIValue thisVal, c setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH,false); msg_center_vector_navi_req_route_walking_search(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -697,6 +700,7 @@ JSIValue BaiduMapComponentModule::route_transit_search(const JSIValue thisVal, c setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH,false); msg_center_vector_navi_req_route_transit_search(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -713,6 +717,7 @@ JSIValue BaiduMapComponentModule::auth_license(const JSIValue thisVal, const JSI setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE,false); msg_center_vector_navi_req_auth_license(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -726,6 +731,7 @@ JSIValue BaiduMapComponentModule::getGeolocation(const JSIValue thisVal, const J OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION,true); msg_center_vector_navi_req_geo_location(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -742,6 +748,7 @@ JSIValue BaiduMapComponentModule::naviInit(const JSIValue thisVal, const JSIValu setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT,false); msg_center_vector_navi_req_navi_init(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -909,6 +916,7 @@ JSIValue BaiduMapComponentModule::poi_sug_search(const JSIValue thisVal, const J setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH,false); msg_center_vertor_navi_req_poi_sug_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -1003,6 +1011,7 @@ JSIValue BaiduMapComponentModule::Geocode_search(const JSIValue thisVal, const J setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH,false); msg_center_vector_navi_req_geocode_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -1020,6 +1029,7 @@ JSIValue BaiduMapComponentModule::Regeocode_search(const JSIValue thisVal, const setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH,true); setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH,false); msg_center_vector_navi_req_regeocode_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH,data,strlen(data)); + ace_free(data); return JSI::CreateBoolean(0); } @@ -1032,6 +1042,7 @@ JSIValue BaiduMapComponentModule::Destroy_page(const JSIValue thisVal, const JSI char *data = JSI::JsonStringify(args[0]); HILOG_INFO(HILOG_MODULE_ACE,"Destroy_page : %s \n",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); return JSI::CreateBoolean(0); } @@ -1050,6 +1061,7 @@ JSIValue BaiduMapComponentModule::onBTConnect(const JSIValue thisVal, const JSIV OHOS::ACELite::JSIValue disconnectCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], DISCONNECT); setCallbackFunction(connectCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED,true); setCallbackFunction(disconnectCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED,false); + ace_free(data); return JSI::CreateBoolean(0); } @@ -1062,6 +1074,7 @@ JSIValue BaiduMapComponentModule::NaviDestroy(const JSIValue thisVal, const JSIV char *data = JSI::JsonStringify(args[0]); HILOG_INFO(HILOG_MODULE_ACE,"exitNavigation : %s \n",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); return JSI::CreateBoolean(0); } @@ -1074,6 +1087,7 @@ JSIValue BaiduMapComponentModule::StopAnswer(const JSIValue thisVal, const JSIVa 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(0); } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/network_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/network_module.cpp index f722c6e49..2cd2d4ade 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/network_module.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/network_module.cpp @@ -55,6 +55,7 @@ void NetWorkModule::AsyncExecuteCallback(void *arg) JSIValue result = JSI::CreateString(static_cast(netParam->status)); JSIValue argv[ARGC_ONE] = {result}; JSI::CallFunction(callback_.net_connect_callback, callback_.net_connect_thisVal, argv, ARGC_ONE); + JSI::ReleaseValue(result); } } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/image_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/image_module.cpp new file mode 100644 index 000000000..36288bf47 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/image_module.cpp @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2022 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 + +#include "ace_log.h" +#include "locale_util.h" +#include "key_parser.h" +#include "keys.h" +#include "image.h" +#include "image_module.h" +#include "common/image_cache_manager.h" +namespace OHOS { +namespace ACELite { +constexpr jerry_object_native_info_t ImageModule::gcCallback; +const char * const ImageModule::attrOnload = "onload"; +const char * const ImageModule::attrOnError = "onerror"; +const char * const ImageModule::attrSrc = "src"; +const char * const ImageModule::attrWidth = "width"; +const char * const ImageModule::attrHeight = "height"; +const char * const ImageModule::className = "Image"; + +void ImageModule::Init(jerry_value_t intlHandle) +{ + (void)intlHandle; + jerry_value_t gObj = jerry_get_global_object(); + JerrySetFuncProperty(gObj, className, CreateImage); +} +void ImageModule::RegisterAttributeFunc(jerry_value_t canvas2dContext, + const char *attributeName, + jerry_external_handler_t setterHandler, + jerry_external_handler_t getterHandler) +{ + // register canvas js attribute setter property via the jerry_define_own_property method + jerry_value_t propName = jerry_create_string(reinterpret_cast(attributeName)); + jerry_property_descriptor_t desc; + jerry_init_property_descriptor_fields(&desc); + desc.is_set_defined = true; + desc.setter = jerry_create_external_function(setterHandler); + desc.is_get_defined = true; + desc.getter = jerry_create_external_function(getterHandler); + jerry_value_t returnValue = jerry_define_own_property(canvas2dContext, propName, &desc); + jerry_free_property_descriptor_fields(&desc); + ReleaseJerryValue(propName, returnValue, VA_ARG_END_FLAG); +} +jerry_value_t ImageModule::CreateImage(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + if (!jerry_value_is_constructor(func)) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("use new to create Image")); + } + ImageModule *imageModule = new ImageModule(); + if (imageModule == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("memory is not enough")); + } + + imageModule->width_ = -1; + imageModule->height_ = -1; + if (argsNum >= 1) { + if (jerry_value_is_number(args[0])) { + imageModule->width_ = jerry_value_to_number(args[0]); + } else if (jerry_value_is_string(args[0])) { + char* val = MallocStringOf(args[0]); + if (val == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("val is nullptr")); + } + imageModule->width_ = atoi(val); + ACE_FREE(val); + } + } + if (argsNum >= static_cast(ArgsCount::NUM_2)) { + if (jerry_value_is_number(args[1])) { + imageModule->height_ = jerry_value_to_number(args[1]); + } else if (jerry_value_is_string(args[1])) { + char* val = MallocStringOf(args[1]); + if (val == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("val is nullptr")); + } + imageModule->height_ = atoi(val); + ACE_FREE(val); + } + } + + jerry_set_object_native_pointer(context, imageModule, &gcCallback); + RegisterAttributeFunc(context, attrOnload, OnLoadSetter, OnLoadGetter); + RegisterAttributeFunc(context, attrOnError, OnErrorSetter, OnErrorGetter); + RegisterAttributeFunc(context, attrSrc, OnSrcSetter, OnSrcGetter); + RegisterAttributeFunc(context, attrWidth, OnWidthSetter, OnWidthGetter); + RegisterAttributeFunc(context, attrHeight, OnHeightSetter, OnHeightGetter); + return UNDEFINED; +} + +jerry_value_t ImageModule::OnLoadSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + if (argsNum == 1 && jerry_value_is_function(args[0])) { + jerry_release_value(imageModel->onLoadFunc_); + imageModel->onLoadFunc_ = args[0]; + } else { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("set imageModel onload arg fail")); + } + return UNDEFINED; +} + +jerry_value_t ImageModule::OnLoadGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + (void)args; + (void)argsNum; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + return imageModel->onLoadFunc_; +} + +jerry_value_t ImageModule::OnErrorSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + if (argsNum >= 1 && jerry_value_is_function(args[0])) { + jerry_release_value(imageModel->onErrorFunc_); + imageModel->onErrorFunc_ = args[0]; + } else { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("set imageModel onload arg fail")); + } + return UNDEFINED; +} + +jerry_value_t ImageModule::OnErrorGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + (void)args; + (void)argsNum; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + return imageModel->onErrorFunc_; +} + +jerry_value_t ImageModule::OnSrcSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + + if (argsNum >= 1) { + ACE_FREE(imageModel->src_); + imageModel->src_ = const_cast(ParseImageSrc(args[0])); + } + if (imageModel->src_ == nullptr || strlen(imageModel->src_) == 0) { + OnCallBack(context, imageModel, false, "src is null"); + return UNDEFINED; + } + jerry_release_value(imageModel->jerrySrc_); + imageModel->jerrySrc_ = jerry_create_string(reinterpret_cast(imageModel->src_)); + + ImageInfo* image = ImageCacheManager::GetInstance().LoadSingleRes(imageModel->src_); + if (!image) { + OnCallBack(context, imageModel, false, "unknown image"); + return UNDEFINED; + } + OnCallBack(context, imageModel, true, "load sucess"); + return UNDEFINED; +} + +jerry_value_t ImageModule::OnSrcGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + (void)args; + (void)argsNum; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + if (jerry_value_is_string(imageModel->jerrySrc_)) { + return imageModel->jerrySrc_; + } + return UNDEFINED; +} + +jerry_value_t ImageModule::OnHeightSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + if (argsNum < 1) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("set height fail")); + } + imageModel->height_ = IntegerOf(args[0]); + return UNDEFINED; +} + +jerry_value_t ImageModule::OnHeightGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + (void)args; + (void)argsNum; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + return imageModel->height_; +} + +jerry_value_t ImageModule::OnWidthSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + if (argsNum < 1) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("set width fail")); + } + imageModel->width_ = IntegerOf(args[0]); + return UNDEFINED; +} + +jerry_value_t ImageModule::OnWidthGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + (void)args; + (void)argsNum; + ImageModule* imageModel = nullptr; + jerry_get_object_native_pointer(context, (void**)&imageModel, &gcCallback); + if (imageModel == nullptr) { + return jerry_create_error(JERRY_ERROR_EVAL, + reinterpret_cast("get imageModel fail")); + } + return imageModel->width_; +} + +void ImageModule::OnCallBack(const jerry_value_t context, + const ImageModule *imageModule, + bool isSucess, + const char* msg) +{ + jerry_value_t targetFunction; + if (imageModule == nullptr) { + return; + } + if (isSucess) { + targetFunction = imageModule->onLoadFunc_; + } else { + targetFunction = imageModule->onErrorFunc_; + } + if (!jerry_value_is_function(targetFunction)) { + return; + } + const int16_t argcount = 1; + jerry_value_t arg = jerry_create_string(reinterpret_cast(msg)); + jerry_value_t args[argcount] = {arg}; + jerry_value_t ret_val = jerry_call_function (targetFunction, context, args, argcount); + if (jerry_value_is_error (ret_val)) { + HILOG_ERROR(HILOG_MODULE_ACE, "call back failed!"); + } + jerry_release_value(arg); + jerry_release_value (ret_val); +} +} +} diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/image_module.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/image_module.h new file mode 100644 index 000000000..cba5bd19c --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/image_module.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2022 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. + */ + +#ifndef OHOS_ACELITE_IMAGE_MODEL_H +#define OHOS_ACELITE_IMAGE_MODEL_H + +#include "acelite_config.h" +#include "image_component.h" +#include "gfx_utils/list.h" +#include "js_fwk_common.h" +namespace OHOS { +namespace ACELite { +class ImageModule final : public MemoryHeap { +enum class ArgsCount { NUM_1 = 1, NUM_2, NUM_3, NUM_4, NUM_5, NUM_6 }; +public: + const char* GetSrc() + { + return src_; + } + + int16_t GetWidth() + { + return width_; + } + + int16_t GetHeight() + { + return height_; + } + + ACE_DISALLOW_COPY(ImageModule); + /** + * @brief register Image object + */ + static void Init(jerry_value_t intlHandle); + + static void RegisterAttributeFunc(jerry_value_t canvas2dContext, + const char *attributeName, + jerry_external_handler_t setterHandler, + jerry_external_handler_t getterHandler); +#if (defined(ENABLED_DELETE_MODULE_IAMGE) && (ENABLED_DELETE_MODULE_IAMGE == 1)) + static void DeleteImage(void* ptr) + { + ImageModule* image = reinterpret_cast(ptr); + ACE_DELETE(image); + } +#endif + + static void OnCallBack(const jerry_value_t context, const ImageModule *imageModule, bool isSucess, const char* msg); + // the handle to release the native value when the js value number format object is not needed. + static constexpr jerry_object_native_info_t gcCallback = { +#if ENABLED_DELETE_MODULE_IAMGE + .free_cb = DeleteImage +#endif + }; + static const char * const attrOnload; + static const char * const attrOnError; + static const char * const attrSrc; + static const char * const attrWidth; + static const char * const attrHeight; + static const char * const className; +private: + ImageModule() + : src_(nullptr), + width_(-1), + height_(-1), + onLoadFunc_(UNDEFINED), + onErrorFunc_(UNDEFINED), + jerrySrc_(UNDEFINED) {} + + ~ImageModule() + { + jerry_release_value(onLoadFunc_); + jerry_release_value(onErrorFunc_); + jerry_release_value(jerrySrc_); + ACE_FREE(src_); + } + + static jerry_value_t CreateImage(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnLoadSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnLoadGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnErrorSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnErrorGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnSrcSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnSrcGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnHeightSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnHeightGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnWidthSetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static jerry_value_t OnWidthGetter(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + +private: + char* src_; + int16_t width_; + int16_t height_; + jerry_value_t onLoadFunc_; + jerry_value_t onErrorFunc_; + jerry_value_t jerrySrc_; +}; +} +} +#endif // NUMBER_FORMAT_MODEL_H diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/intl_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/intl_module.cpp index 40214f00c..bbb4da921 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/intl_module.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/intl_module.cpp @@ -21,6 +21,7 @@ #include "string.h" #include "number_format_module.h" #include "js_fwk_common.h" +#include "image_module.h" namespace OHOS { namespace ACELite { void IntlModule::Init() @@ -33,6 +34,7 @@ void IntlModule::Init() #ifdef FEATURE_DATE_FORMAT DateTimeFormatModule::Init(baseObj); #endif + ImageModule::Init(baseObj); JerrySetNamedProperty(globalObj, "Intl", baseObj); jerry_release_value(globalObj); } 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 52cdd9513..423984060 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 2373c2dcc..9b066efba 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 3f43e27c1..ae0d4de71 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 87011274e..21aa6f2a6 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/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 db861e94b..1aa408027 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 9cc062a5b..b4db3816f 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 395de440a..bf29bb8e1 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 53a1c1b05..c034a59e9 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/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_hfp_hf_service.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_hfp_hf_service.c index 8ae4d4d9d..6a728ebdc 100644 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_hfp_hf_service.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_hfp_hf_service.c @@ -12,7 +12,7 @@ #include "bts_br_gap.h" #include "bts_hfp_hf.h" #include "sample_common.h" -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT #include "audio_manager.h" #else #include "bt_audio_manager_wrapper.h" @@ -59,7 +59,7 @@ typedef struct { hfp_hf_sample_cmd_handle_func func; } sample_hfp_hf_hdl_info; -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT struct AudioManager *g_audio_manager = NULL; struct AudioAdapter *g_primary_adapter = NULL; struct AudioAdapter *g_bluetooth_adapter = NULL; @@ -124,7 +124,7 @@ static uint8_t g_spk_volume = SAMPLE_HFP_PROF_VOL_LEVEL; static osal_task *task_audio_init = NULL; static osal_task *task_audio_deinit = NULL; -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT #define MAX_AUDIO_ADAPTER_NUM 2 #define MAX_KEY_VALUE_LEN 25 @@ -146,7 +146,7 @@ static int32_t g_hdl_dn_spk = -1; static int32_t g_hdl_dn_sco = -1; #endif -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT static void audio_sample_attr_init(enum AudioFormat audio_format, struct AudioSampleAttributes *param) { param->type = AUDIO_IN_COMMUNICATION; @@ -382,7 +382,7 @@ static int32_t abrogation_audio_capture_render_pipeline(void) } #endif -#ifndef MEMORY_MINI +#ifndef MEMORY_MINI_HFP_SUPPORT static int32_t audio_stream_init(void) { /* 请求音频焦点 */ @@ -455,7 +455,7 @@ static int32_t sample_audio_init_start_task_body(const void *data) g_hfp_media_flag = HFP_MEDIA_FLAG_BUSY; int ret; -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT ret = audio_capture_render_init(); if (ret != 0) { bts_sample_log("{%s():%d} audio capture render init failed\n", __FUNCTION__, __LINE__); @@ -469,7 +469,7 @@ static int32_t sample_audio_init_start_task_body(const void *data) g_hfp_media_status = HFP_MEDIA_STATUS_INIT; /* 建立电话上下行通路 */ -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT ret = establish_audio_capture_render_pipeline(); if (ret != 0) { bts_sample_log("{%s():%d} establish audio capture render pipeline failed\n", __FUNCTION__, __LINE__); @@ -504,7 +504,7 @@ static int32_t sample_audio_deinit_task_body(void *data) /* 设置媒体状态繁忙 */ g_hfp_media_flag = HFP_MEDIA_FLAG_BUSY; -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT abrogation_audio_capture_render_pipeline(); #else abrogation_audio_stream_pipeline(); @@ -668,7 +668,7 @@ static void sample_handle_hfp_call_state_changed(const bd_addr_t *bd_addr, const void sample_hfp_hf_set_spk_volume(uint8_t volume) { bts_sample_log("sample hfp set spk volume: %u\n", volume); -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT /* vol range [0, 1.0] */ float vol = (float)volume / SAMPLE_HFP_PROF_VOL_LEVEL; if (g_audio_render_down_link != NULL) { @@ -704,13 +704,13 @@ static void sample_handle_hfp_codec_changed(const bd_addr_t *bd_addr, int codec) sample_hfp_hf_print_addr(bd_addr); bts_sample_log_with_func("codec : %d\n", codec); if (codec == HFP_HF_CODEC_ID_CVSD) { -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT g_hfp_codec = AUDIO_FORMAT_PCM_16_BIT; #else g_hfp_codec = PCM; #endif } else if (codec == HFP_HF_CODEC_ID_MSBC) { -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT g_hfp_codec = AUDIO_FORMAT_mSBC; #else g_hfp_codec = mSBC; @@ -774,7 +774,7 @@ static void sample_hfp_hf_cmd_00_reg_callback(const char **params, int32_t param // 蓝牙通话注册回调 void wstp_hfp_hf_reg_callback(void) { -#ifdef MEMORY_MINI +#ifdef MEMORY_MINI_HFP_SUPPORT audio_hal_init(); #endif errcode_t ret = ERRCODE_BT_SUCCESS; diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_spp_service.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_spp_service.c index f585c1c2f..fcd0dfd42 100644 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_spp_service.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/br_profile/sample_spp_service.c @@ -160,6 +160,8 @@ static void sample_spp_cmd_server_create(const char **params, int32_t params_cnt bts_sample_log_with_func("spp_server_create ret: %x\n", ret); } +static osal_task *g_spp_server_accept_task = NULL; +static bool g_spp_server_wait_accept = false; static int sample_spp_server_accept_task_body(void *data) { int server_id = (int)(intptr_t)data; @@ -168,6 +170,13 @@ static int sample_spp_server_accept_task_body(void *data) int ret = spp_server_accept(server_id); bts_sample_log_with_func("spp_server_accept ret: %x\n", ret); + g_spp_server_wait_accept = false; + bts_sample_log_with_func("spp_server_accept task %x task.task %x\n", + g_spp_server_accept_task, g_spp_server_accept_task->task); + if (g_spp_server_accept_task != NULL && g_spp_server_accept_task->task != NULL) { + osal_kthread_destroy(g_spp_server_accept_task, 0); + g_spp_server_accept_task = NULL; + } return OSAL_SUCCESS; } @@ -175,15 +184,20 @@ static int sample_spp_server_accept_task_body(void *data) /* 等待client连接 */ void wstp_spp_cmd_server_accept(uint32_t server_id) { - osal_task *task = osal_kthread_create(sample_spp_server_accept_task_body, + if (g_spp_server_wait_accept == true) { + bts_sample_log_with_func("create task fail. exsit running task.\n"); + return; + } + g_spp_server_wait_accept = true; + g_spp_server_accept_task = osal_kthread_create(sample_spp_server_accept_task_body, (void *)(uintptr_t)server_id, "spp_server_accept_task", SAMPLE_SPP_TASK_STACK_SIZE); - if (task == NULL) { + if (g_spp_server_accept_task == NULL) { bts_sample_log_with_func("create task fail\n"); return; } - int ret = osal_kthread_set_priority(task, SAMPLE_SPP_TASK_PRI); + int ret = osal_kthread_set_priority(g_spp_server_accept_task, SAMPLE_SPP_TASK_PRI); if (ret != OSAL_SUCCESS) { bts_sample_log_with_func("set pri error: %08x\n", ret); } 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 e3c92c44b..b6bdb0638 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 @@ -66,6 +66,7 @@ typedef enum { BTSRV_SAMPLE_GAP_RECONNECT_PHONE, /* 34 重连手机 */ BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, /* 35 设置inquiry参数 */ + BTSRV_SAMPLE_GAP_SET_SERVICE_TASK_PRIORITY, /* 36 设置BT_SERVICE_TASK优先级 */ } btsrv_gap_sample_cmd_id; typedef enum { @@ -682,6 +683,8 @@ static void btsrv_sample_cmd_disconnect_remote_device(const char **params, int32 errcode_t ret = gap_ble_disconnect_remote_device(&bd_addr); bts_sample_log("gap_disconnect_remote_device ret(bool): %u\n", ret); } + +bd_addr_t g_remote_connect_addr = {0}; acl_conn_ext_mode g_acl_conn_ext_mode = ACL_EXT_MODE_CONNECT_A2DP; /* 连接设备 params: addr addr_type */ static void btsrv_sample_cmd_connect_remote_device(const char **params, int32_t params_cnt) @@ -717,6 +720,7 @@ bool wstp_connect_remote_device(const bd_addr_t *bd_addr) return false; } errcode_t ret = gap_connect_remote_device(bd_addr); + (void)memcpy_s(&g_remote_connect_addr, sizeof(bd_addr_t), bd_addr, sizeof(bd_addr_t)); bts_sample_log("gap_connect_remote_device ret(errcode_t): %x\n", ret); return (ret == ERRCODE_BT_SUCCESS) ? true : false; } @@ -726,6 +730,17 @@ static void sample_gap_state_changed_callback(const int transport, const int sta bts_sample_log("gap_state_changed_callback transport: %d status: %d\n", transport, status); } +/* 主动发起连接 */ +static bool is_active_connection(const bd_addr_t *bd_addr) +{ + if (memcmp(g_remote_connect_addr.addr, bd_addr->addr, BD_ADDR_LEN) == 0) { + (void)memset_s(g_remote_connect_addr.addr, sizeof(bd_addr_t), 0, sizeof(bd_addr_t)); + return true; + } else { + return false; + } +} + static void sample_gap_acl_state_changed_callback(const bd_addr_t *bd_addr, gap_acl_state_t state, unsigned int reason) { bts_sample_log("gap_acl_state_changed_callback addr: "); @@ -740,7 +755,7 @@ static void sample_gap_acl_state_changed_callback(const bd_addr_t *bd_addr, gap_ } #ifndef MEMORY_MINI #if (BTH_BREDR_ONLY == YES) || (BTH_BREDR_LE_DOUBLE == YES) - if (state == GAP_ACL_STATE_CONNECTED && ((uint32_t)device_class & 0x200) == 0) { + if (state == GAP_ACL_STATE_CONNECTED && ((uint32_t)device_class & 0x200) == 0 && is_active_connection(bd_addr)) { /* 只要是非手机设备,连接成功后就先初始化audio manager为音乐播放 */ bts_sample_log("sample_gap_acl_state_changed_callback call AudioManagerInit - AUDIO_STREAM_MUSIC\n"); @@ -1193,6 +1208,17 @@ static void btsrv_sample_cmd_reconnect_phone(const char **params, int32_t params bts_sample_log("reconnect phone ret:%d.\n", ret); } +static void btsrv_sample_cmd_set_service_task_priority(const char **params, int32_t params_cnt) +{ + if (params_cnt != 1) { /* 1:参数个数 */ + bts_sample_log("params_cnt error! need one param!\n"); + return; + } + uint16_t task_priority = (uint16_t)atoi(params[0]); + errcode_t ret = bts_set_service_task_priority(task_priority); + bts_sample_log("bts set service task priority ret:0x%x priority:%d\n", ret, task_priority); +} + btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { /* 0 */ { BTSRV_SAMPLE_GAP_ENABLE_BLE, btsrv_sample_cmd_enable_ble }, @@ -1246,6 +1272,7 @@ btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { /* 35 */ { 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}, }; void btsrv_gap_sample_cmd(uint32_t cmd_id, const char **params, int32_t params_cnt) diff --git a/code/sdk/tools/pkg/bin/brandy/bt.bin b/code/sdk/tools/pkg/bin/brandy/bt.bin index bc9c91a09..60825e2f7 100644 Binary files a/code/sdk/tools/pkg/bin/brandy/bt.bin and b/code/sdk/tools/pkg/bin/brandy/bt.bin differ diff --git a/code/sdk/tools/pkg/chip_packet/brandy/packet.py b/code/sdk/tools/pkg/chip_packet/brandy/packet.py index a7ce8a108..e6ced840e 100644 --- a/code/sdk/tools/pkg/chip_packet/brandy/packet.py +++ b/code/sdk/tools/pkg/chip_packet/brandy/packet.py @@ -24,11 +24,16 @@ from param_packet import gen_flash_part_bin from nv_binary import nv_begin # brandy packet -def build_brandy_other_bin(pack_style_str): +def build_brandy_other_bin(pack_style_str, flash_size): ''' build brandy partition and nv ''' chip_dir = os.path.join(SDK_DIR, "build", "config", "target_config", "brandy") # 分区配置文件路径 - partition_cfg = os.path.join(chip_dir, "param_sector", "param_sector.json") + partition_cfg = os.path.join(chip_dir, "param_sector") + if flash_size.endswith("0x1000000"): + partition_cfg = os.path.join(partition_cfg, "param_sector_16M.json") + else: + partition_cfg = os.path.join(partition_cfg, "param_sector.json") + partition_bin = os.path.join(SDK_DIR, "output", "brandy", "partition_table.bin") # nv配置文件路径 nv_config_json = os.path.join(chip_dir, "nv_bin_cfg") @@ -46,11 +51,8 @@ def build_brandy_other_bin(pack_style_str): gen_flash_part_bin(partition_cfg, partition_bin) nv_begin(nv_config_json, targets, 0) - -def make_all_in_one_packet(pack_style_str): +def make_all_in_one_packet_8M(pack_style_str): # make all in one packet - build_brandy_other_bin(pack_style_str) - bin_dir = os.path.join(PKG_DIR, "bin", "brandy") application_dir = os.path.join(SDK_DIR, "output", @@ -112,6 +114,78 @@ def make_all_in_one_packet(pack_style_str): print(e) exit(-1) +def make_all_in_one_packet_16M(pack_style_str): + # make all in one packet + bin_dir = os.path.join(PKG_DIR, "bin", "brandy") + application_dir = os.path.join(SDK_DIR, + "output", + "brandy", + "acore", + pack_style_str) + recovery_target = "%s-r" % pack_style_str + recovery_target = recovery_target.replace('-user', '') + recovery_bin = os.path.join(SDK_DIR, + "output", + "brandy", + "acore", + recovery_target, + "recovery.bin") + recovery_bx = recovery_bin + "|0x70B80000|0x100000|100" + + upload_app_fwpkg = os.path.join(PKG_DIR, "fwpkg", "brandy", "upload_app.fwpkg") + + ssb = os.path.join(SDK_DIR, "output", "brandy", "acore", "brandy-ssb", "ssb.bin") + if not os.path.exists(ssb): + ssb = os.path.join(bin_dir, "ssb.bin") + print("ssb_path: ", ssb) + ssb_bx = ssb + "|0x70000000|0x20000|0" + + partition = os.path.join(SDK_DIR, "output", "brandy", "partition_table.bin") + partition_bx = partition + "|0x7004F000|0x1000|100" + nv = os.path.join(SDK_DIR, "output", "brandy", "nv_bin", "brandy_all_nv.bin") + nv_bx = nv + "|0x70C80000|0x4000|100" + + app = os.path.join(application_dir, "application.bin") + app_bx = app + "|0x70380000|0x800000|18" + + bt = os.path.join(bin_dir, "bt.bin") + bt_bx = bt + "|0x70090000|0x70000|20" + + target_env = TargetEnvironment(pack_style_str) + dsp_version = target_env.get("dsp_version") + dsp_main = os.path.join(bin_dir, "dsp", dsp_version, "dsp_main.bin") + dsp_main_bx = dsp_main + "|0x70100000|0xC0000|22" + dsp_overlay = os.path.join(bin_dir, "dsp", dsp_version, "dsp_overlay.bin") + dsp_overlay_bx = dsp_overlay + "|0x701C0000|0x1C0000|26" + + fs = os.path.join(application_dir, "file.bin") + fs_bx = fs + "|0xFFFFFFFF|0xFFFFFFFF|101" + + try: + packet_post_agvs = list() + packet_post_agvs.append(ssb_bx) + packet_post_agvs.append(partition_bx) + packet_post_agvs.append(app_bx) + packet_post_agvs.append(recovery_bx) + packet_post_agvs.append(bt_bx) + packet_post_agvs.append(dsp_main_bx) + packet_post_agvs.append(dsp_overlay_bx) + packet_post_agvs.append(nv_bx) + packet_post_agvs.append(fs_bx) + packet_bin(upload_app_fwpkg, packet_post_agvs) + except Exception as e: + print(e) + exit(-1) + + +def make_all_in_one_packet(pack_style_str, flash_size): + # make all in one packet + build_brandy_other_bin(pack_style_str, flash_size) + if flash_size.endswith("0x1000000"): + make_all_in_one_packet_16M(pack_style_str) + else: + make_all_in_one_packet_8M(pack_style_str) + def is_packing_files_exist(soc, pack_style_str): """ 判断打包文件是否存在 diff --git a/code/sdk/tools/pkg/packet.py b/code/sdk/tools/pkg/packet.py index a50d62e20..1f4fe7c4f 100644 --- a/code/sdk/tools/pkg/packet.py +++ b/code/sdk/tools/pkg/packet.py @@ -17,6 +17,7 @@ def main(): print("Parameter error") build_soc = sys.argv[1] build_target = sys.argv[2] + flash_size = sys.argv[3] load_fmt = "chip_packet.%s.packet" %build_soc load_mod = importlib.import_module(load_fmt) @@ -26,7 +27,7 @@ def main(): lost = ";".join(lost_file) print(f"cannot find {lost}") exit(-1) - load_mod.make_all_in_one_packet(build_target) + load_mod.make_all_in_one_packet(build_target, flash_size) if __name__ == "__main__": main() diff --git a/jsapp/baidu/.gradle/6.3/fileChanges/last-build.bin b/jsapp/baidu/.gradle/6.3/fileChanges/last-build.bin new file mode 100644 index 000000000..f76dd238a Binary files /dev/null and b/jsapp/baidu/.gradle/6.3/fileChanges/last-build.bin differ diff --git a/jsapp/baidu/.gradle/6.3/fileHashes/fileHashes.lock b/jsapp/baidu/.gradle/6.3/fileHashes/fileHashes.lock new file mode 100644 index 000000000..f93adbf69 Binary files /dev/null and b/jsapp/baidu/.gradle/6.3/fileHashes/fileHashes.lock differ diff --git a/jsapp/baidu/.gradle/6.3/gc.properties b/jsapp/baidu/.gradle/6.3/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/jsapp/baidu/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/jsapp/baidu/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 000000000..8114c34ce Binary files /dev/null and b/jsapp/baidu/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/jsapp/baidu/.gradle/buildOutputCleanup/cache.properties b/jsapp/baidu/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 000000000..bd5a76b27 --- /dev/null +++ b/jsapp/baidu/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Aug 29 16:30:35 CST 2024 +gradle.version=6.3 diff --git a/jsapp/baidu/.gradle/checksums/checksums.lock b/jsapp/baidu/.gradle/checksums/checksums.lock new file mode 100644 index 000000000..b60f1349c Binary files /dev/null and b/jsapp/baidu/.gradle/checksums/checksums.lock differ diff --git a/jsapp/baidu/.gradle/vcs-1/gc.properties b/jsapp/baidu/.gradle/vcs-1/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/jsapp/map/.gradle/6.3/fileChanges/last-build.bin b/jsapp/map/.gradle/6.3/fileChanges/last-build.bin new file mode 100644 index 000000000..f76dd238a Binary files /dev/null and b/jsapp/map/.gradle/6.3/fileChanges/last-build.bin differ diff --git a/jsapp/map/.gradle/6.3/fileHashes/fileHashes.lock b/jsapp/map/.gradle/6.3/fileHashes/fileHashes.lock new file mode 100644 index 000000000..9e1e05649 Binary files /dev/null and b/jsapp/map/.gradle/6.3/fileHashes/fileHashes.lock differ diff --git a/jsapp/map/.gradle/6.3/gc.properties b/jsapp/map/.gradle/6.3/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/jsapp/map/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/jsapp/map/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 000000000..48a3cd33e Binary files /dev/null and b/jsapp/map/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/jsapp/map/.gradle/buildOutputCleanup/cache.properties b/jsapp/map/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 000000000..8063371da --- /dev/null +++ b/jsapp/map/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Aug 29 16:32:59 CST 2024 +gradle.version=6.3 diff --git a/jsapp/map/.gradle/checksums/checksums.lock b/jsapp/map/.gradle/checksums/checksums.lock new file mode 100644 index 000000000..db78c96e0 Binary files /dev/null and b/jsapp/map/.gradle/checksums/checksums.lock differ diff --git a/jsapp/map/.gradle/checksums/md5-checksums.bin b/jsapp/map/.gradle/checksums/md5-checksums.bin new file mode 100644 index 000000000..a81f763be Binary files /dev/null and b/jsapp/map/.gradle/checksums/md5-checksums.bin differ diff --git a/jsapp/map/.gradle/checksums/sha1-checksums.bin b/jsapp/map/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 000000000..afef8aa32 Binary files /dev/null and b/jsapp/map/.gradle/checksums/sha1-checksums.bin differ diff --git a/jsapp/map/.gradle/vcs-1/gc.properties b/jsapp/map/.gradle/vcs-1/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/jsapp/weather/.gradle/6.3/fileChanges/last-build.bin b/jsapp/weather/.gradle/6.3/fileChanges/last-build.bin new file mode 100644 index 000000000..f76dd238a Binary files /dev/null and b/jsapp/weather/.gradle/6.3/fileChanges/last-build.bin differ diff --git a/jsapp/weather/.gradle/6.3/fileHashes/fileHashes.lock b/jsapp/weather/.gradle/6.3/fileHashes/fileHashes.lock new file mode 100644 index 000000000..4adf1542f Binary files /dev/null and b/jsapp/weather/.gradle/6.3/fileHashes/fileHashes.lock differ diff --git a/jsapp/weather/.gradle/6.3/gc.properties b/jsapp/weather/.gradle/6.3/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/jsapp/weather/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/jsapp/weather/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 000000000..e5f07dfba Binary files /dev/null and b/jsapp/weather/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/jsapp/weather/.gradle/buildOutputCleanup/cache.properties b/jsapp/weather/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 000000000..8063371da --- /dev/null +++ b/jsapp/weather/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Aug 29 16:32:59 CST 2024 +gradle.version=6.3 diff --git a/jsapp/weather/.gradle/checksums/checksums.lock b/jsapp/weather/.gradle/checksums/checksums.lock new file mode 100644 index 000000000..38427dba3 Binary files /dev/null and b/jsapp/weather/.gradle/checksums/checksums.lock differ diff --git a/jsapp/weather/.gradle/vcs-1/gc.properties b/jsapp/weather/.gradle/vcs-1/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/patch_0615sdk_to_0906.txt b/patch_0615sdk_to_0906.txt new file mode 100644 index 000000000..962dbde4c --- /dev/null +++ b/patch_0615sdk_to_0906.txt @@ -0,0 +1,51 @@ +【补丁名称】patch_615_base_to_0906 +【基础版本】b615 +【修复问题】 +BT合入内容 + 1、提供配置BT_SERVICE_TASK任务优先级的接口。 + 2、白名单流控方案,解决BLE配对B核数据积压导致内存不足问题。 + 3、解决T1来电未打断音乐的问题。 + 4、解决task创建过多导致通话通路未创建的问题。 + 5、屏蔽bt睡眠唤醒统计日志。 +PLT合入内容 + 1、msgcenter与native app代码解耦。 + 2、nv flash下电前刷新机制调整。 + 3、支持16M norFlash部署。 +MEDIA合入内容 + 1、解决视频停播问题。 + 2、修改视频解码失败不进行GPU的reset。 +GUI合入内容 + 1、修复足球列表泄漏,统一成员命名风格。 + 2、修复AppList界面点击App返回后回到AppList最上方的问题。 + 3、修复UIKIT SAMPLE选择足球效果死机重启。 + 4、支持切换页面时清除设备分发状态和缓存数据。 + 5、支持SlipFlow。 + 6、支持表情包显示。 + 7、Slice生命周期优化。 + 8、修复视频表盘滑动到指南针不转动问题 + 9、修复transformGroup圆角消失 + 10、修复AbilityJS TransitionCount处理 +OHOS合入内容 + 1、解决jsapp内多次跳转page内存持续增长OOM问题。 + 2、增加network jsi,方便客户native对接。 + 3、提供canvas drawImage API,支持小游戏需求,如贪吃蛇性能。 + 4、提供ontouch触摸事件监听。 + 5、提供国际化native i18n模块,js支持日期格式化DateTimeFormat方法。 +GPU合入内容: + 1、增加AT维测命令。 +NATIVE-JS sample合入内容 + 1、解决美人鱼耳机无法控制音量问题。 + 2、解决取消配对后连接状态未刷新问题。 + 3、调整音量同步逻辑 + 4、删除PresenterTask.h/cpp文件依赖 +【修改影响】NA + +【使用方法】 + 基于B615版本合入补丁 + +【自测情况】 + 自验证范围: + 全功能冒烟 + 自验证target: + Native-js、target3 rc版本 +【是否合入版本】根据测试结果确定