Resource calling method and device, electronic device, and storage medium

CN116954889BActive Publication Date: 2026-10-09TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211619400.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-14
Publication Date
2026-10-09
Estimated Expiration
2042-12-14

AI Technical Summary

Technical Problem

但是,相关技术中实现插件程序调用宿主程序包含的资源的方式比较复杂,降低了资源调用的灵活性和效率

Benefits of technology

[0037] In the technical solution provided by the embodiments of this application: First, the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program are obtained. The host resource file contains resource attribute information corresponding to the host program, and the plugin resource file contains resource attribute information corresponding to the plugin program. Then, the authorization information of the host resource file is updated to the plugin resource file to obtain the updated plugin resource file. The plugin program is then controlled to access the host resource file according to the authorization information contained in the updated plugin resource file, and to call the resources corresponding to the host program according to the resource attribute information contained in the host resource file. This not only enables the plugin program to call the resources corresponding to the host program, but also eliminates the need to modify the resource attribute information contained in the plugin resource file and the host resource file, reducing the extent of modification required to the plugin resource file and the host resource file. The plugin program can call the resources contained in the host program through the plugin resource file, eliminating the need to modify the resource calling code of the plugin program, reducing the complexity of resource calling, and improving the flexibility and efficiency of resource calling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116954889B_ABST
    Figure CN116954889B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a resource calling method and device, equipment and a medium. The method comprises the following steps: first, obtaining a host resource file corresponding to a host program and a plug-in resource file corresponding to a plug-in program, wherein the host resource file contains resource attribute information corresponding to the host program, and the plug-in resource file contains resource attribute information corresponding to the plug-in program; then, updating authorization information of the host resource file to the plug-in resource file to obtain an updated plug-in resource file, and controlling the plug-in program to access the host resource file according to the authorization information contained in the updated plug-in resource file, and to call the resource corresponding to the host program according to the resource attribute information contained in the host resource file. The technical solution of the present application can reduce the complexity of resource calling, and improve the flexibility and efficiency of resource calling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a resource retrieval method, a resource retrieval device, an electronic device, and a computer-readable medium. Background Technology

[0002] A plug-in is a program written according to a certain application programming interface (API) specification and needs to be attached to a host program to run. Deploying plug-ins in a host program can reduce the size of the host program, among other things.

[0003] Both the plugin program and the host program contain corresponding resources. To enrich the functionality of the plugin program and improve the accuracy of data processing, the plugin program can call resources contained in the host program. However, the methods for implementing plugin programs to call resources contained in the host program in related technologies are relatively complex, reducing the flexibility and efficiency of resource calls. Summary of the Invention

[0004] To address the aforementioned technical problems, embodiments of this application provide a resource retrieval method, apparatus, device, and medium, thereby reducing the complexity of resource retrieval to at least a certain extent and improving the flexibility and efficiency of resource retrieval.

[0005] According to one aspect of the embodiments of this application, this application provides a resource invocation method, the method comprising:

[0006] Obtain the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program; wherein, the host resource file contains resource attribute information corresponding to the host program, and the plugin resource file contains resource attribute information corresponding to the plugin program;

[0007] The authorization information of the host resource file is updated to the plugin resource file to obtain the updated plugin resource file;

[0008] The plugin program is controlled to access the host resource file based on the authorization information contained in the updated plugin resource file, and to call the resources corresponding to the host program based on the resource attribute information contained in the host resource file.

[0009] According to one aspect of the embodiments of this application, this application provides a resource retrieval apparatus, the apparatus comprising:

[0010] The acquisition module is configured to acquire the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program; wherein, the host resource file contains resource attribute information corresponding to the host program, and the plugin resource file contains resource attribute information corresponding to the plugin program;

[0011] The update module is configured to update the authorization information of the host resource file to the plugin resource file, thereby obtaining the updated plugin resource file;

[0012] The calling module is configured to control the plugin program to access the host resource file based on the authorization information contained in the updated plugin resource file, and to call the resources corresponding to the host program based on the resource attribute information contained in the host resource file.

[0013] In one exemplary embodiment, the update module includes:

[0014] The host update module is configured to delete the prohibited modification flag information set for the host resource file, thereby obtaining the updated host resource file;

[0015] The plugin update module is configured to add inheritance relationship information to the plugin resource file, indicating that the plugin resource file inherits from the updated host resource file, so as to obtain the updated plugin resource file and enable the updated plugin resource file to have the permission to access the updated host resource file.

[0016] In an exemplary embodiment, the resource attribute information includes a resource name and resource identifier information corresponding to the resource name; the update module is configured to update the priority indication information and the authorization information of the host resource file to the plugin resource file to obtain an updated plugin resource file; wherein, the priority indication information is used to indicate that if the updated plugin resource file and the host resource file contain the same resource name, the priority of the resource name in the updated plugin resource file is higher than the priority of the resource name in the host resource file.

[0017] In an exemplary embodiment, the resource attribute information includes a resource name and resource identifier information corresponding to the resource name; the calling module is configured to: obtain the feature information of the resource to be called corresponding to the plug-in program, and search for a resource name matching the feature information in the updated plug-in resource file according to the priority indication information contained in the updated plug-in resource file; if no resource name matching the feature information is found in the updated plug-in resource file, access the host resource file according to the authorization information contained in the updated plug-in resource file, and search for a resource name matching the feature information in the host resource file; and call the resource corresponding to the host program according to the resource identifier information corresponding to the resource name found in the host resource file.

[0018] In one exemplary embodiment, the host resource file and the plugin resource file each contain resource attribute information for multiple types of resources; the update module includes:

[0019] The joint update module is configured to update the authorization information of the host resource file to the plugin resource file, and update the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file to the resource attribute information of the specified type of resource contained in the plugin resource file, so as to obtain the updated plugin resource file.

[0020] In an exemplary embodiment, the calling module is configured to: control the plug-in program to access the host resource file based on the authorization information of the host resource file contained in the updated plug-in resource file; obtain the resource attribute information of the specified type of resource contained in the host resource file based on the authorization information of the resource attribute information of the specified type of resource in the host resource file contained in the updated plug-in resource file; and call the specified type of resource corresponding to the host program based on the obtained resource attribute information.

[0021] In an exemplary embodiment, the joint update module is configured to: delete the prohibition-modification flag information set for the host resource file and the prohibition-modification flag information set for the resource attribute information of a specified type of resource contained in the host resource file, to obtain an updated host resource file; add inheritance relationship information indicating that the plugin resource file inherits from the updated host resource file, and inheritance relationship information indicating that the resource attribute information of a specified type of resource in the plugin resource file inherits from the resource attribute information of a specified type of resource in the updated host resource file, to the plugin resource file, to obtain an updated plugin resource file.

[0022] In one exemplary embodiment, the plug-in program includes multiple plug-in programs; the apparatus further includes:

[0023] The plugin determination module is configured to determine, from the plurality of plugin programs, the calling plugin program and the called plugin program corresponding to the calling plugin program;

[0024] The plugin file update module is configured to update the authorization information of the called plugin resource file corresponding to the called plugin program to the called plugin resource file corresponding to the calling plugin program, so as to obtain the updated called plugin resource file.

[0025] The plugin invocation module is configured to control the invocation plugin program to access the called plugin resource file according to the authorization information of the called plugin resource file contained in the updated invocation plugin resource file, and to invoke the resources corresponding to the called plugin program according to the resource attribute information contained in the called plugin resource file.

[0026] In one exemplary embodiment, the plugin file update module includes:

[0027] The information deletion module is configured to delete the prohibition-of-modification identifier information set for the called plugin resource file, so as to obtain the updated called plugin resource file;

[0028] The plugin file update submodule is configured to add inheritance relationship information to the calling plugin resource file, indicating that the calling plugin resource file inherits from the updated called plugin resource file, so as to obtain the updated calling plugin resource file and enable the updated calling plugin resource file to have the permission to access the updated called plugin resource file.

[0029] In an exemplary embodiment, the plugin file update submodule is configured to: if there are multiple called plugin resource files, obtain the order of the multiple called plugin resource files; for any called plugin resource file other than the first called plugin resource file, add inheritance relationship information indicating that the any called plugin resource file inherits from the previous called plugin resource file; add inheritance relationship information indicating that the called plugin resource file inherits from the last called plugin resource file to the calling plugin resource file.

[0030] In an exemplary embodiment, the host update module is configured to: delete the prohibited modification identifier information set for the host resource file; and convert the host resource file after the prohibited modification identifier information has been deleted into a resource file of a specified format to obtain an updated host resource file.

[0031] In an exemplary embodiment, the host update module is configured to: intercept the resource update task corresponding to the host program through a designated subroutine included in the host program during the compilation process of the host program; obtain the host resource file corresponding to the host program, and delete the prohibited modification identifier information set for the host resource file to obtain the updated host resource file, so that the resource update task performs resource update according to the updated host resource file.

[0032] According to one aspect of the embodiments of this application, an electronic device is provided, including:

[0033] One or more processors;

[0034] A memory for storing one or more computer programs that, when executed by one or more processors, cause the electronic device to implement the resource access method as described above.

[0035] According to one aspect of the embodiments of this application, the embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor of an electronic device, causes the electronic device to implement the resource retrieval method as described above.

[0036] According to one aspect of the embodiments of this application, the embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the resource access method as described above.

