A method and device for implementing a graphical interface in C language
By adding a subtask management module to the JS APP thread of the lightweight open-source HarmonyOS system, a graphical interface was built using C language, which solved the problems of code size and efficiency, improved the efficiency of interface construction, and reduced system complexity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ASR MICROELECTRONICS CO LTD
- Filing Date
- 2026-01-05
- Publication Date
- 2026-05-29
AI Technical Summary
The lightweight open-source HarmonyOS system does not support the direct use of C language to build application graphical interfaces, resulting in low efficiency of JavaScript-based application interfaces in high-frequency changing scenarios, and porting a C language graphical system would lead to a large code size.
In the JS APP thread of the lightweight open-source HarmonyOS system, a sub-task management module is added through the task management module to execute UI sub-tasks to build, modify or delete graphical components written in C language. Combined with the animation and rendering management module, the graphical interface is built in C language.
Without increasing system complexity or code size, this project enabled the execution and modification of a graphical user interface written in C within a JS app thread, resolving issues of multi-task resource contention and task scheduling asynchrony, and improving interface construction efficiency.
Smart Images

Figure CN122111428A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a graphical interface development technology for the lightweight open-source HarmonyOS system. Background Technology
[0002] OpenHarmony is an open-source operating system for embedded devices, while HarmonyOS is a commercial operating system for smartphones.
[0003] The open-source HarmonyOS kernel has three branches: LiteOS-M, LiteOS-A, and Linux. The open-source HarmonyOS system with the LiteOS-M branch is known as the lightweight open-source HarmonyOS system, which is suitable for use in Internet of Things (IoT) devices, home appliances, sensors, microcontrollers (MCUs), and small terminals. Application examples include smartwatches, switches, remote controls, blood pressure monitors, etc.
[0004] The lightweight open-source HarmonyOS system has the following operating characteristics: (1) No memory management unit (MMU) and does not support multi-process. (2) Only one application (APP) can run at a time. (3) Supports multi-threading, such as user interface (UI), events, network, JS APP (JavaScript application) threads, etc. (4) JavaScript applications can only run through the JavaScript virtual machine (also known as the JavaScript engine), and only one JavaScript virtual machine can run at a time. (5) The JavaScript virtual machine (e.g., JerryScript) runs in the JS APP thread, and only one JavaScript application can run at a time. (6) Low power consumption and fast startup speed. The JavaScript application refers to an application with a graphical interface written by any combination of JavaScript, HML (HarmonyOS Markup Language), and CSS (Cascading Style Sheets).
[0005] The lightweight, open-source HarmonyOS provides a JavaScript (JS)-based UI development framework. Developers can use JavaScript to create and modify graphical components (UIViews) and handle UI events. In this framework, UIView is the base class for graphical components, representing all visible elements, including text, buttons, images, and containers (for displaying animations). Each UIView instance encapsulates core information such as layout properties, display properties, event handling, and hierarchy relationships. RootView is the root node of the entire graphical component tree; all graphical components are direct or indirect children of RootView. RootView manages the lifecycle and rendering refresh of the entire graphical component tree.
[0006] The lightweight, open-source HarmonyOS system creates a JS App thread as the main UI thread upon startup, and initializes multiple modules within this thread to support UI rendering and event handling. Please refer to [link / reference]. Figure 1 The existing modules that execute on the JS APP thread include the JavaScript Virtual Machine, JSAppTaskHandler (JavaScript application task handler) module, TaskManager module, and ANYNCWORK module.
[0007] The JSAppTaskHandler module acts as a bridge between the JavaScript virtual machine and the task management module and asynchronous message processing module, primarily responsible for coordinating the interaction between the JavaScript application and other tasks. The JSAppTaskHandler module manages the task lifecycle of the JavaScript application, including the following aspects: (1) The JSAppTaskHandler module loads and initializes the JavaScript code of the JavaScript application, runs the JavaScript code and parses HML, and constructs multiple graphical components to form the graphical interface of the JavaScript application. (2) When the JavaScript application exits or is no longer needed, the JSAppTaskHandler module is responsible for cleaning up related tasks, destructing related graphical components, stopping interaction with the JavaScript virtual machine, and releasing system resources. (3) When the data of the JavaScript application changes, the JSAppTaskHandler module requests modification of the style of a graphical component in the graphical component tree, or adds or deletes graphical components through the asynchronous message processing (AYNCWORK) module. (4) The JSAppTaskHandler module ensures that all tasks in the UI task queue are executed in the context of the JS APP thread by calling the task management module, avoiding multi-task contention issues.
[0008] The task management module sequentially schedules the input management module, animation management module, and rendering management module to execute the UI task queue. The UI task queue is a linked list structure, consisting of input management tasks, animation management tasks, and rendering management tasks connected serially. The task management module time-division multiplexes the JS APP thread, scheduling each task serially and without contention. These tasks are provided by the lightweight open-source HarmonyOS system for the interaction and refresh of JavaScript application interfaces.
[0009] The input management module is responsible for reading in external user input (touch, key presses, etc.).
[0010] The animation management module is responsible for updating the animation based on the data read by the input management module and marking the container graphics component used to display the animation as invalid. A container graphics component marked as invalid indicates that it needs to be re-rendered. The animation management module also stores each animation segment and controls the coordinates, size, color, etc., of each frame within each animation segment.
[0011] The rendering management module is responsible for marking the corresponding non-container graphics components as invalid based on the data read by the input management module. A non-container graphics component marked as invalid indicates that it needs to be re-rendered. The rendering management module also accesses the graphics component tree and is responsible for drawing the marked invalid graphics components onto the screen in node order and with updated content.
[0012] The asynchronous message processing module is used to modify the parameters of the corresponding graphical component, add or delete graphical components according to the interface parameters of the modified graphical component in JavaScript code and HML, as shown by the dotted line.
[0013] The lightweight, open-source HarmonyOS system only supports a combination of JavaScript, HTML, and CSS for graphical user interface programming. JavaScript is used for dynamic interaction and logic processing. HTML, similar to HTML, is used to define the application's interface structure. CSS is responsible for styling and layout. Developers use HTML to describe the application's interface layout, components, and interface elements. Using HTML in conjunction with JavaScript provides the capabilities for dynamic interaction and responsive design.
[0014] The lightweight open-source HarmonyOS system does not support building graphical interfaces (GUIs) directly using the C language. However, in scenarios where graphical components change frequently, C-based GUIs are more efficient than JavaScript-based GUIs. Therefore, developers want the lightweight open-source HarmonyOS system to support direct C programming of GUIs, allowing modification of the graphical component tree or UI animation effects. If a C-based GUI system and the original GUI system within the lightweight open-source HarmonyOS system were to be ported and run independently, the code size would be enormous. Summary of the Invention
[0015] The technical problem to be solved by this invention is: how to add support for building application graphical interfaces in C language in a lightweight open-source HarmonyOS system while minimizing the overall code volume.
[0016] To address the aforementioned technical problems, this invention proposes a method for constructing a graphical user interface (GUI) using C language, comprising the following steps: Step S1: Upon startup, the lightweight open-source HarmonyOS system creates a JS APP thread as the main UI thread. Step S2: Within the JSAPP thread, the JavaScript virtual machine, JSAppTaskHandler module, task management module, and asynchronous message processing module are initialized to support interface rendering and event handling. Step S3: The task management module calls the input management module to execute input management tasks in the UI task queue. Step S4: The task management module calls the subtask management module to add one or more UI subtasks after the input management tasks and before the animation management tasks in the UI task queue, and executes the newly added UI subtasks; the UI subtasks are used to either construct the interface of the C application, execute the startAbility function, delete the interface of the C application, or execute the terminateAbility function; the C application refers to an application with a GUI written in C language. Step S5: The task management module calls the animation management module to execute animation management tasks in the UI task queue. Step S6: The task management module calls the rendering management module to execute rendering management tasks in the UI task queue.
[0017] Further, in step S3, the input management module reads that the user clicked a button on a certain interface of an application, and the function of the button is to open a C application. In step S4, the task management module adds a single-execution task, constructs the interface of the newly opened C application, and creates various graphical components written in C language for the interface; the subtask management module adds these newly created graphical components to the top level of the graphical component tree and marks the newly created graphical components as invalid.
[0018] Further, in step S3, the input management module reads that the user clicked a button on the interface of an application, and the function of the button is to open a JavaScript application; the JavaScript application refers to an application with a graphical interface written by any combination of JavaScript, HML, and CSS. In step S4, the subtask management module adds a single-execution task and executes the startAbility function, which is a general interface function for opening a new JavaScript application in the open-source HarmonyOS system.
[0019] Furthermore, in step S3, the input management module reads that the interface of a certain application no longer needs to be displayed. In step S4, if the application that does not need to display its interface is application C, the subtask management module adds a single-execution task to delete all graphical components of the interface of application C from the graphical component tree; if the application that does not need to display its interface is JavaScript, the subtask management module adds a single-execution task to execute the teminateAbility function, which is a general interface function for deleting a JavaScript application in the open-source HarmonyOS system.
[0020] Furthermore, in step S4, the UI subtask has the function of accessing, creating, modifying or deleting any graphical component in the graphical interface tree.
[0021] Furthermore, in step S5, the animation management module accesses all animations that created the container graphic component; for the animation applied in the foreground, the animation management module executes the animation callback function; if the animation is configured to change properties, the animation management module redefines the style for the container graphic component and sets the updated container graphic component to invalid.
[0022] Furthermore, in step S6, the rendering management module marks the corresponding non-container type graphics components as invalid based on the data read by the input management module, and re-renders all graphics components marked as invalid, thus redrawing the graphics component tree.
[0023] Preferably, the C application is a system application that is not allowed to be uninstalled; the JavaScript application is a non-system application that is allowed to be uninstalled.
[0024] This invention also proposes a device for building a graphical user interface using C language, including a UI main thread creation unit, a module initialization unit, an input management module, a subtask management module, an animation management module, and a rendering management module. The UI main thread creation unit is used to create a JS APP thread as the UI main thread when the lightweight open-source HarmonyOS system starts. The module initialization unit is used to initialize the JavaScript virtual machine, JSAppTaskHandler module, task management module, and asynchronous message processing module within the JS APP thread to support interface rendering and event handling. The input management module is called by the task management module to execute input management tasks in the UI task queue. The subtask management module is called by the task management module to add one or more UI subtasks after the input management tasks and before the animation management tasks in the UI task queue, and executes the newly added UI subtasks; the UI subtasks are used to either build the interface of the C application, execute the startAbility function, delete the interface of the C application, or execute the terminateAbility function; the C application refers to an application with a graphical interface written in C language. The animation management module is called by the task management module to execute animation management tasks in the UI task queue. The rendering management module is called by the task management module to execute rendering management tasks in the UI task queue.
[0025] Furthermore, the subtask management module provides external interface functions, allowing other threads outside the JS APP thread to add and / or delete UI subtasks in the UI task queue by calling the interface functions.
[0026] The technical effect achieved by this invention is as follows: By scheduling newly added sub-task management modules through a task management module executed in the JS APP thread, the ability to build application graphical interfaces using C language is realized. This invention allows application graphical interfaces written in C language to still run within the JS APP thread and directly access and modify graphical components (regardless of language), providing an interface for using C language interface programming in the lightweight open-source HarmonyOS system. Compared to methods that create new threads, this invention solves the problems of multi-task resource contention, task scheduling asynchrony, and additional system overhead with minimal modifications. Attached Figure Description
[0027] Figure 1 This is a diagram illustrating the modules that execute on an existing JS APP thread.
[0028] Figure 2 This is a flowchart illustrating the method for constructing a graphical interface using C language proposed in this invention.
[0029] Figure 3This is a schematic diagram of the module executed on the JS APP thread of the present invention.
[0030] Figure 4 This is a schematic diagram of the device proposed in this invention for constructing a graphical interface using the C language.
[0031] The diagram shows the following labels: UI main thread creation unit 1, module initialization unit 2, input management module 3, subtask management module 4, animation management module 5, and rendering management module 6. Detailed Implementation
[0032] Please see Figure 2 The method for constructing a graphical interface using C language proposed in this invention includes the following steps.
[0033] Step S1: When the lightweight open-source HarmonyOS system starts up, it creates a JS APP thread as the main UI thread.
[0034] Step S2: Initialize the JavaScript virtual machine, JSAppTaskHandler module, task management module, and asynchronous message processing module within the JS APP thread to support UI rendering and event handling.
[0035] Step S3: The task management module calls the input management module to execute the input management task in the UI task queue.
[0036] As an example, the input management module detects that a user clicked a button on an interface of an application (which could be a JavaScript application or a C application). The function of this button is to open a C application. The C application refers to an application with a graphical interface written in the C language.
[0037] As an example two, the input management module reads that the user clicked a button on the interface of an application (which may be a JavaScript application or a C application), and the function of the button is to open a JavaScript application.
[0038] As an example three, the input management module reads that the interface of a certain application (which could be a JavaScript application or a C application) no longer needs to be displayed. For example, because the user opens a new application, the old application does not need to display its interface.
[0039] Step S4: The task management module calls the subtask manager module to add one or more UI subtasks in the UI task queue, after the input management task and before the animation management task, and then executes the newly added UI subtasks. These UI subtasks can be used to build the interface of a C application, execute the `startAbility` function, delete the interface of a C application, or execute the `terminateAbility` function. This means that the UI subtasks can access, create, modify, or delete graphical components in the graphical interface tree. Therefore, through these UI subtasks, it is possible to create graphical components written in C in the graphical component tree, and also to access, modify, or delete graphical components written in any language.
[0040] Following Example 1, the subtask management module adds a single-execution task to build the interface of the newly opened C application and create various graphical components written in C for this interface. The subtask management module adds these newly created graphical components to the top level of the graphical component tree (the end furthest from the root node) and marks the newly created graphical components as invalid.
[0041] Following Example 2, the subtask management module adds a single-execution task to execute the startAbility function, which is a common interface function for creating a new JavaScript application in the open-source HarmonyOS system.
[0042] Following Example 3, if the application that doesn't need to display a user interface is a C application, the subtask management module adds a single-execution task to remove all graphical components of the C application's interface from the graphical component tree. If the application that doesn't need to display a user interface is a JavaScript application, the subtask management module adds a single-execution task to execute the `teminateAbility` function, which is a common interface function for deleting a JavaScript application in the open-source HarmonyOS system.
[0043] Step S5: The task management module calls the animation management module to execute animation management tasks in the UI task queue. The animation management module accesses all animations that created the container graphic component used to display the animation, regardless of whether the container graphic component is written in JavaScript or C. For the animation applied in the foreground, the animation management module executes the animation callback function. If the animation is configured to change properties such as coordinates, size, or color, the animation management module redefines the style of the container graphic component used to display the animation and sets the updated container graphic component to invalid.
[0044] Step S6: The task management module calls the rendering management module to execute the rendering management tasks in the UI task queue. This includes marking the corresponding non-container graphical components as invalid based on the data read by the input management module, and re-rendering all graphical components marked as invalid (including container graphical components and non-container graphical components), redrawing the graphical component tree, and not distinguishing between graphical components written in JavaScript or C during rendering.
[0045] Please see Figure 3 The modules executed on the JS APP thread of this invention include a JavaScript virtual machine, a JSAppTaskHandler module, a task management module, and an asynchronous message processing module. As shown in steps S3 to S6, the task management module of this invention sequentially schedules the input management module, subtask management module, animation management module, and rendering management module to execute the UI task queue. The subtask management module is a new addition to this invention. This module is used to add, execute, or delete one or more UI subtasks within the range after the input management task and before the animation management task in the UI task queue. These UI subtasks are used to access, create, modify, or delete graphical interfaces (regardless of whether they are graphical components written in C or JavaScript) in the graphical interface tree, and are represented by double-dotted lines. Figure 1 and Figure 3 It can be seen that this invention reuses the original graphics system in the lightweight open-source HarmonyOS system, adding only a small amount of content (subtask management module), thus adding very little system code.
[0046] The UI task queue of this invention is a linked list structure, consisting of an input management task, one or more UI subtasks, an animation management task, and a rendering management task connected in series. The UI subtasks are newly added and managed by the newly added subtask management module. All UI subtasks are placed after the input management task, ensuring that newly added UI subtasks only perform operations after obtaining data from the input management module, such as changing a graphical component and marking it as invalid, adding or modifying animations, etc. All UI subtasks are placed before the animation management task, ensuring that the animation management task, executed after the UI subtasks, can access the container graphical components used to display animations added or modified by the newly added UI subtasks without contention, and also ensuring that the rendering management task, executed after the UI subtasks, can access the non-container graphical components marked as invalid by the newly added UI subtasks without contention, and re-render all graphical components marked as invalid.
[0047] The existing lightweight HarmonyOS system only supports JavaScript applications that use any combination of JavaScript, HML, and CSS to write all the graphical components and form the UI interface. The method proposed in this invention for building graphical interfaces using C language can build C applications that use C to write all the graphical components and form the UI interface on the lightweight HarmonyOS system.
[0048] C applications are suitable as essential, lightweight applications for the HarmonyOS desktop launcher and settings. C applications do not need to be uninstalled, require fast loading at boot, and handle frequent, dynamically monitored events with complex logic. The code for C applications is best executed using XIP (Execute-In-Place) on NOR flash memory.
[0049] JavaScript applications are suitable as lightweight, open-source applications that can be loaded and unloaded within the HarmonyOS system. The code for JavaScript applications is best placed on eMMC (embedded multimedia card). When a JavaScript application is opened, it is temporarily loaded from the eMMC into PSRAM (pseudo-static random access memory) to run. When the JavaScript application is closed, the PSRAM space occupied by the temporary loading is released. The number of JavaScript applications can be expanded arbitrarily; the storage space of eMMC is much larger than that of NOR gate flash memory, thus supporting the storage needs of any number of JavaScript applications.
[0050] In the lightweight open-source HarmonyOS system, all applications are divided into two categories: C applications and JavaScript applications. This fully leverages the advantages of both types of applications, achieving a balance between performance and storage space. Furthermore, both C applications and JavaScript applications can listen to and read input, and can independently implement human-computer interaction. C applications can open and destroy JavaScript applications, and JavaScript applications can also open and destroy C applications.
[0051] Please see Figure 4 The device for constructing a graphical interface using C language proposed in this invention includes a UI main thread creation unit 1, a module initialization unit 2, an input management module 3, a subtask management module 4, an animation management module 5, and a rendering management module 6. Figure 4 The device shown corresponds to Figure 2 The method shown.
[0052] The UI main thread creation unit 1 is used to create a JS APP thread as the UI main thread when the lightweight open-source HarmonyOS system starts.
[0053] The module initialization unit 2 is used to initialize the JavaScript virtual machine, JSAppTaskHandler module, task management module, and asynchronous message processing module within the JS APP thread to support interface rendering and event handling.
[0054] The input management module 3 is used by the task management module to execute input management tasks in the UI task queue.
[0055] The subtask management module 4 is called by the task management module to add one or more UI subtasks after the input management task and before the animation management task in the UI task queue, and execute the newly added UI subtasks. The UI subtasks are used to either build the interface of the C application, execute the startAbility function, delete the interface of the C application, or execute the terminateAbility function.
[0056] The animation management module 5 is used by the task management module to execute animation management tasks in the UI task queue.
[0057] The rendering management module 6 is used by the task management module to execute rendering management tasks in the UI task queue.
[0058] Of the modules mentioned above, only the subtask management module is a new addition in this invention; the other modules are already present in the graphics system of the lightweight open-source HarmonyOS system.
[0059] Preferably, the subtask management module has an internal lock to protect all UI subtasks. The subtask management module also provides external interface functions, allowing other threads to add and / or delete UI subtasks in the UI task queue by calling these functions. The subtask management module also supports setting whether UI subtasks are executed once or repeatedly. Single-execution UI subtasks are automatically deleted from the UI task queue after execution. Repeatedly executed UI subtasks are scheduled and executed cyclically according to a set period until the UI subtask is deleted from the UI task queue.
[0060] This invention reuses the lightweight open-source HarmonyOS graphics system. Besides the native JavaScript, HTML, and CSS combinations for building application graphical interfaces, it adds support for building graphical interfaces using C language. This invention cleverly utilizes the time-division multiplexing, contention-free task scheduling system of the task management module, achieving functional additions with minimal modifications. A sub-task management module is added to the task management module's scheduling. The sub-task management module is positioned after the input management module and before the animation management module. This ensures that within the same time base, the sub-task management module can read changes in the input and modify graphics components, invalid graphics components (requiring re-rendering), and add and modify animations and their container graphics components. The subsequently executed animation module can then access the animations and their container graphics components added or modified by the sub-task management module without contention; the subsequently executed rendering management module can also access the invalid non-container graphics components added by the sub-task management module without contention and re-render all invalid graphics components. This mechanism does not require additional threads. Adding more threads would cause multi-task resource contention issues, requiring additional locking of many resources and increasing the complexity of the lightweight open-source HarmonyOS system.
[0061] The above are merely preferred embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for constructing a graphical user interface using the C language, characterized in that, Includes the following steps; Step S1: When the lightweight open-source HarmonyOS system starts up, it creates a JS APP thread as the main UI thread; Step S2: Initialize the JavaScript virtual machine, JSAppTaskHandler module, task management module, and asynchronous message processing module within the JS APP thread to support UI rendering and event handling; Step S3: The task management module calls the input management module to execute the input management task in the UI task queue; Step S4: The task management module calls the sub-task management module to add one or more UI sub-tasks in the UI task queue after the input management task and before the animation management task, and executes the newly added UI sub-tasks; The UI subtask is used to either build the interface of a C application, execute the startAbility function, delete the interface of a C application, or execute the terminateAbility function; the C application refers to an application with a graphical interface written in C language. Step S5: The task management module calls the animation management module to execute the animation management task in the UI task queue; Step S6: The task management module calls the rendering management module to execute the rendering management task in the UI task queue.
2. The method for constructing a graphical interface using C language according to claim 1, characterized in that, In step S3, the input management module reads that the user clicked a button on a certain interface of an application, and the function of the button is to open an application C. In step S4, the task management module adds a single-execution task, constructs the interface of the newly opened C application, and creates various graphical components written in C language for the interface; the subtask management module adds these newly created graphical components to the top level of the graphical component tree and marks the newly created graphical components as invalid.
3. The method for constructing a graphical interface using C language according to claim 1, characterized in that, In step S3, the input management module reads that the user clicked a button on the interface of an application, and the function of the button is to open a JavaScript application; the JavaScript application refers to an application with a graphical interface written by any combination of JavaScript, HML and CSS. In step S4, the subtask management module adds a single-execution task and executes the startAbility function, which is a general interface function for creating a new JavaScript application in the open-source HarmonyOS system.
4. The method for constructing a graphical interface using C language according to claim 1, characterized in that, In step S3, the interface of an application read by the input management module no longer needs to be displayed; In step S4, if the application that does not need to display an interface is a C application, the subtask management module adds a single-execution task and deletes all graphical components of the C application's interface from the graphical component tree; if the application that does not need to display an interface is a JavaScript application, the subtask management module adds a single-execution task and executes the teminateAbility function, which is a general interface function for deleting a JavaScript application in the open-source HarmonyOS system.
5. The method for constructing a graphical interface using C language according to claim 1, characterized in that, In step S4, the UI subtask has the function of accessing, creating, modifying or deleting any graphical component in the graphical interface tree.
6. The method for constructing a graphical interface using C language according to claim 1, characterized in that, In step S5, the animation management module accesses all animations that created the container graphic component; for the animation applied in the foreground, the animation management module executes the animation callback function; if the animation is configured to change properties, the animation management module redefines the style for the container graphic component and sets the updated container graphic component to invalid.
7. The method for constructing a graphical interface using C language according to claim 1, characterized in that, In step S6, the rendering management module marks the corresponding non-container type graphics components as invalid based on the data read by the input management module, and re-renders all graphics components marked as invalid, thus redrawing the graphics component tree.
8. The method for constructing a graphical interface using C language according to claim 3, characterized in that, The C application is a system application that is not allowed to be uninstalled; the JavaScript application is a non-system application that is allowed to be uninstalled.
9. A device for implementing the construction of a graphical interface using the C language, characterized in that, It includes a UI main thread creation unit, a module initialization unit, an input management module, a subtask management module, an animation management module, and a rendering management module; The UI main thread creation unit is used to create a JS APP thread as the UI main thread when the lightweight open-source HarmonyOS system starts up; The module initialization unit is used to initialize the JavaScript virtual machine, JSAppTaskHandler module, task management module, and asynchronous message processing module within the JS APP thread to support interface rendering and event handling. The input management module is used by the task management module to execute input management tasks in the UI task queue; The subtask management module is used by the task management module to add one or more UI subtasks after the input management task and before the animation management task in the UI task queue, and execute the newly added UI subtasks. The UI subtask is used to either build the interface of a C application, execute the startAbility function, delete the interface of a C application, or execute the terminateAbility function; the C application refers to an application with a graphical interface written in C language. The animation management module is used by the task management module to execute animation management tasks in the UI task queue; The rendering management module is used by the task management module to execute rendering management tasks in the UI task queue.
10. The apparatus for constructing a graphical interface using C language according to claim 9, characterized in that, The subtask management module provides external interface functions, allowing other threads outside the JS APP thread to add and / or delete UI subtasks in the UI task queue by calling these interface functions.