Patch file loading methods, devices, equipment, storage media and products
By automatically generating patch download links on the client side and determining the effectiveness rules locally, the issue of time-consuming patch file downloads and loading was resolved, enabling rapid repairs and improving client stability and user experience.
Patent Information
- Application Number
- CN202510639352.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, when client-side anomalies occur, the patch file download and loading process takes a long time, resulting in untimely repairs and affecting the normal use of the application.
The client automatically generates a download link for the patch package upon startup, including the patch file and activation rules. It then determines the activation rules locally and downloads and loads the patch file in advance to avoid waiting for a server response.
It improved the success rate of patch file downloads and client anomaly repair, reduced application crash rates, and enhanced user experience.
Smart Images

Figure CN123114568A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to patch file loading methods, apparatus, devices, storage media, and products. Background Technology
[0002] As mobile applications become increasingly complex, online versions may experience anomalies such as crashes, requiring fixes. Traditional fixes involve repackaging and releasing the Android application package (APK), going through app store reviews, and requiring manual updates from users—a time-consuming process that can cause problems to persist and affect the normal use of the application. Therefore, hotfix technology has emerged. This technology allows developers to dynamically fix client applications by distributing patch files without needing to re-release a new version of the APK, achieving seamless updates.
[0003] However, if the client-side error occurs early, the client may miss the opportunity to fix it because it has not had time to download and load the patch. Summary of the Invention
[0004] This disclosure provides a patch file loading method, apparatus, device, storage medium, and product, which can optimize existing patch file loading schemes.
[0005] In a first aspect, embodiments of this disclosure provide a patch file loading method, including:
[0006] In response to the startup of a preset client, a download link for a patch package is generated according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link for the patch package in advance based on the preset format.
[0007] Download the patch package using the provided download link;
[0008] In response to the preset client hitting the patch activation rule, the patch file is loaded.
[0009] Secondly, embodiments of this disclosure also provide a patch file loading device, including:
[0010] The download link generation module is used to generate a download link for a patch package in response to the startup of a preset client, according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link to the patch package in advance based on the preset format.
[0011] A patch download module is used to download the patch package based on the download link;
[0012] The patch file loading module is used to load the patch file in response to the preset client hitting the patch activation rule.
[0013] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:
[0014] One or more processors;
[0015] Storage device for storing one or more programs.
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the patch file loading method provided in the embodiments of this disclosure.
[0017] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the patch file loading method provided in embodiments of this disclosure.
[0018] Fifthly, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the patch file loading method provided in this disclosure.
[0019] The patch file loading scheme provided in this disclosure, in response to the startup of a preset client, generates a download link for a patch package according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client pre-generates a download link pointing to the patch package based on the preset format, downloads the patch package based on the download link, and loads the patch file in response to the preset client matching the patch activation rules. By adopting the above technical solution, after the client starts, it is not necessary for the server to determine whether the patch is effective for the client and then receive the download link for the patch package sent by the server if it is effective. Instead, the client generates its own download link according to the preset format used by the server when generating the download link for the patch package and downloads the patch package. The patch activation rules are determined locally, and the patch file is loaded. This effectively advances the timing of patch file download and improves the success rate of the client loading patch files. Attached Figure Description
[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0021] Figure 1A schematic flowchart illustrating a patch file loading method provided in an embodiment of this disclosure;
[0022] Figure 2 A flowchart illustrating another patch file loading method provided in this embodiment of the disclosure;
[0023] Figure 3 A flowchart illustrating another patch file loading method provided in this embodiment of the disclosure;
[0024] Figure 4 This is a schematic diagram of the structure of a patch file loading device provided in an embodiment of the present disclosure;
[0025] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0026] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0027] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0028] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0029] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0030] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0031] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0032] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0033] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, client, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0034] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0035] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0036] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0037] To facilitate understanding of the technical solutions of the embodiments of this disclosure, the relevant technologies are described below. In the relevant technologies, patch files may not be applicable to all clients. Therefore, patch activation rules need to be set. Clients that meet the patch activation rules can download the patch file. After the client starts, if an exception occurs, it needs to send a patch download request to the server. The patch download request needs to include data such as the account identifier (did). The server determines whether the client meets the patch activation rules based on the client's account identifier and other data. If it does, the server sends a download link for the patch file to the client, and the client downloads the patch file based on the download link. However, the interaction between the server and the client takes a certain amount of time, and for new users, the generation of the account identifier also takes a certain amount of time. For example, a prompt pop-up needs to be displayed first. After the new user enters an agreement operation based on the prompt pop-up, the account identifier needs to be generated. Only after the account identifier is generated can the account identifier and other data be reported to the server. Therefore, the client needs to wait a long time to obtain the download link for the patch file. For exceptions that occur early after the client starts, such as frequent crashes, it is difficult to download the patch file in time for repair.
[0038] In this embodiment of the disclosure, by having the client generate a download link to download the patch package and then determining the patch activation rules locally, the timing of patch package download can be advanced, thereby increasing the success rate of the client loading patch files.
[0039] Figure 1 This is a flowchart illustrating a patch file loading method provided in an embodiment of the present disclosure. This embodiment is applicable to the situation of patch file loading. The method can be executed by a patch file loading device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal such as a mobile phone, smartwatch, tablet computer, or personal digital assistant, or a personal computer (PC) or server.
[0040] like Figure 1 As shown, the method includes:
[0041] Step 101: In response to the startup of the preset client, a download link for the patch package is generated according to the preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link for the patch package in advance based on the preset format.
[0042] In this embodiment of the disclosure, the preset client can be any preset application installed in the electronic device. The specific type of the preset application is not limited, such as video application, instant messaging application, or information application.
[0043] For example, a preset client stores a pre-defined format for generating download links for patch packages, denoted as the preset format. The specific content of the preset format is not limited; it can include multiple components, including dynamically determined components such as the version information of the preset client, and pre-defined fixed components such as a preset domain name or a preset string. The preset domain name is a domain name pre-agreed with the server. After receiving the patch package uploaded by the developer, the server can generate a download link pointing to the patch package based on the preset format, waiting for clients to download the patch package.
[0044] For example, a patch package includes patch files and patch activation rules, and the storage format of the patch files and patch activation rules in the patch package is not limited.
[0045] For example, after detecting that the preset client has started, relevant information for generating the download link of the patch package is obtained, such as the version information and preset domain name mentioned above, and the corresponding download link is generated according to the preset format and the obtained relevant information.
[0046] Step 102: Download the patch package based on the download link.
[0047] For example, after generating a download link, the patch package is downloaded based on that link. Since the patch package includes patch files, compared to related technologies, there's no need to wait for the server to send the download link for the patch files, effectively advancing the download timing. After the patch package is successfully downloaded, the patch files and patch activation rules can be obtained by decompressing or parsing the package.
[0048] Step 103: In response to the preset client hitting the patch activation rule, load the patch file.
[0049] For example, after obtaining the patch activation rules from the patch package, the default client can determine locally whether it matches the patch activation rules. If it matches, it means that the patch file in the patch package is valid for the default client and can be loaded; the specific loading method is not limited. Optionally, if it does not match, the patch file can be ignored or the patch file and patch activation rules can be deleted.
[0050] The patch activation rules can include, for example, a percentage of applications that can be patched and a range of operating system version numbers. The percentage represents the proportion of clients that can apply the patch file among all clients of a pre-defined application. To verify the patch's effectiveness and avoid introducing new problems, a subset of clients can be initially allowed to apply the patch. Once the patch is confirmed to be effective, a wider range of clients can be gradually added to the application. Specifically, the percentage can be the proportion of clients currently able to apply the patch file among all clients of the pre-defined application. Different operating system versions may have compatibility issues when applying the patch file. Therefore, the patch activation rules can include a range of operating system version numbers, which can be represented by the minimum and maximum compatible operating system versions. Furthermore, the patch activation rules can also include other information such as whether to block the main thread and the type of patch removal (e.g., immediate removal or removal on the next cold boot).
[0051] For example, assuming the patch activation rule includes a release percentage and an operating system version number range, the default client can obtain the operating system version number of the electronic device and generate a random number, such as a random number between 0 and 100. This random number is used as an account identifier (which is simpler and faster than the account identifier generation method that relies on device information in related technologies). It is determined whether the random number is less than or equal to the release percentage. If it is less than or equal to the release percentage and the operating system version number is within the operating system version number range, it can be determined that the default client has hit the patch activation rule.
[0052] The patch file loading method provided in this disclosure, in response to the startup of a preset client, generates a download link for a patch package according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client pre-generates a download link pointing to the patch package based on the preset format, downloads the patch package based on the download link, and loads the patch file in response to the preset client matching the patch activation rules. By adopting the above technical solution, after the client starts, it is not necessary for the server to determine whether the patch is effective for the client and then receive the download link for the patch package sent by the server if it is effective. Instead, the client automatically generates a download link and downloads the patch package according to the preset format used by the server when generating the download link. The patch activation rules are determined locally, and the patch file is loaded. This effectively advances the timing of patch file download, improves the success rate of client patch file loading, and thus increases the success rate of client anomaly repair. This is especially effective for crashes or functional abnormalities encountered during the first installation of the client. It can also effectively repair repeated startup crashes encountered in scenarios where the client is not installed for the first time, reducing application crash rates and improving user experience.
[0053] In some embodiments, the step of generating a download link for the patch package according to a preset format in response to the startup of a preset client includes: obtaining the version information and / or operating environment of the preset client in response to the startup of the preset client; generating a download link for the patch package according to a preset format, based on a preset domain name and the version information and / or operating environment, wherein the preset domain name is a domain name pre-agreed with the server. This allows for quick and accurate generation of download links.
[0054] For example, the download link can be a Uniform Resource Locator (URL), with a default format of: {default domain name} / {default client version information} / {runtime environment} / patch, where the default domain name is a fixed URL domain name, the default client version information is the version number of the application that needs hotfixing, i.e., the application version number of the default client, the runtime environment can be a debug environment or a release environment, and patch means patch.
[0055] Figure 2 This is a flowchart illustrating another patch file loading method provided in this embodiment. This embodiment optimizes the various optional solutions in the above embodiments. Specifically, the method includes the following steps:
[0056] Step 201: In response to the startup of the preset client, obtain the version information and runtime environment of the preset client.
[0057] Step 202: Generate a download link for the patch package according to a preset format, based on a preset domain name, version information, and operating environment. The preset domain name is a domain name agreed upon with the server in advance. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link for the patch package in advance based on the preset format.
[0058] Optionally, the patch activation rules can be carried using a preset data type. Preset data types occupy less space than JSON data types, thus reducing the patch package size. In related technologies, patch activation rules are stored as JSON data types, containing key-value pairs, such as the key being the system version and the value being the specific version number, resulting in a large data volume. The preset data type can be, for example, Long, which can reduce the number of patch activation rules and effectively reduce the patch package size. For example, in a Long type patch activation rule, each bit is filled with 0 or 1. For instance, bits 0 to 1 are used to store the patch file's offline type, bits 2 to 8 are used to store the minimum compatible operating system version number, bits 9 to 15 are used to store the maximum compatible operating system version number, bits 16 to 22 are used to store the percentage of patch release, and bit 22 is used to store whether the main thread is blocked.
[0059] Step 203: Download the patch package from the download link.
[0060] Step 204: In response to the preset client hit patch activation rules, load the patch file.
[0061] Step 205: Determine the function identifier of the function to be repaired based on the loading results.
[0062] For example, instrumentation can be performed during application compilation to insert patch checking logic into each function of the original class (hereinafter referred to as the original function). This allows the original function to be called before execution to determine whether hotfix is needed. In other words, if a function with the same name and parameters as a certain original function exists in the patch file (hereinafter referred to as the patch function), the patch function will be executed first, bypassing the execution of the original function, thus achieving hotfix.
[0063] In related technologies, after the client pulls the patch, it marks the functions that need hotfix as requiring hotfix. Specifically, this is done by inserting a static variable in the class containing the function to mark whether the function in the current class needs hotfix. If hotfix is triggered too early, it will prematurely trigger the initialization of the class containing the function to be hotfixed. If there is business logic in the initialization of this class, it will cause the timing of business logic to be disordered, resulting in unpredictable problems. For example, the initialization of this class includes the initialization of business logic A, and the initialization of business logic A should be performed before the initialization of business logic B. However, due to the premature triggering of hotfix, if business logic B is not initialized, business logic A cannot be initialized. Or, if business logic A is initialized, it will cause timing disorder problems.
[0064] In this embodiment, because the patch download timing is advanced, that is, the repair of the function to be repaired is advanced to resolve the anomaly that occurred early in the startup of the preset client, the timing of hotfix is triggered earlier. However, the method described above, which involves inserting static variables into the class containing the function to mark whether the function in the current class needs hotfix, can lead to timing disorder and other problems. To solve this problem, this embodiment stores the functions that need hotfix and their corresponding tags. For example, a custom class, denoted as the preset class, can be added to store the hotfix tags. In this preset class, a mapping relationship such as a map can be used to store the functions that need hotfix and their corresponding tags. For example, the key in the mapping relationship represents the function identifier, and the value represents the function's repair tag (also called the hotfix tag).
[0065] In this step, after loading the patch file, the patch functions contained in the patch file can be identified as the functions that need to be repaired, i.e., the functions to be repaired. The function identifier of the function to be repaired can be obtained, such as the function number.
[0066] Step 206: Storing the mapping relationship between function identifiers and repair tags.
[0067] For example, in the preset class, the mapping relationship between function identifiers and repair tags is stored in such a way that the key is the function identifier and the value is the repair tag.
[0068] Step 207: In response to the first function being called, read the mapping relationship.
[0069] For example, the mapping relationship is read by calling a preset class. The first function can be any function (original function) currently being called in the preset client. When the first function is called, the method of reading the value of static variables in the prior art is modified to read the mapping relationship, for example, by calling the preset class to read the mapping relationship.
[0070] Step 208: In response to the existence of a repair flag corresponding to the first function in the mapping relationship, execute the second function in the patch file that has the same function name as the first function.
[0071] For example, if the mapping relationship contains a function identifier for the first function and a corresponding repair marker, it means that the patch file contains a corresponding patch function. Therefore, the second function (patcher function) with the same function name as the first function in the patch file is executed to achieve hot repair of the preset client.
[0072] The patch file loading method provided in this embodiment allows the client to automatically generate a download link and load the patch file according to the preset format used by the server when generating the download link to the patch package. This effectively advances the download timing of the patch file, improving the success rate of the client loading the patch file. After loading the patch file, a mapping relationship between the function identifier and the repair marker of the function to be repaired is stored in a preset class. When a function is called, the mapping relationship is queried to determine whether it needs to be replaced by the patch function in the patch file for repair. Compared with the prior art method of inserting static variables in the class where the function is located to mark whether the function of the current class needs hot repair, this method can avoid the problem of business logic timing disorder and improve the stability of client operation.
[0073] In related technologies, the patch file loading process typically includes decompressing to memory, verifying the patch file, and optimizing the patch file. Taking the Android operating system as an example, patch files include DEX files. DEX is an executable file format on the Android platform used to store the bytecode of Android applications. The patch file loading process may include decompressing the DEX, verifying the DEX, and optimizing with dexopt. All three steps increase the loading time of the patch file.
[0074] In this embodiment of the disclosure, at least one of the above three steps can be optimized to further improve the loading speed of the patch file.
[0075] In some embodiments, the patch file is an uncompressed file aligned to a preset byte number; wherein loading the patch file includes: in response to the patch file being an uncompressed file aligned to a preset byte number, mapping the patch file to memory; and loading the patch file from the memory. Thus, by avoiding compression of the patch file and adjusting its storage method, the patch file can be directly mapped to memory without decompression, improving patch loading speed.
[0076] In some embodiments, before loading the patch file, the method further includes: obtaining the function symbol of a preset function inside the virtual machine from a dynamic link library file; calling the preset function based on the function symbol to set the parameter value of a preset parameter to a target value, wherein the preset parameter is used to indicate whether to verify the patch file; loading the patch file includes: storing the patch file in memory, disabling verification of the patch file in response to the parameter value of the preset parameter being the target value, and loading the patch file from the memory. Thus, by modifying the parameter value of the preset parameter, verification of the patch file is disabled, further reducing loading time.
[0077] In some embodiments, loading the patch file includes: storing the patch file in memory, and loading the patch file from memory based on a preset loading function to avoid optimizing the patch file in a preset manner. Thus, by modifying the loading method of loading the patch file from memory, optimization of the patch file in a preset manner is avoided, further reducing loading time.
[0078] Figure 3 This is a flowchart illustrating another patch file loading method provided in this embodiment. This embodiment optimizes the various optional solutions in the above embodiments. Specifically, the method includes the following steps:
[0079] Step 301: In response to the startup of the preset client, obtain the version information and runtime environment of the preset client.
[0080] Step 302: Generate a download link for the patch package according to the preset format, based on the preset domain name, version information, and operating environment. The patch package includes patch files and patch activation rules.
[0081] When developers determine that a hotfix is needed, they can write the code corresponding to the patch file to obtain the patch file. They then package the patch file and the patch activation rules into a patch package and upload it to a Content Delivery Network (CDN) node on the server side for download by the pre-defined clients. The patch file is an uncompressed file aligned to a pre-defined byte count, such as 4 bytes. If a compressed initial patch file has already been generated according to the standard process, the DEX file it contains can be decompressed, and the decompression result can be regenerated into a 4-byte aligned file and re-signed to obtain the patch file in the patch package. This avoids the need to decompress the DEX file into memory during the loading process.
[0082] Step 303: Download the patch package based on the download link.
[0083] Step 304: In response to the preset client hit patch activation rule, obtain the function symbols of the preset functions inside the virtual machine from the dynamic link library file.
[0084] For example, the dynamic link library file can be libart.so, and the default function can be the Runtime::DisableVerifier() function. This function is an internal function of the virtual machine and does not provide an interface to directly call the function. In this embodiment of the disclosure, the symbol of the function can be obtained from libart.so first, so as to realize the subsequent call to the function.
[0085] Step 305: Call a preset function based on function symbol to set the parameter value of the preset parameter to the target value. The preset parameter is used to indicate whether to verify the patch file.
[0086] For example, the preset parameter is used to indicate whether to verify the patch file. It can be obtained from `Runtime::Current()->IsVerificationEnabled()`. If the preset parameter value is `true`, verification is required; if the parameter value is `false`, verification is not required, i.e., the target value is `false`. Before loading the patch file, the preset function is called automatically using function notation to set the preset parameter value to the target value, thereby skipping the verification step.
[0087] Step 306: In response to the patch file being an uncompressed file aligned to a preset byte number, map the patch file into memory.
[0088] For example, if it is determined that the patch file is not compressed and is 4-byte aligned, the patch file is directly mapped into memory.
[0089] Step 307: Load the patch file from memory based on the preset loading function to avoid optimizing the patch file in a preset way.
[0090] In related technologies, the DexClassLoader function (class loader) is used for loading, which triggers the system behavior of dex2oat during loading, which is an optimization of the default method.
[0091] In this embodiment of the disclosure, for example, different preset loading functions can be selected for different operating system versions. For instance, taking the Android operating system as an example, versions below 8.0 can use the PathClassLoader function (a function used to load DEX files in the APK installation package when installing an application) to load DEX files, while versions 8.0 and above can use the InMemoryDexClassLoader function (a function used to load DEX bytecode from a memory buffer, such as loading data streams sent by the server) to directly load DEX files in memory. This eliminates the need to automatically trigger the dex2oat system behavior when loading DEX, reducing loading time.
[0092] Step 308: Determine the function identifier of the function to be repaired based on the loading result, and store the mapping relationship between the function identifier and the repair mark in a preset class.
[0093] Step 309: In response to the first function being called, read the mapping relationship by calling the preset class.
[0094] Step 310: In response to the existence of a repair flag corresponding to the first function in the mapping relationship, execute the second function in the patch file that has the same function name as the first function.
[0095] The patch file loading method provided in this disclosure allows the client to automatically generate a download link and load the patch file according to the preset format used by the server when generating the download link to the patch package. This effectively advances the download timing of the patch file, improving the success rate of the client loading the patch file. The decompression, verification, and loading from memory stages in the patch loading process have all been optimized, effectively shortening the loading time of the patch file and further improving the success rate of anomaly repair. After loading the patch file, a mapping relationship between the function identifier and the repair marker of the function to be repaired is stored in a preset class. When a function is called, the mapping relationship is queried to determine whether it needs to be replaced by the patch function in the patch file for repair. Compared with the prior art of inserting static variables in the class where the function is located to mark whether the function of the current class needs hot repair, this method can avoid the problem of business logic timing disorder and improve the stability of client operation.
[0096] Figure 4 This is a schematic diagram of the structure of a patch file loading device provided in an embodiment of the present disclosure, as shown below. Figure 4 As shown, the device includes:
[0097] The download link generation module 401 is used to generate a download link for a patch package in response to the startup of a preset client, according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link to the patch package in advance based on the preset format.
[0098] Patch download module 402 is used to download the patch package based on the download link;
[0099] The patch file loading module 403 is used to load the patch file in response to the preset client hitting the patch activation rule.
[0100] The patch file loading device provided in this embodiment, in response to the startup of a preset client, generates a download link for a patch package according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client pre-generates a download link pointing to the patch package based on the preset format, downloads the patch package based on the download link, and loads the patch file in response to the preset client matching the patch activation rules. By adopting the above technical solution, after the client starts, it is not necessary for the server to determine whether the patch is effective for the client and then receive the download link for the patch package sent by the server if it is effective. Instead, the client generates its own download link according to the preset format used by the server when generating the download link for the patch package and downloads the patch package. The patch activation rules are determined locally, and the patch file is loaded. This effectively advances the download timing of the patch file and improves the success rate of the client loading the patch file.
[0101] Optionally, the download link generation module includes:
[0102] The information acquisition unit is used to acquire the version information and / or operating environment of the preset client in response to the startup of the preset client;
[0103] The download link generation unit is used to generate a download link for the patch package according to a preset format, based on a preset domain name, and the version information and / or operating environment, wherein the preset domain name is a domain name agreed upon in advance with the server.
[0104] Optionally, after loading the patch file in response to the preset client hitting the patch activation rule, the method further includes:
[0105] The identifier determination module is used to determine the function identifier of the function to be repaired based on the loading result;
[0106] A mapping relationship storage module is used to store the mapping relationship between the function identifier and the repair marker;
[0107] A mapping relationship reading module is used to read the mapping relationship in response to the first function being called;
[0108] The function execution module is used to execute a second function in the patch file that has the same function name as the first function in response to the existence of a repair flag corresponding to the first function in the mapping relationship.
[0109] Optionally, the patch file is an uncompressed file aligned to a preset byte count;
[0110] The patch file loading module includes:
[0111] A mapping unit is configured to map the patch file into memory in response to the patch file being an uncompressed file aligned to a preset number of bytes.
[0112] A loading unit is used to load the patch file from the memory.
[0113] Optionally, the device may also include:
[0114] The symbol acquisition module, before loading the patch file, further includes: acquiring function symbols of preset functions inside the virtual machine from the dynamic link library file;
[0115] The target value setting module is used to call the preset function based on the function symbol to set the parameter value of the preset parameter as the target value, wherein the preset parameter is used to indicate whether the patch file is verified;
[0116] The verification prohibition module is used to prohibit the verification of the patch file after the patch file is mapped into memory, in response to the parameter value of the preset parameter being the target value.
[0117] Optionally, the loading unit is used to: load the patch file from memory based on a preset loading function, so as to avoid optimizing the patch file in a preset manner.
[0118] The patch file loading device provided in this disclosure can execute the patch file loading method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.
[0119] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.
[0120] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 5 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 5 The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0121] like Figure 5 As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.
[0122] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0123] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.
[0124] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0125] The electronic device provided in this embodiment and the patch file loading method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0126] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the patch file loading method provided in the above embodiments.
[0127] This disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the patch file loading method provided in the above embodiments.
[0128] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage 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 or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0129] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0130] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0131] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: generate a download link for a patch package according to a preset format in response to the startup of a preset client, wherein the patch package includes a patch file and patch activation rules, and the server corresponding to the preset client pre-generates a download link pointing to the patch package based on the preset format; download the patch package based on the download link; and load the patch file in response to the preset client matching the patch activation rules.
[0132] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0133] 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 disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing 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, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, 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.
[0134] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a module does not necessarily limit the module itself; for example, a patch download module can also be described as "a module that downloads the patch package based on the download link".
[0135] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0136] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0137] According to one or more embodiments of this disclosure, a patch file loading method is provided, comprising:
[0138] In response to the startup of a preset client, a download link for a patch package is generated according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link for the patch package in advance based on the preset format.
[0139] Download the patch package using the provided download link;
[0140] In response to the preset client hitting the patch activation rule, the patch file is loaded.
[0141] According to one or more embodiments of this disclosure, the step of generating a download link for a patch package in a preset format in response to a preset client startup includes:
[0142] In response to the startup of a preset client, obtain the version information and / or runtime environment of the preset client;
[0143] According to a preset format, a download link for the patch package is generated based on a preset domain name, the version information, and / or the operating environment. The preset domain name is a domain name agreed upon with the server in advance.
[0144] According to one or more embodiments of this disclosure, after loading the patch file in response to the preset client hitting the patch activation rule, the method further includes:
[0145] The function identifier of the function to be repaired is determined based on the loading results;
[0146] Store the mapping relationship between the function identifier and the repair marker;
[0147] In response to the invocation of the first function, the mapping relationship is read;
[0148] In response to the existence of a repair flag corresponding to the first function in the mapping relationship, the second function with the same function name as the first function in the patch file is executed.
[0149] According to one or more embodiments of this disclosure, the patch file is an uncompressed file aligned to a preset byte number;
[0150] The loading of the patch file includes:
[0151] In response to the patch file being an uncompressed file aligned to a preset byte number, the patch file is mapped into memory;
[0152] Load the patch file from the memory.
[0153] According to one or more embodiments of this disclosure, before loading the patch file, the method further includes:
[0154] Retrieve function symbols for pre-defined functions within the virtual machine from dynamic link library files;
[0155] The preset function is called based on the function symbol to set the parameter value of the preset parameter to the target value, wherein the preset parameter is used to indicate whether the patch file is verified;
[0156] After mapping the patch file into memory, the process also includes:
[0157] In response to the preset parameter value being the target value, verification of the patch file is prohibited.
[0158] According to one or more embodiments of this disclosure, loading the patch file from the memory includes:
[0159] The patch file is loaded from memory based on a preset loading function to avoid optimizing the patch file in a preset manner.
[0160] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0161] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0162] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for loading patch files, characterized in that, include: In response to the startup of a preset client, a download link for a patch package is generated according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link for the patch package in advance based on the preset format. Download the patch package using the provided download link; In response to the preset client hitting the patch activation rule, the patch file is loaded.
2. The method according to claim 1, characterized in that, The response to the preset client startup, generating a download link for the patch package according to a preset format, includes: In response to the startup of a preset client, obtain the version information and / or runtime environment of the preset client; According to a preset format, a download link for the patch package is generated based on a preset domain name, the version information, and / or the operating environment. The preset domain name is a domain name agreed upon with the server in advance.
3. The method according to claim 1, characterized in that, After loading the patch file in response to the preset client hitting the patch activation rule, the method further includes: The function identifier of the function to be repaired is determined based on the loading results; Store the mapping relationship between the function identifier and the repair marker; In response to the invocation of the first function, the mapping relationship is read; In response to the existence of a repair flag corresponding to the first function in the mapping relationship, the second function with the same function name as the first function in the patch file is executed.
4. The method according to claim 1, characterized in that, The patch file is an uncompressed file aligned to a preset byte count; The loading of the patch file includes: In response to the patch file being an uncompressed file aligned to a preset byte number, the patch file is mapped into memory; Load the patch file from the memory.
5. The method according to claim 4, characterized in that, Before loading the patch file, the following is also included: Retrieve function symbols for pre-defined functions within the virtual machine from dynamic link library files; The preset function is called based on the function symbol to set the parameter value of the preset parameter to the target value, wherein the preset parameter is used to indicate whether the patch file is verified; After mapping the patch file into memory, the process also includes: In response to the preset parameter value being the target value, verification of the patch file is prohibited.
6. The method according to claim 4, characterized in that, Loading the patch file from the memory includes: The patch file is loaded from memory based on a preset loading function to avoid optimizing the patch file in a preset manner.
7. A patch file loading device, characterized in that, include: The download link generation module is used to generate a download link for a patch package in response to the startup of a preset client, according to a preset format. The patch package includes patch files and patch activation rules. The server corresponding to the preset client generates a download link to the patch package in advance based on the preset format. A patch download module is used to download the patch package based on the download link; The patch file loading module is used to load the patch file in response to the preset client hitting the patch activation rule.
8. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the patch file loading method as described in any one of claims 1-6.
9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the patch file loading method as described in any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the patch file loading method as described in any one of claims 1-6.