[0037] In the technical solution provided by the embodiments of this application: First, the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program are obtained. The host resource file contains resource attribute information corresponding to the host program, and the plugin resource file contains resource attribute information corresponding to the plugin program. Then, the authorization information of the host resource file is updated to the plugin resource file to obtain the updated plugin resource file. The plugin program is then controlled to access the host resource file according to the authorization information contained in the updated plugin resource file, and to call the resources corresponding to the host program according to the resource attribute information contained in the host resource file. This not only enables the plugin program to call the resources corresponding to the host program, but also eliminates the need to modify the resource attribute information contained in the plugin resource file and the host resource file, reducing the extent of modification required to the plugin resource file and the host resource file. The plugin program can call the resources contained in the host program through the plugin resource file, eliminating the need to modify the resource calling code of the plugin program, reducing the complexity of resource calling, and improving the flexibility and efficiency of resource calling.

[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0040] Figure 1 This is a schematic diagram illustrating an exemplary implementation environment of the technical solutions in the embodiments of this application;

[0041] Figure 2 This is a flowchart illustrating a resource invocation method in an exemplary embodiment of this application;

[0042] Figure 3 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0043] Figure 4 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0044] Figure 5 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0045] Figure 6A This is a schematic diagram of a host R file shown in an exemplary embodiment of this application;

[0046] Figure 6B This is a schematic diagram illustrating the updated host R file as shown in an exemplary embodiment of this application;

[0047] Figure 7 This is a schematic diagram illustrating the processing of R files, as shown in an exemplary embodiment of this application;

[0048] Figure 8 This is a schematic diagram illustrating the processing of R files, as shown in an exemplary embodiment of this application;

[0049] Figure 9 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0050] Figure 10 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0051] Figure 11 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0052] Figure 12 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0053] Figure 13 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0054] Figure 14 This is a schematic diagram illustrating the updated host R file as shown in an exemplary embodiment of this application;

[0055] Figure 15 This is a schematic diagram illustrating the updated plugin R file as shown in an exemplary embodiment of this application;

[0056] Figure 16 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0057] Figure 17 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0058] Figure 18 This is a flowchart illustrating a resource invocation method as shown in another exemplary embodiment of this application;

[0059] Figure 19 This is a flowchart illustrating the updating of an R file, as shown in an exemplary embodiment of this application;

[0060] Figure 20 This is a schematic diagram illustrating the updating of an R file, as shown in an exemplary embodiment of this application;

[0061] Figure 21 This is a block diagram of a resource retrieval apparatus according to an embodiment of this application;

[0062] Figure 22 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation

[0063] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments identical to those of this application. Rather, they are merely examples of apparatuses and methods identical to some aspects of this application as detailed in the appended claims.

[0064] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0065] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0066] It should be noted that "multiple" as mentioned in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0067] A plug-in is a program written according to a specific application programming interface (API) specification and must run in conjunction with a host program. Deploying a plug-in within a host program can reduce the size of the host program, among other things. Both the plug-in and the host program contain corresponding resources. To enrich the functionality of the plug-in and improve the accuracy of data processing, the plug-in can call resources contained in the host program. However, the methods for implementing plug-in calling resources contained in the host program in related technologies are relatively complex, reducing the flexibility and efficiency of resource calling. Based on this, embodiments of this application provide a resource calling method, a resource calling device, an electronic device, and a computer-readable medium, which can ensure the comprehensiveness of testing and improve the testing effect.

[0068] Please see Figure 1 , Figure 1 This is a schematic diagram of an implementation environment related to this application. The implementation environment includes a terminal device 110 and a server 120. The terminal device 110 and the server 120 communicate via a wired or wireless network. The terminal device 110 can upload its own data to the server 120 and can also retrieve data from the server 120.

[0069] Among them, terminal equipment 110 may include, but is not limited to, smartphones, tablets, laptops, computers, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc.

[0070] Server 120 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This document does not impose any restrictions on this.

[0071] It should be noted that, Figure 1 The number of terminal devices 110 and servers 120 is merely illustrative; any number of terminal devices 110 and servers 120 can be used as needed.

[0072] In an exemplary embodiment, the resource invocation method provided in the embodiments of this application can be executed by the terminal device 110.

[0073] For example, terminal device 110 can be used to install a host program and a plug-in program. Terminal device 110 can first obtain the host resource file corresponding to the host program and the plug-in resource file corresponding to the plug-in program. The host resource file contains resource attribute information corresponding to the host program, and the plug-in resource file contains resource attribute information corresponding to the plug-in program. Then, the authorization information of the host resource file is updated to the plug-in resource file to obtain the updated plug-in resource file. This allows the plug-in program to access the host resource file according to the authorization information contained in the updated plug-in resource file, and to call the resources corresponding to the host program according to the resource attribute information contained in the host resource file. This not only enables the plug-in program to call the resources corresponding to the host program, but also eliminates the need to modify the resource attribute information contained in the plug-in resource file and the host resource file, reducing the amount of modification required to the plug-in resource file and the host resource file. The plug-in program can call the resources contained in the host program through the plug-in resource file, eliminating the need to modify the resource calling code of the plug-in program, reducing the complexity of resource calling, and improving the flexibility and efficiency of resource calling.

[0074] In another exemplary embodiment, server 120 may have functions similar to terminal device 110 to execute the resource invocation method provided in this application embodiment. For example, server 120 may first obtain the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program, wherein the host resource file contains resource attribute information corresponding to the host program, and the plugin resource file contains resource attribute information corresponding to the plugin program; then, it updates the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file, thereby controlling the plugin program to access the host resource file according to the authorization information contained in the updated plugin resource file, and to invoke the resources corresponding to the host program according to the resource attribute information contained in the host resource file.

[0075] In another exemplary embodiment, the terminal device 110 and the server 120 can also jointly execute the resource invocation method provided in the embodiments of this application. For example, the terminal device 110 can be used to install a host program; the server 120 can send a plug-in program to the terminal device 110. The terminal device 110 first obtains the host resource file corresponding to the host program and the plug-in resource file corresponding to the plug-in program. The host resource file contains resource attribute information corresponding to the host program, and the plug-in resource file contains resource attribute information corresponding to the plug-in program. Then, the authorization information of the host resource file is updated to the plug-in resource file to obtain an updated plug-in resource file. This allows the plug-in program to access the host resource file according to the authorization information contained in the updated plug-in resource file, and to invoke the resources corresponding to the host program according to the resource attribute information contained in the host resource file.

[0076] It should be noted that the resource retrieval method provided in the embodiments of this application can be applied to different application scenarios. When the host program or plug-in program needs to obtain data related to the user, and the resource retrieval method of this application is applied to a specific product or technology, both require the permission or consent of the user, and the extraction, use, and processing of the relevant data comply with local security standards and local laws and regulations.

[0077] The following details the various implementation details of the technical solutions in the embodiments of this application:

[0078] Please see Figure 2 , Figure 2 This is a flowchart illustrating a resource retrieval method according to an embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0079] like Figure 2 As shown, this resource retrieval method includes at least steps S210 to S230, which are described in detail below:

[0080] Step S210: Obtain the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program; wherein, the host resource file contains the resource attribute information corresponding to the host program, and the plugin resource file contains the resource attribute information corresponding to the plugin program.

[0081] It should be noted that a plugin is a program written according to a certain application programming interface (API) specification to achieve a specific function. A plugin needs to be attached to a host program to run. Plugins can be installed using plugin packages, which are compressed packages that are independent of the host program's installation package.

[0082] The host program contains the runtime resources, code, and environment required for the program to run. It can run independently of the plugin program and has plugin functionality, allowing the plugin program to run by attaching to the host program. Host programs can be of various types, including but not limited to native apps and mini-programs. Native apps are applications that can run directly on a specific operating system (e.g., Android or iOS), while mini-programs are applications that can be used without downloading or installation. Host programs can be installed via their installation packages. Optionally, a host program can be an application developed based on the Android operating system (i.e., an Android application), and the corresponding installation package can be an Android application package (APK). It's important to note that a host program can also be an application developed based on other operating systems; the specific type of host program is not limited here.

[0083] Resource files store resource attribute information for the resources contained in the application. The application can access the corresponding resources through the resource file. Resource attribute information may include, but is not limited to, the resource name and resource identification information. The resource identification information can be a resource identifier (ID), etc. The specific naming of the resource file can be flexibly set according to actual needs. For example, in an Android application, each resource can be assigned a unique ID, and then the ID can be stored as a field in a Java class named R, forming an R file (i.e., R.java). This R file is the resource file of the Android application, and the Android application can access the corresponding resource through the resource ID contained in the R file.

[0084] The host resource file is the resource file corresponding to the host program, which is used to store the resource attribute information of the resources contained in the host program; the plugin resource file is the resource file corresponding to the plugin program, which is used to store the resource attribute information of the resources contained in the plugin program.

[0085] In order for a plugin to access the resources of the host program, it is necessary to first obtain the host resource files corresponding to the host program and the plugin resource files corresponding to the plugin program.

[0086] The specific methods for obtaining the host resource files corresponding to the host program and the plugin resource files corresponding to the plugin program can be flexibly set according to actual needs. Optionally, the host resource files can be obtained from the installation package of the host program, and the plugin resource files can be obtained from the installation package of the plugin program.

[0087] Step S220: Update the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file.

