Component upgrading method and device, electronic equipment and computer readable storage medium

By acquiring and verifying component interfaces, generating interface summary files, updating version numbers, and upgrading components, the problem of components being unable to adapt to system or other module interface standards after upgrading is solved, ensuring the operational stability of the device.

CN121785632APending Publication Date: 2026-04-03SHENZHEN TCL NEW-TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-13
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In the Android system, component upgrades may fail to adapt to the interface standards of the system or other modules, leading to device stability issues.

Method used

By obtaining the component interface, generating an interface summary file, performing compatibility checks, updating the version number, and upgrading the component when conditions are met, the component interface is ensured to be compatible.

Benefits of technology

After component upgrades, the interface standards are compatible with the system and other modules, ensuring the operational stability of mobile devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785632A_ABST
    Figure CN121785632A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a component upgrading method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of computers. The method comprises the following steps: acquiring a component interface of a component, and generating an interface abstract file of the component interface; the component interface comprises an external interface and a dependent interface; according to compatibility strategies corresponding to different types of component interfaces, carrying out compatibility verification on the component interfaces based on the interface abstract file; updating the version number of the component according to a compatibility verification result; packaging the interface abstract file of the component interface and the component to obtain an update component corresponding to the version number; and when the version number meets a version number upgrading condition, performing component upgrading on a target component based on the updating component. Therefore, the scheme can ensure reliable upgrading of the component.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a component upgrade method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] With major Android version updates and iterations, system functions have become highly modularized, supporting independent updates for each functional component (such as binary files, SO libraries, APKs, etc.) without requiring overall system image upgrades. However, due to the deep interaction between components and other modules and system code, independent component upgrades present new technical challenges. If a component upgrade fails to adapt to the interface standards of the system or other modules, it will directly affect the device's operational stability and may even lead to boot errors. Summary of the Invention

[0003] This application provides a component upgrade method, apparatus, electronic device, and computer-readable storage medium, which can ensure reliable component upgrades.

[0004] In a first aspect, embodiments of this application provide a component upgrade method, including: Obtain the component interface of the component and generate an interface summary file for the component interface; the component interface includes external interfaces and dependent interfaces; According to the compatibility strategy corresponding to different types of component interfaces, the component interfaces are verified for compatibility based on the interface summary file. Update the version number of the component based on the compatibility check results; Package the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number; When the version number meets the version number upgrade conditions, the target component is upgraded based on the updated component.

[0005] Secondly, embodiments of this application provide a component upgrade apparatus, including: The summary generation module is used to obtain the component interface of the component and generate an interface summary file of the component interface; the component interface includes external interface and dependent interface; The compatibility verification module is used to perform compatibility verification on the component interface based on the interface summary file according to the compatibility strategy corresponding to different types of component interfaces. The version number update module is used to update the version number of the component based on the compatibility verification results; The component packaging module is used to package the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number; The component upgrade module is used to upgrade the target component based on the updated component when the version number meets the version number upgrade conditions.

[0006] Thirdly, embodiments of this application also provide an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps in the component upgrade method described above.

[0007] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the component upgrade method described above.

[0008] Fifthly, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in embodiments of this application.

[0009] The embodiments of this application have the following beneficial effects: The system can obtain the component's interface, which includes external interfaces and dependent interfaces, and generate an interface summary text describing the dependencies of the component interfaces. Different compatibility strategies apply to external and dependent interfaces. Based on the interface summary text, the system can perform compatibility checks on the component interfaces according to their respective strategies to determine compatibility. The system can update the component's version number based on the compatibility check results, thus determining interface compatibility. Packaging the interface summary text and the component yields an updated component with the updated version number. When upgrading a target component, the system can identify updated components whose version numbers meet the upgrade criteria. These updated components can then be used to upgrade the target component. Since the version number reflects interface compatibility, compatible updated components can be identified, ensuring the upgraded target component remains compatible. This solves the problem of upgraded components failing to adapt to system or other module interface standards, ensuring mobile device stability and enabling reliable component upgrades. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a schematic diagram of the steps of a component upgrade method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the framework of a component upgrade method provided in an embodiment of this application; Figure 3 This is a schematic diagram of a component upgrade verification provided in an embodiment of this application; Figure 4 This is a schematic flowchart of a component upgrade method provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a component upgrade device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0012] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0013] In one embodiment, such as Figure 1 As shown, a component upgrade method is provided. Although the logical order is illustrated in the step diagram, in some cases, the steps shown or described may be performed in a different order than that shown in the figures. Specifically, this component upgrade method can be applied to electronic devices, which may include, but are not limited to, one or more of smartphones, tablets, laptops, desktop computers, and in-vehicle computers. These will be described in detail below. It should be noted that the order of description of the following embodiments is not intended to limit the priority of the embodiments.

