Desktop component generation methods, loading methods, devices, application terminals, and terminal devices

By generating layout files and configuration packages, and combining cross-process communication and security components to handle exceptions, the issues of flexibility and coupling in desktop component development are resolved, resulting in improved stability and user experience.

CN123067862APending Publication Date: 2026-11-10CHONGQING CHANGAN AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611441076.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-16
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

In existing technologies, desktop component development lacks flexibility, has limited functionality, and is highly coupled with the desktop launcher, leading to increased operational stability and maintenance costs.

Method used

By acquiring interface data to generate layout files, creating trigger entry points and component information, and generating configuration packages, the terminal device can load desktop components without starting the application process. It can also access application private data through cross-process communication and set up security components to handle exception logic.

Benefits of technology

It enables flexible development and stable operation of desktop components, reduces the coupling and maintenance cost of the desktop launcher, and improves user experience and operational stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123067862A_ABST
    Figure CN123067862A_ABST
Patent Text Reader

Abstract

This application relates to the field of intelligent cockpit technology, and particularly to a desktop component generation method, loading method, apparatus, application terminal, and terminal device. The method, applied to the application terminal, includes the following steps: acquiring the interface data of the desktop component and creating a trigger entry point for the business logic of the desktop component; when the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface; generating a layout file for the desktop component based on the interface data; registering component information based on the layout file; generating a configuration package for the desktop component based on the trigger entry point, the layout file, and the component information; and loading the desktop component on the desktop interface through the configuration package on the terminal device. This solves the problems of limited functionality and high coupling between the application and the desktop launcher inherent in related technologies that use native desktop components for desktop component development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart cockpit technology, specifically to a desktop component generation method, loading method, apparatus, application terminal, and terminal device. Background Technology

[0002] The flexibility, interactivity, and operational stability of desktop components are crucial for enhancing the user experience of smart cockpits. Related technologies typically employ native desktop component solutions, but these have limitations in supported view types, update frequency, and interactivity. Other technologies utilize custom view solutions, where applications provide custom views and integrate them into the launcher, or the launcher itself develops the interface and business logic for desktop components. However, this approach suffers from high coupling between the launcher and the application, component malfunctions can easily affect launcher stability, and maintenance costs are high. Summary of the Invention

[0003] This application provides a desktop component generation method, loading method, apparatus, application, and terminal device to solve the problems of limited functionality and high coupling between the application and the desktop launcher that exist in related technologies that use native desktop components to develop desktop components.

[0004] The first aspect of this application provides a method for generating a desktop component. The method is applied to an application and includes the following steps: obtaining the interface data of the desktop component and creating a trigger entry point for the business logic of the desktop component. When the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface; generating a layout file of the desktop component based on the interface data and registering component information based on the layout file; generating a configuration package of the desktop component based on the trigger entry point, the layout file, and the component information, and loading the desktop component on the desktop interface through the configuration package by the terminal device.

[0005] Based on the aforementioned technical means, this application generates a layout file by acquiring interface data, thereby fixing the interface structure of desktop components in the form of standardized layout resources, providing a parsable static resource foundation for cross-process loading; by integrating the trigger entry, layout file, and component information into a configuration package, the terminal device only needs to parse the configuration package to obtain all the description information required for loading, without relying on the real-time execution of the application-side code, thus eliminating the need to start the application process during layout loading. If the application's private data needs to be accessed during subsequent interaction stages, the application process is woken up for execution through cross-process communication, and the two do not conflict with each other.

[0006] Optionally, creating a trigger entry point for the business logic of the desktop component includes: identifying at least one of the function data, listener callback data, and task trigger data in the business logic of the desktop component; creating a trigger entry point for the listener callback based on the listener callback data; creating a trigger entry point for the task based on the task trigger data; and creating at least one of the trigger entry points for the constructor function and the lifecycle function based on the function data.

[0007] Based on the aforementioned technical means, this application identifies function data, listener callback data, and task trigger data in the business logic of desktop components, and creates corresponding trigger entry points based on different types of data, enabling different business logics of desktop components to be triggered through the corresponding trigger entry points. Specifically, trigger entry points for listener callbacks are created based on listener callback data, trigger entry points for tasks are created based on task trigger data, and trigger entry points for constructors or lifecycle functions are created based on function data. This unifies the triggering methods of desktop component business logic and provides a foundation for running desktop component business logic through trigger entry points in the future.

[0008] Optionally, generating a layout file for a desktop component based on the interface data includes: extracting component names and hierarchical relationships from the interface data; generating at least one interface element of the desktop component based on the component names; and generating a layout file for the desktop component based on the hierarchical relationships and at least one interface element.

[0009] Based on the aforementioned technical means, this application extracts component names and hierarchical relationships from interface data, generates corresponding interface elements based on component names, and organizes these interface elements according to the hierarchical relationships to generate a layout file for the desktop component. Thus, the component information and hierarchical relationships in the interface data are converted into a layout file that describes the interface structure of the desktop component. This allows the interface content and organizational relationships between interface elements of the desktop component to be saved and loaded through the layout file, providing a foundation for subsequent loading and display of the desktop component.

[0010] Optionally, component information is registered based on the layout file, including: identifying the layout type and resource identifier of the layout file; associating the resource identifier and layout type; and generating component information based on the association result.

[0011] Based on the above technical means, this application identifies the layout type and resource identifier of the layout file, associates the resource identifier with the layout type, and generates component information based on the association result, so that the layout resources of the desktop component are associated with the corresponding layout type, thereby facilitating the terminal device to determine the layout file and loading method of the desktop component based on the component information, and providing a basis for subsequent loading of the desktop component.

[0012] Optionally, the configuration package for generating the desktop component based on the trigger entry point, layout file, and component information also includes: a security component for the business logic that creates the desktop component; the security component is used to listen to the running data of the business logic and skip the abnormal logic when it is detected that there is abnormal logic in the business logic based on the business data; the trigger entry point of the business logic is encapsulated through the security component, and the configuration package for the desktop component is generated based on the encapsulated trigger entry point, layout file, and component information.

[0013] Based on the aforementioned technical means, this application creates a security component for the business logic of the desktop component and uses the security component to monitor the running data of the business logic. When an anomaly is detected in the business logic, the anomaly logic is skipped, thus enabling the anomalies during the operation of the business logic to be handled. Furthermore, the trigger entry point of the business logic is encapsulated by the security component, so that when the business logic is executed through the trigger entry point, it can undergo the anomaly handling of the security component, thereby reducing the impact of desktop component business logic anomalies on the operation of the terminal device and improving the stability of the desktop component operation.

[0014] A second aspect of this application provides a desktop component loading method, which is applied to a terminal device. The method includes the following steps: obtaining a configuration package of the desktop component issued by an application client; running a desktop component generation method on the application client; identifying the layout file, trigger entry point, and component information of the desktop component according to the configuration package; and loading the desktop component on the desktop interface according to the component information, trigger entry point, and layout file.

[0015] Based on the aforementioned technical means, this application enables the terminal device to obtain a desktop component generated by the application by acquiring the desktop component issued by the application; by identifying the layout file, trigger entry, and component information of the desktop component, the application determines the interface layout, business logic triggering method, and component configuration corresponding to the desktop component; further, the application loads the desktop component according to the component information, trigger entry, and layout file, enabling the terminal device to display the desktop component according to the corresponding layout file and run the business logic of the desktop component through the corresponding trigger entry, thereby providing a foundation for the loading and running of the desktop component on the terminal device.

[0016] Optionally, loading a desktop component on the desktop interface based on component information, trigger entry point, and layout file includes: extracting resource identifiers from component information; determining the layout type of the layout file based on the resource identifiers; loading the view of the desktop component on the desktop interface based on the layout type; triggering the trigger entry point through the launcher of the desktop interface to run the business logic of the desktop component; and loading the desktop component based on the execution result of the view and the business logic.

[0017] Based on the aforementioned technical means, this application first extracts resource identifiers to determine the layout type and loads the view, then triggers the entry point to run business logic, and finally combines the view and business logic execution results to complete the full loading of the desktop component. This ensures that the desktop component has completed data filling and state initialization before being displayed, guaranteeing that the desktop component seen by the user is in its final usable state. Determining the layout type ensures that native types use the system framework while custom types use cross-process loading; triggering the entry point ensures that business logic is executed promptly after the view is loaded, avoiding blank or flickering issues caused by incomplete data after the view is displayed; and combining the view and business logic execution results ensures that the desktop component has both a complete interface structure and correct data content, allowing users to interact directly with the desktop component without waiting for additional loading.