[0088] In order to enable the plugin program to call the host program's resources and reduce the complexity of resource calling, the authorization information of the host resource file can be obtained and the authorization information of the host resource file can be updated to the plugin resource file to obtain the updated plugin resource file, so that the updated plugin resource file has the permission to access the host resource file.

[0089] Step S230: Control the plugin program to access the host resource file according to the authorization information contained in the updated plugin resource file, and call the corresponding resources of the host program according to the resource attribute information contained in the host resource file.

[0090] The authorization information of the host resource file is updated to the plugin resource file. After obtaining the updated plugin resource file, the updated plugin resource file has the permission to access the host resource file. Therefore, when the plugin program needs to call the corresponding resources of the host program, it can control the plugin program to access the updated plugin resource file. In this way, it can access the host resource file according to the authorization information of the host resource file contained in the updated plugin resource file, and call the corresponding resources of the host program according to the resource attribute information contained in the host resource file, thereby realizing the plugin program's call to the corresponding resources of the host program.

[0091] exist Figure 2 In the illustrated embodiment, an updated plugin resource file is obtained by adding authorization information from the host resource file to the plugin resource file. This gives the updated plugin resource file permission to access the host resource file, allowing the plugin program to access the host resource file based on the authorization information contained in the updated plugin resource file. The plugin program can then call the corresponding resources of the host program based on the resource attribute information contained in the host resource file. This not only enables the plugin program to call the resources corresponding to the host program, but also eliminates the need to modify the resource attribute information contained in the plugin and host resource files, reducing the scope of modification required. Furthermore, the plugin program can call the resources contained in the host program through the plugin resource file without modifying the plugin program's resource calling code, thus reducing the complexity of resource calls and improving their flexibility and efficiency.

[0092] In one exemplary embodiment, see Figure 3 , Figure 3 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1The terminal device 110 and server 120 in the implementation environment shown execute together.

[0093] like Figure 3 As shown, given that the resource attribute information includes the resource name and the corresponding resource identifier information, the resource invocation method includes steps S210, S310, and S230. The detailed description of step S310 is as follows:

[0094] Step S310: Update the priority indication information and the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file; wherein, the priority indication information is used to indicate that if the updated plugin resource file and the host resource file contain the same resource name, the priority of the resource name in the updated plugin resource file is higher than the priority of the resource name in the host resource file.

[0095] It should be noted that, given that the resource attribute information includes the resource name and the corresponding resource identifier, the resource names contained in the host resource file and the plugin resource file may overlap. To avoid confusion during resource invocation by the plugin program, the priority indicator information and the authorization information of the host resource file are updated in the plugin resource file, resulting in an updated plugin resource file. The priority indicator information indicates that if the updated plugin resource file and the host resource file contain the same resource name, the resource name in the updated plugin resource file has a higher priority than the resource name in the host resource file. This allows the plugin program to preferentially call the resource corresponding to the plugin program. For example, suppose the host resource file contains the resource name "abcd" with a resource ID of "22135670", and the plugin resource file contains the resource name "abcd" with a resource ID of "22135908". If the plugin program needs to call the resource with the resource name "abcd", since the updated plugin resource file contains the priority indicator information, the resource with the resource name "abcd" in the plugin resource file will be preferentially called according to "22135908".

[0096] In an optional embodiment, an instruction can be added to the plugin resource file indicating that the resource identifier information in the updated plugin resource file has a higher priority than the resource identifier information in the host resource file. Under this condition, if the plugin program needs to call a resource, and the plugin resource file and the host resource file contain the same resource identifier information, the plugin program will preferentially call the resource corresponding to the resource identifier information contained in the plugin resource file, thereby avoiding resource identifier information conflicts. Optionally, the plugin program can first search for resource identifier information that matches the feature information of the resource to be called in the plugin resource file. If no match is found, it will then search for resource identifier information that matches the feature information of the resource to be called in the host resource file. The specific calling method is similar to the subsequent steps S410-S430, and will not be described again here.

[0097] It should be noted that, Figure 3 The specific implementation details of steps S210 and S230 shown can be found in [reference]. Figure 2 Steps S210 and S230 shown will not be repeated here.

[0098] exist Figure 3 In the illustrated embodiment, by adding priority indication information to the plugin resource file, the resource name in the plugin resource file has a higher priority than the resource name in the host resource file during the process of the plugin program calling resources. This not only avoids the situation where resource names contained in the plugin resource file and the host resource file are duplicated, which would cause resource calling errors, but also allows the plugin program to call the resources contained in the plugin program first.

[0099] In one exemplary embodiment, see Figure 4 , Figure 4 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0100] like Figure 4 As shown, given that the resource attribute information includes the resource name and the corresponding resource identifier information, the resource invocation method includes steps S210, S310, and steps S410-S430. The detailed descriptions of steps S410-S430 are as follows:

[0101] Step S410: Obtain the feature information of the resource to be called corresponding to the plugin program, and search for the resource name that matches the feature information in the updated plugin resource file according to the priority indication information contained in the updated plugin resource file.

[0102] The characteristic information of the resource to be invoked is used to describe the characteristics of the resource to be invoked. It can be the resource identifier information of the resource to be invoked, the resource name of the resource to be invoked, etc.

[0103] When a plugin needs to call a resource, it can obtain the characteristic information of the resource that the plugin needs to call, that is, the characteristic information of the resource to be called. Then, it can access the updated plugin resource file. Since the updated plugin resource file contains priority indication information, indicating that the priority of the resource identification information in the updated plugin resource file is higher than the priority of the resource identification information in the host resource file, it can first search for the resource name that matches the characteristic information of the resource to be called from the updated plugin resource file.

[0104] Step S420: If no resource name matching the feature information is found in the updated plugin resource file, the host resource file is accessed according to the authorization information contained in the updated plugin resource file, and a resource name matching the feature information is found in the host resource file.

[0105] If no resource name matching the characteristic information of the resource to be called is found in the updated plugin resource file, the plugin program can access the host resource file based on the host resource file authorization information contained in the updated plugin resource file in order to find the resource name matching the characteristic information of the resource to be called in the host resource file.

[0106] Optionally, if a resource name matching the characteristic information of the resource to be called is found in the updated plugin resource file, the plugin program can find the resource identifier information corresponding to the resource name in the updated plugin resource file, and call the corresponding resource from the resources contained in the plugin program according to the found resource identifier information.

[0107] Step S430: Call the resource corresponding to the host program based on the resource identifier information corresponding to the resource name found in the host resource file.

[0108] After finding a resource name that matches the characteristic information of the resource to be called from the host resource file, the plugin program can find the resource identifier information corresponding to that resource name from the host resource file, and call the resource that matches the found resource identifier information from the resources contained in the host program.

[0109] It should be noted that, Figure 4 For details on the specific implementation of step S210 shown, please refer to Figure 2 Step S210 is shown. Figure 4 The specific implementation details of step S310 shown can be found in [reference]. Figure 3 Step S310 shown will not be repeated here.

[0110] exist Figure 4 In the illustrated embodiment, during the process of a plug-in program calling resources, if the priority of the resource name in the plug-in resource file is higher than that of the resource name in the host resource file, the plug-in searches for the resource name of the resource to be called in the plug-in resource file. If the resource name of the resource to be called does not exist in the plug-in resource file, it searches for the resource name of the resource to be called in the host resource file. Thus, the plug-in calls the resource corresponding to the host program based on the resource identifier information corresponding to the resource name of the resource to be called contained in the host resource file, which can improve the efficiency of resource calling.

[0111] In one exemplary embodiment, see Figure 5 , Figure 5 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0112] like Figure 5 As shown, the resource retrieval method includes steps S210, S510-S520, and S230. The detailed descriptions of steps S510-S520 are as follows:

[0113] Step S510: Delete the prohibited modification flag information set for the host resource file to obtain the updated host resource file.

[0114] It should be noted that the "prohibit modification" flag indicates that the object it modifies must not be modified. That is, once a value is assigned to the modified object, it cannot be reassigned or extended. The "prohibit modification" flag includes, but is not limited to, the `final` modifier.

[0115] If the host resource file contains a prohibition-of-modification flag, it cannot be modified or extended (i.e., the host resource file, as a class, cannot be subclassed), making it uninheritable. To allow plugin resource files to inherit from the host resource file and thus grant them access permissions, the prohibition-of-modification flag can be removed, resulting in an updated host resource file that can be inherited and modified. See the example below. Figure 6A As shown, Figure 6A Taking the host resource file as the host R file (the R file corresponding to the host program) as an example, the host R file contains the `final` modifier used to decorate the R file (i.e., "final" in "Public final class R"). The host R file also contains resource IDs for animation resources (anim) and attribute resources (attr). To allow the host R file to be inherited, the `final` modifier used to decorate the R file (i.e., "final" in "Public final class R") is removed, resulting in: Figure 6B The updated host R file is shown.

[0116] Step S520: Add inheritance relationship information to the plugin resource file, indicating that the plugin resource file inherits from the updated host resource file, to obtain the updated plugin resource file, so that the updated plugin resource file has the permission to access the updated host resource file.

[0117] The updated host resource file does not contain any prohibition information set for modification of the host resource file, which allows the updated host resource file to be inherited. Therefore, inheritance information indicating that the plugin resource file inherits from the updated host resource file is added to the plugin resource file to obtain the updated plugin resource file. In other words, the updated plugin resource file inherits from the updated host resource file, making the updated plugin resource file a subclass of the updated host resource file and giving it permission to access the updated host resource file.

