DEV Community

Cover image for HarmonyOS Next 5.0.3 Release Update Notes and Adaptation Guide
kouwei qing
kouwei qing

Posted on

HarmonyOS Next 5.0.3 Release Update Notes and Adaptation Guide

HarmonyOS Next 5.0.3 Release Update Notes and Adaptation Guide

On March 19, 2025, HarmonyOS 5.0.3 Release adds capabilities for a few ArkUI components based on the previously released HarmonyOS 5.0.3 Beta2, optimizes performance and stability, and releases supporting software in Release status.

OS Platform Capabilities

New Features

Mainly in ArkUI:

  • The menu attribute of text component public interfaces newly adds the TRANSLATE value, indicating translation services for selected text. Text/TextArea/TextInput/Search/RichEditor components support this menu attribute.
  • Drag control newly supports setting whether the custom preview image floats during dragging.
  • Scroll components newly support the ability to return to the top by clicking the status bar.
  • Hover events newly support movement events in the stylus hover state.

Adaptation Guide

Change in return values of C API axis event interfaces OH_ArkUI_UIInputEvent_GetSourceType and OH_ArkUI_UIInputEvent_GetToolType

Reasons for Change

Axis events triggered by mouse wheels or touchpads cannot correctly obtain the trigger source device type.

Impact of Change

This change requires application adaptation.

  • Before the change: When using mouse wheel or touchpad two-finger sliding operations, applications cannot accurately obtain the trigger source type through OH_ArkUI_UIInputEvent_GetSourceType and OH_ArkUI_UIInputEvent_GetToolType, returning UNKNOWN.
  • After the change: When using mouse wheel or touchpad two-finger sliding operations, applications can call OH_ArkUI_UIInputEvent_GetSourceType and OH_ArkUI_UIInputEvent_GetToolType to obtain the correct trigger source type. For mouse wheel operations, both SourceType and ToolType are MOUSE; for touchpad operations, SourceType remains MOUSE, but ToolType is TOUCHPAD.

Affected Interfaces/Components

OH_ArkUI_UIInputEvent_GetSourceType and OH_ArkUI_UIInputEvent_GetToolType

Adaptation Guide

When an application uses the OH_NativeXComponent_RegisterUIInputEventCallback interface in native_interface_xcomponent.h to receive and process axis events:

  • If the callback function already uses ToolType for judgment, no further adaptation is needed.
  • If the business logic only processes UNKNOWN types, adaptation is required to ensure differentiation by specific target types.

Example:

Original code:

if (toolType != UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN) {
    // Application business logic
}
Enter fullscreen mode Exit fullscreen mode

Recommended adaptation:

if (toolType == UI_INPUT_EVENT_TOOL_TYPE_MOUSE) { 
    // Axis event from mouse wheel (value unit: degrees)
    double degree = OH_ArkUI_AxisEvent_GetVerticalAxisValue(event);
    // Map degrees to pixel distance
    // Update UI position
} else if (toolType == UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD) {
    // Touchpad operation (supports horizontal/vertical sliding)
    double offsetX = OH_ArkUI_AxisEvent_GetHorizontalAxisValue(event);
    double offsetY = OH_ArkUI_AxisEvent_GetVerticalAxisValue(event);
    if (offsetX == 0) {
        // Vertical sliding (horizontal component is 0)
        // Handle UI vertical sliding
    } else {
        // Horizontal sliding
        // Handle UI horizontal scrolling
    }
} else {
    // Ignore abnormal cases
}
Enter fullscreen mode Exit fullscreen mode

DevEco Studio

DevEco Studio Beta1 (5.0.9.300) has no new or enhanced features.

The tool list, supported API scope, and development version information carried by DevEco Studio 5.0.9.300 are as follows:

Component Version Description
DevEco Studio DevEco Studio 5.0.3 Release (5.0.9.300) -
HarmonyOS SDK HarmonyOS 5.0.3 Release SDK -
HarmonyOS Emulator HarmonyOS Emulator 5.0.3 Release (5.0.9.300) Emulator supporting phones (including foldables) and tablets.
Hvigor 5.15.3 Compilation and build tool DevEco Hvigor (Hvigor) for API 10+ projects.
ohpm 5.0.12 Package management tool for OpenHarmony third-party libraries.
compatibleSdk Minimum compatible version: 4.0.0(10) Minimum SDK version compatible with HarmonyOS applications/meta-services.
modelVersion 5.0.3 Development version number.

Top comments (0)