[0018] Optionally, loading the view of a desktop component on the desktop interface according to the layout type includes: if the layout type is a natively loaded type, loading the view of the desktop component on the desktop interface through the native loading interface, wherein the native loading interface is provided by the operating system of the terminal device; if the layout type is a process-loaded type, creating an application context according to the component information, calling the layout filler according to the application context, and loading the view of the desktop component on the desktop interface according to the layout filler.

[0019] Based on the aforementioned technical means, this application distinguishes between two different layout types, enabling the desktop launcher to select the corresponding loading method according to the actual configuration of the desktop components. This not only maintains compatibility with the native desktop component loading mechanism but also supports a custom desktop component loading mechanism based on cross-process loading, thereby expanding the loading capabilities of desktop components without changing the system's native framework. For native desktop components, loading is completed by directly calling the native loading interface, ensuring compatibility with existing native desktop components. For custom desktop components, the ability to load application-side layout files across processes is achieved by creating an application context and calling a layout filler, thus supporting functions that the native mechanism cannot achieve, such as custom views and complex interactions.

[0020] Optionally, loading a view of a desktop component on the desktop interface based on a layout filler includes: traversing the hierarchy in a layout file and at least one interface element using the layout filler; and loading a view of the desktop component based on the hierarchy and at least one interface element.

[0021] Based on the above technical means, this application obtains the interface structure and composition of the desktop component by traversing the hierarchical relationship and interface elements in the layout file, and loads the interface elements according to the hierarchical relationship, so that each interface element can be combined according to the structure corresponding to the layout file, thereby forming the desktop component interface corresponding to the layout file, providing a foundation for the correct display of the desktop component.

[0022] Optionally, loading a view of a desktop component based on a hierarchy and at least one interface element includes: identifying the size information of the interface element; calculating the footprint of the interface element based on the size information; determining the display position of the interface element based on the hierarchy; and displaying the interface element based on the footprint and display position.

[0023] Based on the above technical means, this application identifies the size information of interface elements and calculates the corresponding placeholder size, so that the interface elements can determine the display space occupied in the application interface according to their own size; further, it determines the display position of the interface elements according to the hierarchical relationship, and displays the interface elements in combination with the placeholder size, so that each interface element can be displayed according to the size and hierarchical relationship corresponding to the layout file, thereby realizing the normal layout and display of the desktop component interface.

[0024] Optionally, after loading the view of the desktop component on the desktop interface according to the layout filler, the method further includes: identifying the target task of the desktop component; when the target task is a local data access type, the launcher executes the target task; when the target task is a remote data access type, the launcher calls the application process, which executes the target task and returns the execution result to the launcher.

[0025] Based on the aforementioned technical means, after the desktop component's view is loaded, this application identifies the target task type and adopts the corresponding execution method, enabling the desktop component to flexibly select the data acquisition path according to different data sources. For locally obtainable data (such as local databases, system service listeners, etc.), the desktop launcher executes directly without waking up the application process, resulting in fast response speed and low resource consumption. For data that requires application process permissions or context to access (such as application private databases, network requests requiring authentication, etc.), cross-process communication is used to call the application process for execution. The application process uses its runtime environment and data access permissions to complete the data acquisition and return the result, thus solving the limitation that the desktop launcher cannot directly access application private data. The two execution methods complement each other, ensuring both the efficiency and stability of data acquisition and the integrity and security of data access. At the same time, application developers can independently decide which method to use based on business scenarios, without increasing the implementation complexity of the desktop launcher.

[0026] A third aspect of this application provides a desktop component generation apparatus. The apparatus is applied to an application terminal. The apparatus includes: a creation module, used to acquire interface data of the desktop component and create a trigger entry point for the business logic of the desktop component. When the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface; a registration module, used to generate a layout file of the desktop component based on the interface data and register component information based on the layout file; and a generation module, used to generate a configuration package of the desktop component based on the trigger entry point, the layout file, and the component information. The terminal device loads the desktop component on the desktop interface through the configuration package.

[0027] A fourth aspect of this application provides a desktop component loading apparatus, which is applied to a terminal device. The apparatus includes: an acquisition module for acquiring a configuration package of a desktop component issued by an application terminal, wherein the application terminal runs a desktop component generation method; an identification module for identifying the layout file, trigger entry point, and component information of the desktop component based on the configuration package; and a loading module for loading the desktop component on the desktop interface based on the component information, trigger entry point, and layout file.

[0028] The fifth aspect of this application provides an application terminal, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the program to implement a desktop component generation method.

[0029] A sixth aspect of this application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a desktop component loading method.

[0030] A seventh aspect of this application provides a computer-readable storage medium having a computer program stored thereon, the program being executed by a processor to implement a desktop component generation method, or to implement a desktop component loading method.

[0031] An eighth aspect of this application provides a computer program product having a computer program or instructions stored thereon. When the computer program or instructions are executed, they are used to implement a desktop component generation method or a desktop component loading method.

[0032] Therefore, this application has at least the following beneficial effects: (1) This application develops desktop components in a custom view manner on the application side and registers the layout resources of the desktop components through component information, so that the interface display and business logic of the desktop components can be developed independently by the corresponding application, providing a more flexible development method for desktop components.

[0033] (2) This application creates a corresponding application context based on the application information of the target application and obtains a layout filler based on the application context to load the desktop component layout resources provided by the target application, so that the desktop launcher can load the desktop component view provided by the target application, thereby reducing the coupling between desktop component development and desktop launcher code.

[0034] (3) This application loads the desktop component view provided by the target application in the desktop launcher and adds the desktop component view to the desktop interface, so that the desktop components can be displayed, added, deleted and dragged in a unified desktop component management method, thereby improving the compatibility between the desktop components and the desktop launcher.

[0035] (4) This application encapsulates the business logic triggering entry points such as the constructor, lifecycle function, listener callback and asynchronous task callback of the desktop component by setting up a security view auxiliary component and a security callback component, so that the exceptions generated by the business logic of the desktop component can be captured in time, thereby reducing the impact of desktop component running exceptions on the stability of the desktop launcher.

[0036] (5) This application provides a unified security encapsulation of the business logic triggering entry of the desktop component and provides an exception listening mechanism to the desktop component, so that the desktop component can promptly know the exception situation and perform corresponding processing when an exception occurs, thereby improving the exception handling capability of the desktop component during operation.

[0037] (6) This application retains the interface resources and business logic of the desktop component in the corresponding application and loads the desktop component according to the component information by the desktop launcher, so that the development of the desktop component and the development of the desktop launcher can be relatively independent. When the interface or business logic of the desktop component is adjusted, the need to modify the desktop launcher code synchronously is reduced. Attached Figure Description

[0038] Figure 1 This is a flowchart of a desktop component generation method according to an embodiment of this application; Figure 2 This is a flowchart illustrating the specific steps involved in registering component information according to an embodiment of this application. Figure 3 This is a schematic diagram of the security component structure according to an embodiment of this application; Figure 4 This is a flowchart illustrating the capture of anomalies by a security component according to an embodiment of this application; Figure 5 This is a flowchart of a desktop component loading method according to an embodiment of this application; Figure 6 This is a schematic diagram of the data flow of desktop component provider information according to an embodiment of this application; Figure 7 This is an example diagram of a desktop component generation apparatus according to an embodiment of this application; Figure 8 This is an example diagram of a desktop component loading device according to an embodiment of this application. Detailed Implementation

[0039] The embodiments of this application will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be understood that the preferred embodiments are only for illustrating this application and are not intended to limit the scope of protection of this application.