[0118] In other words, see Figure 7 As shown, the plugin's installation package contains a plugin R file, and the host program's installation package contains a host R file. To enable the plugin to access resources from the host program, the plugin R file must inherit from the host R file. However, if the host R file contains the `final` modifier, the plugin R file cannot inherit from the host R file. Therefore, see [link to documentation]. Figure 8 As shown, the final modifier of the host R file is removed before inheritance.

[0119] It should be noted that, Figure 5 The specific implementation details of steps S210 and S230 shown can be found in [reference]. Figure 2 Steps S210 and S230 shown will not be repeated here.

[0120] exist Figure 5 In the illustrated embodiment, inheritance grants the updated plugin resource file access to the updated host resource file. This eliminates the need to modify the resource attribute information contained in the plugin and host resource files, as well as the resource call code of the plugin program, reducing resource call complexity and improving resource call flexibility and efficiency. Furthermore, during the inheritance process, if the inheritor (e.g., the plugin resource file) and the inherited party (e.g., the host resource file) have the same resource name or resource identifier information, the inheritor's resource name or resource identifier information will override the inherited party's resource name or resource identifier information. That is, the inheritor's resource name or resource identifier information has higher priority than the inherited party's resource name or resource identifier information, thereby avoiding resource name or resource identifier information duplication and resource call conflicts.

[0121] In one exemplary embodiment, see Figure 9 , Figure 9 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0122] like Figure 9 As shown, the resource retrieval method includes steps S210, S910-S920, S520, and S230; among them, the detailed descriptions of steps S910-S920 are as follows:

[0123] Step S910: Delete the prohibited modification flag information set for the host resource file.

[0124] If the host resource file contains a prohibition-of-modification flag that modifies the host resource file, then delete that prohibition-of-modification flag.

[0125] Step S920: Convert the host resource file after the prohibited modification identification information is deleted into a resource file of a specified format to obtain the updated host resource file.

[0126] The specified format can be flexibly set according to actual needs, or according to the formats supported by the runtime environment. For example, if the host program is developed based on the Android operating system, the Android operating system supports the resource compilation and packaging tool (Android Asset Packaging Tool 2, AAPT2) for compiling and packaging program resources, and the specified format can be a format supported by AAPT2. In one example, the specified format includes, but is not limited to, the jar format, where jar is a software package file format.

[0127] After removing the modification-prohibited flags from the host resource files, the host resource files can be converted to a specified format to obtain updated host resource files. In other words, the updated host file is in the specified format. For example, assuming the specified format is jar, the host resource files can be compressed and packaged into a jar file.

[0128] Optionally, the updated plugin resource files can be converted to a specified format.

[0129] It should be noted that, Figure 9 The specific implementation details of steps S210 and S230 shown can be found in [reference]. Figure 2 Steps S210 and S230 are shown. Figure 9 For detailed implementation of step S520 shown, please refer to [link / reference]. Figure 5 Step S520 shown will not be repeated here.

[0130] exist Figure 9 In the illustrated embodiment, the updated host resource file is set to a specified format, thereby facilitating access by subsequent host programs or plugin programs and improving resource access efficiency.

[0131] In one exemplary embodiment, see Figure 10 , Figure 10 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0132] like Figure 10As shown, the resource retrieval method includes steps S210, S1010-S1020, S520, and S230. The detailed descriptions of steps S1010-S1020 are as follows:

[0133] Step S1010: During the compilation of the host program, the resource update task corresponding to the host program is intercepted through a specified subroutine contained in the host program.

[0134] The host program has a designated subroutine that is used to intercept the resource update task of the host program during the compilation process. The resource update task is used to update the resources in the host program.

[0135] Optionally, if the host application is an application developed based on the Android operating system, the specified subroutine can be a Transform, and the resource update task can be a Gradle task within ProcessAndroidResources (resource processing). The Gradle task can be used for resource compilation and packaging. The specified subroutine can be added to the host application during the compilation and packaging process of the host application's installation package, thereby intercepting the resource update task through the specified subroutine.

[0136] During the compilation of the host program, the resource update task corresponding to the host program can be intercepted by a specified subroutine contained in the host program, thereby updating the host resource file before the resource update.

[0137] Step S1020: Obtain the host resource file corresponding to the host program, and delete the prohibited modification flag information set for the host resource file to obtain the updated host resource file, so that the resource update task can perform resource update based on the updated host resource file.

[0138] After intercepting the resource update task corresponding to the host program, the host resource file corresponding to the host program can be obtained, and the prohibited modification flag information set for the host resource file can be deleted to obtain the updated host resource file, so that the resource update task can perform resource updates based on the updated host resource file.

[0139] Optionally, before executing the resource update task, the plugin resource file of the plugin program can be obtained, and the plugin resource file can inherit the updated host resource file to obtain the updated plugin resource file. The updated host resource file and the plugin resource file can then be used as the output of the resource update task.

[0140] Optionally, updates to the host resource files and plugin resource files can be implemented by specifying a subroutine.

[0141] It should be noted that, Figure 10The specific implementation details of steps S210 and S230 shown can be found in [reference]. Figure 2 Steps S210 and S230 are shown. Figure 10 For detailed implementation of step S520 shown, please refer to [link / reference]. Figure 5 Step S520 shown will not be repeated here.

[0142] exist Figure 10 In the illustrated embodiment, the host resource file is updated before the resource update task is executed, so that the resource update task updates resources based on the updated host resource file, which can improve the accuracy of resource updates.

[0143] In one exemplary embodiment, see Figure 11 , Figure 11 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0144] like Figure 11 As shown, given that the host resource file and the plugin resource file each contain resource attribute information for multiple types of resources, this resource invocation method includes steps S210, S1110, and S230. The detailed description of step S1110 is as follows:

[0145] Step S1110: Update the authorization information of the host resource file to the plugin resource file, and update the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file to the resource attribute information of the specified type of resource contained in the plugin resource file, so as to obtain the updated plugin resource file.

[0146] It should be noted that the host resource file can contain resource attribute information for various types of resources corresponding to the host program. For example, see [link to relevant documentation]. Figure 6A As shown, the host R file contains resource IDs for animation resources (anim), resource IDs for attribute resources (attr), etc. Plugin resource files can contain resource attribute information for various types of resources corresponding to the plugin program.

[0147] The specified type of resource can be a resource included in the host program. Its specific type can be flexibly set according to actual needs. For example, it can be at least one of the following: all resources corresponding to the resource attribute information included in the host resource file, resources whose corresponding resource attribute information in the host resource file has a prohibited modification identifier, or other resources included in the host resource file other than attribute-type resources.

[0148] If a plugin resource file only contains the authorization information of the host resource file, then the plugin resource file only has permission to access the host resource file. However, it may not have access to the resource attribute information of a specific type of resource contained in the host resource file. Therefore, to ensure that the plugin resource file has access to the resource attribute information of a specific type of resource contained in the host resource file, the authorization information of the host resource file can be updated to the plugin resource file, and the authorization information corresponding to the resource attribute information of the specific type of resource contained in the host resource file can be updated to the resource attribute information of the specific type of resource contained in the plugin resource file. This results in an updated plugin resource file. In this way, the updated plugin resource file contains the authorization information of the host resource file and the authorization information corresponding to the resource attribute information of the specific type of resource in the host resource file. This allows the plugin program to obtain the resource attribute information of the specific type of resource contained in the host resource file through the updated plugin resource file and call the specific type of resource contained in the host program based on the resource attribute information.

[0149] It should be noted that, Figure 11 The specific implementation details of steps S210 and S230 shown can be found in [reference]. Figure 2 Steps S210 and S230 shown will not be repeated here.

[0150] exist Figure 11In the illustrated embodiment, by updating the authorization information of the host resource file to the plugin resource file, and updating the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file to the resource attribute information of the specified type of resource contained in the plugin resource file, an updated plugin resource file is obtained. This updated plugin resource file contains the authorization information of the host resource file and the authorization information corresponding to the resource attribute information of the specified type of resource in the host resource file. This allows the plugin program to obtain the resource attribute information of the specified type of resource contained in the host resource file through the updated plugin resource file, and to call the specified type of resource contained in the host program based on this resource attribute information. This ensures that the plugin program can call the specified type of resource contained in the host program through the plugin resource file. Furthermore, updating the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file to the resource attribute information of the specified type of resource contained in the plugin resource file—that is, updating the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file to the resource attribute information of the same type of resource contained in the plugin resource file—facilitates the plugin program in finding the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file, improving resource calling efficiency.

[0151] In one exemplary embodiment, see Figure 12 , Figure 12 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0152] like Figure 12 As shown, given that the host resource file and the plugin resource file each contain resource attribute information for multiple types of resources, this resource invocation method includes steps S210, S1110, and steps S1210-S1230. The detailed descriptions of steps S1210-S1230 are as follows:

[0153] Step S1210: Control the plugin program to access the host resource file based on the authorization information of the host resource file contained in the updated plugin resource file.

[0154] The updated plugin resource file contains the authorization information of the host resource file. Therefore, when the plugin program needs to call the corresponding resources of the host program, it can control the plugin program to access the updated plugin resource file, thereby accessing the host resource file according to the authorization information of the host resource file contained in the updated plugin resource file.

