From: SnickerSun Date: Mon, 2 Dec 2024 06:47:41 +0000 (+0800) Subject: patch_615_1029_to_1127 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8306c6b2e365f5e5884e0343236ebc0a1f1ba8e7;p=mirrors%2FFD230.git patch_615_1029_to_1127 添加u8 project --- diff --git a/autobuild.sh b/autobuild.sh index 257e77ff9..66f79d2a9 100644 --- a/autobuild.sh +++ b/autobuild.sh @@ -86,7 +86,14 @@ RECOVERY_NAME=$APPLICATION_NAME-r SSB_NAME=$APPLICATION_NAME-ssb BUILD_NAME=_FD230 fi - +if [ "$1" == "u8" ] +then +TARGET_PACK_NAME=pack_brandy_native_js_u8 +APPLICATION_NAME=brandy-native-js-u8 +RECOVERY_NAME=$APPLICATION_NAME-r +SSB_NAME=$APPLICATION_NAME-ssb +BUILD_NAME=_U8 +fi if [ "$1" == "w9" ] then TARGET_PACK_NAME=pack_brandy_native_js_w9 diff --git a/code/sdk/application/brandy/brandy_standard/input_app.c b/code/sdk/application/brandy/brandy_standard/input_app.c index bcc6ec85f..87c6c9abd 100644 --- a/code/sdk/application/brandy/brandy_standard/input_app.c +++ b/code/sdk/application/brandy/brandy_standard/input_app.c @@ -409,7 +409,9 @@ static void button_released_state_handler(button_id_t id) g_button_state_record = 0; g_button_press_time = 0; } + uint32_t int_sts = osal_irq_lock(); button_report_click_state(id); + osal_irq_restore(int_sts); } static void button_pressed_state_handler(button_id_t id) diff --git a/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt b/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt index cced05e3a..29b6d1275 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt @@ -28,6 +28,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/NativeAbility.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/StartNative.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SliceTransition.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/BackDragListener.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/transition/ZoomTransition.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/transition/HexagonsTransition.cpp diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h b/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h index 9ddab5cb4..9e3547521 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h @@ -16,6 +16,7 @@ #ifndef NATIVEABILITYFWK_ABILITY_H #define NATIVEABILITYFWK_ABILITY_H #include "utils/utils_list.h" +#include "gfx_utils/vector.h" #include #include @@ -37,7 +38,7 @@ public: void AddSliceProxy(const uint16_t sliceId, SliceProxy* proxy); void ChangeSlice(const uint16_t targetSliceId, TransitionType type = TransitionType::TRANSITION_INVALID, - const uint16_t priority = gSliceDefaultPriority); + const uint16_t priority = gSliceDefaultPriority, bool enableSlideBack = false); void SetDefaultSliceId(const uint16_t defaultSliceId) { defaultSliceId_ = defaultSliceId; } @@ -70,6 +71,9 @@ public: void ResumeSlice(const uint16_t priority = gSliceDefaultPriority); void PauseSlice(); void StopSlice(); + void StopSliceTransition(); + UIView* GetSlideBackInfo(); + void BackToPreSlice(); protected: Ability() = default; @@ -80,8 +84,8 @@ protected: }; struct SliceStruct { - uint16_t sliceId; - Slice* slice; + uint16_t sliceId = 0; + Slice* slice = nullptr; }; // 预加载的所有slices @@ -90,6 +94,41 @@ protected: // 历史记录的所有slices, 当前只使用了id // TODO:: 整页面的能力恢复功能待考虑扩展 std::vector allSlices_; + struct { + uint16_t sliceId; + std::shared_ptr img; + } history_[gMaxHistorySlices]; + int16_t curHistoryNum_ = 0; + + bool PushHistory(uint16_t id, std::shared_ptr img) + { + if (curHistoryNum_ < static_cast(gMaxHistorySlices)) { + history_[curHistoryNum_].sliceId = id; + history_[curHistoryNum_].img = img; + ++curHistoryNum_; + return true; + } + return false; + } + + bool PopHistory() + { + if (curHistoryNum_ <= 0) { + return false; + } + --curHistoryNum_; + history_[curHistoryNum_].img = nullptr; + return true; + } + + void ClearHistory() + { + while (curHistoryNum_ > 0) { + PopHistory(); + } + } + + void RecordHistory(bool useTransition, bool enableSlideBack, bool isCurSnapshotEnabled); SliceStruct curSlice_; SliceStruct prevSlice_; @@ -99,7 +138,8 @@ protected: SliceTransition sliceTransition_; osal_atomic transitionCount_{0}; - void PostChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority); + void PostChangeSlice(const uint16_t targetSliceId, TransitionType type, + const uint16_t priority, bool enableSlideBack); 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 deaaf924f..a4acb09d7 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySlice.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySlice.h @@ -30,7 +30,7 @@ enum class SliceState : uint8_t { template class AbilitySlice : public Slice { public: - AbilitySlice() + AbilitySlice() :view_(nullptr), presenter_(nullptr), state_(SliceState::UNINITIALIZED) {} ~AbilitySlice() {} diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySliceProxy.h b/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySliceProxy.h index 24d2d0f5d..d942f0c62 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySliceProxy.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/AbilitySliceProxy.h @@ -21,9 +21,9 @@ #include "wearable_log.h" namespace OHOS { -template +template -class AbilitySliceProxy : public SliceProxy { +class AbilitySliceProxy : public SliceProxy { public: AbilitySliceProxy() {} ~AbilitySliceProxy() {} diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/BackDragListener.h b/code/sdk/application/wearable/nativeabilityfwk/include/BackDragListener.h new file mode 100644 index 000000000..e6603d6e2 --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/include/BackDragListener.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: BackDragListener + * Author: + * Create: 2024-11-13 + */ + +#ifndef BACK_DRAG_LISTENER_H +#define BACK_DRAG_LISTENER_H +#include +#include "animator/animator.h" +#include "components/ui_view.h" + +namespace OHOS { +class BackDragListener : public UIView::OnDragListener { +public: + BackDragListener(UIView *cur = nullptr, UIView *target = nullptr, std::function targetAction = nullptr, + std::function curAction = nullptr) + : curView_(cur), targetView_(target), targetAction_(targetAction), curAction_(curAction) + {} + BackDragListener(const BackDragListener&) = delete; + BackDragListener& operator =(const BackDragListener&) = delete; + ~BackDragListener() override + { + ClearStatus(); + } + bool OnDragStart(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; + void SetCurrentAndTarget(UIView *cur, UIView *tar) + { + curView_ = cur; + targetView_ = tar; + } + + void SetDragToTargetAction(const std::function &action) + { + targetAction_ = action; + } + + void SetDragToCurrentAction(const std::function &action) + { + curAction_ = action; + } + + void SetAnimatorTime(uint16_t time) + { + time_ = time; + } + +private: + void ClearStatus(); + class BackAnimatorCallback : public AnimatorCallback { + public: + void Callback(UIView* view) override; + void OnStop(UIView& view) override; + void SetDragParam(int16_t startX, int16_t endX, uint16_t dragTimes) + { + startValueX_ = startX; + endValueX_ = endX; + dragTimes_ = dragTimes; + } + + void SetAnimator(Animator *ani) + { + ani_ = ani; + } + + void SetStopAction(const std::function &action) + { + stopAct_ = action; + } + + void SetTargetView(UIView *target) + { + targetView_ = target; + } + + private: + void ResetStatus() + { + curtTime_ = 0; + dragTimes_ = 0; + startValueX_ = 0; + endValueX_ = 0; + ani_ = nullptr; + stopAct_ = nullptr; + targetView_ = nullptr; + } + + Animator *ani_ = nullptr; + UIView *targetView_ = nullptr; + uint16_t curtTime_ = 0; + uint16_t dragTimes_ = 0; + int16_t startValueX_ = 0; + int16_t endValueX_ = 0; + std::function stopAct_; + }; + + Animator *backAnimator_ = nullptr; + BackAnimatorCallback backCallback_; + UIView *targetView_ = nullptr; + UIView *curView_ = nullptr; + int16_t left_ = 0; + int16_t right_ = 0; + std::function targetAction_; + std::function curAction_; + uint16_t time_ = 200; +}; // BackDragListener + +} // namespace OHOS +#endif // BACK_DRAG_LISTENER_H diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h b/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h index 7b0bc5586..ef957b347 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h @@ -36,7 +36,7 @@ namespace OHOS { class NativeAbility : public Ability #ifdef JS_ENABLE -, public SliteAbility +, public SliteAbility #endif { public: diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h b/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h index 8e4bb9321..df5e48803 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/Presenter.h @@ -19,6 +19,8 @@ #include "components/root_view.h" #include "KeyInputListener.h" #include "dock/focus_manager.h" +#include "BackDragListener.h" +#include "NativeAbility.h" namespace OHOS { template @@ -26,7 +28,13 @@ template class Presenter { public: Presenter() : view_(nullptr), model_(nullptr) {} - virtual ~Presenter() {} + virtual ~Presenter() + { + if (backDragListener_ != nullptr) { + delete backDragListener_; + backDragListener_ = nullptr; + } + } /** * @brief Scheduled by slice when it is started and before transition animator starts if exsit @@ -49,6 +57,13 @@ public: } // Reset the default key listener RootView::GetInstance()->SetOnKeyActListener(KeyInputListener::GetInstance()); + UIView* backView = NativeAbility::GetInstance().GetSlideBackInfo(); + if (backView == nullptr || backDragListener_ != nullptr) { + return; + } + backDragListener_ = new BackDragListener( + view_->GetRootContainer(), backView, []() { NativeAbility::GetInstance().BackToPreSlice(); }); + view_->GetRootContainer()->SetOnDragListener(backDragListener_); } /** @@ -93,6 +108,7 @@ public: protected: V* view_; M* model_; + BackDragListener* backDragListener_ = nullptr; private: Presenter(const Presenter&) = delete; diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h b/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h index b6f5acc2d..1dbbf7088 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h @@ -7,6 +7,7 @@ #ifndef SLICE_TRANSITION_H #define SLICE_TRANSITION_H +#include #include "Slice.h" #include "TransitionCallback.h" #include "TransitionType.h" @@ -28,6 +29,24 @@ private: SliceTransition* sliceTransition_ = nullptr; }; +struct ImageDeleter { + void operator()(UIImageView *img) const + { + if (img == nullptr) { + return; + } + UIViewGroup* parent = dynamic_cast(img->GetParent()); + if (parent != nullptr) { + parent->Remove(img); + } + if (img != nullptr && img->GetImageInfo() != nullptr && + img->GetImageInfo()->data != nullptr) { + ImageCacheFree(*const_cast(img->GetImageInfo())); + } + delete img; + } +}; + class SliceTransition : public HeapBase { public: friend class TransitionAnimatorCallback; @@ -38,10 +57,16 @@ public: bool IsCurrentSnapshotEnabled(); bool SaveCurrentSnapshot(UIView* view); void StopAnimator(); + uint8_t GetAnimatorState() const; + std::shared_ptr GetCurrentSnapshot() + { + return currentSnapshot_; + } + private: Animator* animator_ = nullptr; TransitionAnimatorCallback* animatorCallback_ = nullptr; - UIImageView* currentSnapshot_ = nullptr; + std::shared_ptr currentSnapshot_; UIImageView* targetSnapshot_ = nullptr; UIViewGroup* currentView_ = nullptr; UIViewGroup* targetView_ = nullptr; diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp index 1cf68aef9..c4ef8b392 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp @@ -14,9 +14,15 @@ */ #include "Ability.h" +#include "AppViewIDs.h" #include "graphic_service.h" #include "abilityms_slite_client.h" #include "common/input_device_manager.h" +#include "animator/animator.h" +#include "components/root_view.h" +#include "common/screen.h" +#include "BackDragListener.h" +#include "common/graphic_utils.h" namespace OHOS { @@ -91,16 +97,17 @@ ListsNode* Ability::Find(const uint16_t sliceId) return nullptr; } -void Ability::ChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) +void Ability::ChangeSlice(const uint16_t targetSliceId, TransitionType type, + const uint16_t priority, bool enableSlideBack) { if (type == TransitionType::TRANSITION_INVALID) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&Ability::PostChangeSlice, this, targetSliceId, - type, priority)); + type, priority, enableSlideBack)); } else { if (osal_atomic_read(&transitionCount_) <= 0) { osal_atomic_inc(&transitionCount_); GraphicService::GetInstance()->PostGraphicEvent(std::bind(&Ability::PostChangeSlice, this, targetSliceId, - type, priority)); + type, priority, enableSlideBack)); } else { GRAPHIC_LOGE("ChangeSlice failed! targetSliceId = %u, transitionCount_ = %d", targetSliceId, osal_atomic_read(&transitionCount_)); @@ -108,7 +115,55 @@ void Ability::ChangeSlice(const uint16_t targetSliceId, TransitionType type, con } } -void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) +static std::shared_ptr SaveSnapshot(UIView *view) +{ + if (view == nullptr) { + return nullptr; + } + std::shared_ptr img(new UIImageView, ImageDeleter()); + ImageInfo info; + memset_s(&info, sizeof(info), 0, sizeof(info)); + if (RootView::GetInstance()->isSystemViewEmpty() && !view->IsVideoContained()) { + if (!Screen::GetInstance().GetCurrentScreenBitmap(info)) { + return nullptr; + } + } else { + if (!view->GetBitmap(info)) { + return nullptr; + } + } + img->SetSrc(&info); + return img; +} + +void Ability::RecordHistory(bool useTransition, bool enableSlideBack, bool isCurSnapshotEnabled) +{ + if (!enableSlideBack) { + ClearHistory(); + return; + } + if (curSlice_.sliceId == VIEW_INVALID) { + return; + } + if (curHistoryNum_ < gMaxHistorySlices) { + std::shared_ptr img; + if (!useTransition) { + img = SaveSnapshot(curSlice_.slice->GetSliceContainer()); + } else { + if (isCurSnapshotEnabled) { + img = sliceTransition_.GetCurrentSnapshot(); + } else { + img = SaveSnapshot(curSlice_.slice->GetSliceContainer()); + } + } + if (img) { + PushHistory(curSlice_.sliceId, img); + } + } +} + +void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type, + const uint16_t priority, bool enableSlideBack) { #ifdef JS_ENABLE ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); @@ -127,14 +182,19 @@ void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type, bool useTransition = sliceTransition_.SetTransitionType(type); bool isCurSnapshotEnabled = sliceTransition_.IsCurrentSnapshotEnabled(); PauseSlice(); + if (!useTransition) { + RecordHistory(useTransition, enableSlideBack, isCurSnapshotEnabled); StopSlice(); } else if (isCurSnapshotEnabled) { if (!sliceTransition_.SaveCurrentSnapshot(curSlice_.slice->GetSliceContainer())) { useTransition = false; osal_atomic_dec(&transitionCount_); } + RecordHistory(useTransition, enableSlideBack, isCurSnapshotEnabled); StopSlice(); + } else { + RecordHistory(useTransition, enableSlideBack, isCurSnapshotEnabled); } // slice页面跳转,先onstop,再onstart.在一个线程同步执行绘制,不会出现闪屏现象 @@ -203,4 +263,42 @@ void Ability::StopSlice() GRAPHIC_LOGE("No valid slice to stop"); } } + +void Ability::StopSliceTransition() +{ + if (sliceTransition_.GetAnimatorState() != Animator::STOP) { + sliceTransition_.StopAnimator(); + } +} + +UIView* Ability::GetSlideBackInfo() +{ + if (curHistoryNum_ > 0) { + return history_[curHistoryNum_ - 1].img.get(); + } + return nullptr; +} + +void Ability::BackToPreSlice() +{ + GraphicService::GetInstance()->PostGraphicEvent([this](){ + uint16_t targetSliceId = 0; + if (curHistoryNum_ > 0) { + targetSliceId = history_[curHistoryNum_ - 1].sliceId; + } + if (targetSliceId == 0) { + return; + } + + PopHistory(); + PauseSlice(); + StopSlice(); + + // slice页面跳转,先onstop,再onstart.在一个线程同步执行绘制,不会出现闪屏现象 + StartSlice(targetSliceId, gSliceDefaultPriority); + if (curSlice_.slice != nullptr) { + curSlice_.slice->OnResume(); + } + }); +} } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/BackDragListener.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/BackDragListener.cpp new file mode 100644 index 000000000..8f72c22fc --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/src/BackDragListener.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: BackDragListener + * Author: + * Create: 2024-11-13 + */ + +#include "BackDragListener.h" +#include "graphic_config.h" +#include "components/root_view.h" +#include "animator/easing_equation.h" + +namespace OHOS { +bool BackDragListener::OnDragStart(UIView& view, const DragEvent& event) +{ + if (targetView_ == nullptr || curView_ == nullptr || &view != curView_) { + return false; + } + + if (backAnimator_ != nullptr) { + delete backAnimator_; + backAnimator_ = nullptr; + } + RootView::GetInstance()->Insert(nullptr, targetView_); + RootView::GetInstance()->Invalidate(); + left_ = curView_->GetRelativeRect().GetLeft(); + right_ = curView_->GetRelativeRect().GetRight(); + return true; +} + +bool BackDragListener::OnDrag(UIView& view, const DragEvent& event) +{ + if (targetView_ == nullptr || curView_ == nullptr || &view != curView_) { + return false; + } + + if (backAnimator_ != nullptr) { + delete backAnimator_; + backAnimator_ = nullptr; + } + int16_t distance = event.GetDeltaX(); + int16_t x = curView_->GetX(); + x = x + distance; + if (x > right_) { + x = right_; + } else if (x < left_) { + x = left_; + } + + curView_->SetX(x); + RootView::GetInstance()->Invalidate(); + return true; +} + +bool BackDragListener::OnDragEnd(UIView& view, const DragEvent& event) +{ + if (targetView_ == nullptr || curView_ == nullptr || &view != curView_) { + return false; + } + + if (backAnimator_ != nullptr) { + delete backAnimator_; + backAnimator_ = nullptr; + } + bool startAnimator = false; + if (left_ < curView_->GetX() && curView_->GetX() < right_) { + startAnimator = true; + } + if (startAnimator) { + backAnimator_ = new Animator(&backCallback_, curView_, 0, true); + if (backAnimator_ == nullptr) { + return false; + } + backCallback_.SetAnimator(backAnimator_); + int16_t x = curView_->GetX(); + int16_t end; + if (x > (left_ + right_) / 2) { // 2: half + end = right_; + backCallback_.SetStopAction(targetAction_); + } else { + end = left_; + backCallback_.SetStopAction(curAction_); + } + backCallback_.SetTargetView(targetView_); + backCallback_.SetDragParam(x, end, time_ / DEFAULT_TASK_PERIOD); + backAnimator_->Start(); + } else { + if (curView_->GetX() <= left_) { + curView_->SetX(left_); + if (curAction_) { + curAction_(); + } + } else { + curView_->SetX(right_); + if (targetAction_) { + targetAction_(); + } + } + } + + return true; +} + +void BackDragListener::ClearStatus() +{ + if (backAnimator_ != nullptr) { + delete backAnimator_; + backAnimator_ = nullptr; + } + targetView_ = nullptr; + curView_ = nullptr; + left_ = 0; + right_ = 0; + targetAction_ = nullptr; + curAction_ = nullptr; + time_ = 200; // 200: defalut time +} + +void BackDragListener::BackAnimatorCallback::Callback(UIView* view) +{ + if (view == nullptr || ani_ == nullptr || targetView_ == nullptr) { + return; + } + + if (curtTime_ < dragTimes_) { + if (startValueX_ != endValueX_) { + int16_t x = EasingEquation::CubicEaseOut(startValueX_, endValueX_, curtTime_, dragTimes_); + view->SetX(x); + RootView::GetInstance()->Invalidate(); + } else { + ani_->Stop(); + } + } else { + ani_->Stop(); + } + ++curtTime_; +} + +void BackDragListener::BackAnimatorCallback::OnStop(UIView& view) +{ + if (targetView_ == nullptr) { + return; + } + view.SetX(endValueX_); + RootView::GetInstance()->Invalidate(); + if (stopAct_ != nullptr) { + stopAct_(); + } + ResetStatus(); +} +} // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp index 9266d4ce4..fda6da5f0 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp @@ -25,9 +25,9 @@ void TransitionAnimatorCallback::Callback(UIView* view) TransitionCallback* callback = sliceTransition_->transitionCallback_; if (!isStarted_) { if (callback->enableCurrentSnapshot_ && callback->enableTargetSnapshot_) { - callback->OnTransitionStart(sliceTransition_->currentSnapshot_, sliceTransition_->targetSnapshot_); + callback->OnTransitionStart(sliceTransition_->currentSnapshot_.get(), sliceTransition_->targetSnapshot_); } else if (callback->enableCurrentSnapshot_ && !callback->enableTargetSnapshot_) { - callback->OnTransitionStart(sliceTransition_->currentSnapshot_, sliceTransition_->targetView_); + callback->OnTransitionStart(sliceTransition_->currentSnapshot_.get(), sliceTransition_->targetView_); } else if (!callback->enableCurrentSnapshot_ && callback->enableTargetSnapshot_) { callback->OnTransitionStart(sliceTransition_->currentView_, sliceTransition_->targetSnapshot_); } else { @@ -69,19 +69,11 @@ SliceTransition::~SliceTransition() void SliceTransition::ClearTransitionResource() { - if (currentSnapshot_ != nullptr && currentSnapshot_->GetImageInfo() != nullptr && - currentSnapshot_->GetImageInfo()->data != nullptr) { - ImageCacheFree(*const_cast(currentSnapshot_->GetImageInfo())); - } - if (targetSnapshot_ != nullptr && targetSnapshot_->GetImageInfo() != nullptr && targetSnapshot_->GetImageInfo()->data != nullptr) { ImageCacheFree(*const_cast(targetSnapshot_->GetImageInfo())); } - if (currentSnapshot_ != nullptr) { - delete currentSnapshot_; - currentSnapshot_ = nullptr; - } + currentSnapshot_ = nullptr; if (targetSnapshot_ != nullptr) { delete targetSnapshot_; targetSnapshot_ = nullptr; @@ -105,6 +97,11 @@ bool SliceTransition::SetTransitionType(TransitionType type) return true; } +uint8_t SliceTransition::GetAnimatorState() const +{ + return animator_->GetState(); +} + bool SliceTransition::IsCurrentSnapshotEnabled() { if (transitionCallback_ == nullptr) { @@ -135,7 +132,7 @@ bool SliceTransition::SaveCurrentSnapshot(UIView* view) if (view == nullptr) { return false; } - currentSnapshot_ = new UIImageView(); + currentSnapshot_ = std::shared_ptr(new UIImageView(), ImageDeleter()); if (currentSnapshot_ == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "currentSnapshot new failed"); return false; @@ -206,7 +203,7 @@ void SliceTransition::Transition(UIViewGroup* current, UIViewGroup* target) if (transitionCallback_->enableCurrentSnapshot_) { currentSnapshot_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - RootView::GetInstance()->Add(currentSnapshot_); + RootView::GetInstance()->Add(currentSnapshot_.get()); } if (transitionCallback_->enableTargetSnapshot_) { @@ -224,7 +221,7 @@ void SliceTransition::StopAnimator() } if (transitionCallback_ != nullptr) { if (transitionCallback_->enableCurrentSnapshot_) { - RootView::GetInstance()->Remove(currentSnapshot_); + RootView::GetInstance()->Remove(currentSnapshot_.get()); } if (transitionCallback_->enableTargetSnapshot_) { diff --git a/code/sdk/application/wearable/nativeapp/CMakeLists.txt b/code/sdk/application/wearable/nativeapp/CMakeLists.txt index 547475d61..48ae8632a 100644 --- a/code/sdk/application/wearable/nativeapp/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeapp/CMakeLists.txt @@ -6,7 +6,6 @@ set(UI_SAMPLE_ROOT ${ROOT_DIR}/middleware/services/gui/uikit/sample/uitest) set(PUBLIC_HEADER ${NativeApp}/nativelauncher/include - ${NativeApp}/nativelauncher/include/slices/main ${NativeApp}/nativeui/screennotify/include ${NativeApp}/nativeui/bluetooth/include ) @@ -45,6 +44,7 @@ set(PRIVATE_HEADER ${NativeApp}/nativeui/uiservice/include ${NativeApp}/nativeui/uisample/include ${NativeApp}/nativeui/uisample/uitest/framework/include + ${NativeApp}/nativeui/aod_view/include ${NativeApp}/nativeui/alipay/include ${NativeApp}/nativeui/alipay/include/AlipayList @@ -119,6 +119,7 @@ set(SOURCES ${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 + ${UI_SAMPLE_ROOT}/components/ui_test_sphere_view/ui_test_sphere_view.cpp ) diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h index 1086da457..762f0f5de 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h @@ -53,6 +53,7 @@ typedef enum : uint16_t { VIEW_ADD_CARD, VIEW_SET_DIAL, VIEW_SET_DIAL_STYLE, + VIEW_AOD, VIEW_MAX_INTER_ARRY_APP = 0x7FFF, // 在此之前添加内部数组native应用ID. VIEW_MAX_INTER_APP = 0xFFFD, // 在此之前添加内部静态注册native应用ID,æ­¤ID在NativeRegisterType.h里单独管理 VIEW_EXTERN_APP = 0xFFFE, // 三方应用 diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h index b0dbb5c0e..fc251dda0 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h @@ -41,6 +41,7 @@ public: void InitIndoorWalkSlice(void); void InitRebootSlice(void); void InitUISampleSlice(void); + void InitAodViewSlice(void); void InitMainAlipaySlice(void); void InitSetDesktopSlice(void); void InitSetCardSlice(void); diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index 3f9578d93..d5036e48a 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -74,6 +74,7 @@ #include "SetDialPresenter.h" #include "SetDialStylePresenter.h" #include "SetDialStyleView.h" +#include "AodPresenter.h" #ifdef JS_ENABLE #include "product_adapter.h" #endif @@ -107,6 +108,7 @@ static const AppViewMapper SLICE_MAPPER[] = { {VIEW_INDOORWALK, &NativeLauncher::InitIndoorWalkSlice}, {VIEW_REBOOT, &NativeLauncher::InitRebootSlice}, {VIEW_UISAMPLE, &NativeLauncher::InitUISampleSlice}, + {VIEW_AOD, &NativeLauncher::InitAodViewSlice}, #ifdef SUPPORT_ALIPAY_SEC {VIEW_MAIN_ALIPAY, &NativeLauncher::InitMainAlipaySlice}, #endif @@ -397,6 +399,17 @@ void NativeLauncher::InitUISampleSlice(void) NativeAbility::GetInstance().AddSliceProxy(VIEW_UISAMPLE, uisampleView); } +void NativeLauncher::InitAodViewSlice(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitAodVewSlice"); + SliceProxy *aodViewSample = new AbilitySliceProxy; + if (aodViewSample == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "aodViewSample"); + return; + } + NativeAbility::GetInstance().AddSliceProxy(VIEW_AOD, aodViewSample); +} + void NativeLauncher::InitSetDesktopSlice(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitSetDesktopSlice"); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodModel.h b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodModel.h new file mode 100644 index 000000000..69586855d --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodModel.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AodModel + * Author: + * Create: 2024-10-30 + */ + +#ifndef AODMODEL_H +#define AODMODEL_H +#include "AodView.h" +#include "components/ui_view.h" + +namespace OHOS { +class AodModel { +public: + static AodModel& GetInstance() + { + static AodModel model; + return model; + } + void GetAodDialSetting(DialSetting &dial); + void SaveAodDialSetting(const DialSetting &dial); + +private: + AodModel(); + ~AodModel(); + AodModel(const AodModel&) = delete; + AodModel& operator=(const AodModel&) = delete; + DialSetting aodDialSetting_; +}; +} // OHOS +#endif // AODMODEL_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodPresenter.h new file mode 100644 index 000000000..969fc9c1d --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodPresenter.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AodPresenter + * Author: + * Create: 2024-10-30 + */ + +#ifndef AODPRESENTER_H +#define AODPRESENTER_H +#include "Presenter.h" +#include "AodView.h" +#include "components/ui_view.h" +#include "KeyInputListener.h" +#include "ModelListenerSample.h" + +namespace OHOS { +class AodView; +class AodModel; +class AodPresenter : public Presenter, public ModelListenerSample { +public: + AodPresenter() {} + ~AodPresenter() override {} + AodPresenter(const AodPresenter &) = delete; + AodPresenter &operator=(const AodPresenter &) = delete; + void Notify() override; +}; // AodPresenter +} // OHOS + +#endif // AODPRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodView.h b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodView.h new file mode 100644 index 000000000..0bcf7afba --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/include/AodView.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AodView + * Author: + * Create: 2024-10-30 + */ + +#ifndef AODVIEW_H +#define AODVIEW_H +#include "View.h" +#include "MainModel.h" +#include "SetDialInfo.h" +#include "DialBinTypesV2.h" +#include "components/ui_view.h" +#include "components/ui_card_page.h" + +namespace OHOS { +class AodPresenter; +class AodView : public View { +public: + AodView() {} + ~AodView(); + AodView(const AodView &) = delete; + AodView& operator=(const AodView &) = delete; + + void OnStart() override; + void OnStop() override; + void PeriodicUpdate(); + +private: + UIViewGroup *InitAodDial(DialSetting &setting); + UIViewGroup *InitAodOffDial(DialSetting &setting); + UIViewGroup *InitDefaultAod(); + bool isLoaded_ = false; + + UIViewGroup *clockDial_; +}; +} // OHOS +#endif // AODVIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodModel.cpp new file mode 100644 index 000000000..e06b38c0e --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodModel.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AodModel + * Author: + * Create: 2024-10-30 + */ + +#include "AodModel.h" +#include "kv_store.h" + +namespace OHOS { +static const int DIAL_SETTING_VALUE_LEN = 64; +AodModel::AodModel() +{ + aodDialSetting_.dialFlag = 0; + aodDialSetting_.dialId = 0; + aodDialSetting_.dialFullName = ""; +} + +AodModel::~AodModel() +{ +} + +void AodModel::GetAodDialSetting(DialSetting &dial) +{ + char temp[DIAL_SETTING_VALUE_LEN] = { 0 }; + int32_t len = UtilsGetValue("aod_dial_setting", temp, DIAL_SETTING_VALUE_LEN); + if (len < 0) { + dial = aodDialSetting_; + return; + } + char *setBuffer = nullptr; + char *setValue = strtok_s(temp, ",", &setBuffer); + if (setValue != nullptr) { + dial.dialFlag = atoi(setValue); + } else { + dial = aodDialSetting_; + return; + } + + setValue = strtok_s(nullptr, ",", &setBuffer); + if (setValue != nullptr) { + dial.dialId = atoi(setValue); + } else { + dial = aodDialSetting_; + return; + } + + setValue = strtok_s(nullptr, ",", &setBuffer); + if (setValue != nullptr) { + dial.dialFullName = setValue; + if (!((dial.dialFullName.length() > 0) && + (access(dial.dialFullName.c_str(), F_OK) == 0))) { + dial = aodDialSetting_; + return; + } + } else { + dial = aodDialSetting_; + return; + } + aodDialSetting_ = dial; +} + +void AodModel::SaveAodDialSetting(const DialSetting &dial) +{ + aodDialSetting_ = dial; + std::string tmp; + tmp += std::to_string(dial.dialFlag); + tmp += ","; + tmp += std::to_string(dial.dialId); + tmp += ","; + tmp += dial.dialFullName; + tmp += ","; + UtilsSetValue("aod_dial_setting", tmp.c_str()); +} +} // OHOS diff --git a/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodPresenter.cpp new file mode 100644 index 000000000..6af30c4a1 --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodPresenter.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AodPresenter + * Author: + * Create: 2024-10-30 + */ + +#include "AodPresenter.h" + +namespace OHOS { +void AodPresenter::Notify() +{ + view_->PeriodicUpdate(); +} +} // OHOS diff --git a/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodView.cpp new file mode 100644 index 000000000..208138a4a --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/aod_view/src/AodView.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AodView + * Author: + * Create: 2024-10-30 + */ + +#include "AodView.h" +#include "AodPresenter.h" +#include "AodModel.h" +#include "common/graphic_utils.h" +#include "DialBinParser.h" +#include "DialViewGroup.h" +#include "AmbientClockView.h" +#include "DialModelTime.h" + +namespace OHOS { +AodView::~AodView() +{ + if (clockDial_ != nullptr) { + delete clockDial_; + clockDial_ = nullptr; + } +} + +void AodView::OnStart() +{ + DialSetting &setting = MainModel::GetInstance().GetDialSetting(); + if (setting.dialFlag == 0) { // 在线表盘 + clockDial_ = InitAodDial(setting); + } else { + clockDial_ = InitAodOffDial(setting); + } + if (clockDial_ == nullptr) { + clockDial_ = InitDefaultAod(); + } + if (clockDial_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AodView::OnStart: Failed to generate the AOD watch face.\n"); + return; + } + DialViewGroup *dial = dynamic_cast(clockDial_); + if (dial != nullptr) { + dial->PreLoad(); + dial->OnActive(); + presenter_->SetPeriod(dial->GetPeriod()); + } else { + AmbientClockView *clock = dynamic_cast(clockDial_); + if (clock != nullptr) { + presenter_->SetPeriod(clock->GetPeriod()); + } + } + isLoaded_ = true; + AddViewToRootContainer(clockDial_); +} + +void AodView::OnStop() +{ + if (clockDial_ != nullptr) { + DialViewGroup *dial = dynamic_cast(clockDial_); + if (dial != nullptr) { + dial->OnInactive(); + dial->UnLoad(); + } + isLoaded_ = false; + } +} + +UIViewGroup *AodView::InitAodDial(DialSetting &setting) +{ + switch (setting.dialId) { + case DIAL_CLOCK: + return new AmbientClockView; + default: + return nullptr; + } + return nullptr; +} + +UIViewGroup *AodView::InitAodOffDial(DialSetting &setting) +{ + DialPreviewInfo preview; + memset_s(&preview, sizeof(preview), 0, sizeof(preview)); + FILE *fp = fopen(setting.dialFullName.c_str(), "rb"); + if (fp == nullptr) { + return nullptr; + } + bool ret = DialBinParser::GetInstance()->GetDialPreviewInfo(fp, &preview); + fclose(fp); + if (!ret) { + return nullptr; + } + if (preview.capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY || + preview.capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_NORMAL) { + DialViewGroup *dial = new DialViewGroup; + dial->SetDial(setting.dialFullName, DisplayState::AOD); + return dial; + } + return nullptr; +} + +UIViewGroup *AodView::InitDefaultAod() +{ + DialSetting setting; + AodModel::GetInstance().GetAodDialSetting(setting); + if (setting.dialFlag == 0) { + return InitAodDial(setting); + } + return InitAodOffDial(setting); +} + +void AodView::PeriodicUpdate() +{ + if (clockDial_ == nullptr || !isLoaded_) { + return; + } + + DialViewGroup *dial = dynamic_cast(clockDial_); + if (dial != nullptr) { + DialModelTime::GetInstance()->UpdateTime(); + dial->UpdateViewsByPeriodicUpdateData(); + return; + } + + AmbientClockView *clock = dynamic_cast(clockDial_); + if (clockDial_ != nullptr) { + clock->UpdateTime(); + } +} +} // OHOS diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h index 191790b36..fdf1a34f2 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h @@ -47,6 +47,7 @@ public: void ApplistUpdate(void); void SetPresenter(ApplistPresenter *p); AppListStyle GetCurrentStyle(void); + void SetInitFlag(bool flag); private: ApplistModel(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp index 2aa48efc8..86d11a590 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp @@ -62,6 +62,11 @@ namespace OHOS { } } + void ApplistModel::SetInitFlag(bool flag) + { + initFlag = flag; + } + void ApplistModel::ResolvingJSAppItems(void) { #ifdef JS_ENABLE diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp index f73e438fa..7e3301be4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp @@ -115,7 +115,11 @@ namespace OHOS { } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId); if (viewId < VIEW_MAX_INTER_APP) { - NativeAbility::GetInstance().ChangeSlice(viewId, type); + if (viewId == VIEW_SETTING && style == AppListStyle::APPLIST_STYLE) { + NativeAbility::GetInstance().ChangeSlice(viewId, type, gSliceDefaultPriority, true); + } else { + NativeAbility::GetInstance().ChangeSlice(viewId, type); + } return true; } else if (viewId == VIEW_EXTERN_APP) { #ifdef JS_ENABLE @@ -130,6 +134,7 @@ namespace OHOS { SetWantElement(want, startElement); StartAbility(want); + ClearWant(want); delete want; return true; #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/AmbientClockView.h b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/AmbientClockView.h new file mode 100644 index 000000000..2d02ca41e --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/AmbientClockView.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AmbientClockView + * Author: + * Create: 2024-10-30 + */ + +#ifndef AMBIENT_VIEW_GROUP_H +#define AMBIENT_VIEW_GROUP_H + +#include +#include +#include "View.h" +#include "components/ui_label.h" +#include "components/root_view.h" +#include "components/ui_view_group.h" +#include "components/ui_image_view.h" +#include "components/ui_label_button.h" +#include "components/ui_sweep_clock.h" +#include "ChangeSliceListener.h" +#include "font/ui_font_bitmap.h" +#include "font/ui_font.h" +#include "graphic_config.h" +#include "HealthModel.h" +#include "ActivityModel.h" +#include "UiConfig.h" +#include "components/ui_card_page.h" +#include "animator/animator_manager.h" +#include "sys/time.h" + +namespace OHOS { +class AmbientClockView : public UICardPage { +public: + AmbientClockView(); + ~AmbientClockView() override; + AmbientClockView(const AmbientClockView &) = delete; + AmbientClockView &operator=(const AmbientClockView &) = delete; + + bool InitView(void); + void PreLoad(void) override; + void UpdateTime(void); + uint32_t GetPeriod(void) const + { + return 1000; // 1000: ms + } + +private: + bool InitCenterCircleView(void); + bool InitHandView(void); + void InitDateTime(void); + bool InitSweepClock(void); + bool LoadClockImage(Image *view, uint32_t resId); + UISweepClock *mainSweepClock_{nullptr}; + Image *secondHand_{nullptr}; + Image *minuteHand_{nullptr}; + Image *hourHand_{nullptr}; + Image *hand24Hour_{nullptr}; + Image *bigCircle_{nullptr}; + Image *medCircle_{nullptr}; + Image *smallCircle_{nullptr}; + bool viewiInitStatus_{false}; +}; // class AmbientClockView +} // namespace OHOS +#endif // AMBIENT_VIEW_GROUP_H + diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/AmbientClockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/AmbientClockView.cpp new file mode 100644 index 000000000..7bc705a74 --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/AmbientClockView.cpp @@ -0,0 +1,232 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: AmbientClockView + * Author: + * Create: 2024-10-30 + */ + +#include "AmbientClockView.h" +#include "MainPresenterSample.h" +#include "components/ui_label.h" +#include "wearable_log.h" +#include "ui_resource_image.h" +#include "common/image_cache_manager.h" + +namespace OHOS { +static constexpr uint16_t POINT_POSITION_X = 202; +static constexpr uint16_t POINT_POSITION_Y = 16; +static constexpr uint16_t SECOND_POINT_POSITION_Y = 16; +static constexpr uint16_t POINT_CENTER_X = 25; +static constexpr uint16_t POINT_CENTER_Y = 211; +static constexpr uint16_t BIGCIRCLE_POSITION_X = 202; +static constexpr uint16_t BIGCIRCLE_POSITION_Y = 202; +static constexpr uint16_t MEDCIRCLE_POSITION_X = 202; +static constexpr uint16_t MEDCIRCLE_POSITION_Y = 202; +static constexpr uint16_t SMALLCIRCLE_POSITION_X = 202; +static constexpr uint16_t SMALLCIRCLE_POSITION_Y = 202; +static constexpr int16_t SEC_TO_MILLI = 1000; +static constexpr int16_t USEC_TO_MILLI = 1000; +static constexpr int16_t MIN_TO_HOUR = 60; +static constexpr int16_t HOURLY_SYSTEM = 24; + +AmbientClockView::AmbientClockView() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AmbientClockView::AmbientClockView"); + SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + PreLoad(); +} + +AmbientClockView::~AmbientClockView() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AmbientClockView::~AmbientClockView"); + if (viewiInitStatus_) { + mainSweepClock_->RemoveAll(); + delete secondHand_; + secondHand_ = nullptr; + delete minuteHand_; + minuteHand_ = nullptr; + delete hourHand_; + hourHand_ = nullptr; + delete hand24Hour_; + hand24Hour_ = nullptr; + delete bigCircle_; + bigCircle_ = nullptr; + delete medCircle_; + medCircle_ = nullptr; + delete smallCircle_; + smallCircle_ = nullptr; + Remove(mainSweepClock_); + delete mainSweepClock_; + mainSweepClock_ = nullptr; + } +} + +bool AmbientClockView::InitCenterCircleView(void) +{ + bigCircle_ = new Image(); + if (bigCircle_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bigCircle new fail"); + return false; + } + if (!LoadClockImage(bigCircle_, CLOCK_BIGCIRCLE_IMAGE_PATH)) { + return false; + } + + medCircle_ = new Image(); + if (medCircle_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "medCircle new fail"); + return false; + } + if (!LoadClockImage(medCircle_, CLOCK_MEDCIRCLE_IMAGE_PATH)) { + return false; + } + + smallCircle_ = new Image(); + if (smallCircle_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "smallCircle new fail"); + return false; + } + if (!LoadClockImage(smallCircle_, CLOCK_CIRCLE_IMAGE_PATH)) { + return false; + } + return true; +} + +bool AmbientClockView::InitHandView(void) +{ + secondHand_ = new Image(); + if (secondHand_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "secondHand new fail"); + return false; + } + if (!LoadClockImage(secondHand_, CLOCK_SECONDHAND)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "secondHand load fail"); + return false; + } + + minuteHand_ = new Image(); + if (minuteHand_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "minuteHand new fail"); + return false; + } + if (!LoadClockImage(minuteHand_, CLOCK_MINUTEHAND)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "minuteHand load fail"); + return false; + } + hourHand_ = new Image(); + if (hourHand_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hourHand new fail"); + return false; + } + if (!LoadClockImage(hourHand_, CLOCK_HOURHAND)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hourHand load fail"); + return false; + } + + hand24Hour_ = new Image(); + if (hand24Hour_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hand24Hour new fail"); + return false; + } + if (!LoadClockImage(hand24Hour_, CLOCK_HAND24HOUR_IMAGE_PATH)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hand24Hour load fail"); + return false; + } + return true; +} + +bool AmbientClockView::LoadClockImage(Image *view, uint32_t resId) +{ + std::string file = CLOCK_IAMGES; + ImageInfo* image = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file); + if (image == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LoadClockImage %x fail", resId); + return false; + } + view->SetSrc(image); + return true; +} + +bool AmbientClockView::InitSweepClock(void) +{ + if (!InitCenterCircleView()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitCenterCircleView() fail"); + return false; + } + + InitHandView(); + return true; +} + +void AmbientClockView::PreLoad(void) +{ + if (!viewiInitStatus_) { + InitView(); + viewiInitStatus_ = true; + } +} + +bool AmbientClockView::InitView(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AmbientClockView::InitView"); + + mainSweepClock_ = new UISweepClock(); + if (mainSweepClock_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainSweepClock new fail"); + return false; + } + if (!InitSweepClock()) { + return false; + } + + Add(mainSweepClock_); + + mainSweepClock_->SetDragParentInstead(true); + mainSweepClock_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + + // {214, 3}: position x, y {14, 223}: center x, y + mainSweepClock_->SetHandImage(UISweepClock::HandType::SECOND_HAND, *secondHand_, + { POINT_POSITION_X, SECOND_POINT_POSITION_Y }, { POINT_CENTER_X, POINT_CENTER_Y }); + mainSweepClock_->SetHandImage(UISweepClock::HandType::MINUTE_HAND, *minuteHand_, + { POINT_POSITION_X, POINT_POSITION_Y }, { POINT_CENTER_X, POINT_CENTER_Y }); + mainSweepClock_->SetHandImage(UISweepClock::HandType::HOUR_HAND, *hourHand_, { POINT_POSITION_X, POINT_POSITION_Y }, + { POINT_CENTER_X, POINT_CENTER_Y }); + mainSweepClock_->SetHandCircleImage(UISweepClock::HandType::SECOND_HAND, *smallCircle_, + { SMALLCIRCLE_POSITION_X, SMALLCIRCLE_POSITION_Y }); + mainSweepClock_->SetHandCircleImage(UISweepClock::HandType::MINUTE_HAND, *medCircle_, + { MEDCIRCLE_POSITION_X, MEDCIRCLE_POSITION_Y }); + mainSweepClock_->SetHandCircleImage(UISweepClock::HandType::HOUR_HAND, *bigCircle_, + { BIGCIRCLE_POSITION_X, BIGCIRCLE_POSITION_Y }); + + mainSweepClock_->SetInitTime24Hour(0, 0, 0); + mainSweepClock_->SetWorkMode(UISweepClock::WorkMode::NORMAL); + InitDateTime(); + SetCoverable(true); + return true; +} + +void AmbientClockView::InitDateTime(void) +{ + struct tm pTM; + time_t seconds; + time(&seconds); + localtime_r(&seconds, &pTM); + mainSweepClock_->SetTime24Hour(pTM.tm_hour, pTM.tm_min, pTM.tm_sec); +} + +void AmbientClockView::UpdateTime(void) +{ + struct timeval tv; + gettimeofday(&tv, nullptr); + uint64_t second = tv.tv_sec; + uint64_t uSecond = tv.tv_usec; + uint64_t minute = second / MIN_TO_HOUR; + uint64_t hour = minute / MIN_TO_HOUR + timezone / (MIN_TO_HOUR * MIN_TO_HOUR); + uint8_t realHour = static_cast(hour % HOURLY_SYSTEM); + uint8_t realMinute = static_cast(minute % MIN_TO_HOUR); + uint16_t realMilliSecond = static_cast((second % MIN_TO_HOUR) * + SEC_TO_MILLI + uSecond / USEC_TO_MILLI); + mainSweepClock_->SetSweepTime12Hour(realHour, realMinute, realMilliSecond, 1); +} +} + diff --git a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp index 6c9359595..fe31775dd 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp @@ -120,7 +120,9 @@ UIViewGroup *ConnectOpenView::InitShowUpView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "tipsDragListener GetInstance fail"); return nullptr; } - group->SetOnDragListener(tipsDragListener); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + group->SetOnDragListener(tipsDragListener); + } group->SetViewId(CONNECT_OPEN_VIEW); group->SetDraggable(true); group->SetTouchable(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectSelectView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectSelectView.cpp index 296c088ad..e223a9a4a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectSelectView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectSelectView.cpp @@ -109,7 +109,9 @@ UIViewGroup *ConnectSelectView::InitShowUpView() WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "connectDragListener GetInstance fail"); return nullptr; } - group->SetOnDragListener(connectDragListener); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + group->SetOnDragListener(connectDragListener); + } group->SetViewId(CONNECT_SELECT_VIEW); group->SetDraggable(true); group->SetTouchable(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinParser.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinParser.h index dc737236f..82c3ad071 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinParser.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinParser.h @@ -19,13 +19,14 @@ #include "graphic_types.h" #include "DialViewGroup.h" #include "DialBinTypes.h" +#include "DialBinTypesV2.h" #include "components/ui_abstract_progress.h" namespace OHOS { class DialBinParser { public: static DialBinParser* GetInstance(void); - bool UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group); + bool UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group, DisplayState state = DisplayState::NORMAL); bool GetDialPreviewInfo(FILE* fp, DialPreviewInfo* info); protected: @@ -56,6 +57,8 @@ private: std::string file_; uint32_t dirId_ = 0xfef << 20; // 20: offset uint32_t imageOffset_ = 0; + bool v2Version_ = false; + DisplayState state_ = DisplayState::NORMAL; }; } #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h index 366c1bec6..d242a3dc2 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h @@ -29,6 +29,7 @@ struct DialPreviewInfo { char description[DIAL_DESCRIPTION_MAX_LEN]; uint32_t imgId; uint32_t offset; + uint8_t capability; }; struct DialRect { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypesV2.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypesV2.h new file mode 100644 index 000000000..837a0a685 --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypesV2.h @@ -0,0 +1,167 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved. + * Description: DialBinTypesV2 + * Author: + * Create: 2024-10-30 + */ + +#ifndef GRAPHIC_LITE_DIAL_BIN_TYPE_V2_H +#define GRAPHIC_LITE_DIAL_BIN_TYPE_V2_H +#include "DialBinTypes.h" + +namespace OHOS { +enum class DisplayState { + NORMAL, + AOD, +}; +static constexpr uint8_t DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY = 0; +static constexpr uint8_t DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY = 1; +static constexpr uint8_t DIAL_DISPLAY_CAPABILITY_AMBITIENT_NORMAL = 2; + +struct DialHeader_V2 { + char dialName[DIAL_NAME_MAX_LEN]; + int16_t width; + int16_t height; + char version[DIAL_VERSION_MAX_LEN]; + uint16_t previewImgId; + char description[DIAL_DESCRIPTION_MAX_LEN]; + uint32_t imageOffset; + uint8_t freq; + uint8_t dialViewCount; + uint8_t displayCapabiliy; + uint8_t ambientFreq; +}; + +struct DialStaticImg_V2 { + Point pos; + Point center; + float rotate; + uint16_t imgId; + uint8_t displayMode; +}; + +struct DialSequenceImg_V2 { + Point pos; + uint16_t interval; + bool repeat; + uint8_t imgNum; + uint8_t displayMode; +}; + +struct DialRotateImg_V2 { + Point pos; + Point center; + int16_t rotateStart; + int16_t rotateEnd; + uint16_t imgId; + int16_t bindData; + bool isPeriod; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialOptionImg_V2 { + Point pos; + int16_t bindData; + bool isPeriod; + uint8_t count; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialDigitalImg_V2 { + uint8_t alignType : 4; + uint8_t integerLength : 4; + uint8_t decimalPrecision; + uint16_t imgIds[DIAL_DIGITALIMG_IMG_MAX_NUM]; + int16_t signImgId; + int16_t decimalPointImgId; + uint16_t space; + Point alignPosition; + int16_t bindData; + bool isPeriod; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialLabel_V2 { + uint8_t breakMode; + uint8_t align; + uint8_t fontSize; + bool isPeriod; + DialRect rect; + uint32_t color; + char fontName[64]; + char text[64]; + int16_t bindData; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialArcLabel_V2 { + uint8_t align; + uint8_t fontSize; + Point center; + int16_t radius; + int16_t rotateStart; + int16_t rotateEnd; + uint32_t color; + char fontName[64]; + char text[64]; + int16_t bindData; + bool isPeriod; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialBoxProgress_V2 { + uint8_t cap; + uint8_t direction; + bool isPeriod; + int16_t bindData; + uint32_t bgColor; + DialProgressType typeData; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialArcProgress_V2 { + uint8_t cap; + bool isPeriod; + uint16_t radius; + uint16_t startAngle; + uint16_t endAngle; + uint16_t lineWidth; + int16_t bindData; + uint32_t bgColor; + DialProgressType typeData; + uint8_t displayMode; + bool isAmbientPeriodic; +}; + +struct DialVideo_V2 { + DialRect rect; + uint32_t offset; + Color32 colorKey; + uint32_t imgId; + uint8_t displayMode; +}; + +struct DialClick_V2 { + uint8_t type; + DialRect rect; + union { + uint32_t sliceId; + char bundleName[64]; + }; + uint8_t displayMode; +}; + +struct DialKaleidoscope_V2 { + uint16_t imgId; + float crownRotateStep; + float animatorRotateStep; + uint8_t displayMode; +}; +} // namespace OHOS +#endif // GRAPHIC_LITE_DIAL_BIN_TYPE_V2_H diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h index 1d82fac85..8d691e99a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h @@ -18,14 +18,15 @@ namespace OHOS { } CardInfo; typedef struct { - DialId id; + uint8_t id; const char *dialName; const char *dialImg; uint8_t freq; + uint8_t capability; } DialInfo; typedef struct { - uint8_t dialFlag; + uint8_t dialFlag; // 0 ÔÚÏß±íÅÌ 1 ÀëÏß±íÅÌ uint8_t dialId; std::string dialFullName; } DialSetting; @@ -39,7 +40,8 @@ namespace OHOS { void DeleteCardSetting(uint8_t index); void AddCardSetting(uint8_t index); const CardInfo *GetCardInfo(CardId card) const; - const DialInfo *GetDialInfo(DialId dial) const; + const DialInfo *GetDialInfo(uint8_t dial) const; // »ñÈ¡ÔÚÏß±íÅÌÅäÖà + uint8_t GetDialInfoNum() const; // »ñÈ¡ÔÚÏß±íÅ̵ÄÊýÁ¿ void AddDialSetting(const DialSetting &setting); void InitDialSettings(void); DialSetting &GetDialSetting(); @@ -47,6 +49,9 @@ namespace OHOS { void SetFromSetCardView(bool isFrom); void SetFromCardId(uint8_t cardId); uint8_t GetFromCardId(void); + bool IsAodEnabled(); + void EnableAod(bool enable); + private: void InitDialSettingDefault(void); MainModel(); @@ -59,6 +64,7 @@ namespace OHOS { DialSetting dialSetting; bool isFromSetCardView{false}; uint8_t fromCardId{MAX_CARD}; + bool isAodEnabled{false}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h index 3242760e9..76ada9f87 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h @@ -14,6 +14,7 @@ #include "gfx_utils/list.h" #include "DialView.h" #include "DialVideoView.h" +#include "DialBinTypesV2.h" namespace OHOS { class DialViewGroup : public UICardPage, public OnDialDataUpdateListener { @@ -24,7 +25,7 @@ public: /** * @brief Set dial resource path. */ - void SetDial(std::string filePath); + void SetDial(std::string filePath, DisplayState state = DisplayState::NORMAL); /** * @brief Add a view which binds with data of a specific type and could be updated periodically. @@ -127,6 +128,7 @@ private: FILE* fp_ = nullptr; DialVideoView* video_ = nullptr; UIKaleidoscopeView* kaleidoscope_ = nullptr; + DisplayState state_ = DisplayState::NORMAL; typedef struct { Rect area; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp index 737e038b4..f32f7690b 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp @@ -10,6 +10,8 @@ #include "kv_store.h" #include "securec.h" #include "wearable_log.h" +#include "DialBinTypesV2.h" +#include "power_display_service.h" namespace OHOS { static const int CARD_SETTING_VALUE_LEN = 32; @@ -22,10 +24,14 @@ namespace OHOS { }; const DialInfo dialInfoMap[] = { - { DIAL_CLOCK, "扫秒表盘", PNG_SET_DIAL_CLOCK, DEFAULT_TASK_PERIOD }, + { 0, "扫秒表盘", PNG_SET_DIAL_CLOCK, DEFAULT_TASK_PERIOD, DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY}, + { 1, "aod扫秒表盘", PNG_SET_DIAL_CLOCK, DEFAULT_TASK_PERIOD, DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY}, }; - MainModel::MainModel() {} + MainModel::MainModel() + { + power_display_gui_enable_aod(IsAodEnabled()); + } MainModel::~MainModel() {} @@ -45,7 +51,7 @@ namespace OHOS { return nullptr; } - const DialInfo *MainModel::GetDialInfo(DialId dialId) const + const DialInfo *MainModel::GetDialInfo(uint8_t dialId) const { for (uint8_t i = 0; i < (sizeof(dialInfoMap) / sizeof(dialInfoMap[0])); i++) { if (dialId == dialInfoMap[i].id) { @@ -55,6 +61,11 @@ namespace OHOS { return nullptr; } + uint8_t MainModel::GetDialInfoNum() const + { + return sizeof(dialInfoMap) / sizeof(dialInfoMap[0]); + } + void MainModel::InitCardSettings(void) { char temp[CARD_SETTING_VALUE_LEN] = { 0 }; @@ -140,7 +151,7 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitDialSettingDefault"); dialSetting.dialFlag = 0; - dialSetting.dialId = DIAL_CLOCK; + dialSetting.dialId = 0; dialSetting.dialFullName = ""; } @@ -219,4 +230,26 @@ namespace OHOS { { return fromCardId; } + + bool MainModel::IsAodEnabled() + { + char temp[DIAL_SETTING_VALUE_LEN] = { 0 }; + int32_t len = UtilsGetValue("enable_aod", temp, DIAL_SETTING_VALUE_LEN); + if (len >= 0) { + int enable = atoi(temp); + isAodEnabled = (enable != 0); + } + return isAodEnabled; + } + + void MainModel::EnableAod(bool enable) + { + power_display_gui_enable_aod(enable); + isAodEnabled = enable; + if (isAodEnabled) { + UtilsSetValue("enable_aod", "1"); + } else { + UtilsSetValue("enable_aod", "0"); + } + } } \ No newline at end of file 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 f6b7bbf72..e4f3c8fb0 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -127,7 +127,12 @@ bool MainPresenterSample::OnClick(UIView &view, const ClickEvent &event) } if (g_jumpView.count(curViewId) != 0) { - NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]); + if (g_jumpView[curViewId] == VIEW_SETTING) { + NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId], TransitionType::TRANSITION_INVALID, + gSliceDefaultPriority, true); + } else { + NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]); + } } return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp index dbfa000f3..6704a2267 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialArcLabelView.cpp @@ -60,12 +60,12 @@ bool DialArcLabelView::SetTextWithWildcard(const char* text) if (text_ == nullptr) { return false; } - if (memcpy_s(text_, textLen, text, textLen) != EOK) { + if (strcpy_s(text_, textLen, text) != EOK) { + GRAPHIC_LOGE("strcpy_s failed"); UIFree(text_); text_ = nullptr; return false; } - text_[textLen] = '\0'; return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp index 065036851..6d7bb7467 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp @@ -143,11 +143,13 @@ void DialDigitalImgView::HandlePosition() } else if (align_ == ImgAlign::CENTER) { curX -= totalWidth / 2; // 2: half } + UIView* prev = this; // this is always the leading view of those images. for (uint8_t i = 0; i < currentIndex_; i++) { - parent_->Add(imgs_[i]); + parent_->Insert(prev, imgs_[i]); imgs_[i]->SetPosition(curX, alignPos_.y); imgs_[i]->Invalidate(); curX += imgs_[i]->GetWidth() + space_; + prev = imgs_[i]; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp index f7cb557e4..b2e41f5de 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialLabelView.cpp @@ -59,12 +59,12 @@ bool DialLabelView::SetTextWithWildcard(const char* text) if (text_ == nullptr) { return false; } - if (memcpy_s(text_, textLen, text, textLen) != EOK) { + if (strcpy_s(text_, textLen, text) != EOK) { + GRAPHIC_LOGE("strcpy_s failed"); UIFree(text_); text_ = nullptr; return false; } - text_[textLen] = '\0'; return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp index da4317ea7..b8d9e8c51 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 @@ -99,11 +99,12 @@ void DialViewGroup::ClearDial() } } -void DialViewGroup::SetDial(std::string filePath) +void DialViewGroup::SetDial(std::string filePath, DisplayState state) { ClearDial(); resPreloaded_ = false; filePath_ = filePath; + state_ = state; } void DialViewGroup::PreLoad(void) @@ -114,7 +115,7 @@ void DialViewGroup::PreLoad(void) GRAPHIC_LOGE("cannot open file: %s\n", filePath_.c_str()); return; } - DialBinParser::GetInstance()->UpdateDial(filePath_, fp_, this); + DialBinParser::GetInstance()->UpdateDial(filePath_, fp_, this, state_); resPreloaded_ = true; } } @@ -180,8 +181,8 @@ void DialViewGroup::AddView(DialDataType type, DialView* view, bool isPeriodic) passiveUpdateTypes_.PushBack(type); } dialViews_.PushBack(dynamic_cast(view)); - ProcessData(type, view); Add(dynamic_cast(view)); + ProcessData(type, view); } void DialViewGroup::SetPeriod(uint32_t period) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp index b65627294..388ab5451 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp @@ -81,25 +81,44 @@ DialBinParser* DialBinParser::GetInstance(void) bool DialBinParser::GetDialPreviewInfo(FILE* fp, DialPreviewInfo* info) { if (fp == nullptr || info == nullptr) { - GRAPHIC_LOGE("Get dial preview fail, param error!\n"); + GRAPHIC_LOGE("Get dial preview fail, param error!"); return false; } DialHeader* dialHeader = static_cast(MallocAndReadBuf(fp, sizeof(DialHeader))); + DialHeader_V2 *v2Header = nullptr; if (dialHeader == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return false; } + if (strcmp(dialHeader->version, "2.0") == 0) { + UIFree(dialHeader); + dialHeader = nullptr; + int ret = fseek(fp, 0, SEEK_SET); + if (ret != 0) { + GRAPHIC_LOGE("file fseek 0 failed!"); + return false; + } + v2Header = static_cast(MallocAndReadBuf(fp, sizeof(DialHeader_V2))); + dialHeader = reinterpret_cast(v2Header); + if (dialHeader == nullptr) { + GRAPHIC_LOGE("malloc or read fail!"); + return false; + } + info->capability = v2Header->displayCapabiliy; + } else { + info->capability = DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY; + } if (memcpy_s(info->dialName, DIAL_NAME_MAX_LEN, dialHeader->dialName, DIAL_NAME_MAX_LEN) != EOK) { - GRAPHIC_LOGE("[%s: %d]memcpy_s dial name fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("memcpy_s dial name fail!"); UIFree(dialHeader); return false; } if (memcpy_s(info->description, DIAL_DESCRIPTION_MAX_LEN, dialHeader->description, DIAL_DESCRIPTION_MAX_LEN) != EOK) { - GRAPHIC_LOGE("[%s: %d]memcpy_s dial description fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("memcpy_s dial description fail!"); UIFree(dialHeader); return false; } @@ -111,22 +130,52 @@ bool DialBinParser::GetDialPreviewInfo(FILE* fp, DialPreviewInfo* info) return true; } -bool DialBinParser::UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group) +static bool SupportAod(uint8_t capability) +{ + if (capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY || + capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_NORMAL) { + return true; + } + return false; +} + +static bool SupportNormal(uint8_t capability) +{ + if (capability == DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY || + capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_NORMAL) { + return true; + } + return false; +} + +static bool SupportDisplayState(DisplayState state, uint8_t capability) +{ + if (state == DisplayState::AOD && SupportAod(capability)) { + return true; + } + if (state == DisplayState::NORMAL && SupportNormal(capability)) { + return true; + } + return false; +} + +bool DialBinParser::UpdateDial(const std::string& file, FILE* fp, DialViewGroup* group, DisplayState state) { if (fp == nullptr) { - GRAPHIC_LOGE("fp is nullptr!\n"); + GRAPHIC_LOGE("fp is nullptr!"); return false; } if (group == nullptr) { - GRAPHIC_LOGE("update dial param error!\n"); + GRAPHIC_LOGE("update dial param error!"); return false; } file_ = file; dialGroup_ = group; + state_ = state; int32_t ret = ParseDialHeader(fp); if (ret == -1) { - GRAPHIC_LOGE("Parse dial header fail, allom header mem fail!\n"); + GRAPHIC_LOGE("Parse dial header fail, allom header mem fail!"); return false; } return true; @@ -135,25 +184,59 @@ bool DialBinParser::UpdateDial(const std::string& file, FILE* fp, DialViewGroup* int32_t DialBinParser::ParseDialHeader(FILE* file) { if (file == nullptr) { - GRAPHIC_LOGE("Parser dial header fail, param error!\n"); + GRAPHIC_LOGE("Parser dial header fail, param error!"); return -1; } DialHeader* dialHeader = static_cast(MallocAndReadBuf(file, sizeof(DialHeader))); + DialHeader_V2* dialHeaderV2 = nullptr; if (dialHeader == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); + return -1; + } + v2Version_ = (strcmp(dialHeader->version, "2.0") == 0); + if (v2Version_) { + UIFree(dialHeader); + dialHeader = nullptr; + int ret = fseek(file, 0, SEEK_SET); + if (ret != 0) { + GRAPHIC_LOGE("file fseek 0 failed!"); + return -1; + } + dialHeaderV2 = static_cast(MallocAndReadBuf(file, sizeof(DialHeader_V2))); + dialHeader = reinterpret_cast(dialHeaderV2); + if (dialHeader == nullptr) { + GRAPHIC_LOGE("malloc or read fail!"); + return -1; + } + } + uint8_t capability = + (dialHeaderV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dialHeaderV2->displayCapabiliy); + if (!SupportDisplayState(state_, capability)) { + UIFree(dialHeader); + GRAPHIC_LOGE("capability %u not support state %d!", + capability, static_cast(state_)); return -1; } dialGroup_->SetWidth(dialHeader->width); dialGroup_->SetHeight(dialHeader->height); - dialGroup_->SetPeriod(1000 / dialHeader->freq); // 1000: ms + uint32_t period = UINT32_MAX; + if (state_ == DisplayState::NORMAL) { + period = dialHeader->freq == 0 ? UINT32_MAX : 1000 / dialHeader->freq; // 1000: ms + } else { + if (dialHeaderV2 != nullptr) { + period = + dialHeaderV2->ambientFreq == 0 ? UINT32_MAX : 1000 / dialHeaderV2->ambientFreq; // 1000: ms + } + } + dialGroup_->SetPeriod(period); imageOffset_ = dialHeader->imageOffset; uint8_t* viewType = static_cast(MallocAndReadBuf(file, (sizeof(uint8_t) * dialHeader->dialViewCount))); if (viewType == nullptr) { UIFree(dialHeader); - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -161,7 +244,7 @@ int32_t DialBinParser::ParseDialHeader(FILE* file) if (viewType[i] < DIAL_BIN_PARSER_FUNC_NUM) { int32_t ret = (this->*funcArray_[viewType[i]])(file); if (ret == -1) { - GRAPHIC_LOGE("parser dial view fail, view type id is %d!\n", viewType[i]); + GRAPHIC_LOGE("parser dial view fail, view type id is %d!", viewType[i]); break; } } @@ -175,13 +258,19 @@ int32_t DialBinParser::ParseDialHeader(FILE* file) int32_t DialBinParser::ParserDialStaticImg(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial static image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial static image fail, file is nullptr!"); return -1; } - - DialStaticImg* data = static_cast(MallocAndReadBuf(fp, sizeof(DialStaticImg))); + DialStaticImg* data = nullptr; + DialStaticImg_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialStaticImg_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialStaticImg))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -192,12 +281,19 @@ int32_t DialBinParser::ParserDialStaticImg(FILE* fp) uint32_t curReadPt = ftell(fp); ImageInfo* info = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (info == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file:%s resId:%x\n", __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file:%s resId:%x", file_.c_str(), resId); UIFree(data); return -1; } fseek(fp, curReadPt, SEEK_SET); view->SetSrc(info); + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + UIFree(data); + delete view; + return 0; + } dialGroup_->AddView(view); UIFree(data); @@ -207,19 +303,26 @@ int32_t DialBinParser::ParserDialStaticImg(FILE* fp) int32_t DialBinParser::ParserDialSequenceImg(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial sequence image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial sequence image fail, file is nullptr!"); return -1; } - DialSequenceImg* data = static_cast(MallocAndReadBuf(fp, sizeof(DialSequenceImg))); + DialSequenceImg_V2* dataV2 = nullptr; + DialSequenceImg *data = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialSequenceImg_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialSequenceImg))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } uint16_t* imgIdArray = static_cast(MallocAndReadBuf(fp, (sizeof(uint16_t) * data->imgNum))); if (imgIdArray == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); UIFree(data); return -1; } @@ -237,7 +340,7 @@ int32_t DialBinParser::ParserDialSequenceImg(FILE* fp) if (info == nullptr) { UIFree(imgIdArray); UIFree(data); - GRAPHIC_LOGE("[%s: %d]load img fail! file:%s resId:%x\n", __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file:%s resId:%x", file_.c_str(), resId); return -1; } fseek(fp, curReadPt, SEEK_SET); @@ -250,6 +353,14 @@ int32_t DialBinParser::ParserDialSequenceImg(FILE* fp) view->SetSequenceRes(imgInfoArray, data->imgNum); delete [] imgInfoArray; view->Start(); + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(imgIdArray); + UIFree(data); + return 0; + } dialGroup_->AddView(view); UIFree(imgIdArray); @@ -260,13 +371,20 @@ int32_t DialBinParser::ParserDialSequenceImg(FILE* fp) int32_t DialBinParser::ParserDialRotateImg(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial sequence image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial sequence image fail, file is nullptr!"); return -1; } - DialRotateImg* data = static_cast(MallocAndReadBuf(fp, sizeof(DialRotateImg))); + DialRotateImg* data = nullptr; + DialRotateImg_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialRotateImg_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialRotateImg))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } DialRotateImgView* view = new DialRotateImgView(); @@ -278,13 +396,26 @@ int32_t DialBinParser::ParserDialRotateImg(FILE* fp) uint32_t curReadPt = ftell(fp); ImageInfo* info = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (info == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file:%s resId:%x\n", __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file:%s resId:%x", file_.c_str(), resId); UIFree(data); return -1; } fseek(fp, curReadPt, SEEK_SET); view->SetSrc(info); - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } + if (state_ == DisplayState::NORMAL) { + dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + } else { + if (dataV2 != nullptr) { + dialGroup_->AddView(static_cast(data->bindData), view, dataV2->isAmbientPeriodic); + } + } UIFree(data); return 0; @@ -293,20 +424,28 @@ int32_t DialBinParser::ParserDialRotateImg(FILE* fp) int32_t DialBinParser::ParserDialOptionImg(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialOptionImg* data = static_cast(MallocAndReadBuf(fp, sizeof(DialOptionImg))); + DialOptionImg* data = nullptr; + DialOptionImg_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialOptionImg_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialOptionImg))); + } + if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } uint16_t* imgIdArray = static_cast(MallocAndReadBuf(fp, (sizeof(uint16_t) * data->count))); if (imgIdArray == nullptr) { UIFree(data); - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -320,7 +459,7 @@ int32_t DialBinParser::ParserDialOptionImg(FILE* fp) ImageInfo* info = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (info == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file:%s resId:%x\n", __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file:%s resId:%x", file_.c_str(), resId); UIFree(imgIdArray); UIFree(data); return -1; @@ -331,7 +470,21 @@ int32_t DialBinParser::ParserDialOptionImg(FILE* fp) view->SetOptionRes(infoArray, data->count); delete []infoArray; - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(imgIdArray); + UIFree(data); + return 0; + } + if (state_ == DisplayState::NORMAL) { + dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + } else { + if (dataV2 != nullptr) { + dialGroup_->AddView(static_cast(data->bindData), view, dataV2->isAmbientPeriodic); + } + } UIFree(imgIdArray); UIFree(data); @@ -340,9 +493,16 @@ int32_t DialBinParser::ParserDialOptionImg(FILE* fp) int32_t DialBinParser::ParserDialDigitalImg(FILE* fp) { - DialDigitalImg* data = static_cast(MallocAndReadBuf(fp, sizeof(DialDigitalImg))); + DialDigitalImg* data = nullptr; + DialDigitalImg_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialDigitalImg_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialDigitalImg))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -382,8 +542,7 @@ int32_t DialBinParser::ParserDialDigitalImg(FILE* fp) numInfoArray[i] = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (numInfoArray[i] == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file: %s resId: %x\n", - __FUNCTION__, __LINE__, file_.c_str(), data->imgIds[i]); + GRAPHIC_LOGE("load img fail! file: %s resId: %x", file_.c_str(), data->imgIds[i]); UIFree(data); return -1; } @@ -391,7 +550,20 @@ int32_t DialBinParser::ParserDialDigitalImg(FILE* fp) } view->SetParent(dialGroup_); view->SetNumRes(const_cast(numInfoArray), DIAL_DIGITALIMG_IMG_MAX_NUM); - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } + if (state_ == DisplayState::NORMAL) { + dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + } else { + if (dataV2 != nullptr) { + dialGroup_->AddView(static_cast(data->bindData), view, dataV2->isAmbientPeriodic); + } + } UIFree(data); return 0; @@ -400,13 +572,21 @@ int32_t DialBinParser::ParserDialDigitalImg(FILE* fp) int32_t DialBinParser::ParserDialLabel(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialLabel* data = static_cast(MallocAndReadBuf(fp, sizeof(DialLabel))); + DialLabel* data = nullptr; + DialLabel_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialLabel_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialLabel))); + } + if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -417,9 +597,25 @@ int32_t DialBinParser::ParserDialLabel(FILE* fp) Color32 color = {.full = data->color}; view->SetTextColor(color); view->SetAlign(static_cast(data->align)); + bool isPeriodic = false; + if (state_ == DisplayState::NORMAL) { + isPeriodic = data->isPeriod; + } else { + if (dataV2 != nullptr) { + isPeriodic = dataV2->isAmbientPeriodic; + } + } + + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } if (data->bindData != 0) { view->SetTextWithWildcard(data->text); - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + dialGroup_->AddView(static_cast(data->bindData), view, isPeriodic); } else { view->SetText(data->text); dialGroup_->AddView(view); @@ -431,13 +627,19 @@ int32_t DialBinParser::ParserDialLabel(FILE* fp) int32_t DialBinParser::ParserDialArcLabel(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - - DialArcLabel* data = static_cast(MallocAndReadBuf(fp, sizeof(DialArcLabel))); + DialArcLabel* data = nullptr; + DialArcLabel_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialArcLabel_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialArcLabel))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -448,9 +650,24 @@ int32_t DialBinParser::ParserDialArcLabel(FILE* fp) view->SetArcTextRadius(data->radius); view->SetArcTextAngle(data->rotateStart, data->rotateEnd); view->SetStyle(STYLE_TEXT_COLOR, data->color); + bool isPeriodic = false; + if (state_ == DisplayState::NORMAL) { + isPeriodic = data->isPeriod; + } else { + if (dataV2 != nullptr) { + isPeriodic = dataV2->isAmbientPeriodic; + } + } + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } if (data->bindData != 0) { view->SetTextWithWildcard(data->text); - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + dialGroup_->AddView(static_cast(data->bindData), view, isPeriodic); } else { view->SetText(data->text); dialGroup_->AddView(view); @@ -462,7 +679,7 @@ int32_t DialBinParser::ParserDialArcLabel(FILE* fp) bool DialBinParser::SetProgressType(FILE* fp, UIAbstractProgress* view, DialProgressType data) { if (view == nullptr || fp == nullptr) { - GRAPHIC_LOGE("[%s: %d]param error!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("param error!"); return false; } @@ -472,8 +689,7 @@ bool DialBinParser::SetProgressType(FILE* fp, UIAbstractProgress* view, DialProg ImageInfo* foregroundInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (foregroundInfo == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file: %s resId: %x\n", - __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file: %s resId: %x", file_.c_str(), resId); return false; } fseek(fp, curReadPt, SEEK_SET); @@ -487,7 +703,7 @@ bool DialBinParser::SetProgressType(FILE* fp, UIAbstractProgress* view, DialProg } else if (data.type == 2) { // 2: gradient ColorStop* stopArray = static_cast(MallocAndReadBuf(fp, (sizeof(ColorStop) * data.stopCount))); if (stopArray == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return false; } @@ -502,13 +718,20 @@ bool DialBinParser::SetProgressType(FILE* fp, UIAbstractProgress* view, DialProg int32_t DialBinParser::ParserDialBoxProgress(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialBoxProgress* data = static_cast(MallocAndReadBuf(fp, sizeof(DialBoxProgress))); + DialBoxProgress* data = nullptr; + DialBoxProgress_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialBoxProgress_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialBoxProgress))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -522,7 +745,22 @@ int32_t DialBinParser::ParserDialBoxProgress(FILE* fp) UIFree(data); return -1; } - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + bool isPeriodic = false; + if (state_ == DisplayState::NORMAL) { + isPeriodic = data->isPeriod; + } else { + if (dataV2 != nullptr) { + isPeriodic = dataV2->isAmbientPeriodic; + } + } + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } + dialGroup_->AddView(static_cast(data->bindData), view, isPeriodic); UIFree(data); return 0; } @@ -530,13 +768,20 @@ int32_t DialBinParser::ParserDialBoxProgress(FILE* fp) int32_t DialBinParser::ParserDialArcProgress(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialArcProgress* data = static_cast(MallocAndReadBuf(fp, sizeof(DialArcProgress))); + DialArcProgress* data = nullptr; + DialArcProgress_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialArcProgress_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialArcProgress))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -556,7 +801,22 @@ int32_t DialBinParser::ParserDialArcProgress(FILE* fp) return -1; } - dialGroup_->AddView(static_cast(data->bindData), view, data->isPeriod); + bool isPeriodic = false; + if (state_ == DisplayState::NORMAL) { + isPeriodic = data->isPeriod; + } else { + if (dataV2 != nullptr) { + isPeriodic = dataV2->isAmbientPeriodic; + } + } + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } + dialGroup_->AddView(static_cast(data->bindData), view, isPeriodic); UIFree(data); return 0; } @@ -564,13 +824,20 @@ int32_t DialBinParser::ParserDialArcProgress(FILE* fp) int32_t DialBinParser::ParserDialVideo(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialVideo* data = static_cast(MallocAndReadBuf(fp, sizeof(DialVideo))); + DialVideo* data = nullptr; + DialVideo_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialVideo_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialVideo))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -583,12 +850,18 @@ int32_t DialBinParser::ParserDialVideo(FILE* fp) ImageInfo* imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (imgInfo == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file: %s resId: %x\n", - __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file: %s resId: %x", file_.c_str(), resId); return false; } fseek(fp, curReadPt, SEEK_SET); view->SetPreview(imgInfo); + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } dialGroup_->AddView(view, true); UIFree(data); return 0; @@ -597,17 +870,30 @@ int32_t DialBinParser::ParserDialVideo(FILE* fp) int32_t DialBinParser::ParserDialClick(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialClick* data = static_cast(MallocAndReadBuf(fp, sizeof(DialClick))); + DialClick* data = nullptr; + DialClick_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialClick_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialClick))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } Rect rect = {data->rect.x, data->rect.y, data->rect.x + data->rect.w - 1, data->rect.y + data->rect.h - 1}; + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + UIFree(data); + return 0; + } if (data->type == 0) { dialGroup_->AddDialClick(rect, data->sliceId); } else if (data->type == 1) { @@ -621,13 +907,20 @@ int32_t DialBinParser::ParserDialClick(FILE* fp) int32_t DialBinParser::ParserDialKaleidoscope(FILE* fp) { if (fp == nullptr) { - GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!\n"); + GRAPHIC_LOGE("Parser dial option image fail, file is nullptr!"); return -1; } - DialKaleidoscope* data = static_cast(MallocAndReadBuf(fp, sizeof(DialKaleidoscope))); + DialKaleidoscope* data = nullptr; + DialKaleidoscope_V2* dataV2 = nullptr; + if (v2Version_) { + dataV2 = static_cast(MallocAndReadBuf(fp, sizeof(DialKaleidoscope_V2))); + data = reinterpret_cast(dataV2); + } else { + data = static_cast(MallocAndReadBuf(fp, sizeof(DialKaleidoscope))); + } if (data == nullptr) { - GRAPHIC_LOGE("[%s: %d]malloc or read fail!\n", __FUNCTION__, __LINE__); + GRAPHIC_LOGE("malloc or read fail!"); return -1; } @@ -637,8 +930,7 @@ int32_t DialBinParser::ParserDialKaleidoscope(FILE* fp) ImageInfo* imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, file_, fp, false, imageOffset_); if (imgInfo == nullptr) { - GRAPHIC_LOGE("[%s: %d]load img fail! file: %s resId: %x\n", - __FUNCTION__, __LINE__, file_.c_str(), resId); + GRAPHIC_LOGE("load img fail! file: %s resId: %x", file_.c_str(), resId); return false; } fseek(fp, curReadPt, SEEK_SET); @@ -646,6 +938,13 @@ int32_t DialBinParser::ParserDialKaleidoscope(FILE* fp) view->SetSrc(imgInfo); view->SetRotateEventFactor(data->crownRotateStep); // 0.2: rotate event factor view->SetRotateAnimatorValue(data->animatorRotateStep); // 0.1: rotate animator value + uint8_t capability = + (dataV2 == nullptr ? (DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) : dataV2->displayMode); + if (!SupportDisplayState(state_, capability)) { + delete view; + UIFree(data); + return 0; + } dialGroup_->AddView(view); UIFree(data); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp index dba1ce021..7474ad687 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp @@ -98,7 +98,9 @@ UIViewGroup *RebootDeviceView::InitShowUpView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDeviceDragListener GetInstance fail"); return nullptr; } - group->SetOnDragListener(rebootDeviceDragListener); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + group->SetOnDragListener(rebootDeviceDragListener); + } group->SetViewId(REBOOTDEVICE_VIEW); group->SetDraggable(true); group->SetTouchable(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp index 3c573f77c..bfe9a2a03 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp @@ -162,7 +162,9 @@ UIViewGroup *RebootView::InitShowUpView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDragListener GetInstance fail"); return nullptr; } - group->SetOnDragListener(rebootDragListener); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + group->SetOnDragListener(rebootDragListener); + } group->SetViewId(REBOOT_VIEW); group->SetDraggable(true); group->SetTouchable(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp index e3d74ec18..8e0793833 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp @@ -98,7 +98,9 @@ UIViewGroup *ShutdownDeviceView::InitShowUpView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDragListener GetInstance fail"); return nullptr; } - group->SetOnDragListener(rebootDragListener); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + group->SetOnDragListener(rebootDragListener); + } group->SetViewId(SHUTDOWNDEVICE_VIEW); group->SetDraggable(true); group->SetTouchable(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h index 4d202759a..39399a4f4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h @@ -24,6 +24,8 @@ void deregisterNotifyScreenStatus(ScreenStatusNotifyCallback callback); void notify_screen_on_event(void); void notify_screen_off_event(void); +void notify_screen_aod_on_event(void); +void notify_screen_aod_off_event(void); /** * @brief 设置灭屏后slice的存活期,需要在slice对应的Presentor的OnStart方法中调用 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 f4e5532d1..89cef0ac3 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 @@ -13,6 +13,7 @@ #include "ui_screennotify.h" #include "components/root_view.h" #include "notification_manager.h" +#include "DialBinTypesV2.h" #ifdef __cplusplus extern "C" { @@ -58,6 +59,26 @@ static void ChangeToHomeView(void) } } +static void GuiEnterAod(bool entry) +{ + using namespace OHOS; + DisplayState newState = entry ? DisplayState::AOD : DisplayState::NORMAL; + + uint16_t current_slice_id = NativeAbility::GetInstance().GetCurSliceId(); + for (uint16_t i = 0; i < sizeof(ignore_slice_ids) / sizeof(uint16_t); i++) { + if (ignore_slice_ids[i] == current_slice_id) { + return; + } + } + if (NativeAbility::GetInstance().GetNativeAbilityState() == STATE_ACTIVE) { + if (newState == DisplayState::AOD) { + NativeAbility::GetInstance().ChangeSlice(VIEW_AOD); + } else { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + } + } +}; + void notify_screen_on_event(void) { for (auto callback : g_callback) { @@ -75,10 +96,21 @@ void notify_screen_off_event(void) callback(SCREEN_STATUS_OFF); } if (GraphicService::GetInstance()->IsNativeRunning()) { + OHOS::NativeAbility::GetInstance().StopSliceTransition(); // make sure to end slice transition before turning screen off. OHOS::NativeAbility::GetInstance().PauseSlice(); } } +void notify_screen_aod_on_event(void) +{ + GuiEnterAod(true); +} + +void notify_screen_aod_off_event(void) +{ + GuiEnterAod(false); +} + void set_back_to_home_interval(uint32_t time_sec) { g_back_to_home_interval = time_sec; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp index a2b2402f2..3a76e1460 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp @@ -37,11 +37,15 @@ ScreenModels *ScreenModels::GetInstance(void) void ScreenModels::InitKvStorage(void) { #if !defined(_WIN32) +#ifndef XTS_SUPPORT int ret = UtilsSetEnv("/user"); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "UtilsSetEnv /user ret = %d", ret); +#endif #else int ret = UtilsSetEnv("../bin"); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "UtilsSetEnv ../user ret = %d", ret); #endif - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "UtilsSetEnv /user ret = %d", ret); + } void ScreenModels::LoadAppMultiImages(std::string file, uint32_t startId, uint32_t lastId) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp index 8b08c8629..1b2ff5a53 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp @@ -28,7 +28,9 @@ SetDesktopView::~SetDesktopView() void SetDesktopView::OnStart() { GetRootContainer()->SetDraggable(true); - GetRootContainer()->SetOnDragListener(presenter_); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + GetRootContainer()->SetOnDragListener(presenter_); + } GetRootContainer()->SetTouchable(true); scrollview = new UIScrollView(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h index 937c14970..abc288d24 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h @@ -21,6 +21,7 @@ namespace OHOS { std::string dialName; std::string description; /* 仅离线表盘使用 */ ImageInfo *preImageInfo; + uint8_t capability; } SetDialInfo; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h index 4a6b7ffc6..ff3787b17 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h @@ -18,6 +18,7 @@ namespace OHOS { void LoadAllDial(void); size_t GetDialCount(void); std::vector& GetDialInfo(void); + std::vector& GetAmbientDialInfo(void); void ClearDialInfo(void); void SaveDialSetting(uint8_t pageIndex); uint8_t GetPageIndex(void); @@ -30,6 +31,7 @@ namespace OHOS { virtual ~SetDialModel(); int32_t ParseDialHeader(const std::string &dialFileName, SetDialInfo &dialInfo); std::vector dialInfoList; + std::vector aodDialInfoList; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp index e694badd9..51eded2f7 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp @@ -25,19 +25,23 @@ namespace OHOS { } void SetDialModel::LoadAllDial() { - LoadAllDialFromRam(); + LoadAllDialFromRam(); // 导入在线表盘 size_t dialSize = dialInfoList.size(); - LoadAllDialFromFs(); + size_t aodSize = aodDialInfoList.size(); + LoadAllDialFromFs(); // 导入离线表盘 /* 只排序离线表盘 */ std::sort(dialInfoList.begin() + dialSize, dialInfoList.end(), [](const SetDialInfo& f, const SetDialInfo& n) { return f.dialName < n.dialName; }); + std::sort(aodDialInfoList.begin() + aodSize, + aodDialInfoList.end(), + [](const SetDialInfo &f, const SetDialInfo &n) { return f.dialName < n.dialName; }); } void SetDialModel::LoadAllDialFromRam() { - for (uint8_t i = DIAL_CLOCK; i < DIAL_MAX; i++) { - const DialInfo *info = MainModel::GetInstance().GetDialInfo((DialId)i); + for (uint8_t i = 0; i < MainModel::GetInstance().GetDialInfoNum(); i++) { + const DialInfo *info = MainModel::GetInstance().GetDialInfo(i); if (info != nullptr) { SetDialInfo dialInfo{0}; dialInfo.dialFlag = 0; @@ -51,7 +55,14 @@ namespace OHOS { continue; } dialInfo.preImageInfo = imageInfo; - dialInfoList.push_back(dialInfo); + if (info->capability == DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) { + dialInfoList.push_back(dialInfo); + } else if (info->capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY) { + aodDialInfoList.push_back(dialInfo); + } else { + dialInfoList.push_back(dialInfo); + aodDialInfoList.push_back(dialInfo); + } } } } @@ -69,7 +80,14 @@ namespace OHOS { SetDialInfo dialInfo{0}; int ret = ParseDialHeader(direntp->d_name, dialInfo); if (ret == 0) { - dialInfoList.push_back(dialInfo); + if (dialInfo.capability == DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) { + dialInfoList.push_back(dialInfo); + } else if (dialInfo.capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY) { + aodDialInfoList.push_back(dialInfo); + } else { + dialInfoList.push_back(dialInfo); + aodDialInfoList.push_back(dialInfo); + } } } } @@ -122,6 +140,7 @@ namespace OHOS { dialInfo.dialName = preInfo.dialName; dialInfo.description = preInfo.description; dialInfo.preImageInfo = info; + dialInfo.capability = preInfo.capability; fclose(fp); return 0; @@ -152,6 +171,11 @@ namespace OHOS { return dialInfoList; } + std::vector& SetDialModel::GetAmbientDialInfo(void) + { + return aodDialInfoList; + } + void SetDialModel::ClearDialInfo(void) { for (auto iter : dialInfoList) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h index 30b9c95f9..e7f148a40 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h @@ -29,8 +29,10 @@ public: private: UILabel labelCover_; UILabel labelRoller_; + UILabel labelEnableAod_; UIToggleButton btnCover_; UIToggleButton btnRoller_; + UIToggleButton btnEnableAod_; struct { UIToggleButton *btn; DialStyle style; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp index 142ff956e..b0420713f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp @@ -8,6 +8,7 @@ #include "SetDialStyleView.h" #include "SetDialStyleModel.h" #include "SetDialStylePresenter.h" +#include "MainModel.h" namespace OHOS { SetDialStyleView::SetDialStyleView() @@ -22,20 +23,39 @@ void SetDialStyleView::OnStart() { GetRootContainer()->SetDraggable(true); GetRootContainer()->SetTouchable(true); - GetRootContainer()->SetOnDragListener(presenter_); - labelCover_.SetPosition(96, 328, 200, 60); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + GetRootContainer()->SetOnDragListener(presenter_); + } + const int16_t BTN_HEIGHT = 55; + const int16_t BTN_WIDTH = 113; + const int16_t LABEL_WIDTH = 110; + const int16_t LABEL_HEIGHT = 18; + const int16_t COVER_X = 20; + const int16_t ROLLER_X = 158; + const int16_t ENABLE_X = 296; + const int16_t Y1 = 176; + const int16_t Y2 = 250; + + labelCover_.SetPosition(COVER_X, Y2, LABEL_WIDTH, LABEL_HEIGHT); labelCover_.SetText("Coverflow"); AddViewToRootContainer(&labelCover_); - labelRoller_.SetPosition(305, 328, 200, 60); + labelRoller_.SetPosition(ROLLER_X, Y2, LABEL_WIDTH, LABEL_HEIGHT); labelRoller_.SetText("Roller"); AddViewToRootContainer(&labelRoller_); - btnCover_.SetPosition(47, 157, 148, 148); + btnCover_.SetPosition(COVER_X, Y1, BTN_WIDTH, BTN_HEIGHT); AddViewToRootContainer(&btnCover_); - btnRoller_.SetPosition(267, 157, 148, 148); + btnRoller_.SetPosition(ROLLER_X, Y1, BTN_WIDTH, BTN_HEIGHT); AddViewToRootContainer(&btnRoller_); + labelEnableAod_.SetPosition(ENABLE_X, Y2, LABEL_WIDTH, LABEL_HEIGHT); + labelEnableAod_.SetText("´ò¿ªÏ¨ÆÁÏÔʾ"); + AddViewToRootContainer(&labelEnableAod_); + btnEnableAod_.SetPosition(ENABLE_X, Y1, BTN_WIDTH, BTN_HEIGHT); + AddViewToRootContainer(&btnEnableAod_); + btnEnableAod_.SetState(MainModel::GetInstance().IsAodEnabled()); + const DialStyle style = SetDialStyleModel::GetInstance().GetStyle(); int len = sizeof(styleTable_) / sizeof(styleTable_[0]); for (int i = 0; i < len; ++i) { @@ -48,6 +68,7 @@ void SetDialStyleView::OnStart() btnCover_.SetOnClickListener(presenter_); btnRoller_.SetOnClickListener(presenter_); + btnEnableAod_.SetOnClickListener(presenter_); } void SetDialStyleView::OnClick(UIView &view) @@ -56,6 +77,10 @@ void SetDialStyleView::OnClick(UIView &view) if (ptr == nullptr) { return; } + if (ptr == &btnEnableAod_) { + MainModel::GetInstance().EnableAod(ptr->GetState()); + return; + } int len = sizeof(styleTable_) / sizeof(styleTable_[0]); for (int i = 0; i < len; ++i) { if (ptr == styleTable_[i].btn) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItem.h b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItem.h index 250105ce0..0031350f1 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItem.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItem.h @@ -16,6 +16,7 @@ typedef struct { const char *icon; const char *label; bool hasSecondMenu; + bool enableSlideBack; } SettingItem; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h index 934e8166b..f045d1cbe 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h @@ -22,13 +22,17 @@ public: ~SettingItemView() override; virtual void SetItemInfo(const SettingItem itemInfo); virtual void SetUpChild(); + bool SlideBackEnabled() const + { + return sItemInfo.enableSlideBack; + } AppViewId GetViewId(); const char* GetIconId(); private: UIImageView sIcon; UILabel sLabel; UIImageView sNextImage; - SettingItem sItemInfo = { VIEW_INVALID, nullptr, nullptr, false }; + SettingItem sItemInfo = { VIEW_INVALID, nullptr, nullptr, false, false }; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp index 61b893dbd..b13f61a9f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp @@ -22,14 +22,14 @@ namespace OHOS { void SettingModel::InitSettingItem() { int index = 0; - settings[index++] = {VIEW_BLUETOOTH_EARPHONE, PNG_BLUETOOTH_STITLE, "蓝牙耳机", true}; - settings[index++] = {VIEW_CONNECT_PHONE, PNG_CONNECT_PHONE_IMAGE, "连接手机", true}; - settings[index++] = {VIEW_REBOOT, PNG_SETTTING_REBOOT_IMAGE, "重启", true}; - settings[index++] = {VIEW_REBOOT, PNG_SETTTING_SHUTDOWN_IMAGE, "关机", true}; - settings[index++] = {VIEW_SET_DESKTOP, PNG_SETTTING_DESKTOP_IMAGE, "桌面", true}; - settings[index++] = {VIEW_SET_DIAL, PNG_SETTTING_DESKTOP_IMAGE, "表盘", true}; - settings[index++] = {VIEW_SET_CARD, PNG_SETTTING_DESKTOP_IMAGE, "卡片", true}; - settings[index++] = {VIEW_SET_DIAL_STYLE, PNG_SETTTING_DESKTOP_IMAGE, "表盘风格", true}; + settings[index++] = {VIEW_BLUETOOTH_EARPHONE, PNG_BLUETOOTH_STITLE, "蓝牙耳机", true, false}; + settings[index++] = {VIEW_CONNECT_PHONE, PNG_CONNECT_PHONE_IMAGE, "连接手机", true, true}; + settings[index++] = {VIEW_REBOOT, PNG_SETTTING_REBOOT_IMAGE, "重启", true, true}; + settings[index++] = {VIEW_REBOOT, PNG_SETTTING_SHUTDOWN_IMAGE, "关机", true, true}; + settings[index++] = {VIEW_SET_DESKTOP, PNG_SETTTING_DESKTOP_IMAGE, "桌面", true, true}; + settings[index++] = {VIEW_SET_DIAL, PNG_SETTTING_DESKTOP_IMAGE, "表盘", true, false}; + settings[index++] = {VIEW_SET_CARD, PNG_SETTTING_DESKTOP_IMAGE, "卡片", true, false}; + settings[index++] = {VIEW_SET_DIAL_STYLE, PNG_SETTTING_DESKTOP_IMAGE, "表盘风格", true, true}; usedLen = index; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp index 06d4fd6c9..72c677b04 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp @@ -55,7 +55,12 @@ namespace OHOS { RebootModel::GetInstance()->SetExitsView(true); } } - NativeAbility::GetInstance().ChangeSlice(viewId); + if (settingItemView->SlideBackEnabled()) { + NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_INVALID, + gSliceDefaultPriority, true); + } else { + NativeAbility::GetInstance().ChangeSlice(viewId); + } return true; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp index c99f70374..99bcefcbc 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp @@ -94,7 +94,9 @@ void SettingView::OnStart() scrollView->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY); scrollView->SetThrowDrag(true); - scrollView->SetOnDragListener(presenter_); + if (NativeAbility::GetInstance().GetSlideBackInfo() == nullptr) { + scrollView->SetOnDragListener(presenter_); + } scrollView->SetYScrollBarVisible(true); scrollView->Add(title); scrollView->Add(contentList); 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 5b4ae5c2d..fc045bfb3 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 @@ -37,6 +37,7 @@ #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" +#include "ui_test_sphere_view/ui_test_sphere_view.h" namespace OHOS { void UITestGroup::AddTestCase(TestCaseInfo testCaseInfo) @@ -76,6 +77,7 @@ void UITestGroup::SetUpTestCase() #endif testCaseList_->PushBack(TestCaseInfo{"表情包显示", new UITestEmoji()}); testCaseList_->PushBack(TestCaseInfo{"视频播放", new UITestVideoPlay()}); + testCaseList_->PushBack(TestCaseInfo{"球型菜单", new UITestSphereView()}); 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 17c37cf75..a8d8571af 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -108,10 +108,12 @@ set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/player/interfaces/kits/ ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput ${ROOT_DIR}/middleware/utils/fs/include/fs ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common ${ROOT_DIR}/application/auto_ota + ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite ) if("JS_ENABLE" IN_LIST DEFINES) diff --git a/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-cli/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-auto-ota-cli/libmsg_center.a index 69b5ffbb8..8bb4f2906 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 e4d13c492..76e461ce6 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-fd230/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-native-js-fd230/libmsg_center.a index a5c504239..721d4cbc6 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-native-js-fd230/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-native-js-fd230/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-native-js-lt22/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-native-js-lt22/libmsg_center.a index a5c504239..721d4cbc6 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-native-js-lt22/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-native-js-lt22/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-native-js-u8/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-native-js-u8/libmsg_center.a new file mode 100644 index 000000000..721d4cbc6 Binary files /dev/null and b/code/sdk/application/wearable/service/msg_center/brandy-native-js-u8/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-native-js-w9/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-native-js-w9/libmsg_center.a index a5c504239..721d4cbc6 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-native-js-w9/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-native-js-w9/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 a5c504239..721d4cbc6 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 240b7f402..2f1bae72f 100644 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h index 7484c9022..53bbb4d1c 100644 --- a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h +++ b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h @@ -123,6 +123,7 @@ errcode_t msg_center_vector_navi_req_destroy_from_watch(uint8_t cmd_id, uint8_t errcode_t msg_center_vector_navi_rec_destroy_from_watch(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); bool is_vector_navi_long_distance(uint8_t type); +void msg_center_xiaodu_audio_pcm_clear_res(void); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 147a22581..a59ed0aee 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -27,7 +27,11 @@ #include "msg_center_protocol.h" #include "baidumap.h" #include "common_def.h" - +#include "keyinput.h" +#include "KeyInputListener.h" +#include "VolumeSettingView.h" +#include "VolumeSettingPresenter.h" +#include "VolumeSettingView.h" namespace OHOS { #ifdef __cplusplus @@ -46,6 +50,9 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE}, }; +bool g_pressFlag = false; +bool g_longPressFlag = false; + static bool CheckPriority(const Topic topic) { uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]); @@ -192,14 +199,119 @@ static uint8_t MsgCenterGetNotifyTblSize(void) return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]); } +static void CallVolumeDipSwitchControl(uint16_t notifyId, uint8_t states) +{ + VolumeSliderEventListener *volumeSliderEventListener = nullptr; + if (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE || + notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH) { + if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) { + VolumeSettingView *settingView = GetvolumeSetting(); + if (settingView == nullptr) { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); + if (volumeSliderEventListener == nullptr) { + return; + } + volumeSliderEventListener->ChangeVolume(static_cast(VOLUMEUP)); + } else { + HonrsViewChange(); + NotificationManager::GetInstance()->SetVolumeScreenStatus(true); + } + } + return; +} + +static void OnKeyLongPress(uint16_t keyID) +{ + g_longPressFlag = true; // Long press the logo + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button + // After StopNotify, a restart card will pop up first + uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); + if(notifyId == TOPIC_EVENT_ALARM_RING) { + NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT); + NotificationManager::GetInstance()->SetNativeUIRunning(true); + NotificationManager::GetInstance()->StopNotify(); + } + } else if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons + // Switch to user configured shortcut card + } + return; +} + +static void HandleKeyPress(uint16_t notifyId) +{ + if (notifyId == TOPIC_EVENT_ALARM_RING) { + AlarmClockModel::GetInstance()->AlarmGetClockNum(); + AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); + NotificationManager::GetInstance()->StopNotify(); + } +} + +static bool PressKeyEvent(uint16_t keyID, uint8_t state) +{ + switch (state) { + case InputDevice::STATE_PRESS: + g_pressFlag = true; + return true; + case InputDevice::STATE_LONG_PRESS: + OnKeyLongPress(keyID); + return true; + case InputDevice::STATE_RELEASE: + if (g_longPressFlag) { + g_pressFlag = false; + g_longPressFlag = false; + return true; + } + break; + default: + break; + } + return false; +} + +static bool KeyNotifyCallback(uint16_t keyID, uint8_t state) +{ + if (!OHOS::NotificationManager::GetInstance()->HasNotifyShowing()) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Notify does not exist!"); + OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(nullptr); + g_pressFlag = false; + g_longPressFlag = false; + return false; + } + if (PressKeyEvent(keyID, state)) { + return true; + } + uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { // Power button + if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card + // volume+ + CallVolumeDipSwitchControl(notifyId, VOLUMEUP); + } else { + HandleKeyPress(notifyId); + } + } + else if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_FUNC)) { // Function buttons + if (NotificationManager::GetInstance()->GetWatchCallStatus()) { // Volume card + // volume- + CallVolumeDipSwitchControl(notifyId, VOLUMEDOWN); + } else { + // Switch to user configured shortcut card + } + } + g_pressFlag = false; + g_longPressFlag = false; + return true; +} + bool MsgCenterNotifyProc(const Topic topic, Request* req) { uint8_t i; uint8_t tblSize = MsgCenterGetNotifyTblSize(); - + OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback); for (i = 0; i < tblSize; i++) { MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i); - if (item->topic == topic && item->cb != nullptr) { + if (item != nullptr && item->topic == topic && item->cb != nullptr) { item->cb(topic, req); return true; } @@ -242,7 +354,7 @@ void StartJsApp(char *bundleName) SetWantElement(want, startElement); StartAbility(want); - + ClearWant(want); delete want; } diff --git a/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp b/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp index 33edb7ecd..fe13e2c42 100644 --- a/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp @@ -22,6 +22,7 @@ #include "soc_osal.h" #include "watchdog.h" #include "js_ability.h" +#include "recording_module.h" #ifdef __cplusplus extern "C" { @@ -35,6 +36,7 @@ extern "C" { #define ROUTE_TRANS_MAX_SIZE (60 * 1024) /* 60K大小的导航路线规划,距离大概是15KM */ osMessageQueueId_t g_pcm_stream_msg_queue_id = nullptr; +static bool g_pcm_stream_end_record_sended_flag = false; /* 标识pcm的end帧是否发送完成,用于异常场景时资源清理 */ errcode_t msg_center_navigation_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) { @@ -135,6 +137,8 @@ static errcode_t pcm_stream_task_body(void *data) return ERRCODE_FAIL; } + g_pcm_stream_end_record_sended_flag = false; + for (;;) { osStatus_t ret = osMessageQueueGet(g_pcm_stream_msg_queue_id, &msg, nullptr, osWaitForever); if (ret != osOK) { @@ -147,6 +151,7 @@ static errcode_t pcm_stream_task_body(void *data) msg.data = nullptr; if (res != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm stream failed"); + pcm_stream_del_queue(); return ERRCODE_FAIL; } } else if (msg.msg_id == MSGCENTER_TYPE_ID_XIAODU_END_RECORD) { @@ -156,8 +161,10 @@ static errcode_t pcm_stream_task_body(void *data) msg.data = nullptr; if (res != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm end failed"); + pcm_stream_del_queue(); return ERRCODE_FAIL; } + g_pcm_stream_end_record_sended_flag = true; return ERRCODE_SUCC; } } @@ -165,6 +172,31 @@ static errcode_t pcm_stream_task_body(void *data) return ERRCODE_SUCC; } +/* + 异常场景时清除audio资源、pcm队列资源 + 可能的异常场景包括: + 1)录音过程中,JS直接退出; + 2)录音完成后,等待APP结果未返回时,JS退出; + */ +void msg_center_xiaodu_audio_pcm_clear_res(void) +{ + OHOS::ACELite::AudioCapturerModule::ExceptionStop(); + if (g_pcm_stream_end_record_sended_flag == false) { + pcm_stream_queue_msg msg; + msg.msg_id = MSGCENTER_TYPE_ID_XIAODU_END_RECORD; + msg.data = 0; + msg.len = 1; + if (g_pcm_stream_msg_queue_id != nullptr) { + osStatus_t ret = osMessageQueuePut(g_pcm_stream_msg_queue_id, &msg, 0, 0); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "Fatal err, ret = %d\r\n", ret); + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_MSG_CENTER, "active send pcm end\r\n"); + } + } + return; +} + osMessageQueueId_t GetPcmMsgQueueId(void) { return g_pcm_stream_msg_queue_id; @@ -183,6 +215,7 @@ errcode_t pcm_stream_create_task(void) 0 }; if (osThreadNew((osThreadFunc_t)pcm_stream_task_body, nullptr, &attr) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "create pcm_stream task fail!\r\n"); + pcm_stream_del_queue(); return ERRCODE_FAIL; } diff --git a/code/sdk/application/wearable/service/power_manager/include/power_display_service.h b/code/sdk/application/wearable/service/power_manager/include/power_display_service.h index 6c8cc5f43..dc240c35e 100644 --- a/code/sdk/application/wearable/service/power_manager/include/power_display_service.h +++ b/code/sdk/application/wearable/service/power_manager/include/power_display_service.h @@ -223,6 +223,7 @@ typedef struct screen_context { bool press_state; uint32_t screen_on_time_interval; uint32_t screen_off_time_interval; + bool enable_aod; } screen_context_t; /** @@ -400,6 +401,8 @@ errcode_t power_display_task_init(void); */ screen_context_t *power_display_get_screen_context(void); +void power_display_gui_enable_aod(bool enable); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c b/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c index 92fceba54..976e3c5c0 100644 --- a/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c +++ b/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c @@ -266,11 +266,11 @@ int32_t action_display_execute_entry(uint16_t action_bitmap, uint16_t new_state, } if ((action_bitmap & GET_ACTION_MASK(SET_DISPLAY_TO_IDLE_MODE)) != 0) { - // rerserve + notify_screen_aod_on_event(); } if ((action_bitmap & GET_ACTION_MASK(SET_DISPLAY_TO_NORMAL_MODE)) != 0) { - // rerserve + notify_screen_aod_off_event(); } if ((action_bitmap & GET_ACTION_MASK(SET_TE_ON)) != 0) { diff --git a/code/sdk/application/wearable/service/power_manager/src/display_state_machine.c b/code/sdk/application/wearable/service/power_manager/src/display_state_machine.c index 86b46bc2b..767af9f8b 100644 --- a/code/sdk/application/wearable/service/power_manager/src/display_state_machine.c +++ b/code/sdk/application/wearable/service/power_manager/src/display_state_machine.c @@ -97,6 +97,35 @@ static screen_state_change_maxtrix_t g_state_change_matrix[] = { GET_ACTION_MASK(STOP_TIMER), }, + // 当前状态为Ambient + { + SCREEN_AMBIENT, + GET_ACTION_MASK(TURN_ON_SCREEN), + SCREEN_ON, + GET_ACTION_MASK(SET_DISPLAY_ON) | + GET_ACTION_MASK(SET_TE_ON) | + GET_ACTION_MASK(SET_DISPLAY_TO_NORMAL_MODE) | + GET_ACTION_MASK(SET_TP_TO_NORMAL_WORK_MODE) | + GET_ACTION_MASK(START_TIMER), + }, + { + SCREEN_AMBIENT, + GET_ACTION_MASK(KEEP_CURRENT_STATE) | + GET_ACTION_MASK(ENTER_AMBIENT) | + GET_ACTION_MASK(RESET_TIMER), + SCREEN_AMBIENT, + GET_ACTION_MASK(SET_DISPLAY_ON) | + GET_ACTION_MASK(SET_DISPLAY_TO_IDLE_MODE) + }, + { + SCREEN_AMBIENT, + GET_ACTION_MASK(TURN_OFF_SCREEN), + SCREEN_OFF, + GET_ACTION_MASK(SET_DISPLAY_OFF) | + GET_ACTION_MASK(SET_TE_OFF) | + GET_ACTION_MASK(SET_TP_TO_SLEEP_MODE) | + GET_ACTION_MASK(STOP_TIMER), + }, }; static void power_display_run_state_machine(uint32_t input_action_bitmap, state_change_info_t *info) diff --git a/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c b/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c index 0a9b5e44e..334b4adb9 100644 --- a/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c +++ b/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c @@ -35,8 +35,17 @@ static input_action_t filter_gui_execute_touch_event(screen_context_t *current, current->press_state = false; } + screen_context_t *sc = power_display_get_screen_context(); if (event == MC_TP_COVER) { - ac = TURN_OFF_SCREEN; + if (sc->enable_aod) { + if (sc->current_state == SCREEN_ON) { + ac = ENTER_AMBIENT; + } else if (sc->current_state == SCREEN_AMBIENT) { + ac = TURN_ON_SCREEN; + } + } else { + ac = TURN_OFF_SCREEN; + } } else { ac = TURN_ON_SCREEN; } diff --git a/code/sdk/application/wearable/service/power_manager/src/filters/timer_event_filter.c b/code/sdk/application/wearable/service/power_manager/src/filters/timer_event_filter.c index 122960480..d5fcdf858 100644 --- a/code/sdk/application/wearable/service/power_manager/src/filters/timer_event_filter.c +++ b/code/sdk/application/wearable/service/power_manager/src/filters/timer_event_filter.c @@ -27,7 +27,11 @@ static input_action_t filter_timer_execute_system_rule(screen_context_t *current } } else if (event == DEFAULT_TIMER_TIME_OUT) { if (sc->press_state == 0 && sc->time_out_enable == true) { - ac = TURN_OFF_SCREEN; + if (sc->enable_aod) { + ac = ENTER_AMBIENT; + } else { + ac = TURN_OFF_SCREEN; + } } } else if (event == KEEP_ON_TIMER_TIME_OUT) { ac = RESET_TIMER; diff --git a/code/sdk/application/wearable/service/power_manager/src/power_display_service.c b/code/sdk/application/wearable/service/power_manager/src/power_display_service.c index 5deec976b..2a27a6662 100644 --- a/code/sdk/application/wearable/service/power_manager/src/power_display_service.c +++ b/code/sdk/application/wearable/service/power_manager/src/power_display_service.c @@ -43,6 +43,7 @@ static screen_context_t g_screen_context = { .time_out_enable = true, .last_gui_event_stamp = 0, .press_state = 0, + .enable_aod = false, }; #ifdef SUPPORT_OHOSFWK @@ -104,7 +105,7 @@ static errcode_t power_display_turn_on_screen(void) static errcode_t power_display_turn_off_screen(void) { -#ifndef SUPPORT_OHOSFWK +#ifndef SUPPORT_OHOSFWK message_type_t mt = TURN_OFF_SCREEN_CMD; uint32_t event_info = 0; errcode_t ret = power_display_msg_write(mt, (uint8_t *)&event_info, sizeof(uint32_t), false); @@ -428,7 +429,7 @@ errcode_t power_display_set_screenoff_switch_handle(uint32_t message_type, uint3 g_screen_context.time_out_enable = (bool)message_value; if(message_value == 1){ return power_display_execute_filter_rules(TIMER_EVENT, SET_DEFAULT_TIMEOUT); - } + } return ERRCODE_SUCC; } @@ -620,3 +621,8 @@ errcode_t uapi_power_display_init(void) button_register_power_display_cb(power_display_key_event_cb); return ERRCODE_SUCC; } + +void power_display_gui_enable_aod(bool enable) +{ + g_screen_context.enable_aod = enable; +} diff --git a/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp b/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp index 217a764d7..9be12aa18 100644 --- a/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp +++ b/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp @@ -21,6 +21,7 @@ #include "global.h" #include "gt_bundle_manager_service.h" #include "ApplistModel.h" +#include "bundle_manager.h" #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) #define OHOSFWK_MAX_ARGC 8 @@ -51,6 +52,7 @@ static void ReceiveCallback(const uint8_t resultCode, const void *resultMessage) } else { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bms resultCode = 0x%x", resultCode); } + AdapterFree(installMsg); } static int ConvertCmdToParam(uint8_t *para, uint32_t paraLen, @@ -225,6 +227,7 @@ static uint32_t OhosfwkATCmdAmStartJsApp(uint8_t *para, uint32_t paraLen, char * startElement.deviceId = nullptr; SetWantElement(want, startElement); StartAbility(want); + ClearWant(want); delete want; return ERRCODE_SUCC; } @@ -258,6 +261,18 @@ static uint32_t OhosfwkATCmdChangeLanguage(uint8_t *para, uint32_t paraLen, char WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Language changed to %s\n", languageRegion); + bool scanResult = ScanPackages(nullptr); + + if (scanResult) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Scan Packages Succeeded"); + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Scan Packages Failed"); + return ERRCODE_FAIL; + } + + OHOS::ApplistModel::GetInstance().SetInitFlag(false); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "Set InitFlag false Succeeded"); + return ERRCODE_SUCC; } diff --git a/code/sdk/build/cmake/build_component.cmake b/code/sdk/build/cmake/build_component.cmake index d494bbb1e..9d103ae42 100644 --- a/code/sdk/build/cmake/build_component.cmake +++ b/code/sdk/build/cmake/build_component.cmake @@ -220,6 +220,7 @@ macro(unset_var) UNSET(LIBS) UNSET(LIB) UNSET(REWRITE_CCFLAGS) + UNSET(AUTO_ADD_PATH) endmacro(unset_var) @@ -231,14 +232,17 @@ macro(build_component) component_on_rom() if(DEFINED COMPONENT_ON_ROM) need_whole_archiv() - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/private) - set(PRIVATE_HEADER ${PRIVATE_HEADER} ${CMAKE_CURRENT_SOURCE_DIR}/private) - endif() - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/public) - set(PUBLIC_HEADER ${PUBLIC_HEADER} ${CMAKE_CURRENT_SOURCE_DIR}/public) - endif() - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include) - set(PUBLIC_HEADER ${PUBLIC_HEADER} ${CMAKE_CURRENT_SOURCE_DIR}/include) + if(DEFINED AUTO_ADD_PATH AND AUTO_ADD_PATH STREQUAL false) + else() + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/private) + set(PRIVATE_HEADER ${PRIVATE_HEADER} ${CMAKE_CURRENT_SOURCE_DIR}/private) + endif() + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/public) + set(PUBLIC_HEADER ${PUBLIC_HEADER} ${CMAKE_CURRENT_SOURCE_DIR}/public) + endif() + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include) + set(PUBLIC_HEADER ${PUBLIC_HEADER} ${CMAKE_CURRENT_SOURCE_DIR}/include) + endif() endif() if(COMPONENT_ON_ROM STREQUAL false) if(REWRITE_CCFLAGS STREQUAL true) diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index c652717bb..04546e6c4 100644 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -359,6 +359,39 @@ target = { 'NANDFLASH_DS35X' ] }, +################# U8 ############################ + 'brandy-native-js-u8': { + 'base_target_name': 'brandy-native-js', + #自定义配置项,选择硬件及功能参数 + 'defines': [ + 'BOARD_U8', + 'FT_SINGLE_UART', + 'SUPPORT_AUTO_OTA_SERVER', + 'CONFIG_DFX_SUPPORT_DIAG_UP_MACHINE=1', + 'TPTYPE_FT6X46', + 'NANDFLASH_DS35X' + ], + #添加自定义应用 + 'ram_component': ['custom_cmd_service'] + }, + 'brandy-native-js-u8-r': { + 'base_target_name': 'brandy-native-js-r', + #自定义配置项,选择硬件及功能参数 + 'defines': [ + 'BOARD_U8', + 'FT_SINGLE_UART', + 'NANDFLASH_DS35X' + ] + }, + 'brandy-native-js-u8-ssb': { + 'base_target_name': 'brandy-ssb', + #自定义配置项,选择硬件及功能参数 + 'defines': [ + 'BOARD_U8', + 'FT_SINGLE_UART', + 'NANDFLASH_DS35X' + ] + }, ################# W9 ############################ 'brandy-native-js-w9': { 'base_target_name': 'brandy-native-js', @@ -435,6 +468,7 @@ target_group = { 'pack_brandy_target5': ['brandy-ssb', 'brandy-target5-r', 'brandy-target5'], 'pack_brandy_native_js': ['brandy-native-js-ssb', 'brandy-native-js-r', 'brandy-native-js'], 'pack_brandy_native_js_fd230': ['brandy-native-js-fd230-ssb', 'brandy-native-js-fd230-r', 'brandy-native-js-fd230'], + 'pack_brandy_native_js_u8': ['brandy-native-js-u8-ssb', 'brandy-native-js-u8-r', 'brandy-native-js-u8'], 'pack_brandy_native_js_w9': ['brandy-native-js-w9-ssb', 'brandy-native-js-w9-r', 'brandy-native-js-w9'], 'pack_brandy_native_js_lt22': ['brandy-native-js-lt22-ssb', 'brandy-native-js-lt22-r', 'brandy-native-js-lt22'], 'pack_brandy_native_js_user': ['brandy-native-js-user-ssb', 'brandy-native-js-user-r', 'brandy-native-js-user'], diff --git a/code/sdk/build/script/sdk_generator/sdk_generator.py b/code/sdk/build/script/sdk_generator/sdk_generator.py index 82679bde0..ac9ea162b 100644 --- a/code/sdk/build/script/sdk_generator/sdk_generator.py +++ b/code/sdk/build/script/sdk_generator/sdk_generator.py @@ -11,6 +11,7 @@ from utils.build_utils import root_path, script_path, target_config_path, output from utils.build_utils import pkg_tools_path, jlink_tools_path, lzma_tools_path, sign_tools_path from utils.build_utils import memcheck_tools_path, factory_tools_path, derived_tools_path from utils.build_utils import ohos_tools_path +from utils.build_utils import xts_tools_path from utils.build_utils import CopyModule, exec_shell, cmp_file, rm_pyc, rm_all, fn_get_subdirs from enviroment import TargetEnvironment from sdk_generator.target_config_genarator import genarate_reserve_config @@ -27,6 +28,7 @@ sdk_copy_common_files = [ os.path.join(factory_tools_path, 'factory_tools'), os.path.join(derived_tools_path), os.path.join(ohos_tools_path), + os.path.join(xts_tools_path), ] sdk_close_components = [ diff --git a/code/sdk/build/script/utils/build_utils.py b/code/sdk/build/script/utils/build_utils.py index 2bed7607d..92ab62fe1 100644 --- a/code/sdk/build/script/utils/build_utils.py +++ b/code/sdk/build/script/utils/build_utils.py @@ -34,7 +34,7 @@ memcheck_tools_path = os.path.join(root_path, 'tools', 'bin', 'memcheck') factory_tools_path = os.path.join(root_path, 'tools', 'bin', 'factory_tools') derived_tools_path = os.path.join(root_path, 'tools', 'bin', 'derived_key_tool') ohos_tools_path = os.path.join(root_path, 'tools', 'bin', 'ohos_tools') - +xts_tools_path = os.path.join(root_path, 'tools', 'bin', 'xts_tools') """ Colors defines. To highlight important output. """ diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_u8.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_u8.h new file mode 100644 index 000000000..5c1570891 --- /dev/null +++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_u8.h @@ -0,0 +1,308 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2018-2021. All rights reserved. + * Description: brandy evb board config + * Author: @CompanyNameTag + * Create: 2020-02-19 + */ +#ifndef BOARD_U8_CONFIG_H +#define BOARD_U8_CONFIG_H + +#include "pinctrl_porting.h" +#include "gpio_porting.h" +#include "platform_types.h" + +#ifdef ENABLE_CYWEE +extern void cywee_int_callback(pin_t pin, uintptr_t param); +#endif +/** + * @addtogroup connectivity_config_boards + * @{ + */ +/** + * @brief Global evb pio functions. + */ +const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = { + { HAL_PIO_FUNC_QSPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_EGPIO0 + { HAL_PIO_FUNC_QSPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO1 + { HAL_PIO_FUNC_QSPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_EGPIO2 + { HAL_PIO_FUNC_QSPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_EGPIO3 + { HAL_PIO_FUNC_QSPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_EGPIO4 clk + { HAL_PIO_FUNC_QSPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_EGPIO5 cs + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_EGPIO6 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO7 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO8 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO9 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO10 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO11 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO12 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO13 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO14 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO15 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO16 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO17 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO18 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO19 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO20 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO21 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_EGPIO22 clk + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_EGPIO23 ce + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO24 + { HAL_PIO_FUNC_OPI, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_EGPIO25 + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO0 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO1 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO2 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO3 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO4 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_HGPIO5 NC +#if (defined CFG_DRIVERS_NANDFLASH) + { HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO6 + { HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO7 + { HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO8 + { HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO9 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_HGPIO10 + { HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_HGPIO11 cs0 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_HGPIO12 cs1 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_HGPIO13 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_HGPIO14 + { HAL_PIO_FUNC_QSPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_HGPIO15 clk +#else + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO6 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO7 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO8 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO9 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO10 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO11 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO12 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO13 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_HGPIO14 + { HAL_PIO_FUNC_EMMC, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_HGPIO15 emmc clk +#endif + { HAL_PIO_FUNC_SPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO0 NC + { HAL_PIO_FUNC_SPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO1 NC + { HAL_PIO_FUNC_SPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO2 NC + { HAL_PIO_FUNC_SPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO3 NC + +// #if (defined BRANDY_PRODUCT_EVB4) + { HAL_PIO_FUNC_SPI0, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO4 NC +// #else + // { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO4 NC +// #endif + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO5 NC +#ifdef A5133_USE_HW_SPI + { HAL_PIO_FUNC_SPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_MGPIO6 SPI1 DI + { HAL_PIO_FUNC_SPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_MGPIO7 SPI1 DO + { HAL_PIO_FUNC_SPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_MGPIO8 SPI1 CLK + { HAL_PIO_FUNC_SPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_MGPIO9 SPI1 CS0 + { HAL_PIO_FUNC_SPI1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO10 SPI1 CS1 NC +#else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_MGPIO6 SPI1 DI + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_MGPIO7 SPI1 DO + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO8 SPI1 CLK + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO9 SPI1 CS0 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO10 SPI1 CS1 NC +#endif + { HAL_PIO_FUNC_I2C0_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO11 i2c0 SCL NC + { HAL_PIO_FUNC_I2C0_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO12 I2C0 SDA + { HAL_PIO_FUNC_I2C1_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO13 I2C1 SCL touch i2c + { HAL_PIO_FUNC_I2C1_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO14 I2C1 SDA + { HAL_PIO_FUNC_I2C2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO15 I2C2 SCL Sensor 6è½´ 指南针 心率 + { HAL_PIO_FUNC_I2C2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO16 I2C2 SDA Sensor + { HAL_PIO_FUNC_I2C3_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO17 i2c3 SCL smart pa\ 预留马达控制 \安全芯片 + { HAL_PIO_FUNC_I2C3_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO18 I2C3 SDA + { HAL_PIO_FUNC_UART1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO19 uart1 tx + { HAL_PIO_FUNC_UART1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_MGPIO20 uart1 rx + { HAL_PIO_FUNC_UART1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO21 uart1 rts + { HAL_PIO_FUNC_UART1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO22 uart1 cts + { HAL_PIO_FUNC_SPI2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO23 NC + { HAL_PIO_FUNC_SPI2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO24 NC + { HAL_PIO_FUNC_SPI2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO25 NC + { HAL_PIO_FUNC_SPI2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO26 NC +#if (defined QSPI_DISPLAY) + { HAL_PIO_FUNC_QSPI2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO27 + { HAL_PIO_FUNC_QSPI2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO28 + { HAL_PIO_FUNC_QSPI2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO29 + { HAL_PIO_FUNC_QSPI2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO30 + { HAL_PIO_FUNC_QSPI2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO31 + { HAL_PIO_FUNC_QSPI2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO32 +#else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO27 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO28 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO29 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO30 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO31 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO32 +#endif + { HAL_PIO_FUNC_UART_HS_UART, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO33 huart tx + { HAL_PIO_FUNC_UART_HS_UART, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_MGPIO34 huart rx + { HAL_PIO_FUNC_UART_HS_UART, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO35 + { HAL_PIO_FUNC_UART_HS_UART, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_MGPIO36 +#if 0 + { HAL_PIO_FUNC_UART2_M2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_MGPIO37 uart tx + { HAL_PIO_FUNC_UART2_M2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_MGPIO38 uart rx +#else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO37 uart tx NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_MGPIO38 uart rx NC +#endif + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L0 NC + + { HAL_PIO_FUNC_I2S1_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L1 i2s1 + { HAL_PIO_FUNC_I2S1_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L2 + { HAL_PIO_FUNC_I2S1_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L3 + { HAL_PIO_FUNC_I2S1_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L4 + + { HAL_PIO_FUNC_I2S0_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L5 + { HAL_PIO_FUNC_I2S0_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L6 i2s0 + { HAL_PIO_FUNC_I2S0_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L7 + { HAL_PIO_FUNC_I2S0_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L8 + +#if (defined FT_BT_UART) + { HAL_PIO_FUNC_UART2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L9 uart2 txd + { HAL_PIO_FUNC_UART2_M1, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_AGPIO_L10 uart2 rxd +#else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L9 dsp uart TP35 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L10 dsp uart TP36 +#endif + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_ENBALE }, // S_AGPIO_L11 G_INT1 + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L12 i2c data HX3507_SDIO + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L13 i2c CLK HX3507_SCLK + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L14 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L15 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L16 NC + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L17 HX3507_INT not use + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L18 VDDEN //暂时无用,采用VDDIO 默认开启 EXt V3.0 EXt V1.8 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_AGPIO_L19 G_INT2 //暂时不用 + + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_AGPIO_L20 0.2C_CHRG + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L21 NTC_VDD_ON 给低打开 NTC上拉电源 +#ifdef QSPI_DISPLAY + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L22 QSPI TE +#else + { HAL_PIO_FUNC_TE, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L22 MIPI TE +#endif + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L23 CAT_1_PWR_ON 控制CAT_1开机脚,或者控制 CAT1电源 拉高有效 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L24 LCM_EN + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L25 //////////// audio pa reset + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L26 心率复位 PPG reset + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L27 LCM reset +#ifdef SUPPORT_A5133_SERVICE + //{ HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_ENBALE }, // S_AGPIO_L28 CAT_1复位 CAT1_RESET_N 拉低有效 +#else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L28 CAT_1复位 CAT1_RESET_N 拉低有效 +#endif + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L29 charge done info 检测是否充满电 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L30 KP_MKIN1 唤醒 CAT1 ,输出 +#ifdef SUPPORT_A5133_SERVICE + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L31 控制A5133开关 +#else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L31 KP_MKOUIT1 唤醒 蓝牙 ,输入 +#endif + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L32 NC + + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R0 PRG_LED_POWER ON 心率等电源控制脚 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R1 SE_REST 安全芯片复位唤醒脚 +// #if VIB_USE_PWM + // { HAL_PIO_FUNC_PWMP1_M2, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚 + // { HAL_PIO_FUNC_PWMN1_M3, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚 +// #else + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R2 VIBR_PWM 马达控制脚 兼容预留马达驱动复位脚 +// #endif + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_R3 NC + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_AGPIO_R4 tp reset + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_R5 touch int + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_R6 PRG_INT 心率中断 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R7 GYRO_INT2 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R8 GYRO_INT1 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R9 BAT_CHARGE_OFF 关掉充电 温度高的时候 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_R10 Key2 ///////////////////HAL_PIO_IE_ENBALE input enable + +#if CORE == APPS + { HAL_PIO_FUNC_INVALID, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // ULP_GPIO0 mode not config + { HAL_PIO_FUNC_INVALID, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // ULP_GPIO1 mode not config + { HAL_PIO_FUNC_INVALID, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // ULP_GPIO2 mode not config + { HAL_PIO_FUNC_INVALID, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // ULP_GPIO3 mode not config + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // ULP_GPIO4 + { HAL_PIO_FUNC_SWD, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // ULP_GPIO5 + { HAL_PIO_FUNC_SWD, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // ULP_GPIO6 +#endif +}; +/** + * @} + */ + + +/** + * @addtogroup connectivity_config_boards + * @{ + */ +/** + * @brief Global evb gpio functions. + * + * + * typedef struct { + pin_t gpio; + hal_gpio_direction_t direction; + hal_gpio_level_t level; + uint32_t triger; + hal_gpio_callback_t callback; +} hal_gpio_config_t; + */ + + +//需要配置默认输出的,以及需要配置默认输入中断函数的。 +const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = { + // S_AGPIO_L17 HX3507_INT + // { S_AGPIO_L17, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + // S_AGPIO_L12 SDIO_BT + { S_AGPIO_L12, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + // S_AGPIO_L13 SCLK_BT + { S_AGPIO_L13, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + + // S_AGPIO_L26 心率复位 PPG reset + { S_AGPIO_L26, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + // S_AGPIO_R0 PRG_LED_POWER ON 心率等电源控制脚 + { S_AGPIO_R0, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + + //S_AGPIO_L21 NTC_VDD_ON 给低打开 NTC上拉电源 ,默认关闭 + { S_AGPIO_L21, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, +#if 0 //默认正常充电 +// #define GPIO_PIN_ENABLE_CHARGE S_AGPIO_R9 //low enable +// #define GPIO_PIN_ENABLE_CHARGE_0_2C S_AGPIO_L20 //low 0.2c 低电流充电 + { S_AGPIO_R9, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + { S_AGPIO_L20, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, +#else + { S_AGPIO_R9, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, + { S_AGPIO_L20, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, +#endif + +//默认关闭马达 + { S_AGPIO_R2, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, +//默认开启 EXT LDO V3.0 V1.8 + { S_AGPIO_L18, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, + +#ifdef ENABLE_CYWEE + /**G sensor G_INT1 S_AGPIO_L11 G_INT2 S_AGPIO_L19 采用timer 时这些中断要屏蔽*/ + { S_AGPIO_L11, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_RISING_EDGE, cywee_int_callback }, + //{ S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE, cywee_int_callback }, +#endif + /**S_AGPIO_R1 GPO alipay默认resetpin*/ + { S_AGPIO_R1, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, +#ifdef SUPPORT_CAT1_SERVICE + /**cat1 ring input key*/ + // { S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_DEDGE, cat1_ring_isr_callback}, + { S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_RISING_EDGE, cat1_ring_isr_callback}, + +#endif +#ifdef SUPPORT_A5133_SERVICE + //{ S_AGPIO_L28, HAL_GPIO_DIRECTION_INPUT, NULL, GPIO_INTERRUPT_RISING_EDGE, a5133_cko_isr_callback}, +#endif +}; +/** + * @} + */ +#endif diff --git a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h index 1675ea807..52ef76f12 100644 --- a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h +++ b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_ldo.h @@ -89,6 +89,12 @@ void pmu_bcore_vdd0p8_power_vset(uint8_t level); */ void pmu_vdd0p8_power_vset(uint8_t level); +/** + * @brief VDD0p8 power adjust get. + * @param level Voltage level. + */ +void pmu_vdd0p8_power_vget(uint8_t *level); + /** * @brief LDO power on/off. * @param sub Which ldo select. diff --git a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c index c5a0c2ddf..984a31262 100644 --- a/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c +++ b/code/sdk/drivers/chips/brandy/pmu/drivers/acore/pmu_vdd.c @@ -7,6 +7,8 @@ #include "hal_pmu_vdd.h" #include "std_def.h" +uint8_t g_pmu_0p8_vget = 0; + typedef struct { volatile uint32_t lock; volatile uint32_t req_closed; @@ -62,6 +64,11 @@ void pmu_vdd1p0_request_switch(switch_type_t en) osal_irq_restore(irq); } +void pmu_vdd0p8_power_vget(uint8_t *level) +{ + *level = g_pmu_0p8_vget; +} + void pmu_vdd0p8_power_vset(uint8_t level) { /* 1. Set vset step, default: 0.25mv @@ -69,6 +76,7 @@ void pmu_vdd0p8_power_vset(uint8_t level) * 3. requset vset config * 4. wait ack, clr ack */ + g_pmu_0p8_vget = level; hal_pmu_vdd0p8_set_nor_voltage(level); hal_pmu_vdd0p8_vset_requset(PMU_VSET_MCORE); (void)hal_pmu_vdd0p8_vset_ack_get(PMU_VSET_MCORE); diff --git a/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h b/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h index db816f173..ca5d08b7d 100644 --- a/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h +++ b/code/sdk/drivers/chips/brandy/pmu/hal/hal_pmu_interrupt.h @@ -45,7 +45,8 @@ typedef enum { #define PMU_LPM_MCPU_WKUP_ALL_MASK 0xFFFF -#define PMU_LPM_MCPU_WKUP_MASK (BIT(PMU_LPM_MCPU_DAP_WAKEUP) | \ +#define PMU_LPM_MCPU_WKUP_MASK (BIT(PMU_LPM_MCPU_CWDT_INT_WAKEUP) | \ + BIT(PMU_LPM_MCPU_DAP_WAKEUP) | \ BIT(PMU_LPM_MCPU_SSI_WAKEUP) | \ BIT(PMU_LPM_MCPU_GPIO_WAKEUP) | \ BIT(PMU_LPM_MCPU_M_RTC_WAKEUP) | \ diff --git a/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c b/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c index 1a7e00b13..a2e29cbf8 100644 --- a/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c +++ b/code/sdk/drivers/chips/brandy/porting/liteos/riscv70/tick_timer.c @@ -120,48 +120,17 @@ void HalDelayUs(unsigned usecs) } } -#ifdef SUPPORT_RC_CALIBRATION -volatile uint64_t g_pre_count = 0; -volatile double g_pre_msec = 0; -#endif - uint64_t HalClockGetCycles(void) { -#ifdef SUPPORT_RC_CALIBRATION - volatile double tick_count; -#else uint64_t tick_count; -#endif uint64_t cycle; uint32_t lock_int_save; uint32_t load_tick; -#ifdef SUPPORT_RC_CALIBRATION - volatile double msec; - volatile uint64_t now_count; -#endif lock_int_save = LOS_IntLock(); - -#ifdef SUPPORT_RC_CALIBRATION - if (g_pre_count == 0) { - tick_count = (uapi_systick_get_count() * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ; - g_pre_count = uapi_systick_get_count(); - g_pre_msec = tick_count; - } else { - now_count = uapi_systick_get_count(); - msec = (double)((now_count - g_pre_count) * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ; - tick_count = g_pre_msec + msec; - - g_pre_count = now_count; - g_pre_msec = tick_count; - } -#else tick_count = uapi_systick_get_ms(); -#endif - load_tick = machine_timer_get_load_count(); cycle = (uint64_t)(tick_count * load_tick); - LOS_IntRestore(lock_int_save); return cycle; } diff --git a/code/sdk/drivers/chips/brandy/porting/pinctrl/pinctrl_porting_brandy.c b/code/sdk/drivers/chips/brandy/porting/pinctrl/pinctrl_porting_brandy.c index f81fa9f94..105bbd65e 100644 --- a/code/sdk/drivers/chips/brandy/porting/pinctrl/pinctrl_porting_brandy.c +++ b/code/sdk/drivers/chips/brandy/porting/pinctrl/pinctrl_porting_brandy.c @@ -14,16 +14,14 @@ #elif PRE_ASIC #if defined(BOARD_FD230) #include "board_fd230.h" -// #warning board fd230 +#elif defined(BOARD_U8) +#include "board_u8.h" #elif defined(BOARD_W9) #include "board_w9.h" -// #warning board w9 #elif defined(BOARD_LT22) #include "board_lt22.h" -// #warning board lt22 #else #include "board_evb.h" -// #warning board evb #endif #endif #include "pinctrl.h" diff --git a/code/sdk/drivers/drivers/driver/audio/source/build/cmake/audio_common.cmake b/code/sdk/drivers/drivers/driver/audio/source/build/cmake/audio_common.cmake index 87158e5b0..5a90df930 100644 --- a/code/sdk/drivers/drivers/driver/audio/source/build/cmake/audio_common.cmake +++ b/code/sdk/drivers/drivers/driver/audio/source/build/cmake/audio_common.cmake @@ -58,6 +58,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(SAP_BOARD ${BOARD}) # Switch audio libs dir for brandy evb4 if("BRANDY_PRODUCT_EVB4" IN_LIST DEFINES) diff --git a/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c b/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c index efc78a186..c58bdf540 100644 --- a/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c +++ b/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c @@ -216,12 +216,6 @@ td_s32 sap_ioctl_ao_open(td_u32 cmd, td_void *arg, td_void *file) } #endif - ret = drv_ao_load_aef(); - if (ret != AUDIO_SUCCESS) { - sap_err_log_fun(drv_ao_load_aef, ret); - return ret; - } - audio_unused(cmd); audio_unused(file); return AUDIO_SUCCESS; @@ -700,6 +694,14 @@ td_s32 sap_ioctl_ao_set_aef_profile(td_u32 cmd, td_void *arg, td_void *file) profile = (sap_ao_port_aef_profile *)arg; drv_ao = profile->h_mod; + if (profile->aef_profile > AO_AEF_PROFILE_NONE && profile->aef_profile < AO_AEF_PROFILE_MAX) { + ret = drv_ao_load_aef(); + if (ret != AUDIO_SUCCESS) { + sap_err_log_fun(drv_ao_load_aef, ret); + return ret; + } + } + ret = drv_msg_ao_set_aef_profile(drv_ao, profile->aef_profile); if (ret != AUDIO_SUCCESS) { sap_err_log_fun(drv_msg_ao_set_aef_profile, ret); diff --git a/code/sdk/drivers/drivers/driver/efuse/efuse.c b/code/sdk/drivers/drivers/driver/efuse/efuse.c index d2ea93b3a..43cd9f6df 100644 --- a/code/sdk/drivers/drivers/driver/efuse/efuse.c +++ b/code/sdk/drivers/drivers/driver/efuse/efuse.c @@ -13,6 +13,8 @@ #include "soc_osal.h" #include "errcode.h" #include "tcxo.h" +#include "pmu_ldo.h" +#include "hal_pmu_vdd.h" #include "hal_efuse.h" #include "efuse_porting.h" @@ -101,11 +103,22 @@ errcode_t uapi_efuse_write_bit(uint32_t byte_number, uint8_t bit_pos) return ERRCODE_INVALID_PARAM; } + uint8_t old_level = 0; + pmu_vdd0p8_power_vget(&old_level); + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(HAL_PMU_VDD0P8_1P0_0P925V); + } hal_efuse_region_t region = hal_efuse_get_region(byte_number); if (hal_funcs->write_op(byte_number, (uint8_t)bit(bit_pos), region) == ERRCODE_SUCC) { + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_SUCC; } + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_FAIL; } #endif @@ -126,16 +139,28 @@ static errcode_t efuse_write_param_check(uint32_t byte_number, const uint8_t *bu errcode_t uapi_efuse_write_buffer(uint32_t byte_number, const uint8_t *buffer, uint16_t length) { errcode_t ret; + uint8_t old_level; ret = efuse_write_param_check(byte_number, buffer, length); if (ret != ERRCODE_SUCC) { return ERRCODE_EFUSE_INVALID_PARAM; } + + pmu_vdd0p8_power_vget(&old_level); + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(HAL_PMU_VDD0P8_1P0_0P925V); + } hal_efuse_funcs_t *hal_funcs = hal_efuse_get_funcs(); if (hal_funcs->write_buffer_op(byte_number, buffer, length) != ERRCODE_SUCC) { + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_FAIL; } + if (old_level != HAL_PMU_VDD0P8_1P0_0P925V) { + pmu_vdd0p8_power_vset(old_level); + } return ERRCODE_SUCC; } diff --git a/code/sdk/include/middleware/services/bts/br/bts_spp.h b/code/sdk/include/middleware/services/bts/br/bts_spp.h index daf182915..a32df6eab 100644 --- a/code/sdk/include/middleware/services/bts/br/bts_spp.h +++ b/code/sdk/include/middleware/services/bts/br/bts_spp.h @@ -285,6 +285,26 @@ int spp_get_remote_addr(int client_id, bd_addr_t *remote_addr); */ int spp_write(int client_id, const char *data, const unsigned int len); +/** + * @if Eng + * @brief Config client write data retry max times. + * @attention NULL. + * @param [in] retry_times Indicate the retry max times when write operation failed, + retry interval is 5ms. + * @retval ERRCODE_BT_SUCCESS The operation success. + * @par Dependency: + * @li bts_spp.h + * @else + * @brief 配置spp写重试最大次数 + * @attention NULL. + * @param [in] retry_times 入参,用来指定写操作失败时重试的最大次数,重试间隔为5ms。 + * @retval ERRCODE_BT_SUCCESS 操作成功。 + * @par 依赖: + * @li bts_spp.h + * @endif + */ +errcode_bt_t spp_write_retry_times_config(uint32_t retry_times); + /** * @if Eng * @brief Callback function for connection event. diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml index 91cdbc7a6..313b390d6 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml index 584bf5c4a..665f6d647 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_extractor.cpp.xml @@ -3,8 +3,8 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml index 85db15016..19e319a3c 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml @@ -27,7 +27,7 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml index a591e4055..db2c7c3ac 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_parser.cpp.xml @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml index a62c26346..cab6261f5 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml @@ -8,33 +8,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/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 143cdc177..907140add 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 @@ -12,24 +12,24 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml index fbbae6e5e..78791fffd 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml @@ -66,34 +66,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lv_draw_vgu.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lv_draw_vgu.c.xml index 40874769a..dd44adfbf 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lv_draw_vgu.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lv_draw_vgu.c.xml @@ -6,15 +6,15 @@ - - - - - - - - - - - + + + + + + + + + + + \ 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 5bed393f2..a80746c2c 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml @@ -25,48 +25,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml index 4efd77217..e31002fb4 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml @@ -4,41 +4,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml index 8666eca75..bc7f62c33 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml @@ -1,58 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml index 673f2b37d..f99e42766 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/text_ext.cpp.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml index 36adcae55..3cb099481 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_canvas_ext.cpp.xml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml index 531cd1beb..0c209cd88 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view2.cpp.xml @@ -2,7 +2,7 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml index 781eaee31..59e58c89e 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_cache.cpp.xml @@ -1,4 +1,5 @@ - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_vector.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_font_hw_vector.cpp.xml index 3970f5004..f24c47f6a 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_hexagons_list.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_hexagons_list.cpp.xml index ff2fbb76a..7c90cacd9 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_hexagons_list.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_hexagons_list.cpp.xml @@ -1,6 +1,7 @@ - - - - - + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_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 0033c8c7e..706b972e4 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml @@ -1,12 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_waterfall_list.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_waterfall_list.cpp.xml index ea98aa009..2f9847d3d 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_waterfall_list.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_waterfall_list.cpp.xml @@ -1,5 +1,6 @@ - - - - + + + + + \ 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 01a4a5d5e..702616961 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 7431d8d01..bffbace59 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 f776f74cb..a0d6c72d1 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 b52dba1c3..f8a94085f 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 ac5d4758f..dad262a81 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 ccbd601a8..053da1676 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 7a1c78087..e9bac2abc 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 8b569b616..8625c77c7 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 9a9308f2f..88e109a35 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 516879508..09e5b4ae6 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 f08233b4d..eca5d6776 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 4c2d713af..86c785a9f 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 index 114819095..443c14aad 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_audio_manager_wrapper.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_audio_manager_wrapper.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a index b78256b5f..93bc0f23d 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 5f089622d..f6eae9ba5 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/CMakeLists.txt b/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt index 245ab4270..0087bde03 100644 --- a/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt +++ b/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt @@ -28,6 +28,12 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/last_dump/include ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/sample_data/dfx_include ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/sample_data/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_update/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_nv/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/include ${ROOT_DIR}/include/middleware/services/bts ${ROOT_DIR}/include/middleware/services/bts/ble ${ROOT_DIR}/include/middleware/services/bts/br diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h index 88f45f0a7..b95b745fe 100644 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h @@ -87,6 +87,8 @@ typedef enum { CALLERLOGPRESENTER_CPP, CALLERLOGVIEW_CPP, MAINCLOCKVIEW_CPP, + AMBIENTCLOCKVIEW_CPP, + AODVIEW_CPP, COMPASSCALIBRATIONVIEW_CPP, COMPASSCONTROLVIEW_CPP, COMPASSPRESENTER_CPP, diff --git a/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c b/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c index e1f6194f9..04b0d18d6 100644 --- a/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c +++ b/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c @@ -31,6 +31,9 @@ #define PM_SLEEP_SEL_EVENT 0x777 #define PM_SLEEP_TRACE_DEF_VAL 0x5a5a #define PM_OS_US_TO_MS 1000 +#define PM_RTC_LOAD_COUNT_REG 0x57024000 +#define PM_RTC_CUR_ALERT_US 64000000 +#define PM_RTC_LOAD_THRESHOLD_MS (CLOCK_32K_CALI_FREQ / 50) enum { PM_SLEEP_STATE_IDLE, @@ -287,6 +290,7 @@ void pm_enter_sleep(uint32_t sleep_ms_val) uint32_t status; uint32_t sleep_ms = sleep_ms_val; uint32_t rtc_times = 0; + uint32_t rtc_times_alert = 0; if ((g_pm_mcu_dynamic_power_flag == 1) || hal_ipc_get_core_clr_sts(CORES_BT_CORE)) { return; } @@ -294,6 +298,10 @@ void pm_enter_sleep(uint32_t sleep_ms_val) return; } uapi_rtc_get_current_time_us(0, &rtc_times); + if (rtc_times > PM_RTC_CUR_ALERT_US) { + rtc_times_alert = rtc_times; + rtc_times = rtc_porting_cycle_2_us(readl(PM_RTC_LOAD_COUNT_REG)); + } if (rtc_times < PM_OS_US_TO_MS && rtc_times > 0) { return; } @@ -315,7 +323,8 @@ void pm_enter_sleep(uint32_t sleep_ms_val) pm_enter_deepsleep_set_flag(); status = pm_os_irq_lock(); - if ((sleep_ms <= g_pm_sleep_threshold) || pm_get_sleep_veto() || hal_rtc_get_int_status(0) == 1) { + if ((sleep_ms <= g_pm_sleep_threshold) || pm_get_sleep_veto() || hal_rtc_get_int_status(0) == 1 || + ((readl(PM_RTC_LOAD_COUNT_REG) < PM_RTC_LOAD_THRESHOLD_MS) && (rtc_times_alert > PM_RTC_CUR_ALERT_US))) { pm_enter_deepsleep_cancel_flag(); pm_enter_light_sleep(); } else { diff --git a/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c b/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c index 0a40c9ffe..f5ebd3aa1 100644 --- a/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c +++ b/code/sdk/middleware/chips/brandy/pm/service/pm_tickless.c @@ -63,10 +63,14 @@ static void pm_tickless_compensate_os_ticks(uint32_t ticks) g_exit_sleep_time = pm_core_get_count(); // freq:32768 uint64_t sleep_time = ((g_exit_sleep_time - g_entry_sleep_time) * PM_OS_TICKS_PER_S) + g_32k_time_calibrate; uint32_t actual_sleep_time = (uint32_t)(sleep_time / CLOCK_32K_CALI_FREQ); - g_32k_time_calibrate = actual_sleep_time & 0x7FFF; + g_32k_time_calibrate = actual_sleep_time % CLOCK_32K_CALI_FREQ; if (actual_sleep_time > ticks) { +#ifdef __FREERTOS__ pm_os_compensate_sleep_ticks(ticks); +#else + pm_os_compensate_sleep_ticks(actual_sleep_time); +#endif } else { pm_os_compensate_sleep_ticks(actual_sleep_time); } diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-cli/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-auto-ota-cli/libgfx_rm.a index 14858f9ea..c3aeb4d5a 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 f5187426a..41edc9b20 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-fd230-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230-r/libgfx_rm.a index 3882fd869..a646c1415 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230/libgfx_rm.a index f74e03335..39d4b05c0 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-fd230/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22-r/libgfx_rm.a index 3882fd869..a646c1415 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22/libgfx_rm.a index f74e03335..39d4b05c0 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-lt22/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 3882fd869..a646c1415 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-u8-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-u8-r/libgfx_rm.a new file mode 100644 index 000000000..a646c1415 Binary files /dev/null and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-u8-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-u8/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-u8/libgfx_rm.a new file mode 100644 index 000000000..39d4b05c0 Binary files /dev/null and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-u8/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9-r/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9-r/libgfx_rm.a index 3882fd869..a646c1415 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9-r/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9-r/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9/libgfx_rm.a b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9/libgfx_rm.a index f74e03335..39d4b05c0 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/brandy-native-js-w9/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 f74e03335..39d4b05c0 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 6b573544f..f7c2119d7 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 a35b38ef7..259458f62 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 fc2f5ba13..9411414cf 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 c8cf64a39..8edeb5426 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 ea0fcc715..84b84abbd 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 fad81d7f3..72a920587 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 892e432f2..aedcb5c31 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 0a5933bea..445f9cfaa 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 650d29692..5510f058b 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 b309e7daf..e9e265ab6 100644 Binary files a/code/sdk/middleware/services/gpu/api/rm/testsuite-brandy-sdk/libgfx_rm.a and b/code/sdk/middleware/services/gpu/api/rm/testsuite-brandy-sdk/libgfx_rm.a differ diff --git a/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c b/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c index 706ccc6a1..d431017a6 100644 --- a/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c @@ -660,6 +660,10 @@ td_s32 dpu_layer_set_pos(drv_dpu_layer_id layer_id, td_s32 pos_x, td_s32 pos_y) return DRV_ERR_DPU_OPERATION_NOT_SUPPORT; } + if ((layer_dev->run_info.pos_x == pos_x) && (layer_dev->run_info.pos_y == pos_y)) { + return EXT_SUCCESS; + } + osal_spin_lock_irqsave(&layer_dev->layer_lock, &flag); layer_dev->update_flag = TD_TRUE; layer_dev->run_info.pos_x = pos_x; @@ -902,9 +906,11 @@ td_s32 dpu_layer_refresh(void) dpu_disp_set_chnl_reg_up(); dpu_isr_clear_finish_flag(); +#ifdef MIPI_ULPS_SUPPORT if (uapi_mipi_tx_is_in_ulps() == true) { dpu_err("mipi_tx_is_not_exit_ulps, can not flush\n"); } +#endif dpu_hal_disp_set_frame_ready(); if (need_cur_done == TD_TRUE) { diff --git a/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt b/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt index 3151d9768..d6b31d007 100644 --- a/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt @@ -56,6 +56,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() #=============================================================================== @@ -109,6 +113,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() #=============================================================================== @@ -157,5 +165,6 @@ set(MAIN_COMPONENT false ) + build_component() 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 8669dfe77..477c78ea0 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 270e21e26..331f27d06 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-fd230/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230/libdisplay_gfx.a index 19047e880..6f841f37a 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lt22/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lt22/libdisplay_gfx.a index 19047e880..6f841f37a 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lt22/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lt22/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-u8/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-u8/libdisplay_gfx.a new file mode 100644 index 000000000..6f841f37a Binary files /dev/null and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-u8/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-w9/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-w9/libdisplay_gfx.a index 19047e880..6f841f37a 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-w9/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-w9/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 19047e880..6f841f37a 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 11ca32e68..21817f0d3 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 a3d1483c7..8aebfbd9b 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 2d58be448..d55fbbfba 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 36e4f2d2d..7c3739722 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c b/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c index 6f95f71de..fde932976 100644 --- a/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c +++ b/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c @@ -57,6 +57,8 @@ typedef struct { } AddrInfo; TryToFreeImgCallback g_tryToFreeImgCallback = NULL; +TryToFreeFontCacheCallback g_tryToFreeFontCacheCallback = NULL; + #if ENABLE_GMMU static bool g_gmmuAllocated[FB_COUNT] = {false, false}; struct gmmu_buf_struct g_gmmuMem = { 0 }; @@ -228,14 +230,23 @@ static int32_t AllocMem(const AllocInfo *info, BufferHandle **handle) } uint8_t *addr = LosAllocMem(pool, (uint32_t)(buffer->size)); - if (((info->usage & HBM_USE_MEM_YUV) != HBM_USE_MEM_YUV) && - (pool == g_poolId) && (g_tryToFreeImgCallback != NULL)) { + if ((pool == g_poolId) && (g_tryToFreeImgCallback != NULL)) { while (addr == NULL) { if (g_tryToFreeImgCallback()) { DISP_LOGW("Success to free image during AllocMem size: %u\n", buffer->size); addr = LosAllocMem(pool, (uint32_t)(buffer->size)); } else { - DISP_LOGE("Failed to AllocMem size: %u and no image can be free\n", buffer->size); + DISP_LOGE("Failed to AllocMem size: %u, and no image can be free\n", buffer->size); + break; + } + } + } else if ((pool == g_fontPoolId) && (g_tryToFreeFontCacheCallback != NULL)) { + while (addr == NULL) { + if (g_tryToFreeFontCacheCallback()) { + DISP_LOGW("Success to free font cache during AllocMem size: %u\n", buffer->size); + addr = LosAllocMem(pool, (uint32_t)(buffer->size)); + } else { + DISP_LOGE("Failed to AllocMem size: %u, and no font cache can be free\n", buffer->size); break; } } @@ -275,7 +286,7 @@ static void FreeMem(BufferHandle *handle) #endif } } else if (((handle->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) || - ((handle->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH)){ + ((handle->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH)) { LosFreeMem(g_fontPoolId, handle->virAddr); } else { LosFreeMem(g_poolId, handle->virAddr); @@ -290,6 +301,11 @@ static void RegisterTryToFreeImgCallback(TryToFreeImgCallback callback) g_tryToFreeImgCallback = callback; } +static void RegisterTryToFreeFontCacheCallback(TryToFreeFontCacheCallback callback) +{ + g_tryToFreeFontCacheCallback = callback; +} + int32_t GrallocInitialize(GrallocFuncs **funcs) { CHECK_NULLPOINTER_RETURN_VALUE(funcs, DISPLAY_NULL_PTR); @@ -310,6 +326,7 @@ int32_t GrallocInitialize(GrallocFuncs **funcs) gFuncs->AllocMem = AllocMem; gFuncs->FreeMem = FreeMem; gFuncs->RegisterTryToFreeImgCallback = RegisterTryToFreeImgCallback; + gFuncs->RegisterTryToFreeFontCacheCallback = RegisterTryToFreeFontCacheCallback; *funcs = gFuncs; #if ENABLE_GMMU diff --git a/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt b/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt index 4962c481c..d62b15fc4 100644 --- a/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt @@ -44,4 +44,8 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/middleware/services/gui/lvgl/CMakeLists.txt b/code/sdk/middleware/services/gui/lvgl/CMakeLists.txt index 57ccefb47..215d26c6f 100644 --- a/code/sdk/middleware/services/gui/lvgl/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/lvgl/CMakeLists.txt @@ -146,6 +146,7 @@ set(PRIVATE_HEADER ${LVGL_DIR}/proprietary/src/misc ${ROOT_DIR}/middleware/services/gui/hal/input/include ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include + ${ROOT_DIR}/open_source/openharmony/third_party/freetype/include ) set(PRIVATE_DEFINES 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 7695c175e..48522c9c0 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 185a1b411..8accbb273 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 c61f8e2f3..84d5e2fd0 100644 --- a/code/sdk/middleware/services/gui/uikit/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/uikit/CMakeLists.txt @@ -207,6 +207,7 @@ set(COMPONENT_SRC ${PROP_UI_SRC}/components_ext/ui_icosahedron_view.cpp ${PROP_UI_SRC}/components_ext/ui_transform_group.cpp ${PROP_UI_SRC}/components_ext/ui_transform_list.cpp + ${PROP_UI_SRC}/components_ext/ui_sphere_view.cpp ) set(SOURCES 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 1666ee2ed..3e53b5cbf 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 04e7a6a01..2908a3b9c 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-fd230/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230/libuikit_ext.a index a163d4e29..3258fdf5f 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-lt22/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-lt22/libuikit_ext.a index a163d4e29..3258fdf5f 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-lt22/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-native-js-lt22/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-u8/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-u8/libuikit_ext.a new file mode 100644 index 000000000..3258fdf5f Binary files /dev/null and b/code/sdk/middleware/services/gui/uikit/brandy-native-js-u8/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-w9/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-w9/libuikit_ext.a index a163d4e29..3258fdf5f 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-w9/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-native-js-w9/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 a163d4e29..3258fdf5f 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 97a2fe0c3..fc0a9b488 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 a3bd2052c..470c5f1a8 100644 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h index 699ef700b..a7e8fa6b1 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h @@ -39,6 +39,11 @@ #include "gfx_utils/heap_base.h" #include "graphic_config.h" #include "hals/gralloc_engines.h" +#include "graphic_mutex.h" + +#ifdef ERROR +#undef ERROR +#endif #if ENABLE_IMAGE_PACKER namespace OHOS { @@ -144,6 +149,7 @@ private: std::unordered_map bufMap_; ImageNode longTermList_; ImageNode shortTermList_; + GraphicMutex listMutex_; ImageCacheManager() { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h index dc31d5d18..d8b6bbcc7 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h @@ -33,6 +33,7 @@ #define GRAPHIC_LITE_LITE_SURFACE_H #include +#include #include "graphic_utils.h" #include "gfx_utils/list.h" #include "gfx_utils/pixel_format_utils.h" @@ -295,6 +296,13 @@ public: */ void CancelBuffer(SurfaceBuffer* buffer) override; + /** + * @brief Prepare video buffers. This should be called before playing video. + * @since 1.0 + * @version 1.0 + */ + void PrepareBuffers(); + void ClearBuffers(); SurfaceBuffer* GetBackBuf(); @@ -317,6 +325,7 @@ protected: List freeList_; List dirtyList_; IBufferConsumerListener* consumerListener_; + std::shared_ptr waitPrepareBuffer_; }; } // end namespace #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h index d4c923382..e02a80fc8 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/text_ext.h @@ -95,6 +95,7 @@ protected: #endif private: + void SetTextInnner(const char* text); uint16_t textId_ = FontGlobalManager::INVALID_TEXT_ID; #if ENABLE_SHAPING bool isNeedShaping_ = 0; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h index 3643000ee..3ffc31d17 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h @@ -31,6 +31,7 @@ #include "components/ui_swipe_view.h" #include "components/card_swipe.h" #include "components_ext/hor_swipe_view.h" +#include "components_ext/ver_swipe_view.h" namespace OHOS { /** @@ -39,7 +40,8 @@ namespace OHOS { * @since 1.0 * @version 1.0 */ -class UICrossView : public UIViewGroup, public UISwipeView::OnSwipeListener { +class UICrossView : public UIViewGroup, public UISwipeView::OnSwipeListener, + public VerSwipeView::OnMoveChildListener { public: UICrossView(const UICrossView &) = delete; UICrossView &operator=(const UICrossView &) = delete; @@ -77,6 +79,7 @@ public: return &instance; } + void OnMoveChild(UISwipeView& view, int16_t xOffset, int16_t yOffset) override; void OnSwipe(UISwipeView& view) override; bool OnDragStartEvent(const DragEvent& event) override; bool OnDragEvent(const DragEvent& event) override; @@ -234,13 +237,11 @@ private: static constexpr uint16_t INVALID_VIEW_INDEX = 0xff; bool loop_ = false; bool enableScreenCap_ = false; - bool gaussianBlurEnable_ = false; int swipeDirect_ = 0; - int pullIndex_ = 0; int16_t hDragStartIndex_ = INVALID_VIEW_INDEX; int16_t vBlankIndex_ = INVALID_VIEW_INDEX; UIView* vBlankView_ = nullptr; - UISwipeView vertical_; + VerSwipeView vertical_; HorSwipeView horizontal_; UIView* tailView_ = nullptr; UISwipeView::OnSwipeListener *swipeListener_ = nullptr; @@ -250,7 +251,6 @@ private: void RemoveAllInner(UISwipeView& view); void ProcessRes(bool loadAdjacent = true); - void VertSetGausBlur(uint16_t direct); void HorHandleCardEvent(int16_t index, uint16_t scrollStage); void VertHandleCardEvent(uint16_t scrollStage); }; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h index 1bc870e07..2925fd138 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 @@ -32,10 +32,11 @@ public: } /** - * @brief Set image size + * @brief Set the size of Image or UITransformGroup. * LayoutChildren(true) must be invoked mannualy after invoking this method. * - * @param size Indicates size to set, when the image in the center + * @param size Indicates size to set, when the Image or UITransformGroup is displayed in the center. + * It is best to keep child's size as same as this size. */ void SetImageSizeInCenter(uint16_t size) { @@ -85,9 +86,9 @@ public: } /** - * @brief Adds a child image view whose resize mode will set to be UIImageView::COVER. + * @brief Adds UITransformGroup or UIImageView whose resize mode will set to be UIImageView::COVER. * LayoutChildren(true) should be invoked mannualy after invoking this method. - * Note: View index was set for children innner in order of addition, so you can + * Note: View index was set for children inner in order of addition, so you can * get its index by call method GetViewIndex() * * @param view Indicates the pointer to the child view to add. @@ -95,13 +96,13 @@ public: void Add(UIView* view) override; /** - * @brief Inserts a child image view whose resize mode will set to be UIImageView::COVER. + * @brief Inserts UITransformGroup or UIImageView whose resize mode will set to be UIImageView::COVER. * LayoutChildren(true) should be invoked mannualy after invoking this method. - * Note: View index was set for children innner in order of addition, so you can + * Note: View index was set for children inner in order of addition, so you can * get its index by call method GetViewIndex() * - * @param prevView Indicates the pointer to the child image view, previous to the new child image view. - * @param view Indicates the pointer to the new child image view to insert. + * @param prevView Indicates the pointer to the child view, previous to the new child view. + * @param view Indicates the pointer to the new child view to insert. */ void Insert(UIView* prevView, UIView* insertView) override; @@ -217,6 +218,7 @@ private: void CalculateNearestPointFromOutterPoint(const Vector2& outerPoint); void UpdateNearestPointFromFixedPoint(const Vector2& fixedPoint, uint8_t index); void CreatePolygons(uint16_t lap, int16_t angle); + void ScaleBaseElement(UIView* view, float scaleX, float scaleY); Graphic::Vector> imgPoints_{64}; uint16_t maxLap_ = 0; uint16_t maxAngleInMaxLap_ = 0; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h index e4b063a31..8fbc5d774 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h @@ -56,7 +56,7 @@ public: void RefreshIcosahedron(); /** - * @brief Rotates the icosahedral in 3d. + * @brief Rotates the icosahedral in 3d, from the start position. * * @param angle Indicates the rotation angle. * @param pivotStart Indicates the coordinates of the rotation start pivot. @@ -64,6 +64,15 @@ public: */ bool RotatePlanes(int16_t angle, const Vector3& pivotStart, const Vector3& pivotEnd); + /** + * @brief Rotates the icosahedral in 3d, from the current location. + * + * @param angle Indicates the rotation angle. + * @param pivotStart Indicates the coordinates of the rotation start pivot. + * @param pivotEnd Indicates the coordinates of the rotation end pivot. + */ + bool Rotate(int16_t angle, const Vector3& pivotStart, const Vector3& pivotEnd); + /** * @brief Set default Image,the default picture will be used if less than 20 faces are set * @param src Pointer to a ImageInfo struct, which is the source img for kaleidoscope img. diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h index aeb9dc42b..d7a506f04 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h @@ -179,6 +179,8 @@ public: void DumpImgInfo() override; + std::string GetGuiInfo() const override; + private: UILiteSurfaceView(const UILiteSurfaceView&) = delete; UILiteSurfaceView &operator=(const UILiteSurfaceView&) = delete; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h index 5e91bf623..ee1e649e1 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h @@ -141,7 +141,7 @@ public: */ void HidePOI(uint16_t tag, bool isHide = true); void SetX(int16_t x) override; - void SetY(int16_t x) override; + void SetY(int16_t y) override; private: POIInfo* pois_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h index 6167260ee..2ce240163 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h @@ -319,8 +319,8 @@ private: bool switchModeWithAnim_ = false; bool alignWithAnim_ = false; UIView* coverPreviousItem_ = nullptr; - uint16_t itemWidth_ = 0; - uint16_t itemHeight_ = 0; + uint16_t itemWidth_ = 1; + uint16_t itemHeight_ = 1; uint8_t mirrorOpa_ = 100; float radius_ = 0.0f; float perimeter_ = 0.0f; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sphere_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sphere_view.h new file mode 100644 index 000000000..cb057fc9e --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sphere_view.h @@ -0,0 +1,135 @@ +/* + * 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_SPHERE_VIEW_H +#define UI_SPHERE_VIEW_H +#include "components/ui_scroll_view.h" +#include "components/ui_transform_group.h" +#include "components/ui_image_view.h" +namespace OHOS { +class UISphereView : public UIScrollView { +public: + UISphereView(uint8_t numberOfRow); + virtual ~UISphereView() override; + + UIViewType GetViewType() const override + { + return UI_SPHERE_VIEW; + } + + void Add(UIView* child) override; + void Remove(UIView* child) override; + void Insert(UIView* prevView, UIView* insertView) override; + void SetNumberOfRow(uint8_t numberOfRow); + void SetSphereCameraPosition(const Vector2& position); + void SetSphereCameraDistance(int16_t distance); + uint8_t GetNumberOfRow() + { + return numberOfRow_; + } + + void SetSensitivityFactor(float sensitivity) + { + sensitivityFactor_ = sensitivity; + } + + float GetSensitivityFactor() + { + return sensitivityFactor_; + } + +#if ENABLE_ROTATE_INPUT + bool OnRotateStartEvent(const RotateEvent& event) override; + + bool OnRotateEvent(const RotateEvent& event) override; + + bool OnRotateEndEvent(const RotateEvent& event) override; +#endif + + void UpdateItemAngle(float angle); + bool OnDragStartEvent(const DragEvent& event) override; + bool OnDragEvent(const DragEvent& event) override; + bool OnDragEndEvent(const DragEvent& event) override; + void SetHeight(int16_t height) override; + void SetWidth(int16_t width) override; + +protected: + bool DragXInner(int16_t distance) override; + bool DragYInner(int16_t distance) override + { + return true; + } + void StopAnimator() override; + +private: + class DragAnimatorCallback : public AnimatorCallback { + public: + DragAnimatorCallback() + : curTime_(0), + animTime_(0), + previousAngle_(0), + angle_(0) + { + } + + virtual ~DragAnimatorCallback() {} + + void SetAnimTimes(uint16_t times) + { + animTime_ = times; + } + + void SetAngle(float angle) + { + angle_ = angle; + } + + void ResetCallback() + { + angle_ = 0; + previousAngle_ = 0; + animTime_ = 0; + curTime_ = 0; + } + + virtual void Callback(UIView* view) override; + + uint16_t curTime_; + uint16_t animTime_; + float previousAngle_; + float angle_; + }; + + float ConvertDistanceToAngle(int16_t distance); + bool InitChildExtraMsg(); + void ReMeasure(void) override; + void CalculateCameraMatrix(); + void TransformItemGroup(); + + Animator dragAnim_; + DragAnimatorCallback dragCallback_; + uint8_t numberOfRow_ = 1; + bool needRefreshSphere_ = false; + int16_t offsetRotate_ = 0; + float perimeter_ = 0.0f; + float sensitivityFactor_ = 1.0f; + int16_t cameraDistance_ = -2000; // -2000 : default distance + Vector2 cameraPosition_; + Matrix4 perspectiveMatrix_; + /* calculate swipe anim period: angle offset / ANGLE_COEFFICIENT. Minimum swipe anim period is MIN_DRAG_TIMES. */ + static constexpr uint8_t ANGLE_COEFFICIENT = 5; +}; +} +#endif // UI_SPHERE_VIEW_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_waterfall_list.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_waterfall_list.h index 06fea1101..c4d9b69e9 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_waterfall_list.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_waterfall_list.h @@ -32,10 +32,11 @@ public: } /** - * @brief Set image size + * @brief Set the size of Image or UITransformGroup. * LayoutChildren(true) must be invoked mannualy after invoking this method. * - * @param size Indicates size to set, when the image in the center + * @param size Indicates size to set, when the Image or UITransformGroup is displayed in the center. + * It is best to keep child's size as same as this size. */ void SetImageSizeInCenter(uint16_t size) { @@ -85,9 +86,9 @@ public: } /** - * @brief Adds a child image view whose resize mode will set to be UIImageView::COVER. + * @brief Adds UITransformGroup or UIImageView whose resize mode will set to be UIImageView::COVER. * LayoutChildren(true) should be invoked mannualy after invoking this method. - * Note: View index was set for children innner in order of addition, so you can + * Note: View index was set for children inner in order of addition, so you can * get its index by call method GetViewIndex() * * @param view Indicates the pointer to the child view to add. @@ -95,13 +96,13 @@ public: void Add(UIView* view) override; /** - * @brief Inserts a child image view whose resize mode will set to be UIImageView::COVER. + * @brief Inserts UITransformGroup or UIImageView whose resize mode will set to be UIImageView::COVER. * LayoutChildren(true) should be invoked mannualy after invoking this method. - * Note: View index was set for children innner in order of addition, so you can + * Note: View index was set for children inner in order of addition, so you can * get its index by call method GetViewIndex() * - * @param prevView Indicates the pointer to the child image view, previous to the new child image view. - * @param view Indicates the pointer to the new child image view to insert. + * @param prevView Indicates the pointer to the child view, previous to the new child view. + * @param view Indicates the pointer to the new child view to insert. */ void Insert(UIView* prevView, UIView* insertView) override; @@ -144,7 +145,7 @@ public: * @brief Get the Index Of View object in this view group * * @param index, Indicates the view to search - * @return Returns the index, nullptr if not exsit + * @return Returns the view, nullptr if not exsit */ UIView* GetViewByIndex(uint8_t index); @@ -230,6 +231,7 @@ private: void CalculateAdjustDistanceForRectScreen(Vector2& position, float& imgScaleRatio); void AdjustViewByDistance(UIView& view, const Vector2& position); void CalculateReboundDistance(int16_t& dragDistanceX, int16_t& dragDistanceY) override; + void ScaleBaseElement(UIView* view, float scaleX, float scaleY); Graphic::Vector> imgPoints_{64}; float imgDistance_{0}; uint16_t oriImgDistance_{0}; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp index f0d3f0521..332ffe523 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp @@ -17,10 +17,12 @@ #include "hals/gralloc_engines.h" #include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_math.h" +#include "graphic_service.h" + namespace OHOS { LiteSurface::LiteSurface() : bufferCount_(0), queueSize_(0), size_(0), width_(0), height_(0), strideAlignment_(0), format_(PIXEL_FMT_BUTT), - consumerListener_(nullptr) + consumerListener_(nullptr), waitPrepareBuffer_(std::make_shared(false)) { } @@ -51,6 +53,17 @@ void LiteSurface::ClearBuffers() lock_.Unlock(); } +void LiteSurface::PrepareBuffers() +{ + if (bufferCount_ != 0) { + GRAPHIC_LOGD("Already prepared buffers, bufferCount_ is %u", bufferCount_); + return; + } + for (uint8_t i = 0; i < queueSize_; i++) { + AddBuffer(); + } +} + void LiteSurface::AddBuffer() { if (queueSize_ == bufferCount_) { @@ -101,12 +114,21 @@ bool LiteSurface::CanRequest(uint8_t wait) goto END; } if (bufferCount_ < queueSize_) { - AddBuffer(); - res = true; - if (freeList_.IsEmpty()) { - GRAPHIC_LOGE("Cannot request buffer: freeList is empty."); - res = false; + bool waitPrepareBuffer = *waitPrepareBuffer_; + if (!waitPrepareBuffer) { + std::weak_ptr wp = waitPrepareBuffer_; + GraphicService::GetInstance()->PostGraphicEvent([this, wp]() { + if (!wp.expired()) { + PrepareBuffers(); + *waitPrepareBuffer_ = false; + } + }); + *waitPrepareBuffer_ = true; + GRAPHIC_LOGE("Post PrepareBuffers Event. BufferCount: %d, QueueSize: %d.", bufferCount_, queueSize_); + } else { + GRAPHIC_LOGW("Waiting Preparing buffer!"); } + res = false; goto END; } if (wait) { @@ -119,9 +141,13 @@ END: BufferItem* LiteSurface::GetBufferItem(const SurfaceBuffer* buffer) { + if (buffer == nullptr) { + return nullptr; + } + ListNode* cur = buffers_.Head(); while (cur != buffers_.End()) { - if (cur->data_->buffer->addr == buffer->addr) { + if ((cur->data_->buffer == buffer) && (cur->data_->buffer->addr == buffer->addr)) { return cur->data_; } cur = cur->next_; @@ -240,9 +266,12 @@ SurfaceBuffer* LiteSurface::AcquireBuffer() SurfaceBuffer* surfaceBuffer = dirtyList_.Front(); dirtyList_.PopFront(); BufferItem* bufferItem = GetBufferItem(surfaceBuffer); - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_ACQUIRE; + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Acquired buffer is invalid: %p", surfaceBuffer); + lock_.Unlock(); + return nullptr; } + bufferItem->state = BufferState::BUFFER_STATE_ACQUIRE; lock_.Unlock(); return surfaceBuffer; } @@ -253,30 +282,30 @@ SurfaceBuffer* LiteSurface::AcquireBuffer() bool LiteSurface::ReleaseBuffer(SurfaceBuffer* buffer) { lock_.Lock(); - if (buffer != nullptr) { - freeList_.PushBack(buffer); - BufferItem* bufferItem = GetBufferItem(buffer); - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_RELEASE; - } - cond_.Signal(); + BufferItem* bufferItem = GetBufferItem(buffer); + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Release invalid buffer: %p", buffer); lock_.Unlock(); - return true; + return false; } + bufferItem->state = BufferState::BUFFER_STATE_RELEASE; + freeList_.PushBack(buffer); cond_.Signal(); lock_.Unlock(); - return false; + return true; } int32_t LiteSurface::FlushBuffer(SurfaceBuffer* buffer) { lock_.Lock(); - dirtyList_.PushBack(buffer); - BufferItem* bufferItem = GetBufferItem(buffer); - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_FLUSH; + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Flush invalid buffer: %p", buffer); + lock_.Unlock(); + return -1; } + bufferItem->state = BufferState::BUFFER_STATE_FLUSH; + dirtyList_.PushBack(buffer); if (consumerListener_ != nullptr) { consumerListener_->OnBufferAvailable(); } @@ -302,10 +331,12 @@ SurfaceBuffer* LiteSurface::RequestBuffer(uint8_t wait) freeList_.PopFront(); BufferItem* bufferItem = GetBufferItem(buffer); - - if (bufferItem != nullptr) { - bufferItem->state = BufferState::BUFFER_STATE_REQUEST; + if (bufferItem == nullptr) { + GRAPHIC_LOGE("Requested buffer is invalid: %p", buffer); + lock_.Unlock(); + return nullptr; } + bufferItem->state = BufferState::BUFFER_STATE_REQUEST; lock_.Unlock(); return buffer; } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp index 36eac6bbe..08fba0886 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp @@ -115,6 +115,8 @@ bool UICustomHexagonsList::OnRotateStartEvent(const RotateEvent& event) rotateCenterIndexInNormal_ = static_cast(focusIndex); } } + SetTouchable(false); + SetDraggable(false); return UIView::OnRotateStartEvent(event); } @@ -186,6 +188,8 @@ bool UICustomHexagonsList::OnRotateEndEvent(const RotateEvent& event) SetReboundMode(ReboundMode::CENTER_IMG_ON_SCR_CENTER); } + SetTouchable(true); + SetDraggable(true); return UIView::OnRotateEndEvent(event); } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp index b1aba5c57..c474a8840 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp @@ -50,14 +50,7 @@ UILiteSurfaceView::~UILiteSurfaceView() DisplayDev::GetInstance()->CloseLayer(LAYER_1); DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, false); } - if (lastFlushedBuffer_ != nullptr) { - surface_->ReleaseBuffer(lastFlushedBuffer_); - lastFlushedBuffer_ = nullptr; - } - if (currentBuffer_ != nullptr) { - surface_->ReleaseBuffer(currentBuffer_); - currentBuffer_ = nullptr; - } + surface_->UnregisterConsumerListener(); LiteMGfxEngine::GetInstance()->ClearHardwareLayer(this); GraphicService::GetInstance()->PostGraphicEvent([] { @@ -249,6 +242,7 @@ void UILiteSurfaceView::BlitBitmapToFb(BufferInfo& gfxDstBuffer, const Rect& inv BlendOption blendOption; #if UIKIT_SKIP_LINE blendOption.transMap.Scale(Vector2{2.0, 2.0}, Vector2{0, 0}); // 2.0: scale 2 + blendOption.transMap.Translate(Vector2(GetRect().GetX(), GetRect().GetY())); #endif blendOption.opacity = OPA_OPAQUE; blendOption.mode = BLEND_SRC_OVER; @@ -306,13 +300,12 @@ void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidated style.bgColor_ = colorKey_; } - if (!(layerRect_ == GetRect())) { - layerRect_ = GetRect(); - AdjustArea(layerRect_); - Rect dirtyRect(0, 0, layerRect_.GetWidth() - 1, layerRect_.GetHeight() - 1); - DisplayDev::GetInstance()->SetLayerPositon(LAYER_1, layerRect_.GetX(), layerRect_.GetY()); - DisplayDev::GetInstance()->SetLayerDirtyRegion(LAYER_1, dirtyRect); - } + layerRect_ = GetRect(); + AdjustArea(layerRect_); + Rect dirtyRect(0, 0, layerRect_.GetWidth() - 1, layerRect_.GetHeight() - 1); + DisplayDev::GetInstance()->SetLayerPositon(LAYER_1, layerRect_.GetX(), layerRect_.GetY()); + DisplayDev::GetInstance()->SetLayerDirtyRegion(LAYER_1, dirtyRect); + BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, style, OPA_OPAQUE); } @@ -386,4 +379,19 @@ void UILiteSurfaceView::DumpImgInfo() PrintImgInfo(info); } } + +std::string UILiteSurfaceView::GetGuiInfo() const +{ + const int len = 256; + char *buf = new (std::nothrow) char[len]; + if (buf == nullptr) { + return std::string(""); + } + memset_s(buf, len, 0, len); + sprintf_s(buf, len, "stopped %d layerinit %d flushCnt %u lastbuf %p curbuf %p colorKey %x preView %p", + isStopped_, isLayerInit_, flushCount_, lastFlushedBuffer_, currentBuffer_, colorKey_.full, preView_); + std::string str(buf); + delete []buf; + return str; +} } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp index 1e487d13d..ce7ded250 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp @@ -225,6 +225,7 @@ void UISweepClock::CalculateRedrawArea(const Rect& current, Hand& hand, bool clo int16_t right = left + hand.width_ - 1; int16_t top = hand.position_.y + current.GetTop(); int16_t bottom = top + hand.height_ - 1; + int16_t compensationDistance = hand.width_ / 2; Rect handRect(left, top, right, bottom); TransformMap backwardMap(handRect); Vector2 pivot; @@ -240,6 +241,8 @@ void UISweepClock::CalculateRedrawArea(const Rect& current, Hand& hand, bool clo if (!clockInit) { /* Prevent old images from being residued */ redraw.Join(redraw, hand.target_); + redraw.SetRect(redraw.GetLeft() - compensationDistance, redraw.GetTop() - compensationDistance, + redraw.GetRight() + compensationDistance, redraw.GetBottom() + compensationDistance); InvalidateRect(redraw); } } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h index 8c23ed21e..8939b4183 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/hor_swipe_view.h @@ -75,16 +75,6 @@ public: */ void SwipeStart(void); - /* * - * @brief Get state of scroll animator. - * @since 1.0 - * @version 1.0 - */ - uint8_t GetScrollState() - { - return scrollAnimator_.GetState(); - } - private: bool enableScreenCap_ = false; CardSwipe* swipeCallback_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ver_swipe_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ver_swipe_view.h new file mode 100644 index 000000000..cbea964b6 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ver_swipe_view.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: VerSwipeView + * Author: + * Create: 2024-11 + */ + +#ifndef UI_VER_SWIPE_VIEW_H +#define UI_VER_SWIPE_VIEW_H +#include "components/ui_swipe_view.h" + +namespace OHOS { +class VerSwipeView : public UISwipeView { +public: + /** + * @brief Represents a listener for moving children. + * + * This is an inner class of VerSwipeView. + * It contains a callback function to be invoked when the swipe view moves children. + * + * @since 1.0 + * @version 1.0 + */ + class OnMoveChildListener : public HeapBase { + public: + OnMoveChildListener() {} + virtual ~OnMoveChildListener() {} + virtual void OnMoveChild(UISwipeView& view, int16_t xOffset, int16_t yOffset) = 0; + }; + + /* * + * @brief A constructor used to create the VerSwipeView instance. + * @since 1.0 + * @version 1.0 + */ + VerSwipeView() {} + + /* * + * @brief A destructor used to delete the VerSwipeView instance. + * @since 1.0 + * @version 1.0 + */ + ~VerSwipeView() override {} + + /** + * @brief Obtains the listener set for moving child event. + * + * @return Returns the move child listener. + * @since 1.0 + * @version 1.0 + */ + OnMoveChildListener*& GetOnMoveChildListener() + { + return onMoveChildListener_; + } + + /** + * @brief Sets the listener that contains a callback to be invoked upon moving child. + * + * @param onMoveChildListener Indicates the listener to set. + * @since 1.0 + * @version 1.0 + */ + void SetOnMoveChildListener(OnMoveChildListener* onMoveChildListener) + { + onMoveChildListener_ = onMoveChildListener; + } + +protected: + void MoveChildByOffset(int16_t xOffset, int16_t yOffset) override + { + UISwipeView::MoveChildByOffset(xOffset, yOffset); + if (onMoveChildListener_ != nullptr) { + onMoveChildListener_->OnMoveChild(*this, xOffset, yOffset); + } + } + +private: + OnMoveChildListener* onMoveChildListener_ = nullptr; +}; +} +#endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_dom_dump.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_dom_dump.cpp index 79b7aecad..601ea1e77 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_dom_dump.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_dom_dump.cpp @@ -88,6 +88,7 @@ static const struct { {UI_TRANSFORM_GROUP, "UI_TRANSFORM_GROUP"}, {UI_TRANSFORM_LIST, "UI_TRANSFORM_LIST"}, {UI_COVER_FLOW_2, "UI_COVER_FLOW_2"}, + {UI_SPHERE_VIEW, "UI_SPHERE_VIEW"}, {UI_NUMBER_MAX, "UI_NUMBER_MAX"}, }; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h index ddd3c8a52..956c131dc 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/font/ui_font_hw_cache.h @@ -45,6 +45,8 @@ public: uint8_t* GetCacheData(uint8_t fontId, uint32_t unicode); + bool TryToFreeFontCache(); + private: struct FontInfo { uint8_t fontId; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h index 4f015d8c6..74f8be7de 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/font/ui_font_hw_vector.h @@ -45,6 +45,8 @@ public: pointData_.PushBack(data); } + bool TryToFreeFontCache() override; + private: float size_ = 0; UIFontHWCache* pathCache_ = nullptr; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp index 5b29de28b..c40188782 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp @@ -431,10 +431,6 @@ void DisplayDev::SetLayerPositon(uint8_t layerId, int16_t x, int16_t y) return; } - if (layer_[layerId].pos.x == x && layer_[layerId].pos.y == y) { - return; - } - layer_[layerId].pos.x = x; layer_[layerId].pos.y = y; if (layerFuncs_->SetLayerSize != nullptr) { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp index 084dfed50..aca7b257a 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp @@ -21,6 +21,7 @@ #include "gfx_utils/graphic_log.h" #include "securec.h" #include "common/image_cache_manager.h" +#include "font/ui_font.h" #include "hals/gralloc_engines.h" namespace OHOS { @@ -37,6 +38,11 @@ static bool TryToFreeImage() return ImageCacheManager::GetInstance().TryToFreeImage(); } +static bool TryToFreeFontCache() +{ + return UIFont::GetInstance()->TryToFreeFontCache(); +} + bool GrallocEngines::Init() { if (grallocFuncs_ != nullptr) { @@ -47,6 +53,7 @@ bool GrallocEngines::Init() return false; } grallocFuncs_->RegisterTryToFreeImgCallback(TryToFreeImage); + grallocFuncs_->RegisterTryToFreeFontCacheCallback(TryToFreeFontCache); return true; } @@ -64,6 +71,7 @@ bool GrallocEngines::AllocBuffer(const AllocInfo& info, GrallocBuffer& buffer) #endif #ifdef __LITEOS__ OsMemInfoPrint(reinterpret_cast(MEM_POOL_UI_OTHER)); + OsMemInfoPrint(reinterpret_cast(MEM_POOL_UI_FONT)); #endif return false; } @@ -118,7 +126,7 @@ void GrallocEngines::FreeBuffer(uint8_t* virAddr) } #if ENABLE_MEMORY_CHECK -void GrallocEngines::DumpMem() +void GrallocEngines::DumpMem(bool dumpDetails) { int32_t fontCacheSize = 0; int32_t imageCacheSize = 0; @@ -128,6 +136,7 @@ void GrallocEngines::DumpMem() int32_t yuvCacheSize = 0; int32_t fontCount = 0; int32_t fontMax = 0; + int32_t pathCnt = 0; printf("current gralloc allocate memory:\n"); for (auto it : g_buffers) { if ((it.second->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) { @@ -140,42 +149,57 @@ void GrallocEngines::DumpMem() } if (it.second->usage == HBM_USE_ASSIGN_SIZE) { imageCacheSize += it.second->size; - printf(" image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_MULTI_IMG) == HBM_USE_MEM_MULTI_IMG) { imageCacheSize += it.second->size; - printf(" multi image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" multi image addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH) { pathCacheSize += it.second->size; - printf(" path addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" path addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } + pathCnt++; continue; } if ((it.second->usage & HBM_USE_MEM_FB) == HBM_USE_MEM_FB) { fbSize += it.second->size; - printf(" fb addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" fb addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_BUFMAP) == HBM_USE_MEM_BUFMAP) { mapBufferSize += it.second->size; - printf(" mapbuffer addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + if (dumpDetails) { + printf(" mapbuffer addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_YUV) == HBM_USE_MEM_YUV) { - printf(" yuv addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); yuvCacheSize += it.second->size; + if (dumpDetails) { + printf(" yuv addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } if ((it.second->usage & HBM_USE_MEM_JPEG_DATA) == HBM_USE_MEM_JPEG_DATA) { - printf(" jpeg addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); yuvCacheSize += it.second->size; + if (dumpDetails) { + printf(" jpeg addr=%p, size=%d\n", reinterpret_cast(it.first), it.second->size); + } continue; } } - printf("total size: font %d (count: %d, max: %d), image %d, path %d, fb %d, mapbuffer:%d, yuv %d\n", - fontCacheSize, fontCount, fontMax, imageCacheSize, pathCacheSize, fbSize, mapBufferSize, yuvCacheSize); + printf("total size: font %d (count: %d, max: %d), image %d, path %d (count: %d), fb %d, mapbuffer:%d, yuv %d\n", + fontCacheSize, fontCount, fontMax, imageCacheSize, pathCacheSize, pathCnt, fbSize, mapBufferSize, yuvCacheSize); } void GrallocEngines::SetMemMonitor(bool enable) diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h index 138bad1b5..e83c50691 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h @@ -42,7 +42,7 @@ public: bool AllocBufferOnce(const AllocInfo& info, GrallocBuffer& buffer); void FreeBuffer(uint8_t* virAddr); #if ENABLE_MEMORY_CHECK - void DumpMem(); + void DumpMem(bool dumpDetails = false); void SetMemMonitor(bool enable); #endif private: diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp index e23737aa3..a4d3de698 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.cpp @@ -74,7 +74,6 @@ void UITestCoverflow2::TearDown() coverflow_ = nullptr; } lastIndex_ = 0; - lastPage_ = nullptr; addImage_ = nullptr; if (label_ != nullptr) { delete label_; @@ -124,7 +123,6 @@ void UITestCoverflow2::UITestCoverflow2001() imageSub->SetTouchable(true); imageSub->SetOnClickListener(this); coverflow_->Add(page); - lastPage_ = page; } CreateAddButton(); CreateTitleLabel(); @@ -186,8 +184,7 @@ bool UITestCoverflow2::OnClick(UIView& view, const ClickEvent& event) imageSub->SetSrc(src); imageSub->SetTouchable(true); imageSub->SetOnClickListener(this); - coverflow_->Insert(lastPage_, page); - lastPage_ = page; + coverflow_->Insert(nullptr, page); } else { UITransformGroup* page = dynamic_cast(view.GetParent()); UIView* child = page->GetChildrenHead(); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h index 6cb1d9051..0b4bc1804 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow2.h @@ -48,7 +48,6 @@ private: UILabel* label_ = nullptr; UIImageView* addImage_ = nullptr; uint16_t lastIndex_ = 0; - UITransformGroup* lastPage_ = nullptr; }; } // namespace OHOS #endif // UI_TEST_COVERFLOW_VIEW_2_H diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.cpp index 5cb89642e..0bf0b97d8 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.cpp @@ -5,6 +5,7 @@ #include "ui_test_hexagons_list/ui_test_hexagons_list.h" #include "components/root_view.h" #include "components/ui_image_view.h" +#include "components/ui_transform_group.h" #include "common/image_cache_manager.h" #include "common/screen.h" #include "ui_test_list_fps/ui_list_fps_res.h" @@ -61,6 +62,50 @@ void UITestHexagonsList::SetUpButtons(int16_t xEnd, int16_t yEnd, int16_t xMiddl modifyBorderRadiusButton_ = new UIButton(); ConfigButtonAttr(*modifyBorderRadiusButton_, xMiddle - BUTTON_SIZE, yMiddle, BUTTON_SIZE, BUTTON_SIZE); } + if (modifyModeButton_ == nullptr) { + modifyModeButton_ = new UIButton(); // click bottom mid to change mode for next time. + ConfigButtonAttr(*modifyModeButton_, + (container_->GetWidth() - BUTTON_SIZE) / 2, container_->GetHeight() - BUTTON_SIZE, // 2: divisor + BUTTON_SIZE, BUTTON_SIZE); + } +} + +void UITestHexagonsList::SetUpChildren() +{ + ImageInfo* logo = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"hexagons.bin"); + ImageInfo* arrow = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"left_arrow.bin"); + for (int16_t i = 0; i < IMG_COUNT; i++) { + UIImageView* img = new UIImageView(); + img->SetSrc(logo); + if (isImageMode_) { // test UIImageView + img->SetTouchable(true); + img->Resize(imgSize_, imgSize_); + img->SetOnClickListener(this); + hexagonsList_->Add(img); + } else { // test UITransformGroup + UITransformGroup* transformGroup = new UITransformGroup(); + transformGroup->SetStyle(STYLE_BACKGROUND_OPA, 0); + transformGroup->Add(img); + + UIImageView* topImg = new UIImageView(); + topImg->SetSrc(arrow); + transformGroup->Add(topImg); + + UILabel* label = new UILabel(); + label->SetText("6"); + transformGroup->Add(label); + + // Layout transformgroup as if displayed in center. + img->SetPosition(0, 0, imgSize_, imgSize_); + topImg->SetPosition(0, 0, imgSize_ / 3, imgSize_ / 3); // 3: divisor + label->SetPosition(imgSize_ - (imgSize_ / 3), 0, imgSize_ / 3, imgSize_ / 3); // 3: divisor + transformGroup->SetPosition(0, 0, imgSize_, imgSize_); + + transformGroup->SetTouchable(true); + transformGroup->SetOnClickListener(this); + hexagonsList_->Add(transformGroup); + } + } } void UITestHexagonsList::SetUp() @@ -93,14 +138,7 @@ void UITestHexagonsList::SetUp() hexagonsList_->SetPosition(0, 0, container_->GetWidth() - 2 * (horMargin_ + 1), container_->GetHeight() - 2 * (verMargin_ + 1)); // 2, two - ImageInfo* info = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"hexagons.bin"); - for (int16_t i = 0; i < IMG_COUNT; i++) { - UIImageView* img = new UIImageView(); - img->SetSrc(info); - img->SetTouchable(true); - img->SetOnClickListener(this); - hexagonsList_->Add(img); - } + SetUpChildren(); imgScaleFactor_ = hexagonsList_->GetScaleFactorByDistance(); globalScale_ = hexagonsList_->GetGlobalScale(); hexagonsList_->SetImageDistance(imgDistance_); @@ -129,6 +167,7 @@ void UITestHexagonsList::TearDown() modifyHorMarginButton_ = nullptr; modifyVerMarginButton_ = nullptr; modifyBorderRadiusButton_ = nullptr; + modifyModeButton_ = nullptr; } void UITestHexagonsList::HandleClickEventForRectScreen(const UIView& view) @@ -157,7 +196,7 @@ void UITestHexagonsList::HandleClickEventForRectScreen(const UIView& view) bool UITestHexagonsList::OnClick(UIView& view, const ClickEvent& event) { // Handle content click for image view - if (view.GetViewType() == UI_IMAGE_VIEW) { + if ((view.GetViewType() == UI_IMAGE_VIEW) || (view.GetViewType() == UI_TRANSFORM_GROUP)) { uint8_t index = static_cast(view.GetViewIndex()); float scaleInSmall = hexagonsList_->GetScaleInSmallState(); Vector2 center(hexagonsList_->GetWidth() / 2, hexagonsList_->GetHeight() / 2); // 2, center @@ -183,12 +222,15 @@ bool UITestHexagonsList::OnClick(UIView& view, const ClickEvent& event) imgScaleFactor_ += isIncreaseScaleFactor_ ? IMG_SCALE_FACTOR_DELTA : -IMG_SCALE_FACTOR_DELTA; hexagonsList_->SetScaleFactorByDistance(imgScaleFactor_); hexagonsList_->LayoutChildren(true); - } else if (modifyGlobalScaleButton_ == &view) { + } else if (modifyGlobalScaleButton_ == &view) { globalScale_ += isIncreaseGlobalScale_ ? GLOBAL_SCALE_DELTA : -GLOBAL_SCALE_DELTA; int8_t index = hexagonsList_->GetFocusedImgIndex(); if (index >= 0) { hexagonsList_->Scale(globalScale_, static_cast(index)); } + } else if (modifyModeButton_ == &view) { + isImageMode_ = !isImageMode_; + printf("Change display mode to: %d\n", isImageMode_); } if (FloatLess(globalScale_, hexagonsList_->GetScaleThesholdOfZeroFactor())) { hexagonsList_->SetReboundMode(UIHexagonsList::ReboundMode::CENTER_IMG_ON_SCR_CENTER); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.h index 999b41b83..3d0b383cb 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_hexagons_list/ui_test_hexagons_list.h @@ -25,6 +25,7 @@ private: void HandleClickEventForRectScreen(const UIView& view); void ConfigButtonAttr(UIView& view, int16_t x, int16_t y, int16_t width, int16_t height); void SetUpButtons(int16_t xEnd, int16_t yEnd, int16_t xMiddle, int16_t yMiddle); + void SetUpChildren(); UICustomHexagonsList* hexagonsList_ = nullptr; int16_t horMargin_ = 0; int16_t verMargin_ = 0; @@ -48,6 +49,8 @@ private: UIButton* modifyVerMarginButton_ = nullptr; bool isIncreaseBorderRadius_ = true; UIButton* modifyBorderRadiusButton_ = nullptr; + bool isImageMode_ = true; + UIButton* modifyModeButton_ = nullptr; }; } #endif // UI_TEST_HEXAGONS_LIST_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_sphere_view/ui_test_sphere_view.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_sphere_view/ui_test_sphere_view.cpp new file mode 100644 index 000000000..7e9b3baa8 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_sphere_view/ui_test_sphere_view.cpp @@ -0,0 +1,160 @@ +/* + * 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_sphere_view.h" +#include "components/ui_transform_group.h" +#include "components/ui_image_view.h" +#include "common/image_cache_manager.h" +#include "common/screen.h" + +namespace OHOS { +static constexpr uint8_t STEP_SIZE = 10; + +UITestSphereView::UITestSphereView() +{ +} + +void UITestSphereView::SetUp() +{ + container_ = new UIViewGroup(); + container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + container_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); + container_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + + sphereView_ = new UISphereView(8); // 8: Setting the Number of Displayed Lines. + sphereView_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + sphereView_->SetThrowDrag(true); + sphereView_->RequestFocus(); + container_->Add(sphereView_); + for (uint8_t i = 0; i < 24; i++) { // 24: item number. + UITransformGroup* group = new UITransformGroup(); + group->SetPosition(0, 0, 60, 60); // 60: view size + group->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + + UIImageView* image = new UIImageView(); + image->SetPosition(0, 0, 60, 60); // 60: view size + image->SetAutoEnable(false); + image->SetResizeMode(UIImageView::ImageResizeMode::FILL); + ImageInfo* info = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"/kaleidoscope.bin"); + image->SetSrc(info); + group->Add(image); + sphereView_->Add(group); + } + + SetUpLabelButton(); +} + +void UITestSphereView::TearDown() +{ + sphereView_->ClearFocus(); + DeleteChildren(container_); + container_ = nullptr; + sphereView_ = nullptr; + controlGroup_ = nullptr; + controlBt_ = nullptr; + sizeIncreaseBt_ = nullptr; + sizeDiminishedBt_ = nullptr; + addItemBt_ = nullptr; + updateCameraDistance = nullptr; + removeItemBt_ = nullptr; +} + +void UITestSphereView::SetUpLabelButton() +{ + controlGroup_ = new UIViewGroup(); + controlGroup_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + controlGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + controlGroup_->SetVisible(false); + container_->Add(controlGroup_); + + controlBt_ = new UILabelButton(); + controlBt_->SetPosition(200, 400, 60, 30); // 200, 400, 60, 30: label button size + controlBt_->SetOnClickListener(this); + controlBt_->SetText("control"); + container_->Add(controlBt_); + + sizeIncreaseBt_ = new UILabelButton(); + sizeIncreaseBt_->SetPosition(50, 100, 60, 30); // 50, 100, 60, 30: label button size + sizeIncreaseBt_->SetOnClickListener(this); + sizeIncreaseBt_->SetText("size +"); + controlGroup_->Add(sizeIncreaseBt_); + + sizeDiminishedBt_ = new UILabelButton(); + sizeDiminishedBt_->SetPosition(50, 200, 60, 30); // 50, 200, 60, 30: label button size + sizeDiminishedBt_->SetOnClickListener(this); + sizeDiminishedBt_->SetText("size -"); + controlGroup_->Add(sizeDiminishedBt_); + + addItemBt_ = new UILabelButton(); + addItemBt_->SetPosition(140, 100, 60, 30); // 140, 100, 60, 30: label button size + addItemBt_->SetOnClickListener(this); + addItemBt_->SetText("item +"); + controlGroup_->Add(addItemBt_); + + removeItemBt_ = new UILabelButton(); + removeItemBt_->SetPosition(140, 200, 60, 30); // 140, 200, 60, 30: label button size + removeItemBt_->SetOnClickListener(this); + removeItemBt_->SetText("item -"); + controlGroup_->Add(removeItemBt_); + + updateCameraDistance = new UILabelButton(); + updateCameraDistance->SetPosition(230, 100, 60, 30); // 230, 100, 60, 30: label button size + updateCameraDistance->SetOnClickListener(this); + updateCameraDistance->SetText("update distance"); + controlGroup_->Add(updateCameraDistance); +} + +const UIView* UITestSphereView::GetTestView() +{ + return container_; +} + +bool UITestSphereView::OnClick(UIView& view, const ClickEvent& event) +{ + int16_t x = sphereView_->GetX(); + int16_t y = sphereView_->GetY(); + uint16_t width = sphereView_->GetWidth(); + uint16_t height = sphereView_->GetHeight(); + if (&view == controlBt_) { + bool visible = controlGroup_->IsVisible(); + controlGroup_->SetVisible(!visible); + } else if (&view == sizeIncreaseBt_) { + sphereView_->SetPosition(x + (STEP_SIZE >> 1), y + (STEP_SIZE >> 1), width - STEP_SIZE, height - STEP_SIZE); + } else if (&view == sizeDiminishedBt_) { + sphereView_->SetPosition(x - (STEP_SIZE >> 1), y - (STEP_SIZE >> 1), width + STEP_SIZE, height + STEP_SIZE); + } else if (&view == addItemBt_) { + UITransformGroup* group = new UITransformGroup(); + group->SetPosition(0, 0, 60, 60); // 60: view size + group->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + + UIImageView* image = new UIImageView(); + image->SetPosition(0, 0, 60, 60); // 60: view size + image->SetAutoEnable(false); + image->SetResizeMode(UIImageView::ImageResizeMode::FILL); + ImageInfo* info = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"/kaleidoscope.bin"); + image->SetSrc(info); + group->Add(image); + sphereView_->Add(group); + } else if (&view == removeItemBt_) { + UIView* child = sphereView_->GetChildrenTail(); + if (child != nullptr) { + sphereView_->Remove(child); + } + } else if (&view == updateCameraDistance) { + sphereView_->SetSphereCameraDistance(-1000); // -1000 cramer distance + } + return true; +} +} \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_sphere_view/ui_test_sphere_view.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_sphere_view/ui_test_sphere_view.h new file mode 100644 index 000000000..f13f95629 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_sphere_view/ui_test_sphere_view.h @@ -0,0 +1,45 @@ +/* + * 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_SPHERE_VIEW_H +#define UI_TEST_SPHERE_VIEW_H + +#include "components/ui_sphere_view.h" +#include "components/ui_label_button.h" +#include "ui_test.h" + +namespace OHOS { +class UITestSphereView : public UITest, public UIView::OnClickListener { +public: + UITestSphereView(); + ~UITestSphereView() override {} + void SetUp() override; + void TearDown() override;; + const UIView* GetTestView() override; + bool OnClick(UIView& view, const ClickEvent& event) override; +private: + void SetUpLabelButton(); + UIViewGroup* container_ = nullptr; + UISphereView* sphereView_ = nullptr; + + UIViewGroup* controlGroup_ = nullptr; + UILabelButton* controlBt_ = nullptr; + UILabelButton* sizeIncreaseBt_ = nullptr; + UILabelButton* sizeDiminishedBt_ = nullptr; + UILabelButton* addItemBt_ = nullptr; + UILabelButton* removeItemBt_ = nullptr; + UILabelButton* updateCameraDistance = nullptr; +}; +} +#endif \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.cpp index 72eed72ed..09e31242f 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.cpp @@ -5,6 +5,7 @@ #include "ui_test_waterfall_list/ui_test_waterfall_list.h" #include "components/root_view.h" #include "components/ui_image_view.h" +#include "components/ui_transform_group.h" #include "common/image_cache_manager.h" #include "common/screen.h" #include "ui_test_list_fps/ui_list_fps_res.h" @@ -55,6 +56,50 @@ void UITestWaterfallList::SetUpButtons(int16_t xEnd, int16_t yEnd, int16_t xMidd modifyBorderRadiusButton_ = new UIButton(); ConfigButtonAttr(*modifyBorderRadiusButton_, xMiddle - BUTTON_SIZE, yMiddle, BUTTON_SIZE, BUTTON_SIZE); } + if (modifyModeButton_ == nullptr) { + modifyModeButton_ = new UIButton(); // click bottom mid to change mode for next time. + ConfigButtonAttr(*modifyModeButton_, + (container_->GetWidth() - BUTTON_SIZE) / 2, container_->GetHeight() - BUTTON_SIZE, // 2: divisor + BUTTON_SIZE, BUTTON_SIZE); + modifyModeButton_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); + } +} + +void UITestWaterfallList::SetUpChildren() +{ + ImageInfo* logo = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"hexagons.bin"); + ImageInfo* arrow = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"left_arrow.bin"); + for (int16_t i = 0; i < IMG_COUNT; i++) { + UIImageView* img = new UIImageView(); + img->SetSrc(logo); + if (isImageMode_) { // test UIImageView + img->SetTouchable(true); + img->SetOnClickListener(this); + waterfallList_->Add(img); + } else { // test UITransformGroup + UITransformGroup* transformGroup = new UITransformGroup(); + transformGroup->SetStyle(STYLE_BACKGROUND_OPA, 0); + transformGroup->Add(img); + + UIImageView* topImg = new UIImageView(); + topImg->SetSrc(arrow); + transformGroup->Add(topImg); + + UILabel* label = new UILabel(); + label->SetText("6"); + transformGroup->Add(label); + + // Layout transformgroup as if displayed in center. + img->SetPosition(0, 0, imgSize_, imgSize_); + topImg->SetPosition(0, 0, imgSize_ / 3, imgSize_ / 3); // 3: divisor + label->SetPosition(imgSize_ - (imgSize_ / 3), 0, imgSize_ / 3, imgSize_ / 3); // 3: divisor + transformGroup->SetPosition(0, 0, imgSize_, imgSize_); + + transformGroup->SetTouchable(true); + transformGroup->SetOnClickListener(this); + waterfallList_->Add(transformGroup); + } + } } void UITestWaterfallList::SetUp() @@ -87,14 +132,8 @@ void UITestWaterfallList::SetUp() waterfallList_->SetPosition(0, 0, container_->GetWidth() - 2 * (horMargin_ + 1), container_->GetHeight() - 2 * (verMargin_ + 1)); // 2, two - ImageInfo* info = ImageCacheManager::GetInstance().LoadSingleRes(RES_PATH"hexagons.bin"); - for (int16_t i = 0; i < IMG_COUNT; i++) { - UIImageView* img = new UIImageView(); - img->SetSrc(info); - img->SetTouchable(true); - img->SetOnClickListener(this); - waterfallList_->Add(img); - } + SetUpChildren(); + imgScaleFactor_ = waterfallList_->GetScaleFactorByDistance(); waterfallList_->SetImageDistance(imgDistance_); @@ -121,6 +160,7 @@ void UITestWaterfallList::TearDown() modifyHorMarginButton_ = nullptr; modifyVerMarginButton_ = nullptr; modifyBorderRadiusButton_ = nullptr; + modifyModeButton_ = nullptr; } void UITestWaterfallList::HandleClickEventForRectScreen(const UIView& view) @@ -160,6 +200,9 @@ bool UITestWaterfallList::OnClick(UIView& view, const ClickEvent& event) imgScaleFactor_ += isIncreaseScaleFactor_ ? IMG_SCALE_FACTOR_DELTA : -IMG_SCALE_FACTOR_DELTA; waterfallList_->SetScaleFactorByDistance(imgScaleFactor_); waterfallList_->LayoutChildren(true); + } else if (modifyModeButton_ == &view) { + isImageMode_ = !isImageMode_; + printf("Change display mode to: %d\n", isImageMode_); } if (Screen::GetInstance().GetScreenShape() == RECTANGLE) { HandleClickEventForRectScreen(view); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.h index 7b6c61a62..fedc2bfe0 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_waterfall_list/ui_test_waterfall_list.h @@ -25,6 +25,7 @@ private: void HandleClickEventForRectScreen(const UIView& view); void ConfigButtonAttr(UIView& view, int16_t x, int16_t y, int16_t width, int16_t height); void SetUpButtons(int16_t xEnd, int16_t yEnd, int16_t xMiddle, int16_t yMiddle); + void SetUpChildren(); UIWaterfallList* waterfallList_ = nullptr; int16_t horMargin_ = 0; int16_t verMargin_ = 0; @@ -46,6 +47,8 @@ private: UIButton* modifyVerMarginButton_ = nullptr; bool isIncreaseBorderRadius_ = true; UIButton* modifyBorderRadiusButton_ = nullptr; + bool isImageMode_ = true; + UIButton* modifyModeButton_ = nullptr; }; } #endif // UI_TEST_WATERFALL_LIST_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp index ec59ffcc8..f81ece011 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp @@ -69,6 +69,9 @@ UIView::UIView() UIView::~UIView() { +#if ENABLE_ROTATE_INPUT + ClearFocus(); +#endif ClearBackgroundBlur(); if (parent_ != nullptr) { GRAPHIC_LOGE("UIView::~UIView failed, parent is not nullptr! Need to remove from parent component first"); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp index 090a2bdd9..43ed8fc4a 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp @@ -19,6 +19,7 @@ #include "components/root_view.h" #include "gfx_utils/graphic_log.h" +#include "gfx_utils/vector.h" namespace OHOS { UIViewGroup::UIViewGroup() @@ -239,6 +240,35 @@ void UIViewGroup::GetTargetView(const Point& point, UIView** last) } } +static void CalculatedHexagonalRegion(Polygon polygon, Graphic::Vector& vertexes) +{ + vertexes.PushBack({(polygon[0].x_ + polygon[1].x_) / 2, (polygon[0].y_ + polygon[1].y_) / 2}); + vertexes.PushBack({polygon[1].x_ + (polygon[2].x_ - polygon[1].x_) * 1 / 3, + polygon[1].y_ + (polygon[2].y_ - polygon[1].y_) * 1 / 3}); + vertexes.PushBack({polygon[1].x_ + (polygon[2].x_ - polygon[1].x_) * 2 / 3, + polygon[1].y_ + (polygon[2].y_ - polygon[1].y_) * 2 / 3}); + vertexes.PushBack({(polygon[2].x_ + polygon[3].x_) / 2, (polygon[2].y_ + polygon[3].y_) / 2}); + vertexes.PushBack({polygon[3].x_ + (polygon[0].x_ - polygon[3].x_) * 1 / 3, + polygon[3].y_ + (polygon[0].y_ - polygon[3].y_) * 1 / 3}); + vertexes.PushBack({polygon[3].x_ + (polygon[0].x_ - polygon[3].x_) * 2 / 3, + polygon[3].y_ + (polygon[0].y_ - polygon[3].y_) * 2 / 3}); +} +static bool CalculatedPointInRegion(Point point, Graphic::Vector& vertexes) +{ + bool isInPolygon = false; + int j = 0; + for (int i = 0; i < vertexes.Size(); i++) { + int16_t sx = vertexes[i].x; + int16_t sy = vertexes[i].y; + j = (i + 1) % vertexes.Size(); + int16_t tx = vertexes[j].x; + int16_t ty = vertexes[j].y; + if (((point.y > sy) && (point.y <= ty)) || ((point.y > ty) && (point.y <= sy))) { + isInPolygon ^= (sx + (tx - sx) * (point.y - sy) / (ty - sy) > point.x); + } + } + return isInPolygon; +} void UIViewGroup::GetTargetView(const Point& point, UIView** current, UIView** target) { if ((current == nullptr) || (target == nullptr)) { @@ -269,7 +299,15 @@ void UIViewGroup::GetTargetView(const Point& point, UIView** current, UIView** t if (!view->IsViewGroup()) { rect = view->GetRect(); if (rect.IsContains(point)) { - view->GetTargetView(point, current, target); + bool isInPolygon = true; + if (view->GetParent()->GetViewType() == UI_ICOSAHEDRON_VIEW) { + Graphic::Vector vertex(6); // 6: point number + CalculatedHexagonalRegion(view->GetTransformMap().GetPolygon(), vertex); + isInPolygon = CalculatedPointInRegion(point, vertex); + } + if (isInPolygon) { + view->GetTargetView(point, current, target); + } } } else { UIViewGroup* viewGroup = static_cast(view); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp index 3c8b029dc..eb3b84376 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/rotate_input_device.cpp @@ -27,10 +27,11 @@ constexpr int16_t ROTATE_INPUT_THRESHOLD = 1; #else constexpr int16_t ROTATE_INPUT_THRESHOLD = 10; #endif -} +} // namespace namespace OHOS { -RotateInputDevice::RotateInputDevice() : rotateStart_(false), threshold_(ROTATE_INPUT_THRESHOLD), cachedRotation_(0) {} +RotateInputDevice::RotateInputDevice() : rotateStart_(false), threshold_(ROTATE_INPUT_THRESHOLD), cachedRotation_(0) +{} void RotateInputDevice::DispatchEvent(const DeviceData& data) { @@ -56,33 +57,37 @@ void RotateInputDevice::DispatchEvent(const DeviceData& data) } #endif - UIView* view = FocusManager::GetInstance()->GetFocusedView(); - if (view == nullptr) { - return; - } - - UIView* par = view; - while (par->GetParent() != nullptr) { - if (!par->IsVisible()) { + UIView *view = FocusManager::GetInstance()->GetFocusedView(); + if (view != nullptr) { + UIView *par = view; + while (par->GetParent() != nullptr) { + if (!par->IsVisible()) { + return; + } + par = par->GetParent(); + } + if (par->GetViewType() != UI_ROOT_VIEW) { return; } - par = par->GetParent(); - } - if (par->GetViewType() != UI_ROOT_VIEW) { - return; } if (MATH_ABS(data.rotate) < threshold_ && !rotateStart_ && !cachedToRotate) { return; } if (data.rotate == 0 && rotateStart_) { - view->OnRotateEndEvent(0); + if (view != nullptr) { + view->OnRotateEndEvent(0); + } rotateStart_ = false; return; } if (!rotateStart_) { - view->OnRotateStartEvent(data.rotate); + if (view != nullptr) { + view->OnRotateStartEvent(data.rotate); + } + } + if (view != nullptr) { + view->OnRotateEvent(data.rotate); } - view->OnRotateEvent(data.rotate); rotateStart_ = true; } } // namespace OHOS 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 477065f79..fefb1ccfc 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font.cpp @@ -72,6 +72,14 @@ void UIFont::SetFont(BaseFont* font) } } +bool UIFont::TryToFreeFontCache() +{ + if (instance_ == nullptr) { + return false; + } + return instance_->TryToFreeFontCache(); +} + bool UIFont::GetGlyphPathData(uint32_t unicode, uint8_t shapingFont, GlyphPathData& data) { bool ret = false; diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font_vector.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/font/ui_font_vector.cpp index 1527516b2..4c36db7ae 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 @@ -204,7 +204,7 @@ uint16_t UIFontVector::GetEmojiWidth(uint32_t unicode, uint8_t fontId) { ImageInfo info; if (!GetEmoji(unicode, info)) { - return 0; + return INVALID_RET_VALUE; } uint8_t old = GetBaseFontId(); SetBaseFontId(fontId); diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h index 87fcdeb34..c532a50fc 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h @@ -348,6 +348,18 @@ public: } } + void ClearBlurView(UIView* view) + { + if (blurView_ == view) { + blurView_ = nullptr; + } + } + + UIView* GetBlurView() + { + return blurView_; + } + void SetSnapshotFlag(bool flag) { isSnapshot_ = flag; @@ -358,13 +370,6 @@ public: return isSnapshot_; } - void ClearBlurView(UIView* view) - { - if (blurView_ == view) { - blurView_ = nullptr; - } - } - void Add(UIView* view) override { appView_.Add(view); diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h index 8f903f7d6..89e3f184b 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 @@ -127,6 +127,7 @@ enum UIViewType : uint8_t { UI_TRANSFORM_LIST, UI_COVER_FLOW_2, UI_WATERFALL_LIST, + UI_SPHERE_VIEW, UI_NUMBER_MAX }; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h index 56a67f3c1..537350663 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/base_font.h @@ -88,6 +88,11 @@ public: return false; } + virtual bool TryToFreeFontCache() + { + return false; + } + /** * @brief Get bitmap for specific unicode * diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h index 8589c3148..96dcb20bb 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/font/ui_font.h @@ -143,6 +143,12 @@ public: */ bool GetGlyphPathData(uint32_t unicode, uint8_t shapingFont, GlyphPathData& data); + /** + * @brief Try to free mem used for font cache by LRU rule. This is only applicable for UIFontHWVector. + * + */ + bool TryToFreeFontCache(); + /** * @brief Get bitmap for specific unicode * diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp index 41e625272..8d7899f2a 100644 --- a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp @@ -27,6 +27,7 @@ #include "media_thread_adapt.h" #include "msg_center_protocol.h" #include "cmsis_os2.h" +#include "audio_capturer.h" #ifdef __cplusplus extern "C" { @@ -440,6 +441,13 @@ JSIValue AudioCapturerModule::Stop(const JSIValue thisVal, const JSIValue *args, return JSI::CreateBoolean(0); } +void AudioCapturerModule::ExceptionStop(void) +{ + if (g_sample.needStop == false) { + g_sample.needStop = true; + } +} + void InitAudioCapturerModule(JSIValue exports) { JSI::SetModuleAPI(exports, "Start", AudioCapturerModule::Start); diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h index 96041d0e9..6d1c9178e 100644 --- a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h @@ -10,7 +10,6 @@ #include #include "jsi.h" -#include "audio_capturer.h" #ifdef __cplusplus extern "C" { @@ -45,6 +44,11 @@ public: * Stop */ static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + handle exception + */ + static void ExceptionStop(void); }; void InitAudioCapturerModule(JSIValue exports); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c index 4afc7dec8..b0a66c82b 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c @@ -146,7 +146,7 @@ AudioSession AudioServiceAcquireAudioSessionId(void) bool AudioServiceSetVolume(AudioStreamType streamType, int32_t volume) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); if (volume < VOLUME_MIN || volume > VOLUME_MAX) { return false; } @@ -193,7 +193,7 @@ int32_t AudioServiceGetMaxVolume(AudioStreamType streamType) bool AudioServiceMute(AudioStreamType streamType) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); int32_t ret = StreamMgrSetMute(streamType, true); if (ret != AUDIO_SUCCESS) { return false; @@ -203,7 +203,7 @@ bool AudioServiceMute(AudioStreamType streamType) bool AudioServiceUnMute(AudioStreamType streamType) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); int32_t ret = StreamMgrSetMute(streamType, false); if (ret != AUDIO_SUCCESS) { return false; @@ -213,37 +213,37 @@ bool AudioServiceUnMute(AudioStreamType streamType) bool AudioServiceIsMute(AudioStreamType streamType) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrIsMute(streamType); } bool AudioServiceSetMasterMute(bool isMute) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrSetMasterMute(isMute); } bool AudioServiceIsMasterMute(void) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrIsMasterMute(); } bool AudioServiceSetMicrophoneMute(bool isMute) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrSetMicrophoneMute(isMute); } bool AudioServiceIsMicrophoneMute(void) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrIsMicrophoneMute(); } bool AudioServiceSetRingerMode(AudioRingMode mode) { - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); + CHK_FAILED_RETURN(g_audioSVCInited, true, false, "Audio Service not init"); return StreamMgrSetRingerMode(mode); } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c index 2cb89f0e4..70b90c0b7 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c @@ -343,7 +343,7 @@ static int32_t LoadAudioAdapter(const struct AudioAdapterDescriptor *descs, int3 ALOGE("Adapter name:%s InitAllPorts failed", (desc == NULL) ? "unknow" : desc->adapterName); manager->UnloadAdapter(manager, adapter); g_audioHalDesc.audioAdapterDesc[adapterIndex].audioAdapter = NULL; - continue; + return AUDIO_ERROR; } g_audioHalDesc.audioAdapterDesc[adapterIndex].desc = desc; adapterIndex++; diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c index 7afbb4af5..f54edead3 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c @@ -55,6 +55,10 @@ typedef struct { static InterruptMgrContext g_interruptMgrCtx; +static AudioStreamType g_notSupportHandleException[] = { + AUDIO_STREAM_VOICE_ASSISTANT, +}; + static int64_t GetNowTimeUs(void) { struct timeval tv; @@ -524,7 +528,7 @@ bool InterruptMgrCreateStream(AudioSession sessionID, const AudioStreamDescripto ALOGD("CreateStream interruptEl->isInterrupted:%d", interruptEl->isInterrupted); ALOGD("CreateStream interruptEl->sessionID:%d", interruptEl->sessionID); ALOGD("CreateStream interruptEl->streamType:0x%x", interruptEl->streamType); - if (!interruptEl->isInterrupted && interruptEl->sessionID == sessionID && + if (interruptEl->sessionID == sessionID && interruptEl->streamType == streamDesc->streamType) { /* 先把 streamDesc copy 到 streamDesc 中 */ interruptEl->routedStreamDesc.streamDesc = *streamDesc; @@ -889,6 +893,17 @@ int32_t InterruptMgrRemove(const InterruptElement *interruptEl) } return ret; } +static bool CheckStreamTypeSupportHandleException(AudioStreamType streamType) +{ + for (uint32_t i = 0; i < sizeof(g_notSupportHandleException) / + sizeof(g_notSupportHandleException[0]); i++) { + if (g_notSupportHandleException[i] == streamType) { + return false; + } + } + return true; +} + static void InterruptMgrHandleExceptionInner(List *list, bool isOutPut) { int64_t nowTimeUs = GetNowTimeUs(); @@ -915,7 +930,8 @@ static void InterruptMgrHandleExceptionInner(List *list, bool isOutPut) ALOGI("interruptToCreateTimeOutException:%d destroyToDeactiveTimeOutException:%d sessionID:%u streamType:0x%x", interruptToCreateTimeOutException, destroyToDeactiveTimeOutException, interruptEl->sessionID, interruptEl->streamType); - if (interruptToCreateTimeOutException || destroyToDeactiveTimeOutException) { + if ((interruptToCreateTimeOutException || destroyToDeactiveTimeOutException) && + CheckStreamTypeSupportHandleException(interruptEl->streamType)) { /* 栈顶 是 后台流,说明是被打断的应用 重新获取 interrupt,需要回调打断结束的信息 */ ResumeInterruptStream(interruptEl, list, isOutPut); it = ListIterErase(list, it); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c index 3c87f9250..6e6ccedf8 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c @@ -751,9 +751,12 @@ int32_t SetTrackMute(uintptr_t handle, bool mute) TrackHandleContext *context = (TrackHandleContext *)handle; CHK_NULL_RETURN(context, AUDIO_ERROR, "track handle is NULL"); // 状态 - if (context->state == IDLE || context->state == STOP) { + if (context->state == STOP) { ALOGE("track[%d] state is wrong, mute fail", context->streamId); return AUDIO_BAD_STATE; + } else if (context->state == IDLE) { + context->mute = mute; + return AUDIO_SUCCESS; } // 调南向 int32_t ret = context->render->volume.SetMute((AudioHandle)context->render, mute); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/CMakeLists.txt b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/CMakeLists.txt index c100f5221..4e4a3f6a8 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/CMakeLists.txt +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/CMakeLists.txt @@ -67,6 +67,10 @@ endif() false ) + set(AUTO_ADD_PATH + false + ) + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/media/${BOARD}_${APPLICATION}) build_component() diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp index c51fbbd8c..733262176 100644 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp @@ -43,7 +43,7 @@ const uint32_t GET_BUFFER_TIMEOUT_MS = 0u; const uint32_t RENDER_FULL_SLEEP_TIME_US = 10000u; // 1. waiting app response playback complete callback event // 2. waiting interval time for loop playback -const uint32_t RENDER_EOS_SLEEP_TIME_US = 1000000u; +const uint32_t RENDER_EOS_SLEEP_TIME_US = 3000000u; const uint32_t WAIT_BUFFER_EMPTY_SLEEP_TIME_US = 1000000u; const uint32_t DECODER_DEFAULT_WIDTH = 1920; const uint32_t DECODER_DEFAULT_HEIGHT = 1080; @@ -1101,6 +1101,11 @@ void PlayerControl::GetRenderFullSleepThresholdTime(AudioCodecFormat codecFormat void PlayerControl::DataSchPreProcess(PlayerControl *play, bool *isContinue) { + if (play->hasRenderAudioEos_) { + int32_t info = PLAYERCONTROL_ERROR_AUD_PLAY_FAIL; + play->EventCallback(PLAYERCONTROL_EVENT_ERROR, &info); + MEDIA_ERR_LOG("player waiting for the EOS callback timed out."); + } play->DoSeekIfNeed(); play->renderSleepTime_ = 0; @@ -1956,8 +1961,7 @@ int32_t PlayerControl::AyncSeek(int64_t seekTime) { CHECK_NULL_RETURN(playerSource_, HI_FAILURE, "playerSource_ nullptr"); int64_t seekTimeInMs = seekTime; - int32_t ret = DecoderAndSinkReset(); - CHECK_FAILED_RETURN(ret, HI_SUCCESS, ret, "DecoderAndSinkReset failed"); + int32_t ret = 0; ClearCachePacket(); if (fmtFileInfo_.s32UsedVideoStreamIndex != HI_DEMUXER_NO_MEDIA_STREAM) { ret = playerSource_->Seek(fmtFileInfo_.s32UsedVideoStreamIndex, seekTimeInMs, FORMAT_SEEK_MODE_BACKWARD_KEY); diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/CMakeLists.txt b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/CMakeLists.txt index 9adcab5cb..e1851a3d6 100644 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/CMakeLists.txt +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/CMakeLists.txt @@ -64,6 +64,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(LIBRARY_OUTPUT_PATH ${BIN_DIR}/${CHIP}/libs/media/${BOARD}_${APPLICATION}) build_component() diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp index e0f817497..a5c6d2a40 100644 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp @@ -508,6 +508,7 @@ JSIValue AudioModule::StreamTypeSetter(const JSIValue thisVal, const JSIValue *a } double streamType = JSI::ValueToNumber(args[0]); g_streamType = (AudioStreamType)streamType; + AudioPlayer::GetInstance()->SetStreamType(g_streamType); return JSI::CreateBoolean(true); } diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp index 5df5ed0fd..be612b5c5 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 @@ -314,6 +314,10 @@ bool AudioPlayer::Play() MEDIA_ERR_LOG("audio src is required."); return false; } + if (player_->SetAudioStreamType(streamType_) != 0) { + MEDIA_ERR_LOG("fail to SetAudioStreamType streamType = %x.", streamType_); + return false; + } if (player_->Play() != 0) { MEDIA_ERR_LOG("fail to play audio."); return false; @@ -515,11 +519,15 @@ bool AudioPlayer::SetVolume(double volume) bool AudioPlayer::SetStreamType(AudioStreamType streamType) { + streamType_ = streamType; + if (player_ == NULL || player_->IsPlaying()) { + MEDIA_ERR_LOG("player is NULL or not playing!"); + return false; + } if (player_->SetAudioStreamType(streamType) != 0) { MEDIA_ERR_LOG("fail to SetAudioStreamType streamType = %x.", streamType); return false; } - streamType_ = streamType; return true; } diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp index 4f5290bcf..12c82222d 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp @@ -699,6 +699,7 @@ static void PlayerStreamExit(SampleParam *sampleParam) sampleParam->taskAlive.store(false); if (!sampleParam->testSample.isStop) { MediaThreadSetDetach(sampleParam->playTask, true); + sampleParam->playTask = nullptr; } } 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 139a4d5f0..b3fd20955 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp @@ -192,27 +192,40 @@ static int32_t VideoPlay(MediaVideoPlay *videoPlay) return MEDIA_ERR; } videoPlay->player_->SetPlayerCallback(callback); - int32_t ret = videoPlay->player_->Play(); - if (ret != 0) { - MEDIA_ERR_LOG("play failed\n"); - (void)videoPlay->player_->Reset(); - (void)videoPlay->player_->Release(); - return MEDIA_ERR; - } - videoPlay->player_->EnableSingleLooping(videoPlay->isLoop_); + int32_t ret = 0; MediaMutexLock(videoPlay->mutex_); - videoPlay->isPlayed_ = true; - if (videoPlay->button_ != nullptr) { - videoPlay->button_->SetText("Pause"); + if (!videoPlay->isPause_) { + ret = videoPlay->player_->Play(); + if (ret != 0) { + goto EXIT; + } + videoPlay->player_->EnableSingleLooping(videoPlay->isLoop_); + if (videoPlay->button_ != nullptr) { + videoPlay->button_->SetText("Pause"); + } } + videoPlay->isPlayed_ = true; while (!videoPlay->isPlaybackCompleted_ && !videoPlay->isPlaybackStopped_ && !videoPlay->interruptHintStop_ && !videoPlay->playError_) { MediaThreadCondWait(videoPlay->cond_, videoPlay->mutex_); + if (videoPlay->isResume_) { + ret = videoPlay->player_->Play(); + if (ret != 0) { + goto EXIT; + } + videoPlay->isResume_ = false; + } } MediaMutexUnLock(videoPlay->mutex_); return 0; +EXIT: + MEDIA_ERR_LOG("play failed\n"); + (void)videoPlay->player_->Reset(); + (void)videoPlay->player_->Release(); + MediaMutexUnLock(videoPlay->mutex_); + return MEDIA_ERR; } static void VideoStopAndExit(MediaVideoPlay *videoPlay) @@ -419,6 +432,7 @@ void MediaVideoPlay::ResetVideoPlayState(void) isSyncExitMode_ = true; isPause_ = false; isPlayed_ = false; + isResume_ = false; } int32_t MediaVideoPlay::StartVideoPlay(void) @@ -427,6 +441,13 @@ int32_t MediaVideoPlay::StartVideoPlay(void) MEDIA_INFO_LOG("video play is not stop, can not start!"); return MEDIA_OK; } + + // prepare buffers which are used to playing video + LiteSurface* liteSurface = dynamic_cast(surface_); + if (liteSurface != nullptr) { + liteSurface->PrepareBuffers(); + } + isEntered_ = true; ResetVideoPlayState(); MediaThreadattr attr = { "VideoPlayThread", 0x2000, THREAD_SCHED_INVALID, 0, true }; @@ -446,15 +467,17 @@ int32_t MediaVideoPlay::StartVideoPlay(void) int32_t MediaVideoPlay::PauseVideoPlay(void) { MediaMutexLock(mutex_); - if (player_ == nullptr) { - MEDIA_ERR_LOG("can not pause play"); + if (!isEntered_ ||isPlaybackStopped_ || + isPlaybackCompleted_ || interruptHintStop_ || + isPause_) { + MEDIA_ERR_LOG("current state is invaild, can not pause play"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { - MEDIA_ERR_LOG("current state is stop, can not pause play"); + isPause_ = true; + if (player_ == nullptr || !isPlayed_ ) { MediaMutexUnLock(mutex_); - return MEDIA_ERR; + return MEDIA_OK; } int32_t ret = player_->Pause(); if (ret != MEDIA_OK) { @@ -462,7 +485,6 @@ int32_t MediaVideoPlay::PauseVideoPlay(void) MediaMutexUnLock(mutex_); return MEDIA_ERR; } - isPause_ = true; MediaMutexUnLock(mutex_); return ret; } @@ -470,40 +492,69 @@ int32_t MediaVideoPlay::PauseVideoPlay(void) int32_t MediaVideoPlay::ResumeVideoPlay(void) { MediaMutexLock(mutex_); - if (player_ == nullptr) { - MEDIA_ERR_LOG("can not resume play"); + if (!isEntered_ || isPlaybackStopped_ || + isPlaybackCompleted_ || interruptHintStop_ || + !isPause_) { + MEDIA_ERR_LOG("current state is invaild, can not resume play"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { - MEDIA_ERR_LOG("current state is stop, can not resume play"); + isPause_ = false; + if (player_ == nullptr || !isPlayed_) { + MediaMutexUnLock(mutex_); + return MEDIA_OK; + } + isResume_ = true; + MediaThreadCondSignal(cond_); + MediaMutexUnLock(mutex_); + return MEDIA_OK; +} + +int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) +{ + MediaMutexLock(mutex_); + if (player_ == nullptr) { + MEDIA_ERR_LOG("can not get dump info!"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - int32_t ret = player_->Play(); + int32_t ret = player_->DumpInfo(playerInfo); if (ret != MEDIA_OK) { - MEDIA_ERR_LOG("resume failed"); + MEDIA_ERR_LOG("get dump info failed"); MediaMutexUnLock(mutex_); return ret; } - isPause_ = false; MediaMutexUnLock(mutex_); return ret; } -int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) +int32_t MediaVideoPlay::SeekVideoPlay(int64_t mSeconds) { MediaMutexLock(mutex_); if (player_ == nullptr) { - MEDIA_ERR_LOG("can not get dump info!"); + MEDIA_ERR_LOG("can not seek!"); MediaMutexUnLock(mutex_); return MEDIA_ERR; } - int32_t ret = player_->DumpInfo(playerInfo); + int32_t ret = player_->Rewind(mSeconds, PLAYER_SEEK_CLOSEST_SYNC); if (ret != MEDIA_OK) { - MEDIA_ERR_LOG("get dump info failed"); + MEDIA_ERR_LOG("video player seek failed!"); + } + MediaMutexUnLock(mutex_); + return ret; +} + +int32_t MediaVideoPlay::GetCurrentPosition(int64_t *currentPosition) +{ + MediaMutexLock(mutex_); + if (player_ == nullptr) { + MEDIA_ERR_LOG("can not get current play position!"); MediaMutexUnLock(mutex_); - return ret; + return MEDIA_ERR; + } + int32_t ret = player_->GetCurrentTime(*currentPosition); + if (ret != MEDIA_OK) { + MEDIA_ERR_LOG("video player get current play position failed!"); } MediaMutexUnLock(mutex_); return ret; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h index 07d07f315..d1e689ab1 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h @@ -35,6 +35,8 @@ public: int32_t PauseVideoPlay(void); int32_t ResumeVideoPlay(void); int32_t GetDumpInfo(PlayerDebugInfo *playerInfo); + int32_t SeekVideoPlay(int64_t mSeconds); + int32_t GetCurrentPosition(int64_t *currentPosition); void SetVideoPlayLoop(bool isLoop); void SetSyncExitMode(bool isSyncExitMode); bool IsSyncExitMode(void); @@ -50,6 +52,7 @@ public: MediaThreadCondHandle cond_ = nullptr; MediaThreadIdHandle threadHandle_ = nullptr; UILabelButton *button_ = nullptr; + bool isResume_ = false; bool isPause_ = false; bool isPlayed_ = false; bool isLoop_ = true; diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c index ba0ba9cae..259abc32c 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/bluetooth/bluetooth_sub_port.c @@ -47,6 +47,8 @@ extern "C" { #define CAST_SND_PORT_NUM 1 +#define BT_DETACH_FAIL_RETRY_TIMES 3 + #define MAX_KEY_STR_LEN 10 #define MAX_BUF_LEN 1024 @@ -1322,19 +1324,37 @@ static int32_t AudioSDKStopInternal(const SubPortTrackContext *portTrackCtx) return MEDIA_HAL_OK; } +#if defined(BT_HAL_SUPPORT) && defined(SUPPORT_BREDR) +static int32_t BtDetachHandle(const SubPortTrackContext *portTrackCtx, bt_audio_port_params portParam) +{ + int32_t count = 0; + td_u32 btRet = MEDIA_HAL_OK; + while (count < BT_DETACH_FAIL_RETRY_TIMES) { + btRet = bt_detach_audio_port(portTrackCtx->btStreamHandle, &portParam); + if (btRet == MEDIA_HAL_OK) { + MEDIA_HAL_LOGI(MODULE_NAME, "bt detach audio port success!"); + return MEDIA_HAL_OK; + } + count++; + MEDIA_HAL_LOGE(MODULE_NAME, "bt detach audio port retry ret = %x, count: %d", count, btRet); + } + return MEDIA_HAL_ERR; +} +#endif + static int32_t BluetoothDetachInternal(const SubPortTrackContext *portTrackCtx) { + int32_t ret = MEDIA_HAL_OK; #if defined(BT_HAL_SUPPORT) && defined(SUPPORT_BREDR) if (portTrackCtx->isHandlePublicResource) { bt_audio_port_params portParam = {}; portParam.port_type = A2DP; portParam.share_mem_id = portTrackCtx->outputAdpHandle; - td_u32 btRet = bt_detach_audio_port(portTrackCtx->btStreamHandle, &portParam); - CHK_FAILED_NO_RETURN(btRet, MEDIA_HAL_OK, "bt detach audio port failed"); + ret = BtDetachHandle(portTrackCtx, portParam); } #endif MEDIA_HAL_LOGD(MODULE_NAME, "success"); - return MEDIA_HAL_OK; + return ret; } static int32_t AudioSDKDetachInternal(const SubPortTrackContext *portTrackCtx) @@ -2586,15 +2606,15 @@ static int32_t BluetoothAttach(SubPortContext *portCtx, SubPortTrackContext *por static int32_t BluetoothDetach(const SubPortContext *portCtx, const SubPortTrackContext *portTrackCtx) { + int32_t ret = MEDIA_HAL_OK; #if defined(BT_HAL_SUPPORT) && defined(SUPPORT_BREDR) bt_audio_port_params portParam = {}; portParam.port_type = A2DP; portParam.share_mem_id = portCtx->outputAdpHandle; - td_u32 btRet = bt_detach_audio_port(portTrackCtx->btStreamHandle, &portParam); - CHK_FAILED_RETURN(btRet, MEDIA_HAL_OK, MEDIA_HAL_ERR, "bt detach audio port failed"); + ret = BtDetachHandle(portTrackCtx, portParam); #endif MEDIA_HAL_LOGD(MODULE_NAME, "success"); - return MEDIA_HAL_OK; + return ret; } static int32_t SingletonResourceStartInternal(const SubPortContext *portCtx, SubPortTrackContext *portTrackCtx) diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/CMakeLists.txt b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/CMakeLists.txt index cfcab08ed..720263129 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/CMakeLists.txt +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/CMakeLists.txt @@ -67,6 +67,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/media/${BOARD}_${APPLICATION}/${OS}) build_component() diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c index 9b8305922..d56b3f2ea 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c @@ -504,7 +504,6 @@ static int32_t CheckParam(SubPortTrackInContext *portTrackInCtx, uint8_t *buffer MEDIA_HAL_LOGE(MODULE_NAME, "memcpy_s failed"); return MEDIA_HAL_ERR; } - int64_t sec = 0; int64_t nsec = 0; int32_t ret = MediaHalConvertUSecToSecAndNSec(audioStream.pts, &sec, &nsec); diff --git a/code/sdk/middleware/services/media/hal/camera/hw_camera/CMakeLists.txt b/code/sdk/middleware/services/media/hal/camera/hw_camera/CMakeLists.txt index 05ceec5bc..41afbba96 100644 --- a/code/sdk/middleware/services/media/hal/camera/hw_camera/CMakeLists.txt +++ b/code/sdk/middleware/services/media/hal/camera/hw_camera/CMakeLists.txt @@ -46,6 +46,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/media/${BOARD}_${APPLICATION}/${OS}) build_component() diff --git a/code/sdk/middleware/services/media/hal/format/CMakeLists.txt b/code/sdk/middleware/services/media/hal/format/CMakeLists.txt index 97b40f429..76a5c1375 100644 --- a/code/sdk/middleware/services/media/hal/format/CMakeLists.txt +++ b/code/sdk/middleware/services/media/hal/format/CMakeLists.txt @@ -68,6 +68,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/media/${BOARD}_${APPLICATION}/${OS}) build_component() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt index 93e14b5de..aa66f0041 100644 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt @@ -13,6 +13,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/drivers/drivers/driver/audio/include ) @@ -37,5 +38,7 @@ set(WHOLE_LINK set(MAIN_COMPONENT false ) - +set(AUTO_ADD_PATH + false +) build_component() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt index 0db1fa145..10e081bf4 100644 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt @@ -13,6 +13,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/drivers/drivers/driver/audio/include ) @@ -38,4 +39,8 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt index 762672d06..fb9cf6ae8 100644 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt @@ -13,6 +13,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/drivers/drivers/driver/audio/source/include ${CMAKE_SOURCE_DIR}/drivers/drivers/driver/audio/source/drv/include ${CMAKE_SOURCE_DIR}/drivers/drivers/driver/audio/source/core/common/include @@ -40,4 +41,8 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt index 03865a512..f17a6ddcd 100644 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt @@ -13,6 +13,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/middleware/utils/common_headers/drivers/gpu ${CMAKE_SOURCE_DIR}/middleware/chips/brandy/dfx/include ${CMAKE_SOURCE_DIR}/middleware/services/gpu/drv/include @@ -40,4 +41,8 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt index 86351c956..24df0d40a 100644 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt @@ -13,6 +13,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/middleware/utils ${CMAKE_SOURCE_DIR}/middleware/utils/nv/nv_storage_lib ${CMAKE_SOURCE_DIR}/middleware/utils/nv/nv_storage_app @@ -40,4 +41,8 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt index c23cf2f54..b1961b09c 100644 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt @@ -13,6 +13,7 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/middleware/utils/update/inner_include ) @@ -38,4 +39,8 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/middleware/utils/dfx/panic/private/panic.c b/code/sdk/middleware/utils/dfx/panic/private/panic.c index cfc45a757..d49011660 100644 --- a/code/sdk/middleware/utils/dfx/panic/private/panic.c +++ b/code/sdk/middleware/utils/dfx/panic/private/panic.c @@ -43,6 +43,8 @@ #ifdef CFG_DRIVERS_NANDFLASH #include "nandflash_config.h" #endif +#include "preserve.h" +#include "exception_dump.h" #define NON_OS_ENTER_MAX_NUM 8 #define MAX_STR_LEN 64 @@ -286,6 +288,7 @@ void panic_deal(panic_id_t origin, uint32_t code, uint32_t caller) nand_driver_init(SPEED_SLOW); set_trans_type(TRANS_BY_CPU_SINGLE_LINE); #if defined(SAVE_EXC_INFO) && (CONFIG_DFX_SUPPORT_FILE_SYSTEM == DFX_YES) + dump_all_to_file(); save_preserve_file_to_fs(); #endif #endif diff --git a/code/sdk/middleware/utils/dfx/preserve/public/preserve.h b/code/sdk/middleware/utils/dfx/preserve/public/preserve.h index 8ae1a8dbd..965c4c57d 100644 --- a/code/sdk/middleware/utils/dfx/preserve/public/preserve.h +++ b/code/sdk/middleware/utils/dfx/preserve/public/preserve.h @@ -118,6 +118,8 @@ void save_preserve_file_fs(void); void save_btram_file_to_fs(void); void save_btrace_file_to_fs(void); + +void save_preserve_file_to_fs(void); #endif /** * @} diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-cli/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-auto-ota-cli/libx_vfs_private.a index 9a69c8c79..a639a283a 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 f242a63ad..81da18b3c 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-fd230-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230-r/libx_vfs_private.a index 814210a82..90cd1c0d5 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a index 30cef4023..3af25317d 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22-r/libx_vfs_private.a index 814210a82..90cd1c0d5 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22/libx_vfs_private.a index 30cef4023..3af25317d 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lt22/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 814210a82..90cd1c0d5 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-u8-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-u8-r/libx_vfs_private.a new file mode 100644 index 000000000..90cd1c0d5 Binary files /dev/null and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-u8-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-u8/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-u8/libx_vfs_private.a new file mode 100644 index 000000000..3af25317d Binary files /dev/null and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-u8/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9-r/libx_vfs_private.a index 814210a82..90cd1c0d5 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9/libx_vfs_private.a index 30cef4023..3af25317d 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-w9/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 30cef4023..3af25317d 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 415030818..fbd8507e1 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 aca09f535..68cd64fd4 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 cbe84bd7b..f8270f1c2 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 195b52223..8d5a93daf 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 63124010f..f0b10fae6 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 8d53d7986..e7f061d80 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 cacbfe1fa..87aa51be4 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 145ef37fb..81f672633 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 70d8f4781..97e0837a1 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 5a8e9fa7e..ebe05dc02 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 f0d211ee4..1df93e57d 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 a2b09214d..910c73b74 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 29f78ced8..de0481720 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-fd230-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230-r/libfs_yaffs2.a index 5702adb2d..d02a59563 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a index d8ea3497d..0afcd5637 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22-r/libfs_yaffs2.a index 5702adb2d..d02a59563 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22/libfs_yaffs2.a index d8ea3497d..0afcd5637 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lt22/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 5702adb2d..d02a59563 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-u8-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-u8-r/libfs_yaffs2.a new file mode 100644 index 000000000..d02a59563 Binary files /dev/null and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-u8-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-u8/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-u8/libfs_yaffs2.a new file mode 100644 index 000000000..0afcd5637 Binary files /dev/null and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-u8/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9-r/libfs_yaffs2.a index 5702adb2d..d02a59563 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9/libfs_yaffs2.a index d8ea3497d..0afcd5637 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-w9/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 d8ea3497d..0afcd5637 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 55f51b21c..31c392d32 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 0d4a77c6f..73f31e0f2 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 548842ca6..0ac8232b3 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 2ca681e20..616883947 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 f82ffffc5..49128372e 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 224049d55..34f078ddf 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 e9e4ba9e4..e7711cd88 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 b8fb6fb18..5a189d38c 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 22f84d39b..0ae61a12b 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 ae19d6ab3..2a92401c5 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 36634269f..a208c1cc5 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a differ diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt index 673d8e8eb..8fefb41e1 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,11 +1,11 @@ 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 diff --git a/code/sdk/open_source/openharmony/base/security/appverify/CMakeLists.txt b/code/sdk/open_source/openharmony/base/security/appverify/CMakeLists.txt index 9b7c38feb..3c162681c 100644 --- a/code/sdk/open_source/openharmony/base/security/appverify/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/base/security/appverify/CMakeLists.txt @@ -3,10 +3,10 @@ set(MODULE_NAME "ohos") set(AUTO_DEF_FILE_ID TRUE) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/base ${ROOT_DIR}/open_source/mbedtls/mbedtls_v3.6.0/include ${ROOT_DIR}/open_source/openharmony/third_party/cJSON @@ -52,4 +52,8 @@ set(PRIVATE_DEFINES MBEDTLS_ALLOW_PRIVATE_ACCESS ) +set(AUTO_ADD_PATH + false +) + build_component() diff --git a/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h b/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h index 892af1d7e..f2f4e7459 100644 --- a/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h +++ b/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h @@ -44,6 +44,8 @@ extern "C" { #endif typedef bool (*TryToFreeImgCallback)(void); +typedef bool (*TryToFreeFontCacheCallback)(void); + /** * @brief Defines pointers to the memory driver functions. */ @@ -143,6 +145,8 @@ typedef struct { int32_t (*InvalidateCache)(BufferHandle* handle); void (*RegisterTryToFreeImgCallback)(TryToFreeImgCallback callback); + + void (*RegisterTryToFreeFontCacheCallback)(TryToFreeFontCacheCallback callback); } GrallocFuncs; /** diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt index 573a5b765..deb0d7194 100644 --- a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt @@ -105,6 +105,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(PUBLIC_DEFINES ) 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 af06f6ad3..e9e68829d 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 687c70a81..0e42f4dc4 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-fd230/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230/libams.a index acde21e35..41ab31357 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lt22/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lt22/libams.a index acde21e35..41ab31357 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lt22/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lt22/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-u8/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-u8/libams.a new file mode 100644 index 000000000..41ab31357 Binary files /dev/null and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-u8/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-w9/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-w9/libams.a index acde21e35..41ab31357 100644 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-w9/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-w9/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 acde21e35..41ab31357 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 05db49135..8f65cd1c4 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/brandy-auto-ota-cli/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-auto-ota-cli/libace.a index 156b3701f..9317060e9 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 59c8f2fd7..56918f0e6 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-fd230/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-fd230/libace.a index 04b5b7401..619e8fbb0 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-fd230/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-fd230/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-lt22/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-lt22/libace.a index 04b5b7401..619e8fbb0 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-lt22/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-lt22/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-u8/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-u8/libace.a new file mode 100644 index 000000000..619e8fbb0 Binary files /dev/null and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-u8/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-w9/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-w9/libace.a index 04b5b7401..619e8fbb0 100644 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-w9/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js-w9/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 04b5b7401..619e8fbb0 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 f1f1a1a50..5ea6a40a7 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/event_listener.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp index 1615474c2..662cfb3cd 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp @@ -256,7 +256,7 @@ bool ViewOnSwipeListener::OnDrag(UIView& view, const DragEvent& event) { UNUSED(view); UNUSED(event); - HILOG_DEBUG(HILOG_MODULE_ACE, "OnDrag received"); + // HILOG_DEBUG(HILOG_MODULE_ACE, "OnDrag received"); return isStopPropagation_; } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.h index 46303e3fa..6d35188b9 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.h @@ -71,13 +71,19 @@ public: direction_ = direction; } + void DeleteItem(const UIView *uiView); + + uint8_t GetDirection() + { + return direction_; + } + private: bool GenerateListItems(const JSValue descriptors, int16_t size); int16_t CalculateItemIndex(int16_t itemIndex) const; JSValue GetElement(int16_t listItemsIndex, int16_t index, bool &isFor) const; bool AddForDescriptorToList(JSValue descriptorOrElement, int16_t listItemsIndex) const; void InsertItem(JSValue nativeElement, UIView *uiView); - void DeleteItem(const UIView *uiView); void BuildItemViewTree(const JSValue element) const; ListItemValue *listItems_; ViewNativePair *headNode_; diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.cpp index 7c39599b3..579042c12 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.cpp @@ -25,11 +25,15 @@ namespace OHOS { namespace ACELite { const char * const ListComponent::FUNC_SCROLLTO = "scrollTo"; const char * const ListComponent::INDEX_SCROLLTO = "index"; +const char * const ListComponent::FUNC_SCROLLTO_END = "scrollToEnd"; +static uint16_t itemslenght = 0; + ListComponent::ListComponent(JSValue options, JSValue children, AppStyleManager *styleManager) : Component(options, children, styleManager) { SetComponentName(K_LIST); RegisterNamedFunction(FUNC_SCROLLTO, ListScrollTo); + RegisterNamedFunction(FUNC_SCROLLTO_END, ListScrollToEnd); list_.SetIntercept(true); #ifdef FEATURE_ROTATION_API RegisterNamedFunction(FUNC_ROTATION_NAME, HandleRotationRequest); @@ -153,6 +157,8 @@ void ListComponent::OnViewAttached() adapter_.SetDirection(list_.GetDirection()); // Step4. add children to list dynamically. list_.SetAdapter(&adapter_); + // init compute list height + ComputeListLength(); } bool ListComponent::UpdateForView() @@ -178,6 +184,8 @@ bool ListComponent::UpdateForView() // refresh the list, load new child dynamically in list. list_.RefreshList(); + // refresh list , recompute list height + ComputeListLength(); return true; } @@ -196,5 +204,37 @@ JSValue ListComponent::ListScrollTo(const JSValue func, const JSValue dom, } return UNDEFINED; } -} // namespace ACELite -} // namespace OHOS + +void ListComponent::ComputeListLength() +{ + itemslenght = 0; + for (uint16_t index = 0; index < adapter_.GetCount(); index++) { + UIView *view = adapter_.GetView(nullptr, index); + if (view != nullptr) { + if (adapter_.GetDirection() == UIList::VERTICAL) { + itemslenght += view->GetHeightWithMargin(); + } else { + itemslenght += view->GetWidthWithMargin(); + } + adapter_.DeleteItem(view); + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "List compent: ComputeListLength item view is null "); + } + } +} + +JSValue ListComponent::ListScrollToEnd( + const JSValue func, const JSValue dom, const JSValue args[], const jerry_length_t size) +{ + UIList *list = reinterpret_cast(ComponentUtils::GetViewFromBindingObject(dom)); + if (list != nullptr) { + if (itemslenght > list->GetHeight()) { + uint16_t listlenght = itemslenght - list->GetHeight(); + list->ScrollBy(-listlenght); + } + } + return UNDEFINED; +} + +} // namespace ACELite +} // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.h index 80dd7d2a9..41c3bc24a 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_component.h @@ -46,7 +46,10 @@ private: ListEventListener listEventListener_; static const char * const FUNC_SCROLLTO; static const char * const INDEX_SCROLLTO; + static const char * const FUNC_SCROLLTO_END; static JSValue ListScrollTo(const JSValue func, const JSValue dom, const JSValue args[], const jerry_length_t size); + static JSValue ListScrollToEnd(const JSValue func, const JSValue dom, const JSValue args[], const jerry_length_t size); + void ComputeListLength(); }; } // namespace ACELite } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp index c166a79cf..4bf175963 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp @@ -324,7 +324,8 @@ static void ExecuteSendMsgToJS(void *data) HILOG_INFO(HILOG_MODULE_ACE, "ExecuteSendMsgToJS type = %d flag = %d", type, flag); if (!flag) { if ((!CheckIsJsValueFunction(fail)) || (!CheckIsJsValueDefined(context))) { - HILOG_ERROR(HILOG_MODULE_ACE, "Error in ExecuteSendMsgToJS. Invalid params detected!"); + HILOG_ERROR(HILOG_MODULE_ACE, "ExecuteSendMsgToJS Callback or Context is nullptr!"); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); AdapterFree(msgBody); return; } @@ -333,7 +334,8 @@ static void ExecuteSendMsgToJS(void *data) OHOS::ACELite::JSI::ReleaseValue(dataInfo); } else { if ((!CheckIsJsValueDefined(context)) || (!CheckIsJsValueFunction(success))) { - HILOG_ERROR(HILOG_MODULE_ACE, "Error in ExecuteSendMsgToJS. Invalid params detected!"); + HILOG_ERROR(HILOG_MODULE_ACE, "ExecuteSendMsgToJS Callback or Context is nullptr!"); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); AdapterFree(msgBody); return; } @@ -638,7 +640,7 @@ JSIValue BaiduMapComponentModule::poi_nearby_search(const JSIValue thisVal, cons { HILOG_INFO(HILOG_MODULE_ACE, "poi_nearby_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "poi_nearby_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "poi_nearby_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI); poi_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -658,7 +660,7 @@ JSIValue BaiduMapComponentModule::route_riding_search(const JSIValue thisVal, co { HILOG_INFO(HILOG_MODULE_ACE, "route_riding_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "route_riding_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "route_riding_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH); route_riding_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -680,7 +682,7 @@ JSIValue BaiduMapComponentModule::route_walking_search(const JSIValue thisVal, c { HILOG_INFO(HILOG_MODULE_ACE, "route_walking_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "route_walking_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "route_walking_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH); route_walking_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -702,7 +704,7 @@ JSIValue BaiduMapComponentModule::route_transit_search(const JSIValue thisVal, c { HILOG_INFO(HILOG_MODULE_ACE, "route_transit_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "route_transit_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "route_transit_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH); route_transit_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -724,7 +726,7 @@ JSIValue BaiduMapComponentModule::auth_license(const JSIValue thisVal, const JSI { HILOG_INFO(HILOG_MODULE_ACE, "auth_license"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "auth_license : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "auth_license : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE); auth_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -745,7 +747,7 @@ JSIValue BaiduMapComponentModule::getGeolocation(const JSIValue thisVal, const J { HILOG_INFO(HILOG_MODULE_ACE, "getGeolocation"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "getGeolocation : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "getGeolocation : %s", data); ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION); geo_location_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); @@ -762,7 +764,7 @@ JSIValue BaiduMapComponentModule::naviInit(const JSIValue thisVal, const JSIValu { HILOG_INFO(HILOG_MODULE_ACE, "naviInit"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "naviInit : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "naviInit : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT); nav_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -934,7 +936,7 @@ JSIValue BaiduMapComponentModule::poi_sug_search(const JSIValue thisVal, const J { HILOG_INFO(HILOG_MODULE_ACE, "poi_sug_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "poi_sug_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "poi_sug_search : %s", data); ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH); poi_sug_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1033,7 +1035,7 @@ JSIValue BaiduMapComponentModule::Geocode_search(const JSIValue thisVal, const J { HILOG_INFO(HILOG_MODULE_ACE, "Geocode_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "Geocode_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "Geocode_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH); geocode_search_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1054,7 +1056,7 @@ JSIValue BaiduMapComponentModule::Regeocode_search(const JSIValue thisVal, const { HILOG_INFO(HILOG_MODULE_ACE, "Regeocode_search"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "Regeocode_search : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "Regeocode_search : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH); regeocode_search_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1078,7 +1080,7 @@ JSIValue BaiduMapComponentModule::Destroy_page(const JSIValue thisVal, const JSI { HILOG_INFO(HILOG_MODULE_ACE, "Destroy_page"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "Destroy_page : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "Destroy_page : %s", data); msg_center_vector_navi_req_destroy_page( MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_PAGE, data, strlen(data)); ace_free(data); @@ -1092,7 +1094,7 @@ JSIValue BaiduMapComponentModule::onBTConnect(const JSIValue thisVal, const JSIV { HILOG_INFO(HILOG_MODULE_ACE, "onBTConnect"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "onBTConnect : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "onBTConnect : %s", data); // success Callback & failed Callback ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED); bt_connect_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); @@ -1111,7 +1113,7 @@ JSIValue BaiduMapComponentModule::NaviDestroy(const JSIValue thisVal, const JSIV { HILOG_INFO(HILOG_MODULE_ACE, "exitNavigation"); char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "exitNavigation : %s \n", data); + HILOG_INFO(HILOG_MODULE_ACE, "exitNavigation : %s", data); msg_center_vector_navi_req_destroy_from_watch( MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_FROM_WATCH, data, strlen(data)); ace_free(data); @@ -1124,11 +1126,11 @@ JSIValue BaiduMapComponentModule::NaviDestroy(const JSIValue thisVal, const JSIV JSIValue BaiduMapComponentModule::StopAnswer(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) { HILOG_INFO(HILOG_MODULE_ACE, "StopAnswer"); - char *data = JSI::JsonStringify(args[0]); - HILOG_INFO(HILOG_MODULE_ACE, "StopAnswer : %s \n", data); - msg_center_xiaodu_send_stop_answer(MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_SEND_JS_EXIT, data, strlen(data)); - ace_free(data); - return JSI::CreateBoolean(true); + uint8_t data = (uint8_t)JSI::GetNumberProperty(args[0], "data"); + HILOG_INFO(HILOG_MODULE_ACE, "StopAnswer : %d", data); + uint32_t ret = msg_center_xiaodu_send_stop_answer( + MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_SEND_JS_EXIT, &data, sizeof(data)); + return (ret == ERRCODE_SUCC) ? JSI::CreateBoolean(true) : JSI::CreateBoolean(false); } JSIValue BaiduMapComponentModule::MapInit(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp index 4f3a16e7f..3fc7f1ddc 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp @@ -157,6 +157,7 @@ JSIValue DisplayModule::GetMode(const JSIValue thisVal, const JSIValue *args, ui } else { FailCallBack(thisVal, args[0], ret); } + JSI::ReleaseValue(result); return JSI::CreateUndefined(); } @@ -209,6 +210,7 @@ JSIValue DisplayModule::GetValue(const JSIValue thisVal, const JSIValue *args, u } else { FailCallBack(thisVal, args[0], ret); } + JSI::ReleaseValue(result); return JSI::CreateUndefined(); } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/geolocation_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/geolocation_module.cpp index 7c68d87a0..eb3e40afc 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/geolocation_module.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/geolocation_module.cpp @@ -51,12 +51,13 @@ JSIValue LocationModule::GetSupportCoordTypes(const JSIValue thisVal, const JSIV JSIValue result = JSI::CreateString(coordType); JSIValue rltArray = JSI::CreateArray(1); JSI::SetPropertyByIndex(rltArray, 0, result); + JSI::ReleaseValue(result); return rltArray; } JSIValue LocationModule::Unsubscribe(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) { - return JSI::CreateUndefined();; + return JSI::CreateUndefined(); } JSIValue LocationModule::Subscribe(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) @@ -74,7 +75,8 @@ JSIValue LocationModule::GetLocation(const JSIValue thisVal, const JSIValue *arg return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteGetLocation); } -JSIValue LocationModule::ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) +JSIValue LocationModule::ExecuteAsyncWork( + const JSIValue thisVal, const JSIValue *args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) { JSIValue undefValue = JSI::CreateUndefined(); if ((args == nullptr) || (argsNum == 0) || (JSI::ValueIsUndefined(args[0]))) { @@ -100,9 +102,9 @@ void LocationModule::ExecuteSubscribe(void* data) JSIValue args = params->args; JSIValue thisVal = params->thisVal; JSIValue result = JSI::CreateObject(); - char* coordType = JSI::GetStringProperty(args, COORD_TYPES_NAME); - if ( true ) - { + char *coordType = JSI::GetStringProperty(args, COORD_TYPES_NAME); + // This is the sample code which should be replaced by gnss API. + if (true) { JSI::SetNumberProperty(result, LONGITUDE_NAME, LONGITUDE); JSI::SetNumberProperty(result, LATITUDE_NAME, LATITUDE); JSI::SetNumberProperty(result, ALTITUDE_NAME, ALTITUDE); @@ -112,7 +114,7 @@ void LocationModule::ExecuteSubscribe(void* data) } else { FailCallBack(thisVal, args, -1); } - + JSI::ReleaseString(coordType); JSI::ReleaseValueList(args, thisVal, result, ARGS_END); delete params; } @@ -133,7 +135,7 @@ void LocationModule::ExecuteGetLocationType(void* data) JSI::SetNamedProperty(result, "types", typeArray); SuccessCallBack(thisVal, args, result); - JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + JSI::ReleaseValueList(args, thisVal, result, typeArray, LocationType, ARGS_END); delete params; } @@ -154,7 +156,7 @@ void LocationModule::ExecuteGetLocation(void* data) JSI::SetNumberProperty(result, ACCURACY_NAME, ACCURACY); JSI::SetNumberProperty(result, TIME_NAME, static_cast(TIME)); SuccessCallBack(thisVal, args, result); - + JSI::ReleaseString(coordType); JSI::ReleaseValueList(args, thisVal, result, ARGS_END); delete params; } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp index 6019eed54..6c47db112 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.cpp @@ -30,11 +30,12 @@ typedef struct : public OHOS::HeapBase { namespace OHOS { namespace ACELite { - -OHOS::ACELite::JSIValue key_successCallback = nullptr; -OHOS::ACELite::JSIValue key_callbackContext = nullptr; -OHOS::ACELite::JSIValue rotate_successCallback = nullptr; -OHOS::ACELite::JSIValue rotate_callbackContext = nullptr; +KeyNotifyCallback KeyInputModule::notifyCallback_ = nullptr; +OHOS::ACELite::JSIValue keyCallback = nullptr; +OHOS::ACELite::JSIValue rotateCallback = nullptr; +OHOS::ACELite::JSIValue context = nullptr; +OHOS::ACELite::JSIValue onClickCallback = nullptr; +OHOS::ACELite::JSIValue onPressCallback = nullptr; static bool CheckIsJsValueDefined(OHOS::ACELite::JSIValue jsValue) { @@ -94,16 +95,33 @@ static void ExecuteSendKeyMsgToJS(void *data) char *msgBody = params->msgBody; uint16_t status = params->status; - OHOS::ACELite::JSIValue callback = key_successCallback; - OHOS::ACELite::JSIValue context = key_callbackContext; - OHOS::ACELite::JSIValue dataInfo = OHOS::ACELite::JSI::CreateObject(); - OHOS::ACELite::JSI::SetStringProperty(dataInfo, "button", msgBody); - OHOS::ACELite::JSI::SetNumberProperty(dataInfo, "status", status); - OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; - OHOS::ACELite::JSI::CallFunction(callback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); - OHOS::ACELite::JSI::ReleaseValue(dataInfo); + OHOS::ACELite::JSI::SetStringProperty(dataInfo, "keyName", msgBody); + + switch (status) { + case InputDevice::STATE_PRESS: + if (onPressCallback != nullptr && context != nullptr) { + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(onPressCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + } + break; + case InputDevice::STATE_RELEASE: + if (onClickCallback != nullptr && context != nullptr) { + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(onClickCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + } + break; + default: + break; + } + if (keyCallback != nullptr && context != nullptr) { + OHOS::ACELite::JSI::SetNumberProperty(dataInfo, "status", status); + OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; + OHOS::ACELite::JSI::CallFunction(keyCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + } + + OHOS::ACELite::JSI::ReleaseValue(dataInfo); AdapterFree(msgBody); delete params; params = nullptr; @@ -120,99 +138,233 @@ static void ExecuteSendRotateMsgToJS(void *data) int16_t rotate = params->rotate; delete params; params = nullptr; - OHOS::ACELite::JSIValue callback = rotate_successCallback; - OHOS::ACELite::JSIValue context = rotate_callbackContext; OHOS::ACELite::JSIValue dataInfo = OHOS::ACELite::JSI::CreateObject(); OHOS::ACELite::JSI::SetNumberProperty(dataInfo, "rotate", rotate); OHOS::ACELite::JSIValue callbackArgv[OHOS::ACELite::ARGC_ONE] = {dataInfo}; - OHOS::ACELite::JSI::CallFunction(callback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); + OHOS::ACELite::JSI::CallFunction(rotateCallback, context, callbackArgv, OHOS::ACELite::ARGC_ONE); OHOS::ACELite::JSI::ReleaseValue(dataInfo); return; } -JSIValue KeyInputModule::setKeyListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +JSIValue KeyInputModule::SetKeyListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) { - ReleaseJsValue(key_callbackContext); - ReleaseJsValue(key_successCallback); + bool ret = false; + ReleaseKeyCallback(); if (argsNum > 0) { - key_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); - key_successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); - KeyListener::GetInstance()->SetRegister(true); + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + keyCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + if ((!JSI::ValueIsUndefined(keyCallback)) && JSI::ValueIsFunction(keyCallback)) { + ret = true; + } else { + HILOG_DEBUG(HILOG_MODULE_ACE, "setKeyListener: unset listener."); + } } else { - key_callbackContext = nullptr; - key_successCallback = nullptr; + HILOG_ERROR(HILOG_MODULE_ACE, "setKeyListener failed, argsNum is %d.", argsNum); } - return JSI::CreateBoolean(true); + return JSI::CreateBoolean(ret); +} + +void KeyInputModule::ReleaseKeyCallback() +{ + ReleaseJsValue(keyCallback); + keyCallback = nullptr; + return; } -JSIValue KeyInputModule::setRotateListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +JSIValue KeyInputModule::SetRotateListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) { - ReleaseJsValue(rotate_successCallback); - ReleaseJsValue(rotate_callbackContext); + bool ret = false; + ReleaseRotateCallbacks(); if (argsNum > 0) { - rotate_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); - rotate_successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); - RotateListener::GetInstance()->SetRegister(true); + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + rotateCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + if ((!JSI::ValueIsUndefined(rotateCallback)) && JSI::ValueIsFunction(rotateCallback)) { + RotateListener::GetInstance()->SetRegister(true); + ret = true; + // you could enable rotary encoder's driver here. + } else { + HILOG_DEBUG(HILOG_MODULE_ACE, "setRotateListener: unset listener."); + // you could disable rotary encoder's driver here. + } } else { - key_callbackContext = nullptr; - key_successCallback = nullptr; + HILOG_ERROR(HILOG_MODULE_ACE, "setRotateListener failed, argsNum is %d.", argsNum); + // you could disable rotary encoder's driver here. } - return JSI::CreateBoolean(true); + return JSI::CreateBoolean(ret); } -void KeyInputModule::OnDestroy() +void KeyInputModule::ReleaseRotateCallbacks() { - OHOS::ACELite::KeyListener::GetInstance()->SetRegister(false); OHOS::ACELite::RotateListener::GetInstance()->SetRegister(false); + ReleaseJsValue(rotateCallback); + rotateCallback = nullptr; + return; +} + +void OHOS::ACELite::KeyInputModule::SetNotifyKeyListener(KeyNotifyCallback callback) +{ + notifyCallback_ = callback; +} + +KeyNotifyCallback OHOS::ACELite::KeyInputModule::GetNotifyKeyListener(void) +{ + return notifyCallback_; +} + +void KeyInputModule::DefineProperty( + JSIValue target, const char *propName, JSIFunctionHandler getter, JSIFunctionHandler setter) +{ + JSPropertyDescriptor descriptor; + descriptor.getter = getter; + descriptor.setter = setter; + JSI::DefineNamedProperty(target, propName, descriptor); +} + +JSIValue KeyInputModule::OnClickSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + bool ret = false; + if (argsNum > 0) { + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + onClickCallback = OHOS::ACELite::JSI::AcquireValue(args[0]); + if (JSI::ValueIsUndefined(onClickCallback) || !JSI::ValueIsFunction(onClickCallback)) { + ReleaseOnClickCallbacks(); + } else { + ret = true; + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "OnClickSetter failed, argsNum is %d.", argsNum); + } + return JSI::CreateBoolean(ret); +} + +JSIValue KeyInputModule::OnClickGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + return (onClickCallback == nullptr) ? JSI::CreateUndefined() : onClickCallback; +} + +void KeyInputModule::ReleaseOnClickCallbacks() +{ + ReleaseJsValue(onClickCallback); + onClickCallback = nullptr; + return; +} + +JSIValue KeyInputModule::OnPressSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + bool ret = false; + if (argsNum > 0) { + context = OHOS::ACELite::JSI::AcquireValue(thisVal); + onPressCallback = OHOS::ACELite::JSI::AcquireValue(args[0]); + if (JSI::ValueIsUndefined(onPressCallback) || !JSI::ValueIsFunction(onPressCallback)) { + ReleaseOnPressCallbacks(); + } else { + ret = true; + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "OnPressSetter failed, argsNum is %d.", argsNum); + } + return JSI::CreateBoolean(ret); +} + +JSIValue KeyInputModule::OnPressGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) +{ + return (onPressCallback == nullptr) ? JSI::CreateUndefined() : onPressCallback; +} + +void KeyInputModule::ReleaseOnPressCallbacks() +{ + ReleaseJsValue(onPressCallback); + onPressCallback = nullptr; + return; +} + +void KeyInputModule::OnDestroy() +{ + // you could disable rotary encoder's driver here. + ReleaseKeyCallback(); + ReleaseRotateCallbacks(); + ReleaseOnClickCallbacks(); + ReleaseOnPressCallbacks(); + ReleaseJsValue(context); + context = nullptr; } void InitKeyInputModule(JSIValue exports) { - JSI::SetModuleAPI(exports, "setKeyListener", KeyInputModule::setKeyListener); - JSI::SetModuleAPI(exports, "setRotateListener", KeyInputModule::setRotateListener); + JSI::SetModuleAPI(exports, "setKeyListener", KeyInputModule::SetKeyListener); + JSI::SetModuleAPI(exports, "setRotateListener", KeyInputModule::SetRotateListener); + + KeyInputModule::DefineProperty(exports, "onClick", KeyInputModule::OnClickGetter, KeyInputModule::OnClickSetter); + KeyInputModule::DefineProperty(exports, "onPress", KeyInputModule::OnPressGetter, KeyInputModule::OnPressSetter); JSI::SetOnDestroy(exports, KeyInputModule::OnDestroy); } } // namespace ACELite } // namespace OHOS +bool OHOS::ACELite::KeyListener::HasRegister() +{ + if (keyCallback != nullptr || onClickCallback != nullptr || onPressCallback != nullptr) { + return true; + } + return false; +} + +void OHOS::ACELite::KeyListener::SendToJS(const KeyEvent &event) +{ + if (!OHOS::ACELite::KeyListener::HasRegister()) { + return; + } + + char *type = "UNKNOWN"; + switch (event.GetKeyId()) { + case static_cast(ZliteKeyCode::ZLITE_KEY_POWER): + type = "POWER"; + break; + case static_cast(ZliteKeyCode::ZLITE_KEY_FUNC): + type = "FUNCTION"; + break; + default: + break; + } + int32_t ret = KeySendMsgToJS(type, event.GetState()); + if (ret != 0) { + HILOG_ERROR(HILOG_MODULE_ACE, "KeyListener: OnKeyEvent send event error"); + } +} + void OHOS::ACELite::KeyListener::OnKeyEvent(const KeyEvent &event) { - if (OHOS::ACELite::KeyListener::hasRegister()) { - char *type; - switch (event.GetKeyId()) { - case static_cast(ZliteKeyCode::ZLITE_KEY_POWER): - type = "POWER"; - break; - default: - type = "UNKNOWN"; - break; - } - int32_t ret = KeySendMsgToJS(type, event.GetState()); - if (ret != 0) { - HILOG_ERROR(HILOG_MODULE_ACE, "KeyListener: OnKeyEvent send event error"); - } - } else { - switch (event.GetState()) { - case InputDevice::STATE_PRESS: - isPress_ = true; - break; - case InputDevice::STATE_LONG_PRESS: - isLongPress_ = true; - OnKeyLongPress(event); - break; - case InputDevice::STATE_RELEASE: - onRelease(event); - break; - default: - break; + // Prioritize handling notification events + KeyNotifyCallback notifyCallback = KeyInputModule::GetNotifyKeyListener(); + if (notifyCallback != nullptr) { + // If the upper layer does not notify, continue executing the JS event + if (notifyCallback(event.GetKeyId(), event.GetState())) { + return; } } + switch (event.GetState()) { + case InputDevice::STATE_PRESS: + isPress_ = true; + SendToJS(event); + break; + case InputDevice::STATE_LONG_PRESS: + isLongPress_ = true; + OnKeyLongPress(event); + break; + case InputDevice::STATE_RELEASE: + OnRelease(event); + break; + default: + break; + } } -void OHOS::ACELite::KeyListener::onRelease(const KeyEvent &event) +void OHOS::ACELite::KeyListener::OnRelease(const KeyEvent &event) { - if (isPress_ && !isLongPress_) { + if (OHOS::ACELite::KeyListener::HasRegister()) { + SendToJS(event); + } else if (isPress_ && !isLongPress_) { if (event.GetKeyId() == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { JsAppContext::GetInstance()->TerminateAbility(); } @@ -233,11 +385,12 @@ void OHOS::ACELite::KeyListener::OnKeyLongPress(const KeyEvent &event) void OHOS::ACELite::RotateListener::OnRotateEvent(const RotateEvent &event) { - if (OHOS::ACELite::RotateListener::hasRegister()) { - int ret = RotateSendMsgToJS(event.GetRotate()); - if (ret != 0) { - HILOG_ERROR(HILOG_MODULE_ACE, "RotateListener: OnRotateEvent send event error"); - } + if (!OHOS::ACELite::RotateListener::HasRegister()) { + return; + } + int ret = RotateSendMsgToJS(event.GetRotate()); + if (ret != 0) { + HILOG_ERROR(HILOG_MODULE_ACE, "RotateListener: OnRotateEvent send event error"); } } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h index 76d595aa9..1f4fd1df4 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/keyinput/keyinput.h @@ -13,6 +13,7 @@ #include "events/rotate_event.h" #include "dock/input_device.h" #include "common/key_code.h" +typedef bool (*KeyNotifyCallback)(uint16_t keyID, uint8_t state); namespace OHOS { namespace ACELite { @@ -20,9 +21,23 @@ class KeyInputModule : public MemoryHeap { public: KeyInputModule() = default; ~KeyInputModule() = default; - static JSIValue setKeyListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); - static JSIValue setRotateListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue SetKeyListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue SetRotateListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static void SetNotifyKeyListener(KeyNotifyCallback callback); + static KeyNotifyCallback GetNotifyKeyListener(void); + static void DefineProperty(JSIValue target, const char *propName, JSIFunctionHandler getter, JSIFunctionHandler setter); + static JSIValue OnClickGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue OnClickSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue OnPressGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); + static JSIValue OnPressSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); static void OnDestroy(); + +private: + static KeyNotifyCallback notifyCallback_; + static void ReleaseKeyCallback(); + static void ReleaseRotateCallbacks(); + static void ReleaseOnClickCallbacks(); + static void ReleaseOnPressCallbacks(); }; void InitKeyInputModule(JSIValue exports); @@ -37,21 +52,15 @@ public: void OnKeyEvent(const KeyEvent &event); - bool hasRegister() - { - return isRegister_; - } - void SetRegister(bool isRegister) - { - isRegister_ = isRegister; - } + bool HasRegister(); + + void SendToJS(const KeyEvent &event); private: - KeyListener() : isRegister_(false), isPress_(false), isLongPress_(false){}; + KeyListener() : isPress_(false), isLongPress_(false){}; ~KeyListener() = default; - void onRelease(const KeyEvent &event); + void OnRelease(const KeyEvent &event); void OnKeyLongPress(const KeyEvent &event); - bool isRegister_; bool isPress_; bool isLongPress_; }; @@ -66,7 +75,7 @@ public: void OnRotateEvent(const RotateEvent &event); - bool hasRegister() + bool HasRegister() { return isRegister_; } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/cjson_parser.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/cjson_parser.cpp index 1fb1af016..215ef4de2 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/cjson_parser.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/cjson_parser.cpp @@ -353,6 +353,21 @@ bool CJSONParser::ChangeLanguageFileName() languageFile = nullptr; } else { ACE_FREE(languageFile_); + char *fullPath = RelocateJSSourceFilePath(filePath_, languageFile); + if (!IsFileExisted(fullPath)) { + ACE_FREE(fullPath); + // If there is no specified language file, base.json will be used by default + fullPath = RelocateJSSourceFilePath(filePath_, "base.json"); + ACE_FREE(languageFile); + if (IsFileExisted(fullPath)) { + // If there is no specified language file, base.json will be used by default + languageFile = StringUtil::Copy("base.json"); + } else { + // If there is no specified language file base.json , en-US.json will be used by default + languageFile = StringUtil::Copy("en-US.json"); + } + } + ACE_FREE(fullPath); languageFile_ = languageFile; } return true; diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/sensor_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/sensor_module.cpp index 1847cd579..f8c3e9c2a 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/sensor_module.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/sensor_module.cpp @@ -89,6 +89,7 @@ void SensorModule::ExecuteSubscribeStepCounter(void* data) JSIValue result = JSI::CreateObject(); uint32_t steps = DEFAULT_STEPS; JSI::SetNumberProperty(result, STEPS, static_cast(steps)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, false); } else { @@ -109,6 +110,7 @@ void SensorModule::ExecuteSubscribeBarometer(void* data) JSIValue result = JSI::CreateObject(); uint32_t pressure = DEFAULT_PRESSURE; JSI::SetNumberProperty(result, PRESSURE, static_cast(pressure)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, false); } else { @@ -129,6 +131,7 @@ void SensorModule::ExecuteSubscribeHeartRate(void* data) JSIValue result = JSI::CreateObject(); uint32_t heartRate = DEFAULT_HEARTRATE; JSI::SetNumberProperty(result, HEARTRATE, static_cast(heartRate)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, false); } else { @@ -149,6 +152,7 @@ void SensorModule::ExecuteSubscribeOnBodyState(void* data) JSIValue result = JSI::CreateObject(); bool value = DEFAULT_ISONBODY; JSI::SetBooleanProperty(result, ISONBODY, static_cast(value)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, false); } else { @@ -169,6 +173,7 @@ void SensorModule::ExecuteGetOnBodyState(void* data) JSIValue result = JSI::CreateObject(); bool value = DEFAULT_ISONBODY; JSI::SetBooleanProperty(result, ISONBODY, static_cast(value)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, true); } else { @@ -194,11 +199,13 @@ void SensorModule::ExecuteSubscribeAccelerometer(void* data) JSI::SetNumberProperty(result, "x", static_cast(coordinate_x)); JSI::SetNumberProperty(result, "y", static_cast(coordinate_y)); JSI::SetNumberProperty(result, "z", static_cast(coordinate_x)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, false); } else { FailCallBack(thisVal, args, -1, false); } + JSI::ReleaseString(interval); JSI::ReleaseValueList(args, thisVal, result, ARGS_END); delete params; } @@ -219,16 +226,19 @@ void SensorModule::ExecuteSubscribeGyroscope(void* data) JSI::SetNumberProperty(result, "x", static_cast(coordinate_x)); JSI::SetNumberProperty(result, "y", static_cast(coordinate_y)); JSI::SetNumberProperty(result, "z", static_cast(coordinate_x)); + // This is the sample code which should be replaced by gnss API. if (true) { SuccessCallBack(thisVal, args, result, false); } else { FailCallBack(thisVal, args, -1, false); } + JSI::ReleaseString(interval); JSI::ReleaseValueList(args, thisVal, result, ARGS_END); delete params; } -JSIValue SensorModule::ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) +JSIValue SensorModule::ExecuteAsyncWork( + const JSIValue thisVal, const JSIValue *args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) { JSIValue undefValue = JSI::CreateUndefined(); if ((args == nullptr) || (argsNum == 0) || (JSI::ValueIsUndefined(args[0]))) { diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/vibrator_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/vibrator_module.cpp index ff05e1c1a..987ced5c1 100644 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/vibrator_module.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/vibrator_module.cpp @@ -34,7 +34,8 @@ JSIValue VibratorModule::Vibrate(const JSIValue thisVal, const JSIValue *args, u return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteVibrate); } -JSIValue VibratorModule::ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) +JSIValue VibratorModule::ExecuteAsyncWork( + const JSIValue thisVal, const JSIValue *args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) { JSIValue undefValue = JSI::CreateUndefined(); if ((args == nullptr) || (argsNum == 0) || (JSI::ValueIsUndefined(args[0]))) { @@ -67,7 +68,7 @@ void VibratorModule::ExecuteVibrate(void* data) } else { FailCallBack(thisVal, args, -1); } - + JSI::ReleaseString(mode); JSI::ReleaseValueList(args, thisVal, result, ARGS_END); delete params; } diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt index 82a382278..942763070 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt @@ -18,6 +18,7 @@ set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/base ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include + ${ROOT_DIR}/open_source/openharmony/base/security/appverify/include ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include @@ -90,6 +91,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(PUBLIC_DEFINES ) @@ -177,6 +182,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(PUBLIC_DEFINES ) 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 d31affb9d..bf4d76fe5 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 f39f40fed..a2b70c382 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-fd230/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230/libbms.a index fefcdf2e3..f1d031d5e 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lt22/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lt22/libbms.a index fefcdf2e3..f1d031d5e 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lt22/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lt22/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-u8/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-u8/libbms.a new file mode 100644 index 000000000..f1d031d5e Binary files /dev/null and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-u8/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-w9/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-w9/libbms.a index fefcdf2e3..f1d031d5e 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-w9/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-w9/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 fefcdf2e3..f1d031d5e 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 ea35faa18..6cfb8f2f7 100644 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h index 78c3d95bb..11b26a66a 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/appexecfwk_errors.h @@ -216,6 +216,9 @@ enum AppexecfwkErrors { /** Failed to parse the label of the ability. */ ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_LABEL_ERROR, + /** Failed to parse the srcPath of the ability. */ + ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_SRCPATH_ERROR, + /** Failed to parse the description of the ability. */ ERR_APPEXECFWK_INSTALL_FAILED_PARSE_ABILITY_DESCRIPTION_ERROR, diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h index 3ca315402..c2553c2cd 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/bundle_common.h @@ -100,6 +100,7 @@ const char PROFILE_KEY_MODULE_ABLLITY_DESCRIPTION[] = "description"; const char PROFILE_KEY_MODULE_ABILITY_LABEL[] = "label"; const char PROFILE_KEY_MODULE_ABILITY_ICON[] = "icon"; const char PROFILE_KEY_MODULE_ABILITY_TYPE[] = "type"; +const char PROFILE_KEY_MODULE_ABILITY_SRCPATH[] = "srcPath"; const char PROFILE_KEY_MODULE_ABILITY_LAUNCHTYPE[] = "launchType"; const char PROFILE_KEY_MODULE_ABILITY_VISIBLE[] = "visible"; const char PROFILE_KEY_MODULE_ABILITY_DEVICE_CAP[] = "deviceCapability"; @@ -157,7 +158,13 @@ const char JSON_PATH[] = APP_BASE_DIR"user/ace/etc/bundles/"; const char JSON_PATH_NO_SLASH_END[] = APP_BASE_DIR"user/ace/etc/bundles"; // store bundle permissions for IAM const char PERMISSIONS_PATH[] = APP_BASE_DIR"user/ace/etc/permissions"; +// Original IDE version const char ASSET_JS_PATH[] = "/assets/js/default"; +// IDE version 5.0 and above +const char ASSET_JS_PATH_MAIN[] = "/assets/js/MainAbility"; +// IDE version below 5.0 +const char ASSET_JS_PATH_DEFAULT[] = "/assets/js/default"; +const char ASSET_PATH[] = "/assets/js/"; const char ICON_NAME[] = "/icon.bin"; const char SMALL_ICON_NAME[] = "/icon_small.bin"; const char DEFAULT_ICON_SETTING[] = "$media:icon"; @@ -172,7 +179,7 @@ const uint8_t LONG_LENGTH = 8; const uint16_t MAX_INT = 256; const uint8_t MAX_VERSION_NAME_LEN = 20; const uint8_t MAX_LABLE_LEN = 30; -const uint8_t MAX_THIRD_BUNDLE_NUMBER = 30; +const uint8_t MAX_THIRD_BUNDLE_NUMBER = 60; struct SignatureInfo { char *bundleName; @@ -227,6 +234,7 @@ struct BundleProfile { char *vendor; char *label; char *iconPath; + char *srcPath; ProfileVersion profileVersion; ProfileApiVersion profileApiVersion; ModuleInfo moduleInfo; diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h index 7afeaf57d..0e9fd02a2 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_installer.h @@ -69,7 +69,7 @@ private: uint8_t SwitchErrorCode(int32_t errorCode); uint8_t AddBundleResList(const char *bundleName, uint32_t labelId, uint32_t iconId); uint8_t MoveRawFileToDataPath(const BundleInfo *bundleInfo); - uint8_t TransformJsToBc(const char *codePath, InstallRecord &record); + uint8_t TransformJsToBc(const char *codePath, InstallRecord &record, char *jsPath); }; #define FREE_PRO_RESOURCE(fp, permissions, bundleInfo) \ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h index d9f5eec50..de9e3c9ac 100644 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h @@ -105,7 +105,7 @@ private: void APP_QueryAppInfo(const char *appDir, AppInfoList *list); void APP_InsertAppInfo(char *filePath, AppInfoList *list); void APP_FreeAllAppInfo(const AppInfoList *list); - void InstallPreBundle(List systemPathList, InstallerCallback installerCallback); + void InstallPreBundle(List &systemPathList, InstallerCallback installerCallback); GtBundleInstaller *installer_; BundleMap *bundleMap_; diff --git a/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h b/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h index 96041d0e9..6d1c9178e 100644 --- a/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h +++ b/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h @@ -10,7 +10,6 @@ #include #include "jsi.h" -#include "audio_capturer.h" #ifdef __cplusplus extern "C" { @@ -45,6 +44,11 @@ public: * Stop */ static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + handle exception + */ + static void ExceptionStop(void); }; void InitAudioCapturerModule(JSIValue exports); diff --git a/code/sdk/open_source/openharmony/third_party/freetype/CMakeLists.txt b/code/sdk/open_source/openharmony/third_party/freetype/CMakeLists.txt index e1a1184da..eeff068a8 100644 --- a/code/sdk/open_source/openharmony/third_party/freetype/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/third_party/freetype/CMakeLists.txt @@ -56,6 +56,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + build_component() install_sdk(${CMAKE_CURRENT_SOURCE_DIR} "*") diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt b/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt index a0dc84a92..d8e269378 100644 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt @@ -277,6 +277,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(PUBLIC_DEFINES ) 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 251087f83..1dfc9c9d0 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 19c5bebed..04b6781a9 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-fd230/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-fd230/libjerryscript.a index 6c7862789..36966a22d 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-fd230/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-fd230/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-lt22/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-lt22/libjerryscript.a index 6c7862789..36966a22d 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-lt22/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-lt22/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-u8/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-u8/libjerryscript.a new file mode 100644 index 000000000..36966a22d Binary files /dev/null and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-u8/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-w9/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-w9/libjerryscript.a index 6c7862789..36966a22d 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-w9/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-w9/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 6c7862789..36966a22d 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 22d22434f..6b2fc571e 100644 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp index 439832093..2f6f2359b 100644 --- a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp @@ -71,19 +71,29 @@ int GetFullPath(const char* uri, char* fullPath, int len) JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag = false) { - JSIValue undefValue = JSI::CreateUndefined(); - if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { - return undefValue; - } - FuncParams* params = new(std::nothrow) FuncParams(); - if (params == nullptr) { - return undefValue; + JSIValue retValue = JSI::CreateUndefined(); + + if (args != nullptr && argsNum > 0 && NativeapiCommon::IsValidJSIValue(args, argsNum)) { + FuncParams* params = new(std::nothrow) FuncParams(); + if (params != nullptr) { + params->thisVal = JSI::AcquireValue(thisVal); + params->args = JSI::AcquireValue(args[0]); + params->flag = flag; + + bool isSuccess = JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + if (!isSuccess) { + JSI::ReleaseValue(params->thisVal); + JSI::ReleaseValue(params->args); + delete params; + retValue = JSI::CreateErrorWithCode(-1, "Async work dispatch failed"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Failed to allocate FuncParams"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Invalid arguments"); } - params->thisVal = JSI::AcquireValue(thisVal); - params->args = JSI::AcquireValue(args[0]); - params->flag = flag; - JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); - return undefValue; + return retValue; } void ExecuteCopyFile(void* data) diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp index b7c4676e6..2e4c00933 100644 --- a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp @@ -99,21 +99,31 @@ int DeleteValueInner(const char* dataPath, const char* key) } JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, - uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag) + uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag = false) { - JSIValue undefValue = JSI::CreateUndefined(); - if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { - return undefValue; - } - FuncParams* params = new(std::nothrow) FuncParams(); - if (params == nullptr) { - return undefValue; + JSIValue retValue = JSI::CreateUndefined(); + + if (args != nullptr && argsNum > 0 && NativeapiCommon::IsValidJSIValue(args, argsNum)) { + FuncParams* params = new(std::nothrow) FuncParams(); + if (params != nullptr) { + params->thisVal = JSI::AcquireValue(thisVal); + params->args = JSI::AcquireValue(args[0]); + params->flag = flag; + + bool isSuccess = JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + if (!isSuccess) { + JSI::ReleaseValue(params->thisVal); + JSI::ReleaseValue(params->args); + delete params; + retValue = JSI::CreateErrorWithCode(-1, "Async work dispatch failed"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Failed to allocate FuncParams"); + } + } else { + retValue = JSI::CreateErrorWithCode(-1, "Invalid arguments"); } - params->thisVal = JSI::AcquireValue(thisVal); - params->args = JSI::AcquireValue(args[0]); - params->flag = flag; - JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); - return undefValue; + return retValue; } void ExecuteGet(void* data) diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c index 7702abc24..bd9a03a1e 100644 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c @@ -13,6 +13,7 @@ #include "bts_le_gap.h" #include "bts_feature.h" #include "bts_a2dp_source.h" +#include "bts_spp.h" #include "bts_br_gap.h" #include "bts_avrcp_controller.h" #include "sample_common.h" @@ -68,6 +69,7 @@ typedef enum { BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, /* 35 设置inquiry参数 */ BTSRV_SAMPLE_GAP_SET_SERVICE_TASK_PRIORITY, /* 36 设置BT_SERVICE_TASK优先级 */ BTSRV_SAMPLE_GAP_SET_FLOW_LIMIT, /* 37 设置流控限制字节数 */ + BTSRV_SAMPLE_GAP_SET_SPP_WRITE_RETRY_MAX, /* 38 设置spp写入重试最大次数 */ } btsrv_gap_sample_cmd_id; typedef enum { @@ -1231,6 +1233,17 @@ static void btsrv_sample_cmd_set_flow_limit(const char **params, int32_t params_ bts_sample_log("bts set flow limit ret:0x%x limit:%d\n", ret, flow_limit); } +static void btsrv_sample_cmd_set_spp_write_retry_max(const char **params, int32_t params_cnt) +{ + if (params_cnt != 1) { /* 1:参数个数 */ + bts_sample_log("params_cnt error! need one param!\n"); + return; + } + uint32_t retry_max = (uint32_t)atoi(params[0]); + errcode_t ret = spp_write_retry_times_config(retry_max); + bts_sample_log("bts set spp write retry max ret:0x%x max:%u\n", ret, retry_max); +} + btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { /* 0 */ { BTSRV_SAMPLE_GAP_ENABLE_BLE, btsrv_sample_cmd_enable_ble }, @@ -1286,6 +1299,7 @@ btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { { BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, btsrv_sample_cmd_set_filter_device_class }, { BTSRV_SAMPLE_GAP_SET_SERVICE_TASK_PRIORITY, btsrv_sample_cmd_set_service_task_priority}, { BTSRV_SAMPLE_GAP_SET_FLOW_LIMIT, btsrv_sample_cmd_set_flow_limit}, + { BTSRV_SAMPLE_GAP_SET_SPP_WRITE_RETRY_MAX, btsrv_sample_cmd_set_spp_write_retry_max}, }; void btsrv_gap_sample_cmd(uint32_t cmd_id, const char **params, int32_t params_cnt) diff --git a/code/sdk/tools/bin/xts_tools/PCID.json b/code/sdk/tools/bin/xts_tools/PCID.json new file mode 100644 index 000000000..5f364f7c3 --- /dev/null +++ b/code/sdk/tools/bin/xts_tools/PCID.json @@ -0,0 +1,9 @@ +{ + "api_version": 0, + "manufacturer_id": 0, + "system_type": "mini", + "syscap": { + "os": ["SystemCapability.Developtools.Syscap", "SystemCapability.Security.Cipher", "SystemCapability.Security.Huks.Core", "SystemCapability.Security.Huks.Extension"], + "private": [] + } +} diff --git a/code/sdk/tools/bin/xts_tools/PCID.sc b/code/sdk/tools/bin/xts_tools/PCID.sc new file mode 100644 index 000000000..fea83e049 Binary files /dev/null and b/code/sdk/tools/bin/xts_tools/PCID.sc differ diff --git a/code/sdk/tools/bin/xts_tools/syscap_tool_bin/syscap_tool b/code/sdk/tools/bin/xts_tools/syscap_tool_bin/syscap_tool new file mode 100644 index 000000000..f32ca1a0b Binary files /dev/null and b/code/sdk/tools/bin/xts_tools/syscap_tool_bin/syscap_tool differ diff --git a/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/CMakeLists.txt b/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/CMakeLists.txt index 3d62d7961..e4b4b08cb 100644 --- a/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/CMakeLists.txt +++ b/code/sdk/vendor/alipay_sdk/alipay_sec_sdk_v3.0.0/soc/CMakeLists.txt @@ -58,6 +58,10 @@ set(MAIN_COMPONENT false ) +set(AUTO_ADD_PATH + false +) + set(PUBLIC_DEFINES ) diff --git a/jsapp/keyinput_sample/.gitignore b/jsapp/keyinput_sample/.gitignore new file mode 100644 index 000000000..82dc42bd4 --- /dev/null +++ b/jsapp/keyinput_sample/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +/entry/.preview +.cxx diff --git a/jsapp/keyinput_sample/build.gradle b/jsapp/keyinput_sample/build.gradle new file mode 100644 index 000000000..5e5275d7b --- /dev/null +++ b/jsapp/keyinput_sample/build.gradle @@ -0,0 +1,38 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.4.2' + classpath 'com.huawei.ohos:decctest:1.2.4.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } +} diff --git a/jsapp/keyinput_sample/entry/.gitignore b/jsapp/keyinput_sample/entry/.gitignore new file mode 100644 index 000000000..3543521e9 --- /dev/null +++ b/jsapp/keyinput_sample/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/jsapp/keyinput_sample/entry/build.gradle b/jsapp/keyinput_sample/entry/build.gradle new file mode 100644 index 000000000..e61770fa0 --- /dev/null +++ b/jsapp/keyinput_sample/entry/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + testImplementation 'junit:junit:4.13' +} +decc { + supportType = ['html','xml'] +} diff --git a/jsapp/keyinput_sample/entry/proguard-rules.pro b/jsapp/keyinput_sample/entry/proguard-rules.pro new file mode 100644 index 000000000..f7666e475 --- /dev/null +++ b/jsapp/keyinput_sample/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/config.json b/jsapp/keyinput_sample/entry/src/main/config.json new file mode 100644 index 000000000..e3933c991 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/config.json @@ -0,0 +1,40 @@ +{ + "app": { + "bundleName": "com.example.keyinput_sample", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "deviceType": [ + "liteWearable" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "name": "default", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "type": "page" + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/keyinput/keyinput", + "pages/list_scrollToEnd/list_scrollToEnd", + "pages/rotation/rotation" + ], + "name": "default" + } + ] + } +} \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/app.js b/jsapp/keyinput_sample/entry/src/main/js/default/app.js new file mode 100644 index 000000000..6d060ffe5 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/i18n/en-US.json b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/i18n/zh-CN.json b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..8d369c9d7 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,42 @@ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} + +.listcontainer{ + width: 80%; + height: 60%; + justify-content: center; + align-items: center; + background-color: black; + flex-direction: column; +} + +.listitem{ + width: 100%; + height: 80px; + flex-direction: column; + background-color: black; + justify-content: center; +} + +.btn{ + width: 100%; + height: 70px; + font-size: 24px; + text-align:center; + text-align-vertical: center; + color: black; + background-color: grey; +} + diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..41b2076f4 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,7 @@ +
+ + + {{$item.title}} + + +
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..8a875e646 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,30 @@ +import app from "@system.app" +import router from '@system.router'; + +export default { + data: { + pages: [ + { + title: "keyinput Listener", + path: "pages/keyinput/keyinput" + }, + { + title: "List scrollToEnd", + path: "pages/list_scrollToEnd/list_scrollToEnd" + } + ] + }, + onShow() { + + }, + onClick(item){ + router.replace({ + uri:item, + }) + }, + swipe(e){ + if (e.direction == "right" && e.distance > 200) { + app.terminate() + } + } +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.css new file mode 100644 index 000000000..3ef4e822c --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.css @@ -0,0 +1,12 @@ +.container { + width: 454px; + height: 454px; + justify-content: center; + align-items: center; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.hml new file mode 100644 index 000000000..cd062ec03 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.hml @@ -0,0 +1,5 @@ +
+ + register KeyListener & RotateListener + +
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.js new file mode 100644 index 000000000..60c9e5f3d --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/keyinput/keyinput.js @@ -0,0 +1,31 @@ +import key from '@system.keyinput'; +import router from '@system.router'; + +function Rotatecallback(data) { + console.info("Rotatecallback : " + JSON.stringify(data)) +} + +export default { + data: { + Test:"Test" + }, + onShow() { + let that = this + key.setKeyListener({ + "callback": function(data){ + console.info("Keycallback data : "+JSON.stringify(data)+" Test : "+that.Test) + } + }) + key.setRotateListener({ + "callback": Rotatecallback + }) + }, + swipe(e){ + console.info(" swipe "+JSON.stringify(e)) + if (e.direction == "right") { + router.replace({ + uri: 'pages/index/index', + }) + } + } +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.css new file mode 100644 index 000000000..7a53bddbb --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.css @@ -0,0 +1,37 @@ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; +} + +.listcontainer{ + width: 80%; + height: 60%; + justify-content: center; + align-items: center; + background-color: pink; + flex-direction: column; +} + +.listitem{ + width: 100%; + flex-direction: column; + background-color: green; +} + +.btn{ + width: 100%; + font-size: 24px; + text-align:left; + color: black; + background-color: grey; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.hml new file mode 100644 index 000000000..412c99799 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.hml @@ -0,0 +1,9 @@ +
+
+ + + {{$item}} + + +
+
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.js new file mode 100644 index 000000000..d243142f1 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/list_scrollToEnd/list_scrollToEnd.js @@ -0,0 +1,39 @@ +import router from '@system.router'; + +export default { + data: { + isShow:true, + todolist: [ + "add list item 1", + ], + listid:0, + scrollid:0 + }, + onShow() { + this.listid = setInterval(() => { + if (this.todolist[0].length < 1050) { + console.info(" this.todolist[0].length < 1050 ") + let temp = this.todolist[0] + "add list item 1"; + this.todolist[0] = temp; + this.todolist = this.todolist; + } else { + console.info(" this.todolist[0].length > 1050 ") + } + }, 2500) + this.scrollid = setInterval(() => { + const list = this.$refs.list; + list.scrollToEnd(this.code); + }, 1000) + }, + swipe(e) { + if (e.direction == "right" && e.distance > 200) { + router.replace({ + uri: 'pages/index/index', + }) + } + }, + onHide(){ + clearInterval(this.listid); + clearInterval(this.scrollid); + } +} diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.css b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.css new file mode 100644 index 000000000..77816c988 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.css @@ -0,0 +1,9 @@ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + display: flex; + flex-direction: row; +} + diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.hml b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.hml new file mode 100644 index 000000000..8384a9e16 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.hml @@ -0,0 +1,20 @@ +
+ + + + {{$item.title}} 111 + + + +
+ 1 +
+
+ 2 +
+
+ 3 +
+
+ +
diff --git a/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.js b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.js new file mode 100644 index 000000000..e90911fe8 --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/js/default/pages/rotation/rotation.js @@ -0,0 +1,78 @@ +import router from '@system.router'; + +export default { + data: { + picker_data: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"], + todolist: [ + { + title: 'aaa', + }, + { + title: 'bbb' + }, + { + title: 'ccc' + }, + { + title: 'ddd' + }, + { + title: 'eee' + }, + { + title: 'fff' + }, + { + title: 'ggg' + }, + { + title: 'hhh' + }, + { + title: 'iii' + }, + { + title: 'jjj' + }, + { + title: 'kkk' + }, + ], + }, + fun_list() { + console.info("fun_list") + const list = this.$refs.list; + list.rotation({ + "focus": true + }) + }, + fun_pickerview() { + console.info("fun_pickerview") + const pickerview = this.$refs.pickerview; + pickerview.rotation({ + "focus": true + }) + }, + fun_swiper() { + console.info("fun_pickerview") + const swiper = this.$refs.swiper; + swiper.rotation({ + "focus": true + }) + }, + fun_slider() { + console.info("fun_slider") + const slider = this.$refs.slider; + slider.rotation({ + "focus": true + }) + }, + swipe(e) { + if (e.direction == "right" && e.distance > 200) { + router.replace({ + uri: 'pages/index/index', + }) + } + } +} + diff --git a/jsapp/keyinput_sample/entry/src/main/resources/base/element/string.json b/jsapp/keyinput_sample/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..2be18c1ab --- /dev/null +++ b/jsapp/keyinput_sample/entry/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + } + ] +} diff --git a/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon.png b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon.png new file mode 100644 index 000000000..ce307a882 Binary files /dev/null and b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon.png differ diff --git a/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon_small.png b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon_small.png new file mode 100644 index 000000000..0ed5fea2d Binary files /dev/null and b/jsapp/keyinput_sample/entry/src/main/resources/base/media/icon_small.png differ diff --git a/jsapp/keyinput_sample/gradle.properties b/jsapp/keyinput_sample/gradle.properties new file mode 100644 index 000000000..3966a047e --- /dev/null +++ b/jsapp/keyinput_sample/gradle.properties @@ -0,0 +1,13 @@ +# Project-wide Gradle settings. +# IDE (e.g. DevEco Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# If the Chinese output is garbled, please configure the following parameter. +# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false. +# more information see https://docs.gradle.org/current/userguide/performance.html +# org.gradle.parallel=false +# org.gradle.jvmargs=-Dfile.encoding=GBK \ No newline at end of file diff --git a/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.jar b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..490fda857 Binary files /dev/null and b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.jar differ diff --git a/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.properties b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..f59159e86 --- /dev/null +++ b/jsapp/keyinput_sample/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jsapp/keyinput_sample/gradlew b/jsapp/keyinput_sample/gradlew new file mode 100644 index 000000000..2fe81a7d9 --- /dev/null +++ b/jsapp/keyinput_sample/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/jsapp/keyinput_sample/gradlew.bat b/jsapp/keyinput_sample/gradlew.bat new file mode 100644 index 000000000..62bd9b9cc --- /dev/null +++ b/jsapp/keyinput_sample/gradlew.bat @@ -0,0 +1,103 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jsapp/keyinput_sample/settings.gradle b/jsapp/keyinput_sample/settings.gradle new file mode 100644 index 000000000..28d595f2f --- /dev/null +++ b/jsapp/keyinput_sample/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/patch_615_1029_to_1127.txt b/patch_615_1029_to_1127.txt new file mode 100644 index 000000000..1ce62f50e --- /dev/null +++ b/patch_615_1029_to_1127.txt @@ -0,0 +1,93 @@ +【补丁名称】patch_615_1029_to_1127 +【基础版本】b615 + 0906 + 1009 + 1029 +【修复问题】 +BT合入内容: +1、新增需求:提供配置SPP数传重试次数的功能。 + +PLT合入内容 +1、 问题描述:解决客户打开双击宏后,概率性单击按键上报双击事件问题。 + 测试建议:powerkey双击场景验证,库上默认没有打开双击宏 +2、 问题描述:gettimeofday底层调用接口修改,删除冗余算法。。 + 测试建议:不同步时间的情况下,压测系统时间误差 +3、 代码优化:低功耗流程优化 + 测试建议:压测深睡场景 +4、 维测优化:panic函数流程中增加trace&mem导出 + +AUDIO&MEDIA合入内容 +1、 问题描述:概率性初始化失败,导致音频播放失败。 + 测试场景:媒体初始化加载某一个插件失败以后,再进行媒体的初始化 +2、 问题描述:手表连接蓝牙耳机播放蓝牙音乐时来电,挂断后会导致音乐无法恢复。 + 测试场景:蓝牙sink音乐+来电铃声+蓝牙通话,通话打断音乐以后,通话结束以后,音乐恢复 +3、 问题描述:视频表盘弹窗概率性出现视频黑帧 + 测试场景:视频表盘场景,视频还未完全起播就灭屏;视频表盘+视频弹窗场景 +4、 问题描述:蓝牙通话的场景,来电铃声的时候需要静音通话,有时候静音无效。 + 测试场景:蓝牙通话的场景,来电铃声的时候需要静音通话,有时候静音无效 +5、 需求描述:实现音视频播放时进度条拖动需求 + 测试场景:音视频播放的时候,都可以调用seek接口进行跳转 +6、 问题描述:解决音乐播放完DSP无法进入低功耗的问题 + 测试场景:本地音乐播放 +7、 问题描述:JS敲木鱼设置音量不生效 + 测试场景:js敲木鱼的音频播放,在播放前进行音量和流类型的设置,在真正播放的时候生效 +8、 问题描述: 不停推送微信消息会出现音频播放失败的问题 + 测试场景,在播放蓝牙sink音乐的时候,不停的推送微信消息 +9、 问题描述:录音打断sink音乐,结束录音后sink音乐无法恢复。 + 测试场景:先播放蓝牙sink音乐再起小度语音会打断sink音乐,小度语音退出以后,sink音乐会恢复 + +GUI合入内容 +1、 新增需求:AOD离线表盘 + 测试建议:通过工具制作AOD离线表盘,上板测验 +2、 新增需求:球形菜单 + 测试建议:NativeJS示例页面,点击进入球形菜单,滑动,点击按钮测试,参照ui_test_sphere_view.cpp +3、 新增需求:蜂窝瀑布流支持UITransformGroup + 测试建议:NativeJS示例页面,点击进入蜂窝表盘/瀑布列表,点击底部中间位置切换模式,退出再重新进入页面,图标上有叠加其他元素,并且正常响应拖动和点击操作。参照ui_test_hexagons_list.cpp +4、 新增需求:Slice跟手转场 + 测试建议:NativeJS,进入设置界面后,右滑跟手返回前一页面,参照SettingPresenter.cpp以及限制 +5、 问题描述:解决视频特定场景的停播问题 + 测试建议:图形内存严重不足时起播视频,视频起播后调用Stop后重新设置视频源再起播 +6、 问题描述:解决CrossView上下滑动高斯模糊消失问题 + 测试建议:一级表盘界面,向一个方向拖动一段距离后,快速反向滑动然后松手,确认反向拉出的界面是否有正常的高斯模糊效果 +7、 问题描述:解决地图相关的显示和内存问题 + 测试建议:测试地图业务 +8、 问题描述:解决局部视频滑动以及亮灭屏后显示问题 + 测试建议:在一级卡片中播放位于非[0,0]的局部视频,测试左右滑动和量灭屏 +9、 问题描述:解决UIRollerView移除最后一个控件后挂死问题 + 测试建议:NativeJS示例页面,点击进入滚筒后点击页面底部,反复点击remove至到控件被全部移除 +OHOS合入内容 +1、 新增需求:JS应用名支持动态切换语言。 + 测试建议:使用AT命令测试切换语言场景:AT^OHOSFWK_CHANGE_LANGUAGE=en-US,退出applist,再进入后应用名切换为中文。 +2、 新增需求:兼容IDE5.0和2.1版本安装包。 + 安装不同版本IDE(IDE5.0和2.1)编译出的安装包,测试安装是否正常。 +3、 新增需求:添加一个AT命令用于切换语言。 + 测试建议:使用AT命令切换语言AT^OHOSFWK_CHANGE_LANGUAGE=en-US +4、 新增需求:增加最大应用数量,从30修改为60 +5、 新增需求:List 滑动到底部功能添加,以及滑动底部功能js sample代码,示例代码:jsapp/keyinput_sample +6、 代码优化:听书新增streamType API;文心一言设置getApp获取回调,item高度自适应 +7、 代码优化:swiper滑动频繁触发OnDrag原生日志影响流畅度,屏蔽OnDrag原生日志 +8、 代码优化:rotate focus获取焦点,再隐藏控件挂死问题 。示例代码:jsapp/keyinput_sample +9、 新增需求:keyinput 模块,扩展社区标准接口onClick, onPress +10、XTS认证易用性优化 + developtools_syscap_codec仓 归档syscap_tool工具 + 测试建议:linux 执行命令验证syscap_tool工具的可使用性 + 参考 :https://gitee.com/openharmony/developtools_syscap_codec下使用示例 + 例如:./syscap_tool -Pei pcid.json -o path/ +11、新增需求:支持跑马灯功能,跑马灯文本支持旋转功能合 + 测试建议:使用jsapp.zip的marqueesample源码编译出bin,板端安装应用进行测试 +12、新增需求: 新增支持点击power键正常关闭notify。 + 测试建议:js应用下 闹钟notifyshowing时 点击power键正常关闭notify。参考代码:application\wearable\service\msg_center\src\msg_center_customer.cpp +13、代码优化:js安装命令解决内存泄露 + 开发建议:客户参考js安装回调ReceiveCallback中,调用AdapterFree + +【修改影响】NA + +【使用方法】 + 1、合入0906补丁 + 2、合入1009补丁 + 3、合入1029补丁 + 4、合入1127补丁(包含1029到1127所有调试补丁) + +【自测情况】 + 自验证范围: + 全功能冒烟 + 自验证target: + Native-js、target3 rc版本 +【是否合入版本】根据测试结果确定