[0040] The following description, with reference to the accompanying drawings, outlines a desktop component generation method, loading method, apparatus, application, and terminal device according to embodiments of this application. Addressing the issues of limited functionality and high coupling between the application and the desktop launcher inherent in the related technologies mentioned in the background, this application provides a desktop component generation method. In this method, firstly, the interface data of the desktop component is acquired, and a trigger entry point for the business logic of the desktop component is created. When the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface. By defining the trigger entry point, the desktop component can automatically execute business logic, such as data initialization, according to preset trigger conditions after loading. Secondly, a layout file for the desktop component is generated based on the interface data. Component information is registered based on the layout file, and the interface structure of the desktop component is... The layout is fixed in the form of standardized layout resources, separating the interface description of desktop components from business logic. The layout file, as a purely static resource, can be parsed and loaded without running any code, providing a prerequisite for cross-process loading. Then, a configuration package for the desktop component is generated based on the trigger entry point, layout file, and component information. The terminal device loads the desktop component on the desktop interface through the configuration package. By integrating the trigger entry point, layout file, and component information into a unified structured data package, the terminal device only needs to parse this configuration package to obtain all the descriptive information required for loading, without needing to understand or execute the application-side code implementation. Therefore, the application process does not need to be launched during the layout loading process, achieving cross-process layout loading. This solves the problems of limited functionality and high coupling between the application and the desktop launcher that exist in related technologies that use native desktop components for desktop component development.

[0041] Specifically, Figure 1 This is a flowchart illustrating a desktop component generation method provided in an embodiment of this application. The method is applied to an application and includes the following steps: In step S101, the interface data of the desktop component is obtained, and a trigger entry for the business logic of the desktop component is created. When the trigger entry is triggered, the business logic of the desktop component is run through the launcher of the desktop interface.

[0042] Among them, the desktop component is a component displayed on the application interface of the terminal device, which can be a mobile phone, a car infotainment system, etc. Taking the car infotainment system as an example, the desktop component is a small module placed on the car infotainment system desktop, which allows users to view information and perform simple operations directly without opening the app. In this application, it represents a component developed by the application side and loaded into the application interface. The interface data is data used to describe the composition of the desktop component interface and the organizational relationship between interface elements. In this application, it represents data containing component names and hierarchical relationships, used to generate the layout file of the desktop component. The trigger entry is the entry point used to trigger the execution of the business logic of the desktop component. In this application, it represents at least one of the constructor, lifecycle function, listener callback, and asynchronous task. The launcher is the desktop launcher running on the terminal device. In this application, it represents the system application responsible for managing the desktop interface, loading and displaying the desktop component. The desktop interface is the main screen interface of the terminal device. In this application, it represents the main screen used to display the desktop component and application icons. The business logic is the processing logic that the desktop component needs to execute to achieve its function. In this application, it represents operations such as data acquisition, desktop interface update, and interactive response.

[0043] It is understood that this application generates layout files by acquiring interface data, thereby fixing the interface structure of the desktop component in the form of standardized layout resources. The layout files and trigger entry points work together to enable the desktop component to automatically execute business logic (such as data initialization, desktop interface data filling, etc.) according to preset trigger conditions after loading, without the need for manual operation by the user or intervention of external events, thus improving the intelligent response capability and user experience of the desktop component.

[0044] This application develops the display and interaction requirements of corresponding desktop components and preview components using custom views based on the interface data of the desktop components. It generates corresponding layout files based on the interface data, including an initial layout file and a preview layout file. The application registers the layout files and corresponding configuration packages with the operating system through the component provider. The development of custom views is not limited by the view types, refresh rates, and interactive gestures supported by the native desktop components, and is consistent with the interface development capabilities provided by the operating system for ordinary custom controls.

[0045] Specifically, this application can determine the interface data of the desktop component based on its display requirements, and determine the corresponding business logic based on the interaction requirements and business processing of the desktop component. The business logic can be triggered through corresponding entry points, such as through constructors, lifecycle functions, listener callbacks, or task triggers. When an entry point is triggered, the application image corresponding to the desktop component can be entered, the business logic of the desktop component can be run in the application image, and the desktop component can be loaded and displayed based on the interface data. Here, the application image is the application runtime environment corresponding to the application to which the desktop component belongs; in this application, it represents the runtime environment used to provide the desktop component with an application resource access environment and a business logic runtime environment. The application image can be created based on the application information of the application to which the desktop component belongs, and is used to load the layout files provided by the application and run the business logic corresponding to the desktop component. In one embodiment, the application image can be formed by creating an application context based on the application information of the application to which the desktop component belongs. The application context is used to access the resources corresponding to the application and obtain a layout loader for loading layout files.

[0046] In step S102, a layout file for the desktop components is generated based on the interface data, and component information is registered based on the layout file.

[0047] Among them, the layout file is a resource file used to describe the interface structure of the desktop component, and in this application, it represents a file used to describe each interface element in the desktop component and its layout relationship; the component information is information used to describe the configuration of the desktop component, and in this application, it represents information used to record the layout file corresponding to the desktop component and its related configuration package; the resource identifier is identification information used to uniquely identify the layout resource, and in this application, it represents identification information used to determine the layout file corresponding to the desktop component.

[0048] It is understood that this application generates a layout file for desktop components based on interface data, thereby converting the interface data into layout resources that can describe the interface structure of the desktop components; furthermore, it registers component information based on the layout file, thereby establishing a correspondence between the layout file and the desktop components, which facilitates the terminal device to determine and load the corresponding layout file based on the component information, providing a foundation for the subsequent display of desktop components.

[0049] Specifically, in one embodiment of this application, the specific process for registering component information is as follows: Figure 2 As shown. This application follows the standard desktop component development method, registering desktop component information with the system through a registered component provider, and carrying the layout information of the aforementioned desktop component and preview component, as well as the necessary information for display such as the width and height of the desktop component in the metadata resource (including but not limited to the metadata resource).

[0050] The layout information for desktop components and preview components corresponds to layout files, including initial layout files and preview layout files. The initial layout file includes, but is not limited to, `initialLayout` (used by the terminal device to load and display desktop components), and the preview layout file includes, but is not limited to, `previewLayout` (used by the terminal device to display a preview of the desktop component in the desktop component selection list, assisting the user in operating the desktop component). The width and height of the desktop component determine its display size in the application interface of the terminal device. The layout information may include resource identifiers corresponding to the layout files, and the component information may also include the layout type corresponding to the layout files. This application associates resource identifiers with layout types and registers the associated information to the system through a component provider. This application registers the resource information corresponding to the layout files and the configuration packages such as the width and height of the desktop components to the system through a component provider to generate component information.

[0051] In step S103, a configuration package for the desktop component is generated based on the trigger entry, layout file, and component information. The terminal device loads the desktop component on the desktop interface using the configuration package.

[0052] The configuration package is structured data generated by the application to describe the configuration required for loading desktop components, including but not limited to: layout file identifier, layout type, component width and height information, business logic trigger entry identifier, etc. The terminal device obtains the configuration package, determines the layout resources and loading method of the desktop components, and completes the loading and display of the desktop components accordingly.

[0053] It is understood that this application generates a configuration package for desktop components based on trigger entry points, layout files, and component information, thereby establishing a connection between the business logic triggering method, interface layout, and component information of the desktop components. This enables the generated desktop components to execute business logic based on the corresponding trigger entry points and display the interface according to the layout files, providing a foundation for the terminal device to load desktop components onto the desktop interface through the configuration package.

[0054] In one embodiment of this application, the desktop component is developed by an application (such as a weather application, music application, etc.). The application generates a layout file according to the interface display requirements of the desktop component. The application registers the layout file information in the form of metadata in the operating system through the component declaration mechanism provided by the terminal device's operating system. When the application is installed, the operating system automatically parses the declaration and registers the component information in the operating system services for subsequent querying and use by the desktop launcher.

[0055] The application also creates triggering entry points for business logic based on the interaction requirements of the desktop components, and generates a configuration package for the desktop components by associating the layout files and triggering entry points. The configuration package includes the layout file identifier, layout type, component width and height, and business logic triggering entry points for the desktop components, which are used to define the interface structure, display attributes, and interaction response methods of the desktop components. The terminal device loads the desktop components on the desktop interface through the configuration package.

[0056] During the loading process of the aforementioned layout file, the desktop launcher only needs to read the static layout resources in the application installation package, without needing to start or wake up the application. After loading is complete, the view runs in the desktop launcher process, achieving complete decoupling between the desktop component code and the desktop launcher—the desktop component code remains in the application installation package, the application can be updated independently, and the desktop launcher does not need to be released synchronously.