[0155] Step S1220: Based on the authorization information of the resource attribute information of the specified type of resource in the host resource file contained in the updated plugin resource file, obtain the resource attribute information of the specified type of resource in the host resource file.

[0156] If a plugin needs to call a resource of a specific type contained in the host program, the plugin can find the authorization information of the resource attribute information of the corresponding resource of the specified type in the host resource file from the resource attribute information of the specified type of resource contained in the updated plugin resource file, and then obtain the resource attribute information of the specified type of resource from the host resource file based on the authorization information.

[0157] Step S1230: Call the specified type of resource corresponding to the host program based on the obtained resource attribute information.

[0158] Based on the resource attribute information of a specified type of resource obtained from the host resource file, the plugin program can call the specified type of resource contained in the host program. For example, assuming the specified type of resource is an animation resource, the host resource file contains resource attribute information a1 of the animation resource corresponding to the host program, and the plugin resource file contains resource attribute information a2 of the animation resource corresponding to the plugin program. After updating the authorization information of the host resource file to the plugin resource file, and updating the authorization information of resource attribute information a1 to resource attribute information a2, the updated plugin resource file contains the authorization information of the host resource file and the authorization information of resource attribute information a1. When the plugin program needs to call the resource corresponding to resource attribute information a1, it can obtain the authorization information of the host resource file and the authorization information of resource attribute information a1 from the updated plugin resource file. Then, based on the authorization information of the host resource file and the authorization information of resource attribute information a1, it can retrieve resource attribute information a1 from the host resource file, and thus call the animation resource contained in the host program based on resource attribute information a1.

[0159] It should be noted that, Figure 12 For details on the specific implementation of step S210 shown, please refer to Figure 2 Step S210 is shown. Figure 12 For details on the specific implementation of step S1110 shown, please refer to Figure 11 Step S1110 shown will not be repeated here.

[0160] exist Figure 12In the embodiment shown, the plug-in program accesses the host resource file based on the authorization information of the host resource file contained in the updated plug-in resource file, obtains the resource attribute information of the specified type of resource contained in the host resource file based on the authorization information of the resource attribute information of the specified type of resource contained in the host resource file contained in the updated plug-in resource file, and calls the specified type of resource corresponding to the host program based on the obtained resource attribute information, thereby realizing the plug-in program calling the specified type of resource contained in the host program and improving the flexibility of resource calling.

[0161] In one exemplary embodiment, see Figure 13 , Figure 13 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 110 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 110 in the implementation environment shown execute together.

[0162] like Figure 13 As shown, given that the host resource file and the plugin resource file each contain resource attribute information for multiple types of resources, this resource invocation method includes steps S210, S1310-S1320, and S230. The detailed descriptions of steps S1310-S1320 are as follows:

[0163] Step S1310: Delete the prohibited modification flag information set for the host resource file and the prohibited modification flag information set for the resource attribute information of the specified type of resources contained in the host resource file, and obtain the updated host resource file.

[0164] It should be noted that if the host resource file contains any prohibition-of-modification flags set for it, or for the resource attributes of a specified type of resource within the host resource file, then the host resource file cannot be modified, extended, or have its resource attributes extended. This prevents the host resource file from being inherited, and the resource attributes of the specified type of resource within it cannot be inherited. To enable plugin resource files to inherit from the host resource file, and to ensure that the resource attributes of the specified type of resource in the plugin resource file inherit from those in the host resource file, thus granting the plugin resource file permission to access the host resource file and its resource attributes, the prohibition-of-modification flags set for the host resource file and for the specified type of resource within it can be removed. This results in an updated host resource file, which does not contain any prohibition-of-modification flags modifying the host resource file, nor does it contain any prohibition-of-modification flags modifying the resource attributes of the specified type of resource. For example, suppose the host resource file is as follows: Figure 6A The host R file shown here specifies that the resource type is animation (anim). Therefore, remove the `final` modifier used to modify the R file (i.e., "final" in "Public final class R"), and also remove the `final` modifier used to modify the resource attribute information of the animation (anim) (i.e., "final" in "Public static class anim"), resulting in the following: Figure 14 The updated host R file is shown.

[0165] Step S1320: Add inheritance relationship information to the plugin resource file, indicating that the plugin resource file inherits from the updated host resource file, and inheritance relationship information that indicates that the resource attribute information of a specified type of resource in the plugin resource file inherits from the resource attribute information of a specified type of resource in the updated host resource file, to obtain the updated plugin resource file.

[0166] The updated host resource file does not contain any prohibition-of-modification flags set for the host resource file itself, nor for the resource attribute information of specified resource types contained within the host resource file. This allows the updated host resource file to be inherited, and the resource attribute information of specified resource types contained within the updated host resource file to be inherited. Therefore, inheritance relationship information indicating that the plugin resource file inherits from the updated host resource file, as well as inheritance relationship information indicating that the resource attribute information of specified resource types in the plugin resource file inherits from the resource attribute information of specified resource types in the updated host resource file, is added to the plugin resource file to obtain the updated plugin resource file. In other words, the updated plugin resource file inherits from the updated host resource file, making the updated plugin resource file a subclass of the updated host resource file and granting it access to the updated host resource file. Furthermore, the resource attribute information of specified resource types contained in the updated plugin resource file inherits from the resource attribute information of specified resource types contained in the updated host resource file, making the resource attribute information of specified resource types contained in the updated host resource file a subclass of the resource attribute information of specified resource types contained in the updated host resource file and granting it access to the resource attribute information of specified resource types contained in the updated host resource file. For example, see... Figure 15 As shown, assuming the specified type of resource is a color resource and the plugin resource file is a plugin R file (i.e., the R file corresponding to the plugin program), the updated plugin R file contains "Public staticclass color extends ****R.color", which is used to indicate that the color in the updated plugin R file inherits the color in "****R".

[0167] It should be noted that, Figure 13 The specific implementation details of steps S210 and S230 shown can be found in [reference]. Figure 2 Steps S210 and S230 shown will not be repeated here.

[0168] exist Figure 13 In the illustrated embodiment, the updated plugin resource file is granted permission to access the host resource file and the resource attribute information of the specified type of resources contained in the host resource file through inheritance, thereby reducing the complexity of resource calls.

[0169] In one exemplary embodiment, see Figure 16 , Figure 16 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0170] like Figure 16 As shown, when multiple plug-in programs are included, the resource invocation method includes steps S210-S230 and steps S1610-S1630. The detailed description of steps S1610-S1630 is as follows:

[0171] Step S1610: Determine the calling plugin program and the called plugin program corresponding to the calling plugin program from multiple plugin programs.

[0172] In a context containing multiple plugins, to enable a plugin to access resources contained in other plugins, the calling plugin and its corresponding called plugin can be identified from among the multiple plugins. The calling plugin is the plugin that needs to access resources contained in other plugins, while the called plugin is the plugin whose resources are accessed by other plugins.

[0173] Step S1620: Update the authorization information of the called plugin resource file corresponding to the called plugin program to the calling plugin resource file corresponding to the calling plugin program, and obtain the updated calling plugin resource file.

[0174] Among them, the called plugin resource file refers to the resource file corresponding to the called plugin program, and the calling plugin resource file refers to the resource file corresponding to the calling plugin program.

[0175] In order for the calling plugin program to access the resources contained in the called plugin program, the authorization information of the called plugin resource file can be updated to the calling plugin resource file to obtain the updated calling plugin resource file, so that the updated calling plugin resource file has the permission to access the called plugin resource file.

[0176] Step S1630: The control calling plugin program accesses the called plugin resource file according to the authorization information of the called plugin resource file contained in the updated calling plugin resource file, and calls the resource corresponding to the called plugin program according to the resource attribute information contained in the called plugin resource file.

[0177] The updated plugin resource file has permission to access the resource file of the called plugin. Therefore, when a plugin program needs to access the resources corresponding to the called plugin program, it can control the plugin program to access the updated plugin resource file. Based on the authorization information of the called plugin resource file contained in the updated plugin resource file, the plugin program can access the called plugin resource file and access the resources corresponding to the called plugin program based on the resource attribute information contained in the called plugin resource file, thereby realizing resource calls between plugin programs.

[0178] Optionally, if both the calling plugin resource file and the called plugin resource file contain multiple types of resource attribute information, in order to enable the updated calling plugin resource file to access the resource attribute information of the specified type of resource in the called plugin resource file, the authorization information corresponding to the resource attribute information of the specified type of resource in the called plugin resource file can be added to the calling plugin resource file. The specific process is similar to the aforementioned step S1110, and will not be repeated here.

[0179] It should be noted that, Figure 16 The specific implementation details of steps S210-S230 shown can be found in [reference]. Figure 2 Steps S210-S230 shown will not be repeated here. Figure 16 The example given is that steps S210-S230 are executed first, followed by steps S1610-S1630. However, this embodiment does not restrict the execution order of steps S210-S230 and S1610-S1630.

[0180] exist Figure 16 In the illustrated embodiment, by updating the authorization information of the called plugin resource file corresponding to the called plugin program to the called plugin resource file corresponding to the calling plugin program, an updated called plugin resource file is obtained. This enables the calling plugin program to call the resources contained in the called plugin program according to the updated called plugin resource file, thereby realizing resource calls between plugin programs and improving the flexibility of resource calls.

