n9 部分代码合并 3408/1 3408/head 3410/target/1
authorluozheng <1732036298@qq.com>
Mon, 11 May 2026 08:43:16 +0000 (16:43 +0800)
committerluozheng <1732036298@qq.com>
Mon, 11 May 2026 08:43:16 +0000 (16:43 +0800)
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/BackToCrossShapedTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/BackToWaterfallTransition.cpp
code/sdk/application/wearable/n9/nativeabilityfwk/src/transition/CrossShapedTransition.cpp
code/sdk/middleware/services/gui/uikit/sample/sample_ui.h
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.h
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_lottie/ui_test_trim_path.cpp [new file with mode: 0644]
code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_lottie/ui_test_trim_path.h [new file with mode: 0644]
code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp
code/sdk/middleware/services/gui/uikit/ui/frameworks/core/render_manager.cpp

index 6cc07e3..f5b47da 100644 (file)
@@ -3,9 +3,7 @@
  * Description: BackToCrossShapedTransition\r
  * Create: 2025-04\r
  */\r
-#if 0 // 1201patch 为编译过屏蔽\r
-#include "applist/AppItemView.h"\r
-#endif\r
+#include "applist/include/AppItemView.h"\r
 #include "animator/easing_equation.h"\r
 #include "common/screen.h"\r
 #include "components/root_view.h"\r
index 3b96ee4..703c76e 100644 (file)
@@ -9,9 +9,7 @@
 #include "TransitionManager.h"
 #include "NativeAbility.h"
 #include "components/root_view.h"
-#if 0 // 1201patch 为编译过屏蔽
-#include "applist/HexagonsDesktopFragment.h"
-#endif
+#include "applist/include/HexagonsDesktopFragment.h"
 #include "hal_tick.h"
 #include "wearable_log.h"
 #ifdef JS_ENABLE