[0057] Therefore, according to the desktop component generation method proposed in this application embodiment, firstly, the interface data of the desktop component is obtained, and a trigger entry for the business logic of the desktop component is created. When the trigger entry is triggered, the business logic of the desktop component is run through the launcher of the desktop interface. By defining the trigger entry, the desktop component can automatically execute business logic, such as data initialization, according to preset trigger conditions after loading. Secondly, a layout file of the desktop component is generated according to the interface data. Component information is registered according to the layout file, and the interface structure of the desktop component is fixed in the form of standardized layout resources, so that the interface description of the desktop component is separated from the business logic. The layout file, as a pure static resource, can be parsed and loaded without running any code, providing a prerequisite for cross-process loading. Then, a configuration package of the desktop component is generated according to the trigger entry, layout file, and component information. The terminal device loads the desktop component on the desktop interface through the configuration package. The trigger entry, layout file, and component information are integrated into a unified structured data package, so that the terminal device only needs to parse the configuration package to obtain all the description information required for loading, without needing to understand or execute the application-side code implementation. Thus, no application process needs to be started during the layout loading process, realizing cross-process layout loading. This solves the problems of limited functionality and high coupling between applications and desktop launchers that exist in related technologies that use native desktop components to develop desktop components.

[0058] Based on the above embodiments, the following will describe the relevant embodiments of the triggering entry point for the business logic of creating the desktop component in step S101, as follows: In one embodiment of this application, the trigger entry point for creating the business logic of the desktop component includes: identifying at least one of function data, listener callback data, and task trigger data in the business logic of the desktop component; creating a trigger entry point for the listener callback based on the listener callback data; creating a trigger entry point for the task based on the task trigger data; and creating at least one of a trigger entry point for the constructor function and a trigger entry point for the lifecycle function based on the function data.

[0059] The function data refers to function call information in the business logic of the desktop component, which includes constructor data and lifecycle function data in this application; the listener callback data includes information describing the desktop component's listener events and corresponding callback processing; the task trigger data includes information describing the desktop component's task execution conditions and task processing; the constructor is the function executed when the desktop component object is created, and the lifecycle function is the function executed when the desktop component's lifecycle changes accordingly; the listener callback is the callback executed when the desktop component listens for a corresponding event, which in this application represents a callback used to respond to user operations or other events and execute corresponding business logic.

[0060] It is understood that this application identifies function data, listener callback data, and task trigger data in the business logic of desktop components, and creates corresponding trigger entry points based on different types of data, so that different business logics of desktop components can be triggered through the corresponding trigger entry points. Specifically, trigger entry points for listener callbacks are created based on listener callback data, trigger entry points for tasks are created based on task trigger data, and trigger entry points for constructors or lifecycle functions are created based on function data. This unifies the triggering methods of desktop component business logic and provides a foundation for running desktop component business logic through trigger entry points in the future.

[0061] The trigger entry points in the business logic of desktop components can include trigger entry points corresponding to function data, trigger entry points corresponding to listener callback data, and trigger entry points corresponding to task trigger data.

[0062] The trigger entry points for function data can include constructor trigger entry points and lifecycle function trigger entry points, including but not limited to onAttachedToWindow, onDetachedFromWindow, onMeasure, onLayout, onDraw, onFocusChanged, and onWindowVisibilityChanged. The trigger entry points for task trigger data can include trigger entry points for tasks such as post and postDelayed. The trigger entry points for listener callback data can include trigger entry points for various listener callbacks set by the desktop component. The desktop component can be developed using the same methods as a regular custom view, implementing its UI and business logic within the trigger entry points corresponding to function data, listener callback data, and task trigger data.

[0063] Based on at least one of the above embodiments, the relevant embodiments of the layout file and registered component information in step S102 will be described below: In one embodiment of this application, generating a layout file for a desktop component based on interface data includes: extracting component names and hierarchical relationships from the interface data; generating at least one interface element of the desktop component based on the component names; and generating a layout file for the desktop component based on the hierarchical relationships and at least one interface element.

[0064] Among them, the component name is information used to identify the interface component in the desktop component, and in this application, it represents information used to determine the interface elements contained in the desktop component; the hierarchy relationship is information used to describe the organizational relationship between multiple interface elements, and in this application, it represents information used to determine the parent-child relationship and display hierarchy between each interface element; the interface element is the basic display unit that constitutes the desktop component interface, and in this application, it represents the view element generated according to the component name and used to constitute the desktop component interface.

[0065] Understandably, this application extracts component names and hierarchical relationships from the interface data, generates corresponding interface elements based on the component names, and organizes these interface elements according to the hierarchical relationships to generate a layout file for the desktop component. Thus, the component information and hierarchical relationships in the interface data are converted into a layout file that describes the interface structure of the desktop component. This allows the interface content and the organizational relationships between interface elements of the desktop component to be saved and loaded through the layout file, providing a foundation for subsequent loading and display of the desktop component.

[0066] Specifically, interface data describes the composition of desktop components and the organizational relationships between interface elements. Component names representing the components of the interface and hierarchical relationships representing the organizational relationships between these components can be extracted from the interface data. Component names can correspond to text, images, buttons, containers, and other elements that constitute the desktop components.

[0067] Based on the extracted component names, at least one interface element corresponding to each component can be generated, and the organizational relationship between the at least one interface element can be determined according to the hierarchical relationship. Further, the at least one interface element is organized according to the hierarchical relationship to generate a layout file corresponding to the desktop component, so as to describe the interface structure of the desktop component through the layout file.

[0068] In one embodiment of this application, registering component information based on a layout file includes: identifying the layout type and resource identifier of the layout file; associating the resource identifier and layout type; and generating component information based on the association result.

[0069] Among them, the layout type is information used to indicate the layout loading method of the desktop component, and in this application, it represents the type information used to determine the corresponding loading method of the desktop component; the resource identifier is information used to uniquely identify the layout resource, and in this application, it represents the identifier information used to determine the layout file corresponding to the desktop component.

[0070] It is understood that this application identifies the layout type and resource identifier of the layout file, associates the resource identifier with the layout type, and generates component information based on the association result, so that the layout resources of the desktop component are associated with the corresponding layout type. This makes it easier for the terminal device to determine the layout file and loading method of the desktop component based on the component information, thus providing a basis for loading the desktop component in the future.

[0071] In one embodiment of this application, the terminal device includes an operating system. The operating system provides a desktop component management mechanism for receiving and managing component information corresponding to desktop components and providing the component information to the desktop launcher. Therefore, the application of this application registers desktop component information with the terminal device's operating system through a desktop component provider, enabling the terminal device's operating system to obtain layout information and other configuration packages for supporting desktop component display.

[0072] (1) This application inherits the desktop component provider and implements a component provider for registering desktop components.

[0073] (2) Application configuration resource files, as shown in Table 1. Table 1 is a table of configuration attributes and descriptions for desktop component configuration nodes.

[0074] Table 1

[0075] In this embodiment, a custom desktop component view and a preview custom view can be used as root nodes, directly filling the initial layout file and the preview layout file respectively to form the layout files corresponding to the desktop component and the preview component. The desktop component view and the preview custom view can correspond to the interface elements in the layout files.

[0076] (3) The component provider implemented in this application is configured in the form of a receiver (including but not limited to a receiver) in the application manifest file (including but not limited to a manifest), and then registered with the operating system of the terminal device, and the above resource file is assigned to the receiver in the form of metadata resource (including but not limited to a meta-data resource).

[0077] Based on at least one of the above embodiments, the following will describe the relevant embodiments of generating the configuration package of the desktop component according to the trigger entry, layout file and component information in step S103, as follows: In one embodiment of this application, the configuration package for generating a desktop component based on the trigger entry point, layout file, and component information further includes: a security component for creating the business logic of the desktop component; the security component is used to monitor the running data of the business logic, and skips the abnormal logic when it is detected that there is abnormal logic in the business logic based on the business data; the trigger entry point of the business logic is encapsulated through the security component, and the configuration package for the desktop component is generated based on the encapsulated trigger entry point, layout file, and component information.

[0078] Among them, the security component is a functional component used to perform security processing on the business logic of the desktop component. In this application, it represents a component used to monitor the operation of the business logic and to handle exceptions during the triggering process of the business logic. The running data is the data generated during the execution of the business logic. In this application, it represents data used to reflect the execution status of the business logic. The exception logic is the exception handling logic generated during the execution of the business logic. In this application, it represents the business processing logic that may cause the desktop component to run abnormally. The encapsulation is a processing method that combines the triggering entry of the original business logic with the security processing function. In this application, it represents the use of the security component to wrap the triggering entry of the business logic so as to perform exception handling when the business logic is triggered. The component configuration package is the structured data of the desktop component, including at least one of the layout file identifier, the business logic triggering entry, and the security component. It is used to determine the interface resources, loading method, interaction response, and exception handling mechanism when the desktop launcher loads the desktop component.