[0014] In one embodiment, Figure 2 This is a schematic diagram illustrating the framework of a component upgrade method provided in an embodiment of this application; as shown below. Figure 2As shown, the overall design of this application embodiment can include five core modules: an interface acquisition module, an interface compatibility verification module, a version number management module, a component interface packaging module, and an upgrade verification module. The interface acquisition module is mainly used to distinguish between external interfaces and dependent interfaces by annotating the source code, facilitating subsequent independent management. The interface compatibility verification module is mainly used to perform compatibility verification on the external interfaces and dependent interfaces of a component according to their respective compatibility strategies, and provide the compatibility verification results. The version number management module is mainly used to automatically update the component's version number based on the compatibility verification results and generate an interface change snapshot, facilitating traceability and compatibility verification between different versions. The component interface packaging module is mainly used to package the component interface information into the component's meta information (META-INF) partition as a summary of the component interface. The component upgrade verification module is mainly used to perform interface verification before module upgrade installation and to intercept abnormal component installations.

[0015] according to Figure 1 The component upgrade method shown includes at least steps S110 to S150, which are described in detail below: In step S110, the component interface of the component is obtained, and an interface summary file of the component interface is generated.

[0016] A system component is a modular functional unit used to describe an Android system, such as binary files, shared objects (SOs), and application packages (Android Package Kits, APKs). These components can be compiled, deployed, and upgraded independently without requiring a system image upgrade. Components can be updated or upgraded versions of existing components. To ensure that updated components still adapt to the interface standards of the system and other modules, the updated component interface must be backward compatible with the original interface (i.e., compatible with the original interface standard). Therefore, it is necessary to obtain the component's interface and determine its dependencies to determine compatibility.

[0017] Component interfaces can include Component Provided Interfaces (CPIs) and Component Required Interfaces (CRIs). A component's public API is the publicly exposed interface (Public API) that a system component exposes to other components, the system framework, or external applications. It is the sole compliant entry point for other entities to call the component's functionality and obtain its data. A component's CRI is the interface that a system component calls during runtime from other components or the system framework. It is the necessary interaction channel for a component to obtain external dependent resources and complete its own business logic.

[0018] To assess the compatibility of component interfaces, an Interface Summary File (ISF) can be generated. The ISF primarily describes the important interface information of the component, including its dependencies. It provides a structured overview of the core information of the component's external and dependent interfaces, including interface names, input and output parameters, calling rules, and version information. The ISF can be used to quickly review key interface information and verify interface compatibility.

[0019] Optionally, the dependencies of component interfaces can be precisely identified using annotations, thereby generating an interface summary file for the component interfaces; alternatively, the dependencies of component interfaces can be determined by performing deep dependency resolution, thereby generating an interface summary file for the component interfaces.

[0020] In step S120, the component interface is verified for compatibility based on the interface summary file according to the compatibility strategy corresponding to different types of component interfaces.

[0021] Component interfaces can include at least two types: external interfaces and dependent interfaces. External interfaces and dependent interfaces have different compatibility strategies. The interface summary file of a component interface describes the interface information; therefore, compatibility checks can be performed on component interfaces based on the compatibility strategies corresponding to each type of component interface, combined with the interface summary file. Compatibility checks involve comparing the interface summary files of the current component (the updated component) with those of the previous stable version (the component before the update) to determine if the component has any compatibility violations.

[0022] The compatibility strategies for external interfaces include: if the updated component removes an external interface compared to the original component, it is incompatible; if the updated component adds an external interface compared to the original component, it is compatible. Alternatively, the interface compatibility strategies include: if the updated component adds a dependent interface compared to the original component, it is incompatible; if the updated component reduces dependent interfaces compared to the original component, it is compatible.

[0023] In step S130, the version number of the component is updated according to the compatibility verification result.

[0024] Version numbers can include major version numbers, minor version numbers, and revision numbers. The major version number is the core identifier within the version numbering system that marks a significant incompatibility change to a component's interface. A major version number upgrade indicates that the core specifications, interaction logic, or functional architecture of the component's interface have undergone fundamental adjustments that are no longer backward compatible. The minor version number is the identifier within the version numbering system that marks the addition of new features or optimization of interaction rules to the component's interface while maintaining backward compatibility. A minor version number upgrade indicates that the component's interface has undergone functional expansion or experiential improvements within the existing compatibility framework, without affecting the normal use of the original interface. The revision number is the identifier within the version number that marks the fixing of defects and optimization of details to the component's interface while maintaining functionality and compatibility. Revision number upgrades only address vulnerability fixes, performance tuning, or documentation improvements to the component's interface and do not involve changes to the core logic or interaction rules of the interface.