@@ -26,7 +24,6 @@ static const float TARGET_SCALE_END = 1.0f;
 
 void BackToHexagonsTransition::OnTransitionStart(UIImageView* current, UIViewGroup* target)
 {
-#if 0 // 1201patch 为编译过屏蔽
     current_ = current;
     target_ = dynamic_cast<UICustomHexagonsList*>(TransitionUtils::GetViewAndTransparentizePath(target, UI_HEXAGONS_LIST));
     if ((target_ == nullptr) || (current_ == nullptr)) {
@@ -75,7 +72,6 @@ void BackToHexagonsTransition::OnTransitionStart(UIImageView* current, UIViewGro
     float yScale = current->GetHeight() * 1.0f / rect.GetHeight();
     tarScaleStart_ = FloatLessEqual(xScale, yScale) ? xScale : yScale;
     curScaleEnd_ = 1.0f / tarScaleStart_;
-#endif
 }
 
 void BackToHexagonsTransition::TransitionAlg(uint32_t time)
index c047df4..7907cfc 100644 (file)
@@ -9,7 +9,7 @@
 #include "TransitionManager.h"
 #include "NativeAbility.h"
 #include "components/root_view.h"
-// #include "applist/WaterfallDesktopFragment.h"
+#include "applist/include/WaterfallDesktopFragment.h"
 #include "hal_tick.h"
 #include "wearable_log.h"
 #ifdef JS_ENABLE
@@ -24,7 +24,6 @@ static const float TARGET_SCALE_END = 1.0f;
 
 void BackToWaterfallTransition::OnTransitionStart(UIImageView* current, UIViewGroup* target)
 {
-#if 0 // 1201patch 为编译过屏蔽
     current_ = current;
     target_ = dynamic_cast<UIWaterfallList*>(TransitionUtils::GetViewAndTransparentizePath(target, UI_WATERFALL_LIST));
     if ((target_ == nullptr) || (current_ == nullptr)) {
@@ -80,7 +79,6 @@ void BackToWaterfallTransition::OnTransitionStart(UIImageView* current, UIViewGr
     float yScale = current->GetHeight() * 1.0f / rect.GetHeight();
     tarScaleStart_ = FloatLessEqual(xScale, yScale) ? xScale : yScale;
     curScaleEnd_ = 1.0f / tarScaleStart_;
-#endif
 }
 
 void BackToWaterfallTransition::TransitionAlg(uint32_t time)
index d824432..b178b68 100644 (file)
@@ -4,9 +4,7 @@
  * Create: 2025-04\r
  */\r
 \r
-#if 0 // 1201patch 为编译过屏蔽\r
-#include "applist/AppItemView.h"\r
-#endif\r
+#include "applist/include/AppItemView.h"\r
 #include "animator/easing_equation.h"\r
 #include "common/screen.h"\r
 #include "components/root_view.h"\r
index 194f1f0..22021e9 100644 (file)
@@ -15,8 +15,8 @@ extern "C" {
 int SampleUi(void);
 
 /*
-  \e$)A\ e9&D\ChJv\ f       :  \ eFt6/V86(SC@}\ f
-  \e$)A\ e2NJ}DZH]\ f       :  \ e2NJ}N*SC@}C{3F\ f
+  功能描述 :  启动指定用例
+  参数内容 :  参数为用例名称
 */
 int StartCaseUi(const char* testCaseId);
 
index 52dbc30..fd52908 100644 (file)
@@ -65,7 +65,7 @@ public:
     AppGroupView *InitWatchFacePage(void);
     AppGroupView *InitHeartRatePage(void);
     AppGroupView *InitActivityPage(void);
-    bool OnClick(UIView& view, const ClickEvent& event) override;   // Çл»ÌØÐÔ
+    bool OnClick(UIView& view, const ClickEvent& event) override;   // 切换特性
     AppGroupView *InitCompassPage(void);
     void AnimatorStart(int pageIndex);
     void AnimatorStop(void);
@@ -93,7 +93,7 @@ private:
     UICrossView *mainSwipeGroup{nullptr};
     SwipeListener *listener{nullptr};
     CardSwipe* callback{nullptr};
-    UILabelButton* controlButton {nullptr}; // Çл»°´Å¥
+    UILabelButton* controlButton {nullptr}; // 切换按钮
     bool HorizontalViewInit(void);
     void VerticalViewInit(void);
     void VertViewLoad(void);
diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_lottie/ui_test_trim_path.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_lottie/ui_test_trim_path.cpp
new file mode 100644 (file)
index 0000000..0a8f938
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved.
+ * Description: Trim path Test
+ * Author: Hisi Graphic Team
+ * Created: 2025-6
+ */
+
+#include "ui_test_trim_path.h"
+#include "lottie/lott_trim_path.h"
+#include "draw/hw_draw_utils.h"
+#include "engines/gfx/lite_m_gfx_engine.h"
+#include "gfx_utils/mem_check.h"
+
+namespace OHOS {
+static const int32_t TRIM_RANGE_MIN = 0;
+static const int32_t TRIM_RANGE_MAX = 100;
+static const int16_t SLIDER_WIDTH = 130;
+static const int16_t SLIDER_HEIGHT = 30;
+static const int16_t SLIDER_VALID_HEIGHT = 4;
+static const int16_t KNOB_WIDTH = 8;
+
+void UITestTrimPath::InitPath()
+{
+    Path sectorPath = {0};
+    ArcInfo arcInfo = {{100, 150}, {0, 0}, 100, 0, 90, nullptr}; // 100, 15, 90: arc info paramters
+    if (!HWDrawUtils::GetInstance()->ObtainSectorPath(arcInfo, sectorPath.cmdNum, sectorPath.cmds,
+        sectorPath.dataNum, sectorPath.data)) {
+        GRAPHIC_LOGE("alloc data failed");
+        return;
+    }
+
+    Path cirlePath = {0};
+    arcInfo = {{270, 80}, {0, 0}, 50, 0, 0, nullptr}; // 270, 80, 50: arc info paramters
+    if (!HWDrawUtils::GetInstance()->ObtainCirclePath(arcInfo, cirlePath.cmdNum, cirlePath.cmds,
+        cirlePath.dataNum, cirlePath.data)) {
+        GRAPHIC_LOGE("alloc data failed");
+        HWDrawUtils::GetInstance()->FreeBufferForPath(&sectorPath);
+        return;
+    }
+
+    path_.cmdNum = sectorPath.cmdNum + cirlePath.cmdNum;
+    path_.dataNum = sectorPath.dataNum + cirlePath.dataNum;
+    const uint8_t fSize = sizeof(float);
+    HWDrawUtils::GetInstance()->AllocBufferForPath(&path_, path_.cmdNum, path_.dataNum);
+    memcpy_s(path_.cmds, path_.cmdNum, sectorPath.cmds, sectorPath.cmdNum);
+    memcpy_s(path_.cmds + sectorPath.cmdNum, cirlePath.cmdNum, cirlePath.cmds, cirlePath.cmdNum);
+    memcpy_s(path_.data, path_.dataNum * fSize, sectorPath.data, sectorPath.dataNum * fSize);
+    memcpy_s(path_.data + sectorPath.dataNum, cirlePath.dataNum * fSize, cirlePath.data, cirlePath.dataNum * fSize);
+    HWDrawUtils::GetInstance()->FreeBufferForPath(&sectorPath);
+    HWDrawUtils::GetInstance()->FreeBufferForPath(&cirlePath);
+
+    paint_.SetStyle(Paint::PaintStyle::STROKE_STYLE);
+    paint_.SetStrokeColor(Color::Green());
+    paint_.SetStrokeWidth(5); // 5: stroke width
+    canvas_->BeginPath(paint_);
+    canvas_->SetPathData(path_.cmdNum, path_.cmds, path_.dataNum, path_.data);
+    canvas_->DrawPath();
+}
+
+void UITestTrimPath::InitSlider(UISlider*& slider, int16_t x, int16_t y)
+{
+    slider = new UISlider();
+    if (slider == nullptr) {
+        GRAPHIC_LOGE("new UISlider failed\n");
+        return;
+    }
+    slider->SetPosition(x, y, SLIDER_WIDTH, SLIDER_HEIGHT);
+    slider->SetRange(TRIM_RANGE_MIN, TRIM_RANGE_MAX);
+    slider->SetValidHeight(SLIDER_VALID_HEIGHT);
+    slider->SetValidWidth(SLIDER_WIDTH - 10); // 10, reserve width
+    slider->SetKnobWidth(KNOB_WIDTH);
+    slider->SetSliderRadius(5, 5); // 5:background radius, 5:foreground radius
+    slider->SetKnobStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full);
+    slider->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::White().full);
+    slider->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 90); // 90: opa
+    slider->SetDirection(UISlider::Direction::DIR_LEFT_TO_RIGHT);
+    slider->SetSliderEventListener(this);
+    container_->Add(slider);
+}
+
+void UITestTrimPath::InitLabel(UILabel*& label, const Rect& rect, const char* str)
+{
+    label = new UILabel();
+    if (label == nullptr) {
+        GRAPHIC_LOGE("new UILabel failed\n");
+        return;
+    }
+    label->SetPosition(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
+    label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    label->SetText(str);
+    container_->Add(label);
+}
+
+void UITestTrimPath::SetUp()
+{
+    MemCheck::GetInstance()->DumpMemInfo();
+    if (container_ != nullptr) {
+        return;
+    }
+    container_ = new UIViewGroup();
+    container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+    canvas_ = new UICanvasExt();
+    canvas_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), 250); // 250: canvas height
+    canvas_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);
+    container_->Add(canvas_);
+
+    InitLabel(startLabel_, Rect(20, 280, 70, 310), "Start:"); // 20, 280, 70, 310: coordinate
+    InitSlider(startSlider_, 70, 280); // 70, 280: coordinate
+
+    InitLabel(endLabel_, Rect(220, 280, 270, 310), "End:"); // 220, 280, 270, 310: coordinate
+    InitSlider(endSlider_, 270, 280); // 260, 280: coordinate
+    endSlider_->SetValue(TRIM_RANGE_MAX);
+
+    InitLabel(offsetLabel_, Rect(110, 330, 170, 360), "Offset:"); // 110, 330, 170, 360: coordinate
+    InitSlider(offsetSlider_, 170, 330); // 180, 330: coordinate
+
+    InitLabel(parallelLabel_, Rect(200, 380, 260, 440), "Parallel:"); // 200, 380, 260, 440: coordinate
+    parallelCheckBox_ = new UICheckBox();
+    parallelCheckBox_->SetPosition(260, 380, 50, 50); // 260, 380, 50, 50: coordinate
+    parallelCheckBox_->SetState(UICheckBox::UICheckBoxState::UNSELECTED);
+    parallelCheckBox_->SetOnChangeListener(this);
+    container_->Add(parallelCheckBox_);
+
+    InitPath();
+}
+
+void UITestTrimPath::TearDown()
+{
+    UIViewGroup::RemoveAndDeleteAllRecursively(container_);
+    HWDrawUtils::GetInstance()->FreeBufferForPath(&path_);
+    lottTrimPath_.ClearPath();
+    MemCheck::GetInstance()->DumpMemInfo();
+}
+
+void UITestTrimPath::TrimPath()
+{
+    canvas_->Clear();
+    canvas_->BeginPath(paint_);
+    lottTrimPath_.SetPath(path_);
+    Path trimedPath = lottTrimPath_.TrimPath(startValue_, endValue_, offsetValue_, isParallel_);
+    // sync because trimed path is drawing and needs to be updated
+    LiteMGfxEngine::GetInstance()->SyncHwDraw();
+    canvas_->SetPathData(trimedPath.cmdNum, trimedPath.cmds, trimedPath.dataNum, trimedPath.data);
+    canvas_->DrawPath();
+}
+
+bool UITestTrimPath::OnChange(UICheckBox::UICheckBoxState state)
+{
+    isParallel_ = (state == UICheckBox::UICheckBoxState::SELECTED);
+    TrimPath();
+    return true;
+}
+
+void UITestTrimPath::OnChange(int32_t value)
+{
+    startValue_ = startSlider_->GetValue() * 1.0f / TRIM_RANGE_MAX;
+    endValue_ = endSlider_->GetValue() * 1.0f / TRIM_RANGE_MAX;
+    offsetValue_ = offsetSlider_->GetValue() * 1.0f / TRIM_RANGE_MAX;
+    TrimPath();
+}
+
+const UIView* UITestTrimPath::GetTestView()
+{
+    return container_;
+}
+}
\ No newline at end of file
diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_lottie/ui_test_trim_path.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_lottie/ui_test_trim_path.h
new file mode 100644 (file)
index 0000000..17aa7c7
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved.
+ * Description: Lottie Test
+ * Author: Hisi Graphic Team
+ * Created: 2025-6
+ */
+
+#ifndef UI_TEST_TRIM_PATH_H
+#define UI_TEST_TRIM_PATH_H
+
+#include "ui_test.h"
+#include "components/ui_canvas_ext.h"
+#include "components/ui_label.h"
+#include "components/ui_slider.h"
+#include "components/ui_checkbox.h"
+#include "lottie/lott_trim_path.h"
+
+namespace OHOS {
+class UITestTrimPath : public UITest, public UISlider::UISliderEventListener, public UICheckBox::OnChangeListener {
+public:
+    void SetUp() override;
+    void TearDown() override;
+    const UIView* GetTestView() override;
+    void OnChange(int32_t value) override;
+    bool OnChange(UICheckBox::UICheckBoxState state) override;
+
+private:
+    void InitPath();
+    void TrimPath();
+    void InitSlider(UISlider*& slider, int16_t x, int16_t y);
+    void InitLabel(UILabel*& label, const Rect& position, const char* str);
+    UILabel* startLabel_{nullptr};
+    UISlider* startSlider_{nullptr};
+    float startValue_{0.0f};
+
+    UILabel* endLabel_{nullptr};
+    UISlider* endSlider_{nullptr};
+    float endValue_{1.0f};
+
+    UILabel* offsetLabel_{nullptr};
+    UISlider* offsetSlider_{nullptr};
+    float offsetValue_{0.0f};
+
+    UILabel* parallelLabel_{nullptr};
+    UICheckBox* parallelCheckBox_{nullptr};
+    bool isParallel_{false};
+
+    UIViewGroup* container_ = nullptr;
+    PaintExt paint_{};
+    LottTrimPath lottTrimPath_{};
+    Path path_{0};
+    UICanvasExt* canvas_{nullptr};
+};
+}
+#endif
\ No newline at end of file
index 24f68be..cebd683 100644 (file)
@@ -30,7 +30,7 @@ InputDeviceManager* InputDeviceManager::GetInstance()
 
 void InputDeviceManager::Init()
 {
-    SetPeriod(0);
+    SetPeriod(0); // Input的默认处理周期受RTC/TE刷新周期控制
     TaskManager::GetInstance()->Add(this);
 }
 
index 8ea6dd0..2be30e1 100644 (file)
@@ -36,7 +36,7 @@ RenderManager& RenderManager::GetInstance()
 
 void RenderManager::Init()
 {
-    SetPeriod(0);
+    SetPeriod(0); // 防止波动场景下的Draw Task的遗漏处理
     Task::Init();
 }