[0079] Understandably, this application creates a security component and encapsulates the triggering entry point of the business logic, enabling exceptions during the desktop component's operation to be captured and isolated by the security component. This prevents exceptions from propagating upwards to the desktop launcher process, causing desktop crashes or freezes, thus ensuring the stability of the desktop launcher. Simultaneously, the security component monitors the execution data of the business logic, skipping abnormal logic and notifying the application when it detects it. This allows the application to promptly perceive abnormal states and perform follow-up processing, improving the maintainability of the desktop component and the user experience. Furthermore, the encapsulation mechanism of the security component effectively isolates the business logic of the desktop component from the core process of the desktop launcher. Even if the desktop component has defects, it will not affect the normal operation of the desktop launcher, further reducing the coupling risk between desktop component development and the desktop launcher.

[0080] Specifically, the security component structure of this application embodiment is as follows: Figure 3 As shown, the flowchart for the security component to capture exceptions is as follows: Figure 4 As shown.

[0081] In one embodiment of this application, the triggering entry point of the business logic of the desktop component can be encapsulated by a security component. The security component encapsulates the triggering entry point of the business logic so that when the triggering entry point is triggered, the corresponding business logic is called through the security component, so as to perform secure processing on the operation process of the business logic.

[0082] Specifically, refer to Figure 3 and Figure 4 Security components can include SafeViewHelper, SafeLifecycleCallback, and SafeCallback. These components encapsulate the trigger points for business logic and monitor runtime data during the business logic's execution to handle exceptions when they occur.

[0083] (1) The SafeViewHelper component has encapsulated the corresponding interface for calling the SafeLifecycleCallback component and captures exceptions during interface execution. The custom view of the desktop component implements the SafeLifecycleCallback interface to replace the direct implementation of business logic in the trigger entry point of business logic, so that the business logic is called through the security component. When the trigger entry point of business logic is triggered, the security component calls the corresponding business logic and listens to the running data of the business logic; when it identifies the existence of abnormal logic in the business logic based on the running data, it captures the abnormal logic and skips the abnormal logic, thereby avoiding the transmission of the running risk of the desktop component to the application interface.

[0084] (2) When a custom view of the desktop component needs to set a common listener callback, it directly calls the listener setting method of the SafeViewHelper component, including commonly used listener callback settings (including but not limited to setOnClickListener, setOnTouchListener, setOnLongClickListener, etc.), and implements the business logic in the corresponding listener callback. When the SafeViewHelper component sets a listener callback, it creates a corresponding type of security listener callback, encapsulates the original listener callback, including calling the original listener callback and listening to the running data of the original listener callback, as well as capturing the abnormal logic in the running process of the original listener callback; when abnormal logic is detected in the original listener callback, the abnormal logic is skipped.

[0085] (3) When the business logic of the desktop component requires the use of business logic listener callbacks (including but not limited to LiveData, RxJava, AnimatorUpdateListener, Glide) to load listener callbacks from other specific software development kits, a secure callback component is used to encapsulate the listener callbacks that need to be set. The encapsulation of the secure callback component allows an exception handling process to be inserted during the normal invocation of the original listener callback when the listener callback is triggered, so as to listen to the execution data of the callback and identify whether there is any abnormal logic in the listener callback based on the execution data; when abnormal logic is identified in the listener callback, the abnormal logic is captured and skipped.

[0086] (4) This application registers an exception listener with the application interface through the SafeViewHelper component. After the security component identifies an exception in the business logic based on the running data and performs exception handling, it sends an exception notification to the application interface through the SafeViewHelper component. After receiving the exception notification, the application interface performs necessary follow-up processing.

[0087] Figure 5 This is a flowchart illustrating a desktop component loading method provided in an embodiment of this application. The method is applied to a terminal device and includes the following steps: In step S201, the configuration package of the desktop component issued by the application is obtained, and the application runs the desktop component generation method.

[0088] Understandably, the centralized generation and distribution mechanism of configuration packages eliminates the need for desktop component updates to rely on terminal device software version upgrades, thereby reducing desktop component maintenance costs and improving update efficiency.

[0089] In step S202, the layout file, trigger entry point, and component information of the desktop component are identified based on the configuration package.

[0090] It is understood that this application enables terminal devices to determine the interface layout, business logic triggering method, and configuration package corresponding to the desktop component by identifying the layout file, trigger entry point, and component information of the desktop component, thus providing a foundation for loading the desktop component based on the layout file, trigger entry point, and component information.

[0091] Specifically, the terminal device scans the desktop component provider information registered by the application in the configuration package using the `getInstalledProvidesForProfile` method of the Desktop Component Manager (`Manager`). For each desktop component provider, it retrieves its corresponding information. From this information, it obtains the relevant information carried by the desktop component.

[0092] The desktop component provider information also includes the initial layout and preview layout of the desktop component, the width and height of the desktop component, and the type of the desktop component.

[0093] Among them, initialLayout and previewLayout correspond to the layout files of the desktop component, and the width, height and type of the desktop component correspond to the component information; the trigger entry point is determined according to the business logic of the desktop component, and the trigger entry point is identified so that the application image of the desktop component can be entered and the desktop component can be loaded according to the trigger entry point.

[0094] In step S203, the desktop component is loaded based on the component information, trigger entry point, and layout file.

[0095] The loading process refers to the process of loading the desktop component onto the terminal device based on the layout resources, business logic, and configuration package corresponding to the desktop component. In this application, it represents the process of loading and displaying the desktop component on the terminal device based on the component information, trigger entry point, and layout file.

[0096] It is understood that this application loads desktop components based on component information, trigger entry points, and layout files, enabling the terminal device to determine the corresponding layout resources and loading method based on the component information, and to run the business logic of the desktop components based on the trigger entry points, thereby realizing the loading and display of desktop components on the terminal device.

[0097] Therefore, according to the desktop component loading method proposed in this application embodiment, the terminal device first obtains the configuration package generated by the application. The configuration package has pre-associated layout files, trigger entry points, and component information, providing a complete data foundation for subsequent loading. Based on this, the terminal device determines the layout file, business logic triggering method, and loading configuration corresponding to the desktop component by parsing the configuration package. Then, the terminal device loads the view of the desktop component according to the layout type in the configuration package and runs the business logic of the desktop component according to the trigger entry point, so that the desktop component is displayed according to the corresponding interface layout and responds to interactive operations. The desktop component does not need to rely on the real-time execution of the application code during the entire loading process. It can complete the entire process from data acquisition to interface display to interactive response solely through the configuration package. Thus, it solves the problems of limited functionality and high coupling between the application and the desktop launcher that exist in related technologies that use native desktop components to develop desktop components.

[0098] Based on at least one of the above embodiments, the following will describe the relevant embodiments of loading desktop components on the desktop interface according to component information, trigger entry and layout file in step S203, as follows: In one embodiment of this application, loading a desktop component on a desktop interface based on component information, a trigger entry point, and a layout file includes: extracting resource identifiers from the component information; determining the layout type of the layout file based on the resource identifiers; loading the view of the desktop component on the desktop interface based on the layout type; triggering the trigger entry point through the launcher of the desktop interface to run the business logic of the desktop component; and loading the desktop component based on the execution result of the view and the business logic.

[0099] In this application, the view is the view object corresponding to the desktop component, representing the interface object generated after loading the layout file through the layout filler; the launcher is the desktop launcher running on the terminal device, representing the system application responsible for managing the desktop interface and loading and displaying the desktop components.

[0100] Understandably, this application first extracts resource identifiers to determine the layout type and loads the view, then triggers the entry point to run business logic, and finally combines the view and business logic execution results to complete the full loading of the desktop component. This ensures that the desktop component has completed data population and state initialization before being displayed, guaranteeing that the desktop component seen by the user is in its final usable state. Determining the layout type ensures that native types use the system framework and custom types use cross-process loading; triggering the entry point ensures that business logic is executed promptly after the view is loaded, avoiding blank or flickering issues caused by incomplete data after the view is displayed; and combining the view and business logic execution results ensures that the desktop component has both a complete interface structure and correct data content, allowing users to interact directly with the desktop component without waiting for additional loading.