[0025] The major version number is generally not modified; the minor version number can be changed when adding dependent interfaces and / or deleting external interfaces; the revision number can be changed when adding external interfaces, removing dependent interfaces, and / or fixing bugs. Compatibility verification results can include which specific types of interfaces (external interfaces or dependent interfaces) have been added or deleted. Therefore, based on the compatibility verification results, the version number of the component before the update can be directly changed to obtain the version number of the updated component.

[0026] In step S140, the interface summary file of the component interface and the component are packaged together to obtain the updated component corresponding to the version number.

[0027] During component construction, the component's external interface files and dependent interface files can be packaged together with the component as part of the component. This allows for component interface verification before activation and interception at runtime. Specifically, the interface summary file of the component's interfaces can be packaged together with the component to obtain an updated component corresponding to the updated version number. The external interfaces and dependent interfaces can be distinguished and stored in META-INF with a fixed name.

[0028] In step S150, when the version number meets the version number upgrade conditions, the target component is upgraded based on the updated component.

[0029] When a target component needs to be upgraded, the version number of each updating component can be used to identify the updating component whose version number meets the upgrade criteria. This updating component can then be used to upgrade the target component. Before upgrading, compatibility strategies based on different component interfaces can be used to verify whether the updating component is compatible with the target component. If the updating component passes the compatibility check, it can be used to update the target component, thus making it the updated component.

[0030] By employing the technical solution of this application embodiment, the component interface of a component can be obtained. The component interface includes external interfaces and dependent interfaces, and then an interface summary text of the component interface can be generated. The interface summary text can describe the dependency relationship of the component interface. Since external interfaces and dependent interfaces have different compatibility strategies, the component interface can be verified for compatibility based on the interface summary text of the component interface according to its respective compatibility strategy, thereby determining whether the component interface is compatible. The component version number can be updated based on the compatibility verification result, thus determining whether the component interface is compatible based on the component version number. The interface summary text of the component interface and the component are packaged to obtain an updated component, the version number of which is the updated version number. When a component upgrade is required for the target component, the updated component whose version number meets the upgrade conditions can be determined based on the version numbers of each updated component. This updated component can then be used to upgrade the target component. Because the version number reflects whether the component interface is compatible, a compatible updated component can be determined based on the version number, ensuring that the target component remains compatible after the upgrade. This solves the problem of components being unable to adapt to the interface standards of the system or other modules after upgrade, thereby ensuring the operational stability of mobile devices and achieving reliable component upgrades.

[0031] Based on the above technical solution, as an embodiment, the component interface may include interface annotations. Generating the interface summary file of the component interface may include: scanning the interface annotations of the component interface to obtain the annotation information of the component interface; the annotation information of the component interface includes: the capabilities provided by the external interface and the methods called by the dependent interfaces; and generating the interface summary file of the component interface based on the annotation information.

[0032] The external interfaces and dependent interfaces of a component can be pre-marked with annotation information using interface annotations. This annotation information may include, but is not limited to, the type of the component interface, the capabilities provided by the external interface, and the methods called by the dependent interfaces. By statically scanning the interface annotations of the component interfaces, the annotation information of the component interfaces can be obtained. Based on the annotation information of the component interfaces, an interface summary file of the component interfaces can be generated.

[0033] External interfaces can be explicitly annotated by developers in the source code using the `@ComponentProvidedInterface` annotation; this annotation specifies the capabilities provided by the external interface. Dependent interfaces can also be explicitly annotated by developers in the source code using the `@ComponentRequiredInterface(interface="interfaceName")` annotation; this annotation specifies the methods invoked by the dependent interfaces.

[0034] By adopting the technical solution of this application embodiment, component interfaces can be annotated, thereby quickly determining the type and dependency of component interfaces through static scanning, and then quickly generating interface summary files of component interfaces, so as to facilitate subsequent compatibility verification of component interfaces using interface summary files.

[0035] Based on the above technical solution, as an embodiment, generating the interface summary file of the component interface may include: initializing the component interface and analyzing the members of the component interface; determining public members from the members of the component interface and recording the public members; filtering out standard interfaces from the public members to obtain target members; parsing the target members to determine the dependencies of the target members; and generating the interface summary file of the component interface according to the dependencies of the target members.