[0181] In one exemplary embodiment, see Figure 17 , Figure 17 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1The terminal device 110 and server 120 in the implementation environment shown execute together.

[0182] like Figure 17 As shown, the resource retrieval method includes steps S210-S230, step S1610, steps S1710-S1720, and step S1630. The detailed descriptions of steps S1710-S1720 are as follows:

[0183] Step S1710: Delete the prohibited modification flag information set for the called plugin resource file to obtain the updated called plugin resource file.

[0184] To enable the called plugin resource file to be inherited by the called plugin resource file, thus granting the calling plugin resource file access permissions to the called plugin resource file, the "prohibit modification" flag set for the called plugin resource file can be deleted, resulting in an updated called plugin resource file.

[0185] Step S1720: Add inheritance relationship information to the calling plugin resource file, indicating that the calling plugin resource file inherits the updated called plugin resource file, to obtain the updated calling plugin resource file, so that the updated calling plugin resource file has the permission to access the updated called plugin resource file.

[0186] The updated called plugin resource file does not contain any prohibition-of-modification flags set for the called plugin resource file, allowing the updated called plugin resource file to be inherited. Therefore, by adding inheritance information indicating that the calling plugin resource file inherits from the updated called plugin resource file to the calling plugin resource file, the updated calling plugin resource file is obtained. In other words, the updated calling plugin resource file inherits from the updated called plugin resource file, making the updated calling plugin resource file a subclass of the updated called plugin resource file and having the permission to access the updated called plugin resource file.

[0187] It should be noted that, Figure 17 The specific implementation details of steps S210-S230 shown can be found in [reference]. Figure 2 Steps S210-S230 are shown. Figure 17 The specific implementation details of steps S1610 and S1630 shown can be found in [reference]. Figure 16 Steps S1610 and S1630 shown will not be repeated here.

[0188] exist Figure 17In the illustrated embodiment, inheritance is used to enable the calling resource file to have access to the called resource file, thereby allowing the calling plugin program to call the resources contained in the called plugin program based on the updated calling plugin resource file, thus reducing the complexity of resource calls between plugin programs.

[0189] In one exemplary embodiment, see Figure 18 , Figure 18 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. This method can be applied to... Figure 1 The implementation environment shown can be composed of Figure 1 The terminal device 110 in the implementation environment shown can execute this, or it can be performed by... Figure 1 The server 120 in the implementation environment shown can perform the operation, or it can be performed by... Figure 1 The terminal device 110 and server 120 in the implementation environment shown execute together.

[0190] like Figure 18 As shown, the resource retrieval method includes steps S210-S230, S1610, S1710, S1810-S1830, and step S1630. The detailed descriptions of steps S1810-S1830 are as follows:

[0191] Step S1810: If there are multiple resource files of the called plugin, then obtain the order of the multiple resource files of the called plugin.

[0192] If there are multiple resource files of the called plugin (i.e., multiple called plugin programs), in order to ensure that the calling plugin program can access the resources contained in multiple called plugin programs, the order of the multiple called plugin resource files can be obtained first. The sorting method of the multiple called plugin resources can be flexibly set according to actual needs.

[0193] Step S1820: For any of the multiple called plugin resource files other than the first called plugin resource file, add information in any called plugin resource file indicating that any called plugin resource file inherits the inheritance relationship information of the previous called plugin resource file.

[0194] After obtaining the order of multiple called plugin resource files, for any called plugin resource file other than the first called plugin resource file, add inheritance information to that called plugin resource file indicating that it inherits from the previous called plugin resource file. This gives each called plugin resource file permission to access its predecessor. In other words, the second called plugin resource file inherits from the first called plugin file, the third called plugin resource file inherits from the second called plugin file, and so on, until the last called plugin resource file inherits from the second-to-last called plugin file. This gives the last called plugin resource file permission to access all the called plugin resource files from the first to the second-to-last called plugin resource file.

[0195] Step S1830: Add information to the calling plugin resource file indicating the inheritance relationship information of the calling plugin resource file inheriting from the last called plugin resource file.

[0196] Add an instruction to the calling plugin resource file indicating that the calling plugin resource file inherits from the last called plugin resource file. That is, the calling plugin resource file inherits from the last called plugin resource file. Since the last called plugin resource file has access to the first to the second-to-last called plugin resource files, and the calling plugin resource file has access to the last called plugin resource file, it has access to all the called plugin resource files from the first to the last called plugin resource file. For example, assuming the called plugin resource files are in the order r1, r2, r3, and the calling plugin resource file is rd, then r2 inherits from r1, r3 inherits from r2, and rd inherits from r3. Since rd has access to r3, r3 has access to r2, and r2 has access to r1, rd has access to r3-r1. This allows the calling plugin program to access the resources contained in the called plugin programs corresponding to r3-r1 based on rd.

[0197] It should be noted that, Figure 18 The specific implementation details of steps S210-S230 shown can be found in [reference]. Figure 2 Steps S210-S230 are shown. Figure 18 The specific implementation details of steps S1610 and S1630 shown can be found in [reference]. Figure 16 Steps S1610 and S1630 are shown. Figure 18 For details on the specific implementation of step S1710 shown, please refer to Figure 17 Step S1710 shown will not be repeated here.

[0198] exist Figure 18 In the illustrated embodiment, by setting the order of multiple called resource files, with each called resource file inheriting from the previous called resource file and the calling resource file inheriting from the last called resource file, the calling resource file has the permission to access multiple called resource files. This enables the plug-in program to call resources contained in multiple plug-in programs, improving the flexibility of resource calling.

[0199] In one exemplary embodiment, an Android application is used as an example for illustration. See [link to example]. Figure 19 , Figure 19 This is a flowchart illustrating a resource invocation method, as shown in another exemplary embodiment of this application. Figure 19 As shown, the resource retrieval method includes steps S1901-S1902, which are described in detail below:

[0200] Step S1901: During the compilation and packaging process of the host program installation package, add a specified Transform to the host program.

[0201] It should be noted that the host program is an Android application, and its Android package is an APK. The Transform is specified to intercept the Gradle task of ProcessAndroidResources in the code processing flow of the APK.

[0202] Step S1902: Obtain the gradle task of ProcessAndroidResources corresponding to the host program by specifying Transform.

[0203] Optionally, you can obtain the gradle task from ProcessAndroidResources through the getTask interface provided by AGP (Android Gradle Plugin).

[0204] Step S1903: Before the ProcessAndroidResources task corresponding to the host program is executed, obtain the host R file corresponding to the host program, and remove the final modifier from the host R file and its subclasses.

[0205] Here, the host R file refers to a class named R, used to store the resource IDs of resources contained in the host program. It contains subclasses, each corresponding to a resource ID of a specific type of resource. To allow the host R file and its subclasses to be inherited, the `final` modifier can be removed from both the host R file and its subclasses. For example, see... Figure 6A As shown, the host R file contains a subclass named `anim` and a subclass named `attr`. The subclass named `anim` stores the resource IDs of animation resources, and the subclass named `attr` stores the resource IDs of attribute resources. The assignment operator is preceded by the resource name and its modifier, and followed by the resource ID. For example, "Public static final int abc_fade_in=2130771968" means that the resource ID of the resource name "abc_fade_in" is "2130771968", where "Public static final int" is the modifier of "abc_fade_in". To enable inheritance between the host R file and its subclasses, the `final` modifier in the host R file (i.e., "final" in "Public final class R"), the `final` modifier in the `anim` subclass (i.e., "final" in "Public static final class anim"), and the `final` modifier in the `attr` subclass (i.e., "final" in "Public static final class attr") are removed.

[0206] Step S1904: Before the ProcessAndroidResources task corresponding to the host program is executed, obtain the plugin R file corresponding to the plugin program, and control the plugin R file to inherit from the host R file, and the subclass of the plugin R file to inherit from the subclass of the host R file.

[0207] A plugin R file is a class named R used to store the resource IDs of the resources contained in the plugin program. It contains subclasses, each of which corresponds to a resource ID of a certain type of resource. In order for the plugin R file to have the permission to access the host R file and its subclasses, the plugin R file can be controlled to inherit from the host R file, and the subclasses of the plugin R file can inherit from the subclasses of the host R file.

[0208] In this context, the control plugin R file inherits from the host R file, and the specific method by which subclasses of the plugin R file inherit from subclasses of the host R file can be found in the descriptions of the aforementioned embodiments, and will not be repeated here. The subclasses of the plugin R file and the subclasses of the host R file they inherit from can be classes corresponding to the same type of resource. For example, the anim subclass of the plugin R file inherits from the anim subclass of the host R file.

[0209] Step S1905: The modified host R file and plugin R file are used as the output of ProcessAndroidResources.

[0210] Optionally, the modified host R file and plugin R file can be compressed and packaged separately to obtain a jar format host R file and a jar format plugin R file. The jar format host R file and jar format plugin R file are then used as the output of ProcessAndroidResources, so that the plugin program can call the resources contained in the host program based on the jar format plugin R file and jar format host R file.