[0101] In one embodiment of this application, loading a view of a desktop component on a desktop interface according to a layout type includes: if the layout type is a natively loaded type, loading a view of a desktop component on the desktop interface through a native loading interface, wherein the native loading interface is provided by the operating system of the terminal device; if the layout type is a process-loaded type, creating an application context based on component information, calling a layout filler based on the application context, and loading a view of a desktop component on the desktop interface based on the layout filler.

[0102] Among them, the native loading type refers to the type loaded using the terminal device's native desktop component framework; the native loading interface refers to the native desktop component loading interface provided by the terminal device's operating system, which in this application represents system interfaces such as AppWidgetManager and AppWidgetHost; the process loading type refers to the type loaded using the cross-process loading layout mechanism of this application, which in this application corresponds to a desktop component with widgetCategory "custom"; the application context is ApplicationContext, which in this application represents the context environment used to access application resources and load layout files; the layout inflater is LayoutInflater, which in this application represents a system tool used to parse and convert XML (Extensible Markup Language) layout files into view objects; and the view of the desktop component is the view object corresponding to the desktop component, which in this application represents the card interface displayed on the desktop interface.

[0103] Understandably, this application distinguishes between two different layout types, enabling the desktop launcher to select the appropriate loading method based on the actual configuration of the desktop components. This ensures compatibility with the native desktop component loading mechanism while also supporting a custom desktop component loading mechanism based on cross-process loading. Thus, it expands the loading capabilities of desktop components without altering the system's native framework. For native desktop components, loading is completed directly by calling the native loading interface, ensuring compatibility with existing native desktop components. For custom desktop components, the ability to load application-side layout files across processes is achieved by creating an application context and calling a layout filler, thereby supporting features that the native mechanism cannot implement, such as custom views and complex interactions.

[0104] Specifically, the desktop launcher scans the desktop component provider information registered by the application in the configuration package. Each desktop component provider information contains the corresponding layout resource identifier and component configuration parameters.

[0105] If the provider information in the desktop component provider information is an active component type, then the corresponding application information can be further obtained. This application information is used to determine the application to which the desktop component belongs. Based on the obtained application information, the desktop launcher creates and caches a corresponding application context for each application that has registered a desktop component, for use in loading the layout file of the desktop component later.

[0106] Furthermore, the desktop launcher determines the corresponding loading method based on the layout type of the desktop component: when the layout type is native, the desktop component is loaded on the desktop interface through the native loading interface; when the layout type is custom, an application context is created based on the component information, the layout filler is called based on the application context, and the view of the desktop component is loaded on the desktop interface based on the layout filler.

[0107] The desktop component loading process of this application is as follows: Figure 6 As shown.

[0108] When loading desktop widgets, the appropriate loading method can be selected based on the widget's layout type. If the widget's layout type is a process-based loading type based on the application interface, the widget view will be loaded using the relevant interfaces of the native desktop widget framework within the application interface. For example, if the widget's layout type is "standard," the widget view can be loaded using interfaces such as AppWidgetHost from the native desktop widget framework.

[0109] If the desktop component's layout type is based on a process-based loading mechanism, an application context is created based on the component information. The layout filler is then invoked based on the application context, and the desktop component's view is loaded onto the desktop interface based on the layout filler. For example, if the desktop component's layout type is "custom," a cross-process layout loading mechanism is needed to load the view, ensuring that the desktop component's layout file can be loaded from the application image corresponding to the desktop component.

[0110] In one embodiment of this application, the view loading method based on the cross-process layout loading mechanism is as follows: Based on the scanned component information, an application context is created for each application. The terminal device obtains the application context and builds a layout inflater (including but not limited to LayoutInflater) based on the application context. Then, the cloneInContext method of the layout inflater is used to obtain a copy of the layout inflater to avoid polluting the original application. Based on the copy, the components registered by the application and the preview layout information (including but not limited to initialLayout and previewLayout) are populated. The views of the desktop components are obtained and loaded.

[0111] In one embodiment of this application, loading a view of a desktop component on a desktop interface according to a layout filler includes: traversing the hierarchy in a layout file and at least one interface element using a layout filler; and loading a view of the desktop component according to the hierarchy and at least one interface element.

[0112] The hierarchy refers to the hierarchical relationship between multiple UI elements in the layout file; each UI element corresponds to a view control defined in the layout file.

[0113] Understandably, this application obtains the interface structure and composition of the desktop component by traversing the hierarchical relationship and interface elements in the layout file, and organizes the interface elements for loading according to the hierarchical relationship, so that each interface element can be combined according to the structure corresponding to the layout file, thereby forming the desktop component interface corresponding to the layout file, and providing a foundation for the correct display of the desktop component.

[0114] When a desktop component view needs to be displayed, the layout filler parses the layout file, traverses the hierarchy and at least one UI element in the layout file, determines the loading relationship of the UI elements based on the hierarchy, and creates the corresponding view based on the UI elements, thereby obtaining the views corresponding to the desktop component and the preview component.

[0115] In one embodiment of this application, loading a view of a desktop component based on a hierarchical relationship and at least one interface element includes: identifying the size information of the interface element; calculating the footprint size of the interface element based on the size information of the interface element; determining the display position of the interface element based on the hierarchical relationship; and displaying the interface element based on the footprint size and the display position.

[0116] Among them, size information is information used to describe the size of interface elements, and in this application, it represents information used to determine the width and height of interface elements; place size is information used to indicate the space occupied by interface elements in the application interface, and in this application, it represents the width and height required for displaying interface elements as determined by the interface element size information; display position is information used to determine the display position of interface elements in the application interface, and in this application, it represents the layout position of interface elements determined by the hierarchical relationship between interface elements.

[0117] It is understood that this application identifies the size information of interface elements and calculates the corresponding placeholder size, so that the interface elements can determine the display space occupied by the interface elements in the application interface according to their own size; further, it determines the display position of the interface elements according to the hierarchical relationship, and displays the interface elements in combination with the placeholder size, so that each interface element can be displayed according to the size and hierarchical relationship corresponding to the layout file, thereby realizing the normal layout and display of the desktop component interface.

[0118] The application interface uses a unified component view display rule to display component views within the main layout of the application interface. This display rule includes: converting the width and height of registered components to the grid size of the application interface; overlaying unified interface elements such as add, delete, and overlay on components; and incorporating component views into drag-and-drop management.

[0119] Specifically, when the application interface needs to display a component view, it calculates the grid size (i.e., placeholder size) that the component needs to occupy in the application interface based on the size information (including but not limited to width and height) registered by the component, and calibrates the layout parameters (including but not limited to LayoutParams) of the component view to ensure that the size of the component view is displayed correctly. Then, the component view is added to the control tree of the application interface page by calling the view addition interface (addView). Furthermore, unified interface elements such as adding, deleting, and overlaying are superimposed on the component, and the component view is included in drag management, thereby forming a complete and usable desktop component for the user.

[0120] In one embodiment of this application, after loading the view of the desktop component on the desktop interface according to the layout filler, the method further includes: identifying the target task of the desktop component; when the target task is a local data access type, the launcher executes the target task; when the target task is a remote data access type, the launcher calls the application process, which executes the target task and returns the execution result to the launcher.

[0121] In this application, the target task refers to the data acquisition or business processing operation that the desktop component needs to perform. In this application, it represents the specific task that the desktop component needs to perform to complete the interface display or interactive response. The local data access type refers to the type of target task that is directly executed in the desktop launcher process. In this application, it represents the desktop component directly accessing local data sources or calling local interfaces through the desktop launcher process to complete the target task, without needing to wake up the application process of the application to which the desktop component belongs. The remote data access type refers to the type of target task that needs to be executed by calling the application process of the application to which the desktop component belongs through inter-process communication. In this application, it represents the application process of the application to which the desktop component belongs as the final executor of the target task, with the desktop launcher only acting as the initiator. The application process refers to the process corresponding to the application to which the desktop component belongs. In this application, it represents the process used to execute the remote data access type target task, which has the application's runtime environment and data access permissions. Inter-process communication refers to the data exchange method between the desktop launcher process and the application process. In this application, it represents inter-process communication implemented through the Binder mechanism, used to pass the target task from the desktop launcher process to the application process for execution and return the execution result to the desktop launcher process.