[0036] Some dependencies of component interfaces are implicit and may not be marked by interface annotations. Therefore, it is necessary to perform deep dependency resolution on component interfaces to determine the dependencies of component interfaces and generate interface summary files for component interfaces.

[0037] Deep dependency resolution of component interfaces may include, but is not limited to, the following steps: Obtain the compiled output and initialize the jar or apk information; Load and analyze dex members: Load the dex file, iterate through each member (class, method, field) of the dex file, only public members are processed, and the results are recorded in jar_info. Different member types are stored in jar_info.provide_func_des and jar_info.provide_obj_des respectively. Load the contents of the dex file and initialize the type mapping table to correctly parse the data types in the dex file; Initialize the class information for filtering, add native system standard interface classes to the whitelist, and they will not be exported later; Parse the dex and collect dependent APIs: Iterate through the API dependency information and export the external dependency information to jar_info. Different member types are stored in jar_info.require_func_des and jar_info.require_obj_des respectively. Write jar_info to the specified JSON file.

[0038] Specifically, the process involves: retrieving the compilation artifacts (JAR or APK) corresponding to the component and initializing the file information; loading the dex file from the artifacts, iterating through all members such as classes, methods, and fields, filtering out only public members, and classifying and recording them in the jar_info structure, with method class members stored in jar_info.provide_func_des and object class members stored in jar_info.provide_obj_des; loading the complete content of the dex file, constructing and initializing the type mapping table to ensure the accuracy of data type parsing in the dex; initializing the filter class information, including standard interfaces of the native system in the whitelist to prevent these non-core business interfaces from being mistakenly included in the dependency analysis, and identifying the remaining interfaces as target members; iterating through the dex file again to parse the API dependency information of the target members, extracting all external dependencies and classifying them into jar_info, with method class external dependencies stored in jar_info.require_func_des and object class external dependencies stored in jar_info.require_obj_des; and writing the integrated jar_info data into the specified JSON file to form complete dependency information that can be directly used in the interface summary file. In this process, by initializing the component interface, we can comprehensively sort out the various member information contained in the interface; accurately identify and record public members from all members, which are the core carriers for the component's external interaction; by filtering out the system standard interfaces in the public members, we can obtain the target members that need to be analyzed in detail; conduct in-depth analysis of the target members to clarify their internal and cross-module dependencies, and finally integrate them into a complete component interface summary file based on these dependencies.

[0039] By adopting the technical solution of this application embodiment, the entire process, through layered parsing and precise screening, not only ensures that the interface summary file covers the core interface information, but also solves the problem of implicit dependency identification. The final generated interface summary file can fully reflect the whole picture of the component interface, so as to facilitate the subsequent use of the interface summary file for component interface compatibility verification.

[0040] Based on the above technical solution, as an embodiment, the step of performing compatibility verification on the component interface based on the interface summary file according to the compatibility strategy corresponding to different types of component interfaces may include: obtaining the interface summary file of the component interface and obtaining the interface summary file of the previous version of the component interface; comparing the interface summary text of the component interface and the interface summary file of the previous version of the component interface to determine the addition or deletion result of the component interface; when the addition or deletion result indicates that the component interface has deleted an external interface and / or added a dependent interface, determining that the compatibility verification result is failed; when the addition or deletion result indicates that the component interface has added an external interface and / or reduced a dependent interface, determining that the compatibility verification result is passed.

[0041] Compatibility checks on component interfaces involve comparing the interface summary files of the current (updated) component with those of the previous stable version (before the update) to determine if any compatibility issues exist. Since the interface summary file directly reflects the component's interface information, comparing the summary files of the current (updated) and previous versions allows for identification of symbolic differences. Based on predefined upward / downward compatibility strategies, the system determines if a compatibility issue exists, thus influencing version number changes and the compilation process. Incompatibility will result in an error. This compatibility check can be integrated with pipelined builds to prevent the submission of incompatible code changes.

[0042] During the data preparation phase, the interface summary files of the current version of the component interface and the previous version of the component interface can be loaded. Hash mapping preprocessing is performed on both interface summary files. Based on the class name, method name, and parameter signature, a SHA-256 fingerprint is calculated for each interface item in both interface summary files and stored in a HashMap for easy retrieval.

[0043] External interfaces are backward compatible. The external interfaces of the component in the current version and the component in the previous version can be traversed and compared. If an external interface does not exist in the current version but existed in the previous version, it indicates that the external interface has been deleted, and therefore incompatible. If an external interface exists in the current version but did not exist in the previous version, it indicates that the external interface has been added, and therefore compatible.