[0211] Optional, see Figure 20 As shown, the installation packages of the host program and the plugin program can be obtained. Then, ProcessAndroidResources is obtained, and the host R file is modified using ModifyBaseRJarTask (host R file modification task). During the modification of the host R file, the final modifier of the host R file and the final modifier of the subclasses of the host R file are removed, and the host R file is packaged into a jar format host R file (i.e., baseR.jar). Then, the plugin R file is modified using ModifySplitRJarTask (plugin R file modification task). During the modification of the plugin R file, the inheritance relationship of the plugin R file and the inheritance relationship of the subclasses of the plugin R file are modified, and the plugin R file is packaged into a jar format plugin R file (i.e., pluginR.jar). Thus, the modified jar format host R file and the modified jar format plugin R file are obtained. The modified jar format host R file is added to the installation package of the host program, and the modified jar format plugin R file is added to the installation package of the plugin program.

[0212] Optionally, to enable the host program to access resources contained in the plugin program, the host program can directly access the plugin program's R file based on the plugin program's identification information, and then access the corresponding resources of the plugin program based on the plugin program's R file. For example, assuming the plugin program is module1, the host program can access the resources of module1 by calling the module1.R file.

[0213] exist Figure 19In the illustrated embodiment, the host R file is made into an inheritable class by modifying its `final` modifier. Then, the inheritance relationship of the plugin R file is modified so that the plugin R file inherits from the host R file. In this way, the plugin program can access the resource ID of the host R file through the plugin R file, thereby enabling the plugin program to call the resources of the host program. Furthermore, there is no need to adjust the structure of the R file, and there is no problem of missing resource IDs. During the inheritance process, if the resource name in the plugin R file is the same as the resource name in the host R file, the resource name in the plugin R file overrides the resource name in the host R file (that is, during the process of the plugin program looking up the resource ID, if the resource name of the resource to be called exists in both the plugin R file and the host R file, then the resource ID corresponding to the resource name of the resource to be called in the plugin R file is obtained, and the resource is called based on the resource ID), so that there is no problem of resource name conflict.

[0214] It should be noted that, in order to enable the plugin program to call resources contained in the host program, in related technology 1, the plugin program can use the getidentifier interface to find the corresponding resource ID by the resource name and call the resource based on the resource ID, thereby enabling the plugin program to call resources contained in the host program. However, this method requires hardcoding the resource name in the code, which has low flexibility. In related technology 2, the host R file and the plugin R file are re-aggregated into the same resource file, so that the plugin program can call resources contained in the host program through the aggregated resource file. However, this method requires traversing the resource names and resource IDs in the host R file and the plugin R file, which is prone to missing resource names and resource IDs. In addition, it is also necessary to handle the problem of resource name and resource ID conflicts. Therefore, as shown in Table 1 below, compared with related technology 1 and related technology 2, Figure 19 The embodiment shown modifies the inheritance relationship of the R file, which has the advantages of not requiring code modification, not requiring resource name encoding, and not requiring handling of resource conflicts.

[0215]

[0216]

[0217] Table 1

[0218] Figure 21 This is a block diagram illustrating a resource retrieval apparatus according to an embodiment of this application. Figure 20 As shown, the device includes:

[0219] The acquisition module 2101 is configured to acquire the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program; wherein, the host resource file contains the resource attribute information corresponding to the host program, and the plugin resource file contains the resource attribute information corresponding to the plugin program.

[0220] Update module 2102 is configured to update the authorization information of the host resource file to the plugin resource file, so as to obtain the updated plugin resource file;

[0221] Module 2103 is configured to control the plugin program to access the host resource file based on the authorization information contained in the updated plugin resource file, and to call the corresponding resources of the host program based on the resource attribute information contained in the host resource file.

[0222] In one embodiment of this application, based on the foregoing scheme, the update module 2102 includes:

[0223] The host update module is configured to delete the prohibited modification flag information set for host resource files, and obtain the updated host resource files.

[0224] The plugin update module is configured to add inheritance information to the plugin resource file, indicating that the plugin resource file inherits from the updated host resource file, so as to obtain the updated plugin resource file and enable the updated plugin resource file to have the permission to access the updated host resource file.

[0225] In one embodiment of this application, based on the aforementioned scheme, under the condition that the resource attribute information includes a resource name and the resource identifier information corresponding to the resource name, the update module 2102 is specifically configured to: update the priority indication information and the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file; wherein, the priority indication information is used to indicate that if the updated plugin resource file and the host resource file contain the same resource name, the priority of the resource name in the updated plugin resource file is higher than the priority of the resource name in the host resource file.

[0226] In one embodiment of this application, based on the aforementioned scheme, under the condition that the resource attribute information includes a resource name and the resource identifier information corresponding to the resource name, the calling module 2103 is specifically configured as follows: obtain the feature information of the resource to be called corresponding to the plug-in program, and search for a resource name matching the feature information in the updated plug-in resource file according to the priority indication information contained in the updated plug-in resource file; if no resource name matching the feature information is found in the updated plug-in resource file, access the host resource file according to the authorization information contained in the updated plug-in resource file, and search for a resource name matching the feature information in the host resource file; call the resource corresponding to the host program according to the resource identifier information corresponding to the resource name found in the host resource file.

[0227] In one embodiment of this application, based on the foregoing scheme, where the host resource file and the plugin resource file each contain resource attribute information of multiple types of resources, the update module 2102 includes:

[0228] The joint update module is configured to update the authorization information of the host resource file to the plugin resource file, and update the authorization information corresponding to the resource attribute information of the specified type of resources contained in the host resource file to the resource attribute information of the specified type of resources contained in the plugin resource file, so as to obtain the updated plugin resource file.

[0229] In one embodiment of this application, based on the aforementioned scheme, under the condition that the host resource file and the plugin resource file respectively contain resource attribute information of multiple types of resources, the calling module 2103 is specifically configured as follows: controlling the plugin program to access the host resource file according to the authorization information of the host resource file contained in the updated plugin resource file; obtaining the resource attribute information of the specified type of resource contained in the host resource file according to the authorization information of the resource attribute information of the specified type of resource in the host resource file contained in the updated plugin resource file; and calling the specified type of resource corresponding to the host program according to the obtained resource attribute information.

[0230] In one embodiment of this application, based on the aforementioned scheme, under the condition that the host resource file and the plugin resource file respectively contain resource attribute information of multiple types of resources, the joint update module is configured as follows: delete the prohibition-modification flag information set for the host resource file and the prohibition-modification flag information set for the resource attribute information of the specified type of resources contained in the host resource file, to obtain the updated host resource file; add inheritance relationship information in the plugin resource file that indicates that the plugin resource file inherits the updated host resource file, and inheritance relationship information that indicates that the resource attribute information of the specified type of resources in the plugin resource file inherits the resource attribute information of the specified type of resources in the updated host resource file, to obtain the updated plugin resource file.

[0231] In one embodiment of this application, based on the foregoing solution, when the plug-in program includes multiple plug-in programs, the device further includes:

[0232] The plugin determination module is configured to determine the calling plugin program and the called plugin program corresponding to the calling plugin program from multiple plugin programs.

[0233] The plugin file update module is configured to update the authorization information of the called plugin resource file corresponding to the called plugin program to the called plugin resource file corresponding to the calling plugin program, so as to obtain the updated called plugin resource file.

[0234] The plugin invocation module is configured to control the invocation plugin program to access the called plugin resource file based on the authorization information of the called plugin resource file contained in the updated invocation plugin resource file, and to invoke the corresponding resources of the called plugin program based on the resource attribute information contained in the called plugin resource file.

[0235] In one embodiment of this application, based on the foregoing scheme, the plugin file update module includes:

[0236] The information deletion module is configured to delete the "prohibit modification" flag set for the resource file of the called plugin, and obtain the updated resource file of the called plugin.

[0237] The plugin file update submodule is configured to add inheritance information to the calling plugin resource file, indicating that the calling plugin resource file inherits the updated called plugin resource file, so as to obtain the updated calling plugin resource file and enable the updated calling plugin resource file to have the permission to access the updated called plugin resource file.

[0238] In one embodiment of this application, based on the aforementioned scheme, when a plugin program contains multiple plugin programs, the plugin file update submodule is configured as follows: if there are multiple called plugin resource files, the order of the multiple called plugin resource files is obtained; for any called plugin resource file other than the first called plugin resource file, inheritance relationship information indicating that any called plugin resource file inherits from the previous called plugin resource file is added to any called plugin resource file; and inheritance relationship information indicating that the calling plugin resource file inherits from the last called plugin resource file is added to the calling plugin resource file.

[0239] In one embodiment of this application, based on the aforementioned scheme, the host update module is specifically configured to: delete the prohibited modification identifier information set for the host resource file; convert the host resource file after the prohibited modification identifier information has been deleted into a resource file of a specified format to obtain the updated host resource file.

[0240] In one embodiment of this application, based on the foregoing scheme, the host update module is configured to: intercept the resource update task corresponding to the host program through a specified subroutine contained in the host program during the compilation process of the host program; obtain the host resource file corresponding to the host program, and delete the prohibited modification flag information set for the host resource file to obtain the updated host resource file, so that the resource update task performs resource update according to the updated host resource file.

[0241] It should be noted that the apparatus provided in the foregoing embodiments and the method provided in the foregoing embodiments belong to the same concept, and the specific way in which each module and unit performs operations has been described in detail in the method embodiments.

[0242] Embodiments of this application also provide an electronic device, including: one or more processors; and a memory for storing one or more computer programs, which, when executed by one or more processors, cause the electronic device to implement the aforementioned resource retrieval method.

[0243] Figure 22 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments.