[0122] Understandably, after the desktop component's view is loaded, this application identifies the target task type and adopts the corresponding execution method, enabling the desktop component to flexibly select the data acquisition path based on different data sources. For locally accessible data (such as local databases, system service listeners, etc.), the desktop launcher executes directly without waking up the application process, resulting in fast response and low resource consumption. For data that requires application process permissions or context to access (such as application private databases, network requests requiring authentication, etc.), cross-process communication is used to call the application process for execution. The application process then uses its runtime environment and data access permissions to complete the data acquisition and return the results, thus solving the limitation that the desktop launcher cannot directly access application private data. The two execution methods complement each other, ensuring both the efficiency and stability of data acquisition and the integrity and security of data access. Furthermore, application developers can independently decide which method to use based on their business scenarios, without increasing the implementation complexity of the desktop launcher.

[0123] After loading the desktop component's view onto the desktop interface based on the layout filler, this application further identifies the desktop component's target task. When the target task is of the local execution type, the desktop component's view directly executes the target task within the desktop launcher process. For example, the view can directly call a local database interface to operate on the database, or directly initiate an HTTP network request to retrieve data, or register a listener through the operating system's listening interface to receive data updates in real time. In this approach, it is not necessary to start the application process of the application to which the desktop component belongs.

[0124] When the target task is a remote execution type, the view calls the application process through inter-process communication (including but not limited to the Binder inter-process communication mechanism), and the application process executes the target task and returns the execution result to the view. For example, the view calls the service interface provided by the application process through inter-process communication, and the application process performs database operations or network requests. The execution result is returned to the view through inter-process communication for view updates.

[0125] Whether to use local or remote execution is determined by the application to which the desktop component belongs, based on its own business needs; this application does not impose any restrictions on this.

[0126] Building upon the security components' encapsulation of the business logic's trigger entry points and their monitoring of operational data, the application interface further incorporates a global exception handling mechanism. This includes setting up an `uncaughtExceptionHandler` to handle exceptions not caught by the security components during desktop component execution. When the security components fail to capture exceptions generated during business logic execution, the global exception handling mechanism captures the exceptions and performs necessary cleanup, further reducing the likelihood of desktop component operational risks propagating to the application interface process.

[0127] Specifically, when the application interface loads and displays the views of desktop components and preview components, the rendering process of the views and the corresponding business logic of the desktop components can run within the application interface process. Therefore, if unhandled exceptions occur during the execution of the desktop component's business logic, runtime errors may occur in the application interface process. For example, if a null pointer exception occurs in the business logic of a desktop component, it may cause an exception in the application interface process. To maintain the stability of the application interface and isolate the runtime risks of the desktop components, the application interface provides a security component library to the desktop components, including security components such as SafeViewHelper and SafeCallback.

[0128] When desktop components are developed using custom views, a security component is used to securely encapsulate the business logic trigger points. This captures any exceptions that occur during the execution of the business logic at those trigger points and skips them when they are detected, preventing the exceptions from being passed to the application's UI process and causing runtime errors. Simultaneously, the security component can provide exception listeners to the application UI, allowing it to perform necessary cleanup actions promptly upon detecting exceptions.

[0129] The business logic triggering entry points include at least one of the following: constructor, lifecycle functions, listener callbacks, and task triggering entry points. Lifecycle functions include, but are not limited to, onAttachedToWindow, onDetachedFromWindow, onMeasure, onLayout, onDraw, onFocusChanged, and onWindowVisibilityChanged; listener callbacks include, but are not limited to, commonly used listener callbacks such as setOnClickListener, setOnTouchListener, and setOnLongClickListener, as well as listener callbacks corresponding to LiveData, RxJava, AnimatorUpdateListener, Glide loading, and other specific SDKs used in the desktop component's business logic; task triggering entry points include the triggering entry points corresponding to asynchronous Handler tasks such as post and postDelayed.

[0130] For the aforementioned business logic triggering entry points, SafeViewHelper can encapsulate lifecycle functions and general listener callbacks, while SafeCallback can encapsulate listener callbacks corresponding to LiveData, RxJava, AnimatorUpdateListener, Glide loading, and other specific SDKs. It then listens for and captures exceptions in the execution data of the corresponding business logic when it is triggered. When an exception is detected, the security component skips it and sends an exception notification to the application interface via exception listening. For exceptions not caught by the security component, the uncaughtExceptionHandler set by the application interface provides global fallback handling, thus forming a multi-layered exception protection mechanism for desktop components.

[0131] In summary, taking an in-vehicle infotainment system running Android as an example, the desktop component developed on the application side in this application embodiment can achieve cross-process loading layout between the desktop component and the application interface of the in-vehicle infotainment system. It breaks through the limitations of native Android desktop components regarding the types of controls they support, allowing the use of all controls supported by the Android system and custom controls; it breaks through the limitations of native desktop components regarding refresh rates, maintaining consistency with the control refresh driven by VSYNC (Vertical Synchronization); it breaks through the limitations of native desktop components regarding interactive gestures, supporting all gestures and custom gestures; and the code of the desktop component is placed in its application-side (including but not limited to APP) project, completely decoupled from the application interface, isolating the runtime risks of the desktop component from the application interface.

[0132] In summary, taking an in-vehicle infotainment system running Android as an example, in this embodiment, the application develops a desktop component using a custom view approach and registers the layout file with the system service through the operating system component declaration mechanism. The desktop launcher obtains the layout file information by querying the operating system service, retrieves the layout filler based on the application context of the application to which the desktop component belongs, loads the layout file to generate a view, and displays it on the desktop interface. Simultaneously, it executes business logic through a trigger entry point to obtain data and populate or update the view's display content, thus completing the loading of the desktop component. Through the aforementioned cross-process layout loading mechanism, this application can achieve the following technical effects: (1) Desktop components run in the desktop launcher process as a complete custom view and can use all controls supported by the operating system and custom controls, breaking through the limitations of native desktop components on control types; (2) The view of the desktop component runs directly in the desktop launcher process. Its UI refresh is driven by the operating system signal, which is consistent with the refresh mechanism of the ordinary view, thus breaking the limitation of the native desktop component update frequency. (3) The view runs in the desktop launcher process, so the view of the desktop component can directly respond to touch events and gesture operations, supporting all gestures and custom gestures, breaking through the limitations of the native desktop component on interactive gestures; (4) The code and layout files of the desktop components are kept in the application project. The desktop launcher can be dynamically loaded at runtime without integrating the application code. Therefore, the desktop components do not need to be updated in sync with the desktop launcher, thus achieving complete decoupling between the desktop components and the desktop interface. (5) The business logic triggering entry of the desktop component is encapsulated by the security component. The exception is captured by the security component and is not passed to the desktop launcher process. Therefore, even if the desktop component has a runtime exception, it will not cause the desktop launcher to crash, thus achieving runtime risk isolation.

[0133] The desktop component generation apparatus according to embodiments of this application is described with reference to the accompanying drawings.

[0134] Figure 7 This is a block diagram of a desktop component generation apparatus according to an embodiment of this application.

[0135] like Figure 7 As shown, the desktop component generation device 10 is applied to the application end. The desktop component generation device 10 includes: a creation module 100, a registration module 200, and a generation module 300.

[0136] The creation module 100 is used to obtain the interface data of the desktop component and create the trigger entry for the business logic of the desktop component. When the trigger entry is triggered, the business logic of the desktop component is run through the launcher of the desktop interface. The registration module 200 is used to generate the layout file of the desktop component based on the interface data and register the component information based on the layout file. The generation module 300 is used to generate the configuration package of the desktop component based on the trigger entry, the layout file and the component information. The terminal device loads the desktop component on the desktop interface through the configuration package.

[0137] It should be noted that the foregoing explanation of the desktop component generation method embodiment also applies to the desktop component generation apparatus of this embodiment, and will not be repeated here.

[0138] According to the desktop component generation apparatus proposed in this application, firstly, the creation module obtains the interface data of the desktop component and creates a trigger entry point for the business logic of the desktop component. When the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface. By defining the trigger entry point, the desktop component can automatically execute business logic, such as data initialization, according to preset trigger conditions after loading. Secondly, the registration module generates a layout file of the desktop component based on the interface data, registers component information based on the layout file, and fixes the interface structure of the desktop component in the form of a standardized layout resource, so that the interface description of the desktop component is separated from the business logic. The layout file, as a pure static resource, can be parsed and loaded without running any code, providing a prerequisite for cross-process loading. Then, the generation module generates a configuration package of the desktop component based on the trigger entry point, the layout file, and the component information. The terminal device loads the desktop component on the desktop interface through the configuration package, integrating the trigger entry point, the layout file, and the component information into a unified structured data package, so that the terminal device only needs to parse the configuration package to obtain all the description information required for loading, without needing to understand or execute the application-side code implementation, thereby realizing cross-process layout loading without starting the application process during the layout loading process. This solves the problems of limited functionality and high coupling between applications and desktop launchers that exist in related technologies that use native desktop components to develop desktop components.