[0044] Dependency interfaces must be backward compatible. The system can iterate through and compare the dependency interfaces of the current version of a component interface with those of the previous version. If a dependency interface does not exist in the current version but does exist in the previous version, it indicates that the dependency interface has been removed, and compatibility is maintained. If a dependency interface exists in the current version but does not exist in the previous version, it indicates that the dependency interface has been added, and incompatibility is maintained.

[0045] The compatibility check result is determined based on the compatibility of the various component interfaces. If all component interfaces are compatible, the compatibility check result is "passed"; if any component interface is incompatible, the compatibility check result is "failed".

[0046] By employing the technical solution of this application embodiment, the compatibility verification result can be quickly determined by comparing the interface summary files of two versions. Furthermore, by applying different compatibility strategies to different types of interfaces, the compatibility verification result can be accurately determined. This avoids the need to commit incompatible code changes or upgrade incompatible components, thereby preventing any impact on the operational stability of the device.

[0047] Based on the above technical solution, as an embodiment, updating the version number of the component according to the compatibility verification result may include: updating the minor version number of the component when the compatibility verification result is unsuccessful; and updating the revision number of the component when the compatibility verification result is successful.

[0048] The interface file is validated every time the system is compiled. If the validation fails, it means that the change may affect the compatibility of the component. In this case, the interface file and the version number need to be updated. Each version number change can be queried through the interface file change record.

[0049] If the compatibility check fails, it may be due to the removal of external interfaces and / or the addition of dependent interfaces. In this case, the minor version number of the component should be updated. If the compatibility check passes, it may be due to the addition of external interfaces and / or the reduction of dependent interfaces. Therefore, the revision number of the component should be updated.

[0050] Optionally, version change tracking can also be provided. Every version change is recorded, and all validation changes to interface files are associated with the version number: Interface change → Validation logic → Version number modification → Update record, which facilitates quick identification of changes that affect compatibility.

[0051] The technical solution adopted in this application involves compiling and verifying the interface file each time. If the verification fails, a compatibility risk warning is issued and the version number is updated synchronously. This allows the version changes to be determined based on the interface file records, thereby achieving compatibility control and change traceability.

[0052] Based on the above technical solution, as an embodiment, when the version number meets the version number upgrade conditions, upgrading the target component based on the updated component may include: obtaining the version number of the target component; and upgrading the target component based on the updated component when the major version number of the updated component is consistent with the major version number of the target component, the minor version number of the updated component is consistent with the minor version number of the target component, and the revision number of the updated component is higher than the revision number of the target component.

[0053] Figure 3 This is a schematic diagram of a component upgrade verification provided in an embodiment of this application; as shown Figure 3 As shown, component upgrade verification is completed through interaction between the component upgrade application, the component compatibility verification tool, and the system pre-built component (target component). The system pre-built component refers to the system component compiled with the system image in the device. It contains interface information that is compatible with the current whole machine and serves as the basis for subsequent component compatibility.

[0054] Before a component is activated, the component upgrade application downloads an updated component that meets the version number upgrade conditions. These conditions can include: the major and minor version numbers being the same, and the component having a higher revision number. The major and minor version numbers of the updated component used to update the target component must be the same as the major and minor version numbers of the target component, and the updated component's revision number must be higher than the target component's revision number.

[0055] Applications can use component compatibility verification tools to upgrade components. These tools perform compatibility checks on the target component against the updated component, determining whether the upgrade is allowed based on the verification results. The tool can determine the compatibility results by comparing the interface summary files of the updated and target components.

[0056] During the data preparation phase, the interface summary files of the updated component and the target component can be loaded. Hash mapping preprocessing is performed on both interface summary files, calculating the SHA-256 fingerprint for each interface item in both files based on the class name, method name, and parameter signature. External interfaces are backward compatible. The external interfaces of the updated component and the target component can be traversed and compared; if an external interface does not exist in the updated component but exists in the target component, it indicates that the external interface has been deleted, resulting in incompatibility; if an external interface exists in the updated component but not in the target component, it indicates that the external interface has been added, maintaining compatibility.

[0057] Dependency interfaces must be backward compatible. The dependency interfaces of the updated component and the target component can be traversed and compared. If a dependency interface exists in the target component but not in the updated component, it indicates that the dependency interface has been removed, and compatibility is maintained. If a dependency interface exists in the updated component but not in the target component, it indicates that the dependency interface has been added, and incompatibility is maintained.