[0244] It should be noted that, Figure 22 The computer system 2200 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0245] like Figure 22 As shown, the computer system 2200 includes a Central Processing Unit (CPU) 2201, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 2202 or programs loaded from storage portion 2208 into Random Access Memory (RAM) 2203. The RAM 2203 also stores various programs and data required for system operation. The CPU 2201, ROM 2202, and RAM 2203 are interconnected via a bus 2204. An Input / Output (I / O) interface 2205 is also connected to the bus 2204.

[0246] The following components are connected to I / O interface 2205: an input section 2206 including a keyboard, mouse, etc.; an output section 2207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 2208 including a hard disk, etc.; and a communication section 2209 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 2209 performs communication processing via a network such as the Internet. A drive 2210 is also connected to I / O interface 2205 as needed. Removable media 2211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 2210 as needed so that computer programs read from them can be installed into storage section 2208 as needed.

[0247] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 2209, and / or installed from removable medium 2211. When the computer program is executed by central processing unit (CPU) 2201, it performs various functions defined in the system of this application.

[0248] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. For example, a computer-readable medium can be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium that includes or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program included on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0249] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which includes one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0250] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0251] Another aspect of this application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the resource access method as described above. This computer-readable medium may be included in the electronic device described in the above embodiments, or it may exist independently and not incorporated into the electronic device.

[0252] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable medium. A processor of a computer device reads the computer instructions from the computer-readable medium and executes the computer instructions, causing the computer device to perform the resource invocation methods provided in the various embodiments described above.

[0253] The above description is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.

Claims

1. A resource invocation method, characterized in that, The method includes: Obtain the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program; wherein, the host program includes an Android application; the host resource file stores resource attribute information corresponding to the resources contained in the host program, and the plugin resource file stores resource attribute information corresponding to the resources contained in the plugin program; the resource attribute information includes a resource ID; The authorization information of the host resource file is updated to the plugin resource file to obtain the updated plugin resource file; The plugin program is controlled to access the host resource file according to the authorization information contained in the updated plugin resource file, and to call the resource corresponding to the host program according to the resource ID contained in the host resource file; The step of updating the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file includes: Delete the prohibited modification flag information set for the host resource file to obtain the updated host resource file; Add inheritance information to the plugin resource file to indicate that the plugin resource file inherits from the updated host resource file, thereby obtaining the updated plugin resource file, so that the updated plugin resource file has the permission to access the updated host resource file.

2. The method as described in claim 1, characterized in that, The resource attribute information includes a resource name and resource identifier information corresponding to the resource name, wherein the resource identifier information is the resource ID; updating the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file includes: The priority indication information and the authorization information of the host resource file are updated to the plugin resource file to obtain the updated plugin resource file; wherein, the priority indication information is used to indicate that if the updated plugin resource file and the host resource file contain the same resource name, the priority of the resource name in the updated plugin resource file is higher than the priority of the resource name in the host resource file.

3. The method as described in claim 2, characterized in that, The control of the plugin program to access the host resource file based on the authorization information contained in the updated plugin resource file, and to call the resource corresponding to the host program based on the resource ID contained in the host resource file, includes: Obtain the feature information of the resource to be called corresponding to the plugin program, and search for the resource name that matches the feature information in the updated plugin resource file according to the priority indication information contained in the updated plugin resource file; If no resource name matching the feature information is found in the updated plugin resource file, the host resource file is accessed according to the authorization information contained in the updated plugin resource file, and a resource name matching the feature information is searched in the host resource file. The resource corresponding to the host program is invoked based on the resource ID corresponding to the resource name found in the host resource file.

4. The method as described in claim 1, characterized in that, The host resource file and the plugin resource file each contain resource attribute information for various types of resources; updating the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file includes: The authorization information of the host resource file is updated to the plugin resource file, and the authorization information corresponding to the resource attribute information of the specified type of resource contained in the host resource file is updated to the resource attribute information of the specified type of resource contained in the plugin resource file, so as to obtain the updated plugin resource file.

5. The method as described in claim 4, characterized in that, The control of the plugin program to access the host resource file based on the authorization information contained in the updated plugin resource file, and to call the resource corresponding to the host program based on the resource ID contained in the host resource file, includes: The plugin program is controlled to access the host resource file based on the authorization information of the host resource file contained in the updated plugin resource file; Based on the authorization information of the resource attribute information of the specified type of resource in the host resource file contained in the updated plugin resource file, obtain the resource attribute information of the specified type of resource contained in the host resource file; The host program is invoked with the specified type of resource based on the resource ID contained in the obtained resource attribute information.

6. The method as described in claim 4, characterized in that, The step of updating the authorization information of the host resource file to the plugin resource file, and updating the authorization information corresponding to the resource attribute information of the specified type of resources contained in the host resource file to the resource attribute information of the specified type of resources contained in the plugin resource file, to obtain the updated plugin resource file, includes: Delete the prohibited modification flag information set for the host resource file and the prohibited modification flag information set for the resource attribute information of the specified type of resources contained in the host resource file to obtain the updated host resource file; Add inheritance relationship information to the plugin resource file, indicating that the plugin resource file inherits from the updated host resource file, and inheritance relationship information that indicates that the resource attribute information of a specified type of resource in the plugin resource file inherits from the resource attribute information of a specified type of resource in the updated host resource file, to obtain the updated plugin resource file.

7. The method as described in claim 1, characterized in that, The plug-in program includes multiple plug-in programs; the method further includes: Determine the calling plugin program and the called plugin program corresponding to the calling plugin program from the plurality of plugin programs; Update the authorization information of the called plugin resource file corresponding to the called plugin program to the called plugin resource file corresponding to the calling plugin program to obtain the updated called plugin resource file; The program controls the calling plugin to access the called plugin resource file based on the authorization information of the called plugin resource file contained in the updated calling plugin resource file, and to call the resources corresponding to the called plugin program based on the resource attribute information contained in the called plugin resource file.

8. The method as described in claim 7, characterized in that, The step of updating the authorization information of the called plugin resource file corresponding to the called plugin program to the called plugin resource file corresponding to the calling plugin program, to obtain the updated called plugin resource file, includes: Delete the "Do Not Modify" flag set for the called plugin resource file to obtain the updated called plugin resource file; Add inheritance relationship information to the calling plugin resource file to indicate that the calling plugin resource file inherits from the updated called plugin resource file, so as to obtain the updated calling plugin resource file and enable the updated calling plugin resource file to have the permission to access the updated called plugin resource file.

9. The method as described in claim 8, characterized in that, The step of adding inheritance relationship information indicating that the calling plugin resource file inherits from the updated called plugin resource file to the calling plugin resource file, to obtain the updated calling plugin resource file, includes: If there are multiple resource files of the called plugin, then obtain the order of the multiple resource files of the called plugin; For any of the multiple called plugin resource files other than the first called plugin resource file, add inheritance relationship information to the called plugin resource file that indicates that the called plugin resource file inherits from the previous called plugin resource file. Add information to the calling plugin resource file indicating the inheritance relationship of the calling plugin resource file, which inherits from the last called plugin resource file.

10. The method as described in claim 1, characterized in that, The step of deleting the prohibited modification flag information set for the host resource file to obtain the updated host resource file includes: Delete the "prohibit modification" flag set for the aforementioned host resource file; Convert the host resource file after deleting the prohibited identification information into a resource file of a specified format to obtain the updated host resource file.

11. The method as described in claim 1, characterized in that, The step of deleting the prohibited modification flag information set for the host resource file to obtain the updated host resource file includes: During the compilation of the host program, the resource update task corresponding to the host program is intercepted through a designated subroutine contained in the host program; The host resource file corresponding to the host program is obtained, and the prohibited modification flag information set for the host resource file is deleted to obtain the updated host resource file, so that the resource update task can perform resource update according to the updated host resource file.

12. A resource allocation device, characterized in that, The device includes: The acquisition module is configured to acquire the host resource file corresponding to the host program and the plugin resource file corresponding to the plugin program; wherein, the host program includes an Android application; the host resource file stores resource attribute information corresponding to the resources contained in the host program, and the plugin resource file stores resource attribute information corresponding to the resources contained in the plugin program; the resource attribute information includes a resource ID; The update module is configured to update the authorization information of the host resource file to the plugin resource file, thereby obtaining the updated plugin resource file; The calling module is configured to control the plugin program to access the host resource file based on the authorization information contained in the updated plugin resource file, and to call the resource corresponding to the host program based on the resource ID contained in the host resource file; The step of updating the authorization information of the host resource file to the plugin resource file to obtain the updated plugin resource file includes: Delete the prohibited modification flag information set for the host resource file to obtain the updated host resource file; Add inheritance information to the plugin resource file to indicate that the plugin resource file inherits from the updated host resource file, thereby obtaining the updated plugin resource file, so that the updated plugin resource file has the permission to access the updated host resource file.

13. An electronic device, characterized in that, include: One or more processors; A memory for storing one or more computer programs that, when executed by one or more processors, cause the electronic device to implement the resource access method as described in any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the processor of the electronic device, causes the electronic device to implement the resource retrieval method according to any one of claims 1-11.

15. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the resource retrieval method according to any one of claims 1-11.

Citation Information

Patent Citations

  • Method and system for controlling authority of plug-in unit

    CN101604371A

  • Plug-in resource searching method, device and equipment and readable storage medium

    CN111984343A