[0139] The desktop component loading apparatus according to an embodiment of this application is described with reference to the accompanying drawings.

[0140] Figure 8 This is a block diagram of a desktop component loading device according to an embodiment of this application.

[0141] like Figure 8 As shown, the desktop component loading device 20 is applied to a terminal device, wherein the desktop component loading device 20 includes: an acquisition module 400, an identification module 500 and a loading module 600.

[0142] The acquisition module 400 is used to acquire the configuration package of the desktop component issued by the application terminal, and the application terminal runs the desktop component generation method; the identification module 500 is used to identify the layout file, trigger entry and component information of the desktop component according to the configuration package; the loading module 600 is used to load the desktop component on the desktop interface according to the component information, trigger entry and layout file.

[0143] It should be noted that the foregoing explanation of the desktop component loading method embodiment also applies to the desktop component loading device of this embodiment, and will not be repeated here.

[0144] According to the desktop component loading device proposed in this application embodiment, the acquisition module first acquires the configuration package generated by the application. The configuration package has been pre-associated with layout files, trigger entry points, and component information, providing a complete data foundation for subsequent loading. Based on this, the identification module determines the layout file, business logic triggering method, and loading configuration corresponding to the desktop component by parsing the configuration package. Then, the loading module loads the view of the desktop component according to the layout type in the configuration package and runs the business logic of the desktop component according to the trigger entry point, so that the desktop component is displayed according to the corresponding interface layout and responds to interactive operations. The desktop component does not need to rely on the real-time execution of the application code during the entire loading process. It can complete the entire process from data acquisition to interface display to interactive response solely through the configuration package. Thus, it solves the problems of limited functionality and high coupling between the application and the desktop launcher that exist in related technologies that use native desktop components to develop desktop components.

[0145] The fifth aspect of this application provides an application terminal, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the program to implement a desktop component generation method.

[0146] A sixth aspect of this application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a desktop component loading method.

[0147] A seventh aspect of this application provides a computer-readable storage medium having a computer program stored thereon, the program being executed by a processor to implement a desktop component generation method, or to implement a desktop component loading method.

[0148] An eighth aspect of this application provides a computer program product having a computer program or instructions stored thereon, characterized in that, when the computer program or instructions are executed, they are used to implement a desktop component generation method or a desktop component loading method.

[0149] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0150] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0151] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0152] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or more of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0153] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by a program instructing related hardware, and the program can be stored in a computer-readable storage medium. When executed, the program includes one or a combination of the steps of the method embodiments.

[0154] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A method for generating desktop components, characterized in that, The method is applied to the application side, and includes the following steps: Obtain the interface data of the desktop component and create a trigger entry point for the business logic of the desktop component. When the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface. Generate a layout file for the desktop component based on the interface data, and register component information based on the layout file; The desktop component configuration package is generated based on the trigger entry, the layout file, and the component information. The terminal device loads the desktop component on the desktop interface through the configuration package.

2. The desktop component generation method according to claim 1, characterized in that, The trigger entry points for the business logic of creating the desktop component include: Identify at least one of the function data, listener callback data, and task trigger data in the business logic of the desktop component; Create a trigger entry point for the listening callback based on the listening callback data; Create a trigger entry point for the task based on the task trigger data; Create at least one trigger entry for the constructor and a trigger entry for the lifecycle function based on the function data.

3. The desktop component generation method according to claim 1, characterized in that, The step of generating the layout file for the desktop component based on the interface data includes: Extract the component names and hierarchical relationships from the interface data; Generate at least one interface element of the desktop component based on the component name; The layout file for the desktop component is generated based on the hierarchical relationship and at least one of the interface elements.

4. The desktop component generation method according to claim 1, characterized in that, The step of registering component information according to the layout file includes: Identify the layout type and resource identifier of the layout file; Associate the resource identifier with the layout type, and generate the component information based on the association result.

5. The desktop component generation method according to claim 1, characterized in that, The step of generating the configuration package for the desktop component based on the trigger entry, the layout file, and the component information further includes: A security component for creating the business logic of the desktop component is provided. The security component is used to monitor the running data of the business logic and, when it is detected that there is abnormal logic in the business logic based on the business data, it skips the abnormal logic. The security component encapsulates the trigger entry point of the business logic, and generates a configuration package for the desktop component based on the encapsulated trigger entry point, the layout file, and the component information.

6. A method for loading desktop components, characterized in that, The method is applied to a terminal device, and the method includes the following steps: Obtain the configuration package of the desktop component issued by the application client, and the application client runs the desktop component generation method as described in any one of claims 1-5; The configuration package is used to identify the layout file, trigger entry point, and component information of the desktop component; The desktop component is loaded on the desktop interface based on the component information, the trigger entry, and the layout file.

7. The desktop component loading method according to claim 6, characterized in that, The step of loading the desktop component on the desktop interface based on the component information, the trigger entry, and the layout file includes: Extract the resource identifier from the component information; The layout type of the layout file is determined based on the resource identifier; The view of the desktop component is loaded on the desktop interface according to the layout type; The trigger entry is triggered through the launcher of the desktop interface to run the business logic of the desktop component; The desktop component is loaded based on the execution result of the view and the business logic.

8. The desktop component loading method according to claim 7, characterized in that, The step of loading the view of the desktop component on the desktop interface according to the layout type includes: If the layout type is a natively loaded type, then the view of the desktop component is loaded on the desktop interface through the native loading interface, wherein the native loading interface is provided by the operating system of the terminal device; If the layout type is a process-loaded type, then an application context is created based on the component information, a layout filler is invoked based on the application context, and the view of the desktop component is loaded on the desktop interface based on the layout filler.

9. The desktop component loading method according to claim 8, characterized in that, The step of loading the view of the desktop component onto the desktop interface according to the layout filler includes: The layout filler is used to traverse the hierarchical relationships and at least one interface element in the layout file; The view of the desktop component is loaded according to the hierarchy and at least one of the interface elements.

10. The desktop component loading method according to claim 9, characterized in that, The step of loading the view of the desktop component according to the hierarchical relationship and at least one of the interface elements includes: Identify the size information of the interface elements; Calculate the footprint of the interface element based on its size information; The display position of the interface elements is determined according to the hierarchical relationship; The interface elements are displayed according to the specified space size and display position.

11. The desktop component loading method according to claim 9, characterized in that, After loading the view of the desktop component on the desktop interface according to the layout filler, the method further includes: Identify the target task of the desktop component; When the target task is of the local data access type, the launcher executes the target task; When the target task is a remote data access type, the launcher calls the application process, which executes the target task and returns the execution result to the launcher.

12. A desktop component generation apparatus, characterized in that, The device is used in an application, wherein the device includes: A module is created to obtain the interface data of the desktop component and create a trigger entry point for the business logic of the desktop component. When the trigger entry point is triggered, the business logic of the desktop component is run through the launcher of the desktop interface. The registration module is used to generate a layout file for the desktop component based on the interface data, and to register component information based on the layout file. The generation module is used to generate a configuration package for the desktop component based on the trigger entry, the layout file, and the component information. The terminal device loads the desktop component on the desktop interface through the configuration package.

13. A desktop component loading device, characterized in that, The device is applied to a terminal device, wherein the device includes: The acquisition module is used to acquire the configuration package of the desktop component issued by the application terminal, wherein the application terminal runs the desktop component generation method as described in any one of claims 1-5; The identification module is used to identify the layout file, trigger entry point, and component information of the desktop component based on the configuration package; The loading module is used to load the desktop component on the desktop interface based on the component information, the trigger entry, and the layout file.

14. An application terminal, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the desktop component generation method as described in any one of claims 1-5.

15. A terminal device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the desktop component loading method as described in any one of claims 6-11.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the desktop component generation method as described in any one of claims 1-5, or to implement the desktop component loading method as described in any one of claims 6-11.

17. A computer program product having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed, they are used to implement the desktop component generation method as described in any one of claims 1-5, or to implement the desktop component loading method as described in any one of claims 6-11.