[0058] The compatibility check result is determined based on the compatibility of the various component interfaces of the updated component. If all component interfaces are compatible, the compatibility check result is passed; if any component interface is incompatible, the compatibility check result is failed. If the compatibility check passes, the target component can be upgraded using the updated component, and the target component can be upgraded to the updated component; if the compatibility check fails, the target component cannot be upgraded using the updated component, and an error can be reported.

[0059] By adopting the technical solution of this application embodiment, incompatible update components can be initially excluded by the version number upgrade condition, and potentially compatible update components can be obtained; then, by using a compatibility verification tool to verify the update components, it can be determined whether the update components are compatible, thereby avoiding the use of incompatible update components to update the target components and avoiding the impact on the operational stability of the device.

[0060] Based on the above technical solution, as an embodiment, packaging the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number may include: converting the format of the interface summary text of the component interface to obtain interface summary information; packaging the interface summary information and the component to obtain the updated component corresponding to the version number; and storing the updated components separately according to the type of the component interface of the updated component.

[0061] During component construction, the interface summary files of the component's external interfaces and the interface summary files of its dependencies can be packaged together with the component installation package, thereby achieving interface control of the component. Specifically, the interface summary files of the component interfaces can first undergo a unified format conversion. The converted files can mark three core interface elements: classes, methods, and fields, removing redundant code comments, formatting symbols, and other irrelevant information to ensure that the files are lightweight and that the core information is unambiguous. Furthermore, external interfaces and dependent interfaces can be strictly distinguished, and the two types of interfaces can be classified and labeled with exclusive identifiers to avoid interface type confusion during subsequent verification.

[0062] After format conversion and classification, the processed interface files are stored in the component's META-INF partition. The META-INF partition serves as the standard storage area for component metadata, ensuring that interface files are not tampered with or omitted during component distribution and deployment. Interface files can be named with fixed names. By assigning fixed naming rules to each interface summary file, regardless of component version iterations, the interface summary files for external interfaces and dependent interfaces use a unified preset name. This facilitates compatibility verification tools in quickly locating and reading the interface summary file content before component upgrades.

[0063] Before upgrading a component, the interface summary file in META-INF can be read directly and compared with the interface summary file of the target component. If a component upgrade does not meet the compatibility requirements, it can be precisely intercepted based on the information in the interface summary file, thereby greatly improving the stability of component adaptation.

[0064] By adopting the technical solution of this application embodiment, the interface summary files are packaged together, breaking through the passive situation of discovering interface compatibility issues at runtime. This achieves pre-activation interface verification before component activation and real-time interception of interface calls at runtime, thus avoiding functional abnormalities caused by interface incompatibility from the source.

[0065] Based on the above technical solutions, as an example, a mechanism can be implemented to revert the system to a stable version when a component upgrade fails. This can be achieved automatically based on the component version number or data backup, preventing system unavailability caused by component upgrades.

[0066] Figure 4 This is a flowchart illustrating a component upgrade method provided in an embodiment of this application; see reference. Figure 4 After obtaining the component's code source, interface annotation information can be retrieved through the component's interface annotations. Furthermore, a JSON file can be obtained by performing deep dependency parsing on the component's interfaces. Based on the interface annotation information and the JSON file, the type of the component's interface can be determined, and an interface summary file can be generated. Compatibility checks of the component's interfaces can be performed using the interface summary file and the corresponding compatibility rules for different interfaces. If the compatibility check passes, the interface summary files of the component's interfaces can be packaged into a unified compressed format and integrated into the component. Thus, based on the component's code file and the interface summary file, a complete component can be obtained.

[0067] In this embodiment, by employing interface labeling and classification, automated compatibility verification, and dynamic version management mechanisms, compatibility issues during independent component upgrades can be effectively resolved, significantly reducing the risk of upgrade failures and functional malfunctions. Compared to related technologies, this embodiment optimizes system stability, improves development efficiency, and shortens problem location and recovery time, while also possessing good scalability and being applicable to other modular software systems.

[0068] Related technologies use static scanning tools to perform a full scan of the component code's API, checking for interface changes between old and new versions. However, based on superficial information about interface changes, they cannot distinguish between critical external interfaces and dependent interfaces, leading to a high risk of misjudgment and omissions, and are unsuitable for complex component dependencies. Related technologies employ manual version control, managing component version upgrades through strict version number rules and manual review processes. However, this high level of manual intervention can easily lead to version management chaos due to differences in human experience or errors.

[0069] To facilitate better implementation of the component upgrade method of this application, this application also provides a component upgrade apparatus based on the above-described component upgrade method. The meanings of the terms used are the same as in the component upgrade method described above, and specific implementation details can be found in the descriptions of the method embodiments.

[0070] Please see Figure 5 , Figure 5 This is a schematic diagram of the component upgrade device provided in an embodiment of this application, wherein the component upgrade device includes: The summary generation module 501 is used to obtain the component interface of the component and generate an interface summary file of the component interface; the component interface includes external interface and dependent interface; The compatibility verification module 502 is used to perform compatibility verification on the component interface based on the interface summary file according to the compatibility strategy corresponding to different types of component interfaces. Version number update module 503 is used to update the version number of the component based on the compatibility check result; The component packaging module 504 is used to package the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number; The component upgrade module 505 is used to upgrade the target component based on the updated component when the version number meets the version number upgrade conditions.

[0071] In one embodiment, the component interface includes an interface label; The summary generation module 501 includes: The scanning unit is used to scan the interface annotations of the component interface to obtain the annotation information of the component interface; the annotation information of the component interface includes: the capabilities provided by the external interface and the methods called by the dependent interface; The first summary generation unit is used to generate an interface summary file of the component interface based on the annotation information.

[0072] In one embodiment, the summary generation module 501 includes: An initialization unit is used to initialize the component interface and analyze the members of the component interface; A public member determination unit is used to determine public members from the members of the component interface and record the public members; An interface filtering unit is used to filter out standard interfaces from the public members to obtain the target members. A member resolution unit is used to resolve the target member and determine the dependency relationship of the target member; The second summary generation unit is used to generate an interface summary file of the component interface based on the dependency relationship of the target member.

[0073] In one embodiment, the compatibility verification module 502 includes: The summary file acquisition unit is used to acquire the interface summary file of the component interface and the interface summary file of the previous version of the component interface. The addition / deletion result determination unit is used to compare the interface summary text of the component interface with the interface summary file of the previous version of the component interface to determine the addition / deletion result of the component interface. The verification failure unit is used to determine that the compatibility verification result is failure when the addition / deletion result indicates that the component interface has deleted an external interface and / or added a dependent interface; The verification unit is used to determine that the compatibility verification result is passed when the addition / deletion result indicates that the component interface has added an external interface and / or reduced dependent interfaces.

[0074] In one embodiment, the version number includes: a major version number, a minor version number, and a revision number; the version number update module 503 includes: The minor version number update unit is used to update the minor version number of the component when the compatibility verification result is unsuccessful. The revision number update unit is used to update the revision number of the component when the compatibility verification result is passed.

[0075] In one embodiment, the component upgrade module 505 includes: Version number acquisition unit, used to acquire the version number of the target component; The component upgrade unit is configured to upgrade the target component based on the updated component when the major version number of the updated component is the same as the major version number of the target component, the minor version number of the updated component is the same as the minor version number of the target component, and the revision number of the updated component is higher than the revision number of the target component.

[0076] In one embodiment, the component packaging module 504 includes: The format conversion unit is used to convert the interface summary text of the component interface to obtain interface summary information; The component packaging unit is used to package the interface summary information and the component to obtain the updated component corresponding to the version number; Separate storage units are used to store the updated components separately according to the type of the component interface of the updated component.

[0077] By employing the technical solution of this application embodiment, the component interface of a component can be obtained. The component interface includes external interfaces and dependent interfaces, and then an interface summary text of the component interface can be generated. The interface summary text can describe the dependency relationship of the component interface. Since external interfaces and dependent interfaces have different compatibility strategies, the component interface can be verified for compatibility based on the interface summary text of the component interface according to its respective compatibility strategy, thereby determining whether the component interface is compatible. The component version number can be updated based on the compatibility verification result, thus determining whether the component interface is compatible based on the component version number. The interface summary text of the component interface and the component are packaged to obtain an updated component, the version number of which is the updated version number. When a component upgrade is required for the target component, the updated component whose version number meets the upgrade conditions can be determined based on the version numbers of each updated component. This updated component can then be used to upgrade the target component. Because the version number reflects whether the component interface is compatible, a compatible updated component can be determined based on the version number, ensuring that the target component remains compatible after the upgrade. This solves the problem of components being unable to adapt to the interface standards of the system or other modules after upgrade, thereby ensuring the operational stability of mobile devices and achieving reliable component upgrades.

[0078] For specific limitations regarding the component upgrade device, please refer to the limitations on the component upgrade method above, which will not be repeated here. Each module in the aforementioned component upgrade device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0079] In addition, this application also provides an electronic device, such as Figure 6 As shown, it illustrates the structural diagram of the electronic device involved in this application, specifically: The electronic device may include components such as a processor 601 with one or more processing cores and a memory 602 with one or more computer-readable storage media. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 601 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall monitoring of the electronic device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.

[0080] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.

[0081] In one embodiment, the electronic device further includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power equipment debugging circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0082] In one embodiment, the electronic device may further include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0083] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602, thereby implementing the steps in any of the component upgrade methods provided in the embodiments of this application.

[0084] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0085] In one embodiment, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the methods described in any embodiment of this application.

[0086] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of this application.

[0087] In some embodiments, a computer program product is also provided, including a computer program or instructions that, when executed by a processor, implement the methods described in any embodiment of this application.

[0088] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0089] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0090] Therefore, this application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to perform the steps in any of the component upgrade methods provided in this application.

[0091] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0092] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0093] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the component upgrade methods provided in this application, the beneficial effects that any of the component upgrade methods provided in this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0094] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0095] The above provides a detailed description of a component upgrade method, apparatus, electronic device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A component upgrade method, characterized in that, include: Obtain the component interface of the component and generate an interface summary file for the component interface; the component interface includes external interfaces and dependent interfaces; According to the compatibility strategy corresponding to different types of component interfaces, the component interfaces are verified for compatibility based on the interface summary file. Update the version number of the component based on the compatibility check results; Package the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number; When the version number meets the version number upgrade conditions, the target component is upgraded based on the updated component.

2. The method according to claim 1, characterized in that, The component interface includes interface annotations; The process of generating the interface summary file for the component interface includes: Scan the interface annotations of the component interface to obtain the annotation information of the component interface; the annotation information of the component interface includes: the capabilities provided by the external interface and the methods called by the dependent interfaces; Based on the annotation information, an interface summary file for the component interface is generated.

3. The method according to claim 1, characterized in that, The process of generating the interface summary file for the component interface includes: The component interface is initialized, and its members are analyzed. Identify and record the public members from the members of the component interface; Filter out the standard interfaces from the public members to obtain the target members; The target member is parsed to determine its dependencies; Based on the dependencies of the target members, an interface summary file for the component interface is generated.

4. The method according to claim 1, characterized in that, The step of performing compatibility verification on the component interfaces based on the interface summary file according to the compatibility strategy corresponding to different types of component interfaces includes: Obtain the interface summary file of the component interface, and obtain the interface summary file of the component interface of the previous version; Compare the interface summary text of the component interface with the interface summary file of the previous version of the component interface to determine the addition or deletion result of the component interface; When the addition / deletion result indicates that the component interface has deleted an external interface and / or added a dependent interface, the compatibility verification result is determined to be unsuccessful. When the addition / deletion result indicates that the component interface has added an external interface and / or reduced dependent interfaces, the compatibility verification result is determined to be passed.

5. The method according to claim 4, characterized in that, The version number includes: major version number, minor version number, and revision number; The step of updating the version number of the component based on the compatibility verification result includes: If the compatibility check result is unsuccessful, update the minor version number of the component; When the compatibility check result is passed, the revision number of the component is updated.

6. The method according to claim 5, characterized in that, When the version number meets the version number upgrade conditions, upgrading the target component based on the updated component includes: Obtain the version number of the target component; When the major version number of the updated component is the same as the major version number of the target component, the minor version number of the updated component is the same as the minor version number of the target component, and the revision number of the updated component is higher than the revision number of the target component, the target component is upgraded based on the updated component.

7. The method according to claim 1, characterized in that, The step of packaging the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number includes: The interface summary text of the component interface is converted to obtain the interface summary information; The interface summary information and the component are packaged together to obtain the update component corresponding to the version number; The update components are stored separately according to the type of the component interface of the update component.

8. A component upgrade device, characterized in that, include: The summary generation module is used to obtain the component interface of the component and generate an interface summary file of the component interface; the component interface includes external interface and dependent interface; The compatibility verification module is used to perform compatibility verification on the component interface based on the interface summary file according to the compatibility strategy corresponding to different types of component interfaces. The version number update module is used to update the version number of the component based on the compatibility verification results; The component packaging module is used to package the interface summary file of the component interface and the component to obtain the updated component corresponding to the version number; The component upgrade module is used to upgrade the target component based on the updated component when the version number meets the version number upgrade conditions.

9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the component upgrade method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the component upgrade method as described in any one of claims 1 to 7.