A client updating method and device, electronic equipment and computer storage medium

By using a compatibility check file to detect the compatibility between the dynamically installed files and the host application during the client upgrade process, the problem of abnormal client upgrades was resolved, improving upgrade stability and user experience.

CN114791821BActive Publication Date: 2026-05-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-01-25
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

During the client upgrade process, the client malfunctions due to mismatches between some classes or interfaces in the host file that the dynamically installed file depends on. This results in a poor user experience.

Method used

When distributing the dynamic installation file, a matching detection file is provided simultaneously. The detection program generates a set of target objects based on the host application to ensure that the dynamic installation file matches the host application before the upgrade is performed.

Benefits of technology

This avoids abnormal client operation caused by incompatibility between the host application and the dynamically installed files, thus improving the stability of client upgrades and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114791821B_ABST
    Figure CN114791821B_ABST
Patent Text Reader

Abstract

The application provides a client updating method and device, electronic equipment and computer storage medium, and relates to the technical field of clouds. In the application, a dynamic installation file used for updating a client is acquired, and a matching degree detection file corresponding to the dynamic installation file is acquired; the matching degree detection file contains a detection program, the detection program is generated according to a target object set relied on by the dynamic installation file when running, and the target object set includes objects in a host application of at least one client; the detection program in the matching degree detection file is run; when the detection program normally runs, it is determined that the dynamic installation file matches the host application, and the dynamic installation file is run to update the client. According to the application, after it is determined that the dynamic installation file sent to the client by the client matches the host application of the client, the dynamic installation file is run to upgrade the client, so that the situation that the client abnormally runs due to the fact that the host application does not match the dynamic installation file can be avoided.
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 in particular to a client update method, apparatus, electronic device, and computer storage medium. Background Technology

[0002] With the continuous development of computer and communication technologies, smart terminal applications have spread to many fields; various types of clients can be installed and run on smart terminals to meet the diverse needs of users.

[0003] A client is software that corresponds to and works with a server to provide local services to users. Clients running on a terminal include basic operating system software and various application software, ensuring the terminal's operation and providing users with various network services, such as web browsing, email sending and receiving, and instant messaging.

[0004] Due to the rapid development of communication technology, new operating systems and application software are constantly being released, requiring clients to continuously upgrade. When upgrading these clients, the server generates a dynamic installation file for the upgrade and distributes it to the client. During the upgrade, the dynamic installation file is run directly on the client's host file. However, since the dynamic installation file depends on certain classes or interfaces in the host file, this may cause client upgrade errors. Summary of the Invention

[0005] This application provides a client update method, apparatus, electronic device, and computer storage medium to avoid upgrade anomalies caused by the dynamic installation file depending on some classes or interfaces in the host file during the client upgrade process.

[0006] In a first aspect, embodiments of this application provide a client update method, including:

[0007] Obtain a dynamic installation file for updating the client, and obtain a matching degree detection file corresponding to the dynamic installation file; wherein, the matching degree detection file contains a detection program, which is generated based on a set of target objects that the dynamic installation file depends on at runtime, and the set of target objects includes at least one object in the host application of the client;

[0008] Run the detection program in the matching degree detection file;

[0009] When the detection program is confirmed to be running normally, it is determined that the dynamic installation file matches the host application, and the dynamic installation file is run to update the client.

[0010] Secondly, embodiments of this application provide a client update apparatus, including:

[0011] The acquisition unit is used to acquire a dynamic installation file for updating the client, and to acquire a matching degree detection file corresponding to the dynamic installation file; wherein, the matching degree detection file contains a detection program, which is generated based on a set of target objects that the dynamic installation file depends on at runtime, and the set of target objects includes at least one object in the host application of the client;

[0012] The processing unit is used to run the detection program in the matching degree detection file;

[0013] The update unit is configured to, when the detection program is running normally, determine that the dynamic installation file matches the host application, and run the dynamic installation file to update the client.

[0014] Thirdly, embodiments of this application provide an electronic device, including:

[0015] At least one processor; and

[0016] A memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the client update method provided in this application.

[0018] Fourthly, embodiments of this application provide a computer-readable medium storing computer-executable instructions for executing the client update method provided in this application.

[0019] The beneficial effects of this application are:

[0020] In this embodiment, when the server sends a dynamic installation file to the client, it simultaneously sends a matching detection file corresponding to the dynamic installation file. This matching detection file contains a detection program, which is generated based on the set of target objects in the host application that the dynamic installation file depends on when the host application runs the dynamic installation file. Before running the dynamic installation file, the host application runs the detection program in the matching detection file. If the detection program runs normally, it determines that the target objects that the dynamic installation file depends on during its operation match the client's host application. Therefore, it can be determined that the dynamic installation file sent to the client matches the client's host application. This ensures that the dynamic installation file can depend on the target objects contained in the client's host application during its operation. Based on this, when the client's host application runs the dynamic installation file to upgrade the client, it avoids abnormal client operation caused by incompatibility between the host application and the dynamic installation file. Attached Figure Description

[0021] Figure 1 A schematic diagram illustrating an optional client update application scenario provided in this application embodiment;

[0022] Figure 2 A flowchart illustrating a client update method provided in an embodiment of this application;

[0023] Figure 3 A flowchart for generating a matching degree detection file is provided as an embodiment of this application;

[0024] Figure 4 A flowchart of a class matching degree detection program and a method matching degree detection program provided in the embodiments of this application;

[0025] Figure 5 A flowchart of a client update provided in an embodiment of this application;

[0026] Figure 6 This is a schematic diagram of a client display interface provided in an embodiment of this application;

[0027] Figure 7 A client update flowchart illustrating the interaction between a client and a server is provided as an embodiment of this application.

[0028] Figure 8 This is a schematic diagram of the structure of a client update device provided in an embodiment of this application;

[0029] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0030] Figure 10This is a schematic diagram of the structure of a computing device provided in an embodiment of this application. Detailed Implementation

[0031] To enable those skilled in the art to better understand the technical solutions disclosed in this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0032] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0033] The following explains some of the terms that appear in the text:

[0034] 1. Client: This can refer to both software applications (APPs) and terminal devices. It has a visual interface that interacts with the user; it corresponds to a server and provides local services to the client. For software applications, except for some applications that run only locally, they are generally installed on ordinary client terminals and need to work in conjunction with the server. With the development of the Internet, commonly used applications include email clients for sending and receiving emails, and instant messaging clients. For these types of applications, corresponding servers and service programs on the network are required to provide services such as database services and configuration parameter services. Therefore, a specific communication connection needs to be established between the client terminal and the server to ensure the normal operation of the application.

[0035] 2. Server: It 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, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0036] 3. Host Application: Also known as a host program or host environment, this refers to the software environment in a computer environment on which the software depends for its existence. The environment is called the host, and the host is the runtime environment, which is the host program or host application. For example, ASP (Active Server Pages) needs to run on IIS (Internet Information Services), and IIS is the host program. The host environment (host program or host application) can be an operating system, server program, application program, etc.

[0037] 4. Class: A class is a programming term; it's the foundation for information encapsulation in Object-Oriented Programming (OOP). A class is a user-defined reference data type, also called a class type. Each class contains data descriptions and a set of functions for manipulating data or passing messages; internally, a class encapsulates attributes and methods for manipulating its own members. Instances of a class are called objects, which are definitions of a certain type of object, possessing behavior. This behavior describes what an object can do and the methods it can use; these are the programs and procedures that can manipulate the object; they contain information about the object's behavior, such as its name, attributes, methods, and events.

[0038] 5. .class file: The full name of the .class file is Java class file, also known as a compiled file or class file. Its main function is to make Java more suitable for networks in terms of platform independence and network mobility. Its task in platform independence is to provide Java programs with binary services independent of the underlying host platform. The .class file breaks with the tradition followed by languages ​​such as C or C++, where programs written in these traditional languages ​​are usually first compiled and then linked into separate binary files specifically designed to support particular hardware platforms and operating systems.

[0039] 6. Class object: also known as class object; in Java, each class has a corresponding class object; that is, when writing a class, after compilation, a class object will be generated in the generated .class file to represent the type information of the class.

[0040] 7. Interface: A software class interface is a reference type that defines a contract. Other types implement the interface to ensure that they support certain operations. An interface specifies members that must be provided by a class or other interfaces that implement it. Similar to a class, an interface can contain methods, properties, indexers, and events as members.

[0041] 8. Methods: In software development, some code may need to be used in multiple places, meaning the same code needs to be written in different locations, resulting in code duplication. To solve this problem, the code that needs to be called in multiple places can be encapsulated into a method. Then, the method can be called directly where needed, avoiding rewriting the code. Furthermore, to accomplish complex functions, the complex functionality can be modularized, with each method performing a specific function. Finally, these individual methods are called to complete the complex operation. This facilitates code maintenance. A method is essentially a combination of code blocks that perform a specific function.

[0042] 9. Terminal equipment: Also known as user equipment (UE), mobile station (MS), mobile terminal (MT), etc., it is a device that provides voice and / or data connectivity to users. Examples include handheld devices with wireless connectivity and in-vehicle devices. Currently, some examples of terminals include: mobile phones, tablets, laptops, PDAs, and mobile internet devices (MIDs).

[0043] The design concept of the embodiments of this application is briefly introduced below:

[0044] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.

[0045] Cloud technology is a collective term for network technology, information technology, integration technology, management platform technology, and application technology applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.

[0046] Cloud security refers to the collective term for security software, hardware, users, organizations, and security cloud platforms based on cloud computing business models. Cloud security integrates emerging technologies and concepts such as parallel processing, grid computing, and the identification of unknown virus behavior. Through a large network of clients, it monitors abnormal software behavior on the network, obtains the latest information on Trojans and malware on the internet, sends it to the server for automatic analysis and processing, and then distributes solutions for viruses and Trojans to each client.

[0047] The main research directions in cloud security include: 1. Cloud computing security, which mainly studies how to ensure the security of the cloud itself and various applications on the cloud, including cloud computer system security, secure storage and isolation of user data, user access authentication, information transmission security, network attack protection, and compliance auditing; 2. Cloudification of security infrastructure, which mainly studies how to use cloud computing to build and integrate security infrastructure resources and optimize security protection mechanisms, including building a large-scale security event and information collection and processing platform through cloud computing technology to achieve the collection and correlation analysis of massive amounts of information and improve the ability to control network-wide security events and risks; 3. Cloud security services, which mainly studies various security services provided to users based on cloud computing platforms, such as antivirus services.

[0048] As the number of client applications installed on terminal devices increases and the functionality of each client is constantly updated, client updates are frequently required after installation. A common approach to client updates involves technicians compiling a dynamic installation file for the update using a compiler and uploading it to a server. When a user launches the client, one option is for the server to send an update notification message. If the user confirms the upgrade, the server retrieves the dynamic installation file for the client upgrade, and the client's host application runs this file to upgrade the client's functionality. Another option is for the server to send the updated dynamic installation file to the client after confirming its availability. When the user confirms the update, the client's host application directly runs the dynamic installation file to upgrade the client's functionality. However, because the dynamic installation file depends on certain classes or interfaces in the host application, a mismatch between the dynamic installation file and the host application can cause the dynamic installation file to fail to obtain the required classes or interfaces, leading to a crash in the host application and client crashes. Furthermore, incompatibility between dynamically installed files and the client's host application is quite common. For example, errors in the backend matching code logic, incomplete backend matching rules, or communication network issues during the server-to-client distribution process can all lead to incorrect dynamically installed files being sent from the server to the client, resulting in a mismatch between the dynamically installed files and the client's host application. In such cases, host application crashes and client crashes may occur during the client update process, leading to a poor user experience.

[0049] To address the aforementioned issues, this application proposes a client upgrade method. This method involves obtaining a dynamic installation file for updating the client, and a matching degree detection file corresponding to the dynamic installation file. The matching degree detection file contains a detection program generated based on a set of target objects that the dynamic installation file depends on during runtime. This set of target objects includes at least one object from the client's host application. The method then runs the detection program within the matching degree detection file. Upon confirming that the detection program is running normally, the method determines that the dynamic installation file matches the host application and runs the dynamic installation file to upgrade the client. In this embodiment of the application, when the server sends a dynamic installation file to the client, it also sends a matching degree detection file corresponding to the dynamic installation file. The matching degree detection file contains a detection program, which is generated based on the set of target objects in the host application that the dynamic installation file depends on when the host application runs the dynamic installation file. Before running the dynamic installation file, the host application first runs the detection program in the matching degree detection file. If the detection program runs normally, it is determined that the target objects that the dynamic installation file depends on during its operation match the host application of the client. Thus, it can be determined that the dynamic installation file sent by the client matches the host application of the client. In this way, it can be determined that during the operation of the dynamic installation file, the dynamic installation file can depend on the target objects contained in the host application of the client. Based on this, when the host application of the client runs the dynamic installation file to upgrade the client, it can avoid the situation where the client runs abnormally due to the mismatch between the host application and the dynamic installation file.

[0050] After introducing the design concept of the embodiments of this application, the following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application can be applied. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.

[0051] like Figure 1 As shown, it is a schematic diagram of an exemplary application scenario of this application embodiment, including user 10, terminal 11, and server 12; wherein, a client is installed on terminal 11.

[0052] It should be noted that the client in this embodiment can be any client on terminal 11, and the server 12 is the server corresponding to the client.

[0053] One possible application scenario is that when an update is needed for the client on terminal 11, a dynamic installation file for updating the client is generated; and a matching degree detection file is generated based on the set of target objects in the host application of the client that the dynamic installation file depends on at runtime; wherein the matching degree detection file contains a detection program. Server 12 stores the dynamic installation file for upgrading the client, and the matching degree detection file that matches the dynamic installation file.

[0054] One possible approach is for server 12 to push an update notification message to the client on terminal 11. After receiving an update confirmation message from the client, server 12 sends a dynamic installation file and a corresponding compatibility check file to the client. Alternatively, another possible approach is for server 12 to push a dynamic installation file and a corresponding compatibility check file to the client. After the user confirms the update through the client, the client is updated based on the dynamic installation file and the corresponding compatibility check file.

[0055] After obtaining the dynamic installation file and the corresponding matching detection file, the client runs the detection program in the matching detection file; when the detection program is confirmed to be running normally, it determines that the dynamic installation file matches the host application; and then runs the dynamic installation file to update the client.

[0056] In this application embodiment, the server can be a single server or a server cluster composed of multiple servers.

[0057] The following section, in conjunction with the application scenarios described above, provides reference... Figures 2-7 This application describes a client update method provided by exemplary embodiments. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way. Rather, the embodiments of this application can be applied to any applicable scenario.

[0058] like Figure 2 The diagram shown is a schematic flowchart of a client update method provided in an embodiment of this application. The method may include the following steps:

[0059] Step S201: Obtain the dynamic installation file used to update the client, and obtain the matching degree detection file corresponding to the dynamic installation file; wherein, the matching degree detection file contains a detection program, which is generated based on the target object set that the dynamic installation file depends on at runtime, and the target object set includes at least one object in the host application of the client.

[0060] Step S202: Run the detection program in the matching degree detection file;

[0061] Step S203: When the detection program is running normally, determine that the dynamic installation file matches the host application, and run the dynamic installation file to update the client.

[0062] In this embodiment, the dynamic installation file is used to update the client. Running the dynamic installation file on the client updates its functionality. When a client update is needed, it's not necessary to regenerate the complete client installation file; only the dynamic installation file is generated for the functions that need updating. For example, the dynamic installation file can be a client plugin, and its type can be APK, JAR, etc.

[0063] In this embodiment of the application, the client can obtain from the server a dynamic installation file for updating the client, and a matching degree detection file corresponding to the dynamic installation file;

[0064] It should be noted that after generating the dynamic installation file for updating the client, the dynamic installation file can be scanned by the compilation tool. At the same time, a matching degree detection file is generated, which contains the detection program.

[0065] The matching degree detection file contained in this application embodiment includes a detection program. After the dynamic installation file and the matching degree detection file are sent to the client, the client needs to run the detection program in the matching degree detection file before running the dynamic installation file. If the detection program can run normally, it is determined that the dynamic installation file matches the client's host application, and the dynamic installation file continues to run.

[0066] The detection program can be a predefined method; when the detection program is run, the predefined method can be called to execute the code program corresponding to the predefined method, in order to determine whether the dynamic installation file matches the host application of the client.

[0067] It should be noted that the predefined method can be a Java method; a Java method includes a method name, method body, modifiers, return type, and parameter types.

[0068] Among them, the method name is the actual name of the defined method. The method name and the parameter list together constitute the method signature.

[0069] Method body: The method body contains specific statements (or program code) that define the functionality that can be executed when the method is called;

[0070] Modifiers: Modifiers (optional components of a method) are used to instruct the compiler on how to call the method and define the method's access type;

[0071] Return value type (returnValueType): Some methods may return a value; this defines the data type of the method's return value. Additionally, some methods perform the required operations but do not return a value; in this case, the return value type is the keyword void.

[0072] Parameter type: A parameter in a method is a placeholder; when the method is called, a value is passed to the parameter, and this value is called an actual argument or variable; the parameter list refers to the parameter types, order, and number of parameters in the method; in addition, parameters in a method are optional, and a method may not contain any parameters.

[0073] The detection program in this application embodiment may include a class matching degree detection program and a method matching degree detection program; wherein, the class matching degree detection program is used to detect whether there is a missing mapping between the dynamically installed file and the class in the host application; the method matching degree detection program is used to detect whether the method signature of the dynamically installed file has been modified, or whether the methods corresponding to the abstract class or interface have been added, deleted, or modified.

[0074] When running the detection program, you can determine whether the program is running normally using the following methods:

[0075] Run the class matching test program and the method matching test program in the detection program;

[0076] If no class loading exception occurs when running the class matching degree detection program, and no method loading exception occurs when running the method matching degree detection program, then the detection program is considered to be running normally.

[0077] Otherwise, if a class loading exception occurs when running the class matching degree detection program, or a method loading exception occurs when running the method matching degree detection program, then it is determined that the detection program is not running normally.

[0078] The following details the process of generating the matching degree detection file in the embodiments of this application:

[0079] In this embodiment of the application, after generating the dynamic installation file, the set of target objects of the host application of the client that the dynamic installation file needs to run is determined;

[0080] In some embodiments, when determining the target object set, the code file of the dynamic installation file can be scanned and analyzed. For example, the import code area in the code file can be analyzed to obtain the target object set of the host application of the client that the dynamic installation file depends on at runtime.

[0081] The target objects in the target object set can be classes or interfaces.

[0082] After determining the set of target objects of the host application of the client that the dynamic installation file needs to depend on at runtime, the compilation data generated by the host application during compilation is intercepted; if the package name or class name of the compiled file in the compilation data is determined to be a file that the dynamic installation file depends on at runtime based on the target objects contained in the target object set, then the file that the dynamic installation file depends on at runtime is intercepted.

[0083] For example, the compilation data generated during the compilation of the host application can be multiple ".class" files (for ease of description, class files are used instead in the application file), and the compilation file can be a class file;

[0084] In some embodiments, the generated class file can be intercepted and processed through a transformation process to construct a class object.

[0085] After intercepting the compiled files that the dynamically installed file depends on at runtime, the type of the class object corresponding to the compiled file is determined. If the type of the class object is an abstract class or interface, the compiled file is not intercepted. If the type of the class object is a regular class, the compiled file corresponding to the regular class object is intercepted, and the methods of the intercepted compiled file are obtained. For each method, a test method with the same parameters as that method is constructed, and the constructed test method is inserted into the compiled file. A matching degree detection file is generated based on the intercepted compiled files.

[0086] The following is in conjunction with the appendix Figure 3 Taking the class file generated by the host application during compilation as an example, this application describes the process of generating a matching degree detection file in its embodiment.

[0087] The matching degree detection file is a Java file, for example, the matching degree detection file is CheckMatchDegree.java.

[0088] Step S301: Intercept and process the class files generated during the compilation of the host application through the Transform process, and construct class objects.

[0089] Step S302: Determine the classes that the dynamically installed file depends on at runtime;

[0090] Among them, the classes that the dynamically installed file depends on at runtime are the classes of the host application that it depends on.

[0091] For each class object constructed, execute steps S303 to S307 respectively:

[0092] Step S303: Determine whether the class object is a class that the dynamic installation file needs to depend on at runtime; if yes, proceed to step S304; if no, proceed to step S305.

[0093] Step S304: Determine whether the type of the class object is an abstract class or an interface; if yes, proceed to step S306; if no, proceed to step S305.

[0094] Step S305: Obtain the next class object.

[0095] Step S306: Obtain all member methods of the class file corresponding to the object of this class, and construct a test method with the same parameters as the method;

[0096] For example, if the member methods of the class file include method a, method b, and method c, then the following methods are constructed: aTest (with the same parameter as method a), bTest (with the same parameter as method b), and cTest (with the same parameter as method c); wherein the implementations of aTest, bTest, and cTest are empty implementations.

[0097] Step S307: Insert the test methods corresponding to all the constructed member methods into the corresponding class files;

[0098] In practice, you can use javasist to manipulate class files and insert the constructed test methods into the class files.

[0099] Step S308: Generate a matching degree detection file based on each class file.

[0100] After generating the matching degree detection file, this application embodiment also needs to generate the class matching degree detection program and the method matching degree detection program contained in the matching degree detection file; the process of generating the class matching degree detection program and the method matching degree detection program in this application embodiment is described in detail below:

[0101] After obtaining the dynamic installation file, determine the set of target objects of the host application of the client that the dynamic installation file depends on at runtime;

[0102] In some embodiments, when determining the target object set, the code file of the dynamic installation file can be scanned and analyzed. For example, the import code area in the code file can be analyzed to obtain the target object set of the host application of the client that the dynamic installation file depends on at runtime.

[0103] The target objects in the target object set can be classes or interfaces.

[0104] After obtaining the target object set, determine the package name path and name information corresponding to each target object in the target object set;

[0105] For example, when the target object is a class, the name information is the class name; when the target object is an interface, the name information is the interface name.

[0106] After obtaining the package name path and name information corresponding to each target object in the target object set, on the one hand, it iterates through the package name path and name information corresponding to each target object, concatenates them into obfuscation rules according to the preset first rule, and stores them;

[0107] It should be noted that generating and storing obfuscation rules is used to ensure that the target objects that the dynamic installation file depends on are not obfuscated when packaging the code of the host application and the code files of the dynamic installation file into an APK file.

[0108] In addition, the package name path and name information corresponding to each target object in the target object set are concatenated into first code data according to the preset second rule; a class matching degree detection program is generated based on the obtained first code data;

[0109] In some embodiments, the preset second rule can be the execution order of each target object in the target object set in the host application. Then, according to the execution order of each target object in the target object set in the host application, the package name path and name information corresponding to each target object are concatenated into the first code data.

[0110] The first code data can be a test code block;

[0111] When generating a class matching degree detection program based on the obtained first code data, the first code data can be written into a predefined class matching degree detection program; for example, if the matching degree detection file is CheckMatchDegree.java and the predefined class matching degree detection program is the checkClassDegree method, then the concatenated first code data is written into the checkClassDegree method of CheckMatchDegree.java.

[0112] In this embodiment of the application, after generating the class matching degree detection program, it is also necessary to generate the method matching degree detection program in the matching degree detection file.

[0113] One possible implementation involves obtaining the compilation files corresponding to each target object in the target object set from the compilation data corresponding to the host application; generating sub-code data corresponding to each compilation file based on the method code data contained in each compilation file; combining the sub-code data corresponding to each compilation file into second code data; and generating a method matching degree detection program based on the obtained second code data.

[0114] In some embodiments, the compilation files corresponding to each target object in the target object set are obtained from the compilation data corresponding to the host application, and the compilation files corresponding to each target object are copied to a temporary directory to generate a jar package that the dynamic installation file depends on the host application.

[0115] When generating sub-code data for each compiled file based on the method code data contained in each compiled file, the method of generating sub-code data for each compiled file will be different if the types of class objects corresponding to the compiled files are different.

[0116] In this embodiment of the application, after generating the jar package that the host application depends on in the dynamic installation file, the various compilation files are modified based on the Gradle Transform process to construct the class objects corresponding to each compilation file.

[0117] In practice, the JAR package can be imported into the defined verification project for compilation. The Gradle Transform process is used to modify the class files compiled from the JAR package, thereby constructing the class objects corresponding to each compiled file.

[0118] After constructing the class objects corresponding to each compiled file, the type of each class object is determined;

[0119] Among them, the types of class objects include abstract classes, interfaces, and ordinary classes;

[0120] It should be noted that when a class object is neither an abstract class nor an interface, the type of the class object can be determined to be a regular class.

[0121] For example, if the compiled files are class files, the isInterface() method can be used to obtain the contents of each class file and determine whether the contents of the class file are classes or interfaces; if it is determined that the contents of the class file are classes, then it can be further determined whether they are abstract classes.

[0122] 1. The class object corresponding to the compiled file is an abstract class object or an interface;

[0123] When determining the sub-code data corresponding to the compiled file, the method code data contained in the compiled file is obtained, and the method code data contained in the compiled file is updated through an anonymous inner class to obtain the sub-code data corresponding to the compiled file.

[0124] It should be noted that if the compiled file is a class file, and the class object corresponding to the class file is an abstract class or interface, then the methods of the abstract class or interface are overridden through the implementation methods of the anonymous inner class, thereby generating sub-code data; the generated sub-code data can be test code blocks.

[0125] 2. The class object corresponding to the compiled file is a regular class;

[0126] When determining the sub-code data corresponding to the compiled file, a test method with the same parameters as the method code data is constructed based on the method code data contained in the compiled file, and sub-code data that calls the test method is generated.

[0127] In practice, the compiled file is a class file, which obtains all methods from the class file of a regular class, such as all public interface methods; and constructs a test method with the same parameters as the methods.

[0128] For example, if a class file contains methods a, b, and c, then the constructor will obtain a method similar to method a.

[0129] The class has three methods: aTest (with the same parameter as method b), bTest (with the same parameter as method c), and cTest (with the same parameter as method c). The implementations of aTest, bTest, and cTest are empty.

[0130] When the sub-code data corresponding to each compiled file is obtained, the sub-code data corresponding to all compiled files is combined into a code block and written into the predefined method matching degree detection program; for example, if the matching degree detection file is CheckMatchDegree.java and the predefined method matching degree detection program is the checkMethodDegree method, then the concatenated second code data is written into the checkMethodDegree method of CheckMatchDegree.java.

[0131] The following is in conjunction with the appendix Figure 4 The following describes the process of generating the class matching degree detection program and the method matching degree detection program in the embodiments of this application, specifically including the following steps:

[0132] Step S401: After obtaining the dynamic installation file, determine the set of target objects of the host application of the client that the dynamic installation file depends on at runtime;

[0133] The target object can be a class or an interface;

[0134] In practice, the code files of the dynamically installed file can be scanned and analyzed. The import code area in the code file can be analyzed to obtain the classes or interfaces of the host application of the client that the dynamically installed file depends on at runtime, and the dependent classes and interfaces can be combined into a target object set.

[0135] Step S402: Determine the package name path and name information corresponding to each target object in the target object set;

[0136] For example, when the target object is a class, the name information is the class name; when the target object is an interface, the name information is the interface name.

[0137] Step S403: Concatenate the package name path and name information corresponding to each target object into an obfuscation rule file;

[0138] After concatenating the package name path and name information corresponding to the target object into an obfuscation rule file, when the code files of the host application and the dynamic installation file are packaged into an APK file, it is ensured that the target objects that the dynamic installation file depends on will not be obfuscated.

[0139] Step S404: According to the preset splicing rules, the package name path and name information corresponding to each target object are spliced ​​into the first code data;

[0140] Specifically, when concatenating the package name path and name information corresponding to the target object into the first code data, the class.getName() method can be constructed for each target object to concatenate the package name path and name information corresponding to each target object into the first code data.

[0141] Step S405: Write the concatenated first code data into the class matching degree detection program of the matching degree detection file;

[0142] The matching degree detection file can be CheckMatchDegree.java, and the class matching degree detection program can be the checkClassDegree method.

[0143] Step S406: Obtain the class files corresponding to each target object in the target object set from the compilation artifacts of the host application, copy the obtained class files to a temporary directory, and generate the jar package that the dynamic installation file depends on for the host application.

[0144] Step S407: Import the JAR package into the defined verification project and compile it.

[0145] Step S408: Through the Gradle Transform process, the class files compiled from the jar package are modified to construct the class objects corresponding to each class file.

[0146] Step S409: Obtain the class object type and corresponding method code data of each class file in the jar package.

[0147] For each class file, execute steps S410 to S413 respectively:

[0148] Step S410: Determine whether the type of the class object corresponding to the class file is an abstract class or an interface; if yes, proceed to step S411; if no, proceed to step S412.

[0149] Step S411: Obtain the method code data contained in the class file, update the code data contained in the class file through anonymous inner classes, and obtain the sub-code data corresponding to the class file.

[0150] Step S412: Based on the method code data contained in the class file, construct a test method with the same parameters as the method code data, and insert the test method into the class file;

[0151] It should be noted that the implementation of the test method, which has the same data parameters as the method code, is an empty implementation.

[0152] Step S413: Generate sub-code data that calls the test method.

[0153] Step S414: Combine the sub-code data of each class file into second code data.

[0154] Step S415: Write the second code data into the matching degree detection program of the matching degree detection file;

[0155] The matching degree detection file can be CheckMatchDegree.java, and the method matching degree detection program can be the checkMethodDegree method.

[0156] In this application embodiment, after generating the matching degree detection file corresponding to the dynamic installation file, when updating the client, an optional implementation is to package the dynamic installation file and the matching degree detection file together and send them to the client.

[0157] For example, in embodiments of this application, the dynamic installation file and the matching detection file can be packaged into a compressed file, and the compressed file type can be a ZIP file.

[0158] After receiving the packaged dynamic installation file and the matching detection file, the client first runs the matching detection file; in practice, the client can run the matching detection file through the host application.

[0159] Because the matching score detection file contains class matching score detection programs and method matching score detection programs, the client calls the class matching score detection programs and method matching score detection programs contained in the matching score detection file when running the matching score detection file.

[0160] During the running of the matching degree detection file on the client side, it is determined whether the class matching degree detection program and the method matching degree detection program contained in the matching degree detection file are running normally;

[0161] In some embodiments, when the client runs the matching degree detection file, it first executes the class matching degree detection program; if an error is found when executing the class matching degree detection program, it indicates that there is a missing mapping between the dynamically installed file and the class in the host application, then the client stops running the matching degree detection file and exits the update client.

[0162] If no class loading exception is found, the method matching test program continues to execute; if a method loading exception is found when executing the method matching test program, it means that the method signature has been modified, or that the method in the class file of the abstract class or interface has been added, deleted, or modified. In this case, the client stops running the matching test file and exits the update client.

[0163] If no method loading exception is found, it is determined that the dynamic installation file matches the host application; then the client continues to run the dynamic installation file, which ensures that no exceptions occur during the running of the dynamic installation file, and the client update is completed.

[0164] The following is in conjunction with the appendix Figure 5 The client update process in this application embodiment is described below, specifically including the following steps:

[0165] Step S501: The client receives the dynamic installation file and the matching degree detection file; wherein, the matching degree detection file contains a class matching degree detection program and a method matching degree detection program;

[0166] For example, the matching detection file can be CheckMatchDegree.java, the class matching detection program can be the checkClassDegree method, and the method matching detection program can be the checkMethodDegree method.

[0167] Step S502: The client runs the matching degree detection file and calls the class matching degree detection program in the matching degree detection file.

[0168] Step S503: The client determines whether a class loading exception occurred when calling the class matching degree detection program; if yes, proceed to step S507; if no, proceed to step S504.

[0169] Step S504: The client calls the matching degree detection program in the matching degree detection file.

[0170] Step S505: The client determines whether a method loading exception occurred when calling the method matching detection program; if yes, proceed to step S507; if no, proceed to step S506.

[0171] Step S506: The client determines that the dynamic installation file matches the host application and runs the dynamic installation file to update the client.

[0172] Step S507: The client stops running the matching degree detection file and exits the update client.

[0173] The following describes the client update process of an embodiment of this application, using optional application scenarios as examples:

[0174] When it is determined that the client needs to be updated, a dynamic installation file for updating the client is generated, and a matching degree detection file matching the dynamic installation file is generated based on the generated dynamic installation file; the matching degree detection file contains a class matching degree detection program and a method matching degree detection program.

[0175] It should be noted that the method for generating a matching degree detection file that matches the dynamic installation file in this application embodiment can refer to the method described above.

[0176] Following the matching degree detection file, one optional implementation is to upload the matching degree detection file to the server; when the client needs to be updated, the server can send an update prompt to the client. After the user starts the client and confirms the update according to the update prompt sent by the server, the server sends the dynamic installation file and the matching degree detection file to the client.

[0177] For example, such as Figure 6 As shown, after the server sends an update notification to the client, the user launches the client and the client's display shows a prompt message asking whether to perform a "version update". After the user selects to confirm the update, the client obtains the dynamic installation file and the compatibility detection file from the server.

[0178] like Figure 7 As shown in the embodiment of this application, the interaction flow between the server and the client when updating the client is as follows:

[0179] Step S701: When the server determines that the client needs to be updated, it sends an update prompt to the client.

[0180] Step S702: After the client confirms the update based on the user's operation, it sends an update confirmation message to the server.

[0181] Step S703: The server packages the dynamic installation file and the matching degree detection file and sends them to the client;

[0182] Step S704: The client runs the matching degree detection file and calls the class matching degree detection program in the matching degree detection file;

[0183] Step S705: If it is determined that no class loading exception has occurred, the client calls the matching degree detection program in the matching degree detection file;

[0184] Step S706: If it is determined that no method loading exception has occurred, the client determines that the dynamic installation file matches the host application and runs the dynamic installation file to update the client.

[0185] Based on the same inventive concept, this application also provides a client update device. Since the principle of this device in solving the problem is similar to the above-mentioned client update method, the implementation of this device can refer to the implementation of the method, and the repeated parts will not be described again.

[0186] like Figure 8 The diagram shown is a structural schematic of a client update device provided in an embodiment of this application, comprising:

[0187] The acquisition unit 801 is used to acquire a dynamic installation file for updating the client, and to acquire a matching degree detection file corresponding to the dynamic installation file; wherein, the matching degree detection file contains a detection program, which is generated based on a set of target objects that the dynamic installation file depends on at runtime, and the set of target objects includes at least one object in the host application of the client.

[0188] Processing unit 802 is used to run the detection program in the matching degree detection file;

[0189] The update unit 803 is used to determine, when the detection program is running normally, that the dynamic installation file matches the host application, and to run the dynamic installation file to update the client.

[0190] Optionally, the detection program includes a class matching degree detection program and a method matching degree detection program;

[0191] The update unit 803 is specifically used for:

[0192] When running the class matching degree detection program in the detection program, it was determined that no class loading exception occurred;

[0193] And when running the method matching degree detection program in the matching degree detection file, it is determined that no method loading exception has occurred.

[0194] Optionally, the acquisition unit 801 is further configured to:

[0195] Before obtaining the matching degree detection file corresponding to the dynamic installation file, the package name path and name information corresponding to each target object in the target object set are concatenated according to the execution order of each target object in the host application to obtain the first code data;

[0196] The class matching degree detection program is generated based on the obtained first code data.

[0197] Optionally, the acquisition unit 801 is further configured to:

[0198] Before obtaining the matching degree detection file corresponding to the dynamic installation file, obtain the compilation file corresponding to each target object in the target object set from the compilation data corresponding to the host application;

[0199] Based on the method code data contained in each compiled file, generate the corresponding sub-code data for each compiled file;

[0200] The sub-code data corresponding to each of the compiled files are combined to form the second code data;

[0201] The method matching degree detection program is generated based on the obtained second code data.

[0202] Optionally, the acquisition unit 801 is specifically used for:

[0203] Perform the following operations on each compiled file:

[0204] If the class object corresponding to one of the compiled files is an abstract class object or an interface, then the method code data contained in the compiled file is updated through an anonymous inner class to obtain the sub-code data corresponding to the compiled file.

[0205] If the class object corresponding to one of the compiled files is a regular class object, then based on the method code data contained in the compiled file, a test method with the same parameters as the method code data is constructed, and sub-code data that calls the test method is generated.

[0206] Optionally, the acquisition unit 801 is further configured to:

[0207] After obtaining the compilation files corresponding to each target object in the target object set from the compilation data corresponding to the host application, and before generating the sub-code data corresponding to each compilation file based on the method code data contained in each compilation file, the compilation files are modified according to the compilation script conversion process to construct the class objects corresponding to each compilation file.

[0208] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.

[0209] Those skilled in the art will understand that each aspect of this application can be implemented as a system, method, or program product. Therefore, each aspect of this application can be specifically implemented as a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0210] In some possible implementations, embodiments of this application also provide an electronic device, see below. Figure 9 As shown, the electronic device 900 may include at least one processor 901 and at least one memory 902. The memory 902 stores program code that, when executed by the processor 901, causes the processor 901 to perform the steps in the client update method according to various exemplary embodiments of this application described above. For example, the processor 901 may perform actions such as... Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 7 The steps are shown.

[0211] In some possible implementations, embodiments of this application also provide a computing device, which may include at least one processing unit and at least one storage unit. The storage unit stores program code, which, when executed by the processing unit, causes the processing unit to perform the steps in the client update method according to various exemplary embodiments of this application described above. For example, processor 901 may execute... Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 7 The steps are shown in the figure.

[0212] The following reference Figure 10 To describe a computing device 1000 according to this embodiment of the present application. Figure 10The computing device 1000 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0213] like Figure 10 The computing device 1000 is manifested in the form of a general-purpose computing device. The components of the computing device 1000 may include, but are not limited to: at least one processing unit 1001, at least one storage unit 1002, and a bus 1003 connecting different system components (including storage unit 1002 and processing unit 1001).

[0214] Bus 1003 represents one or more of several bus structures, including a memory bus or memory controller, peripheral bus, processor, or a local bus using any of the various bus structures.

[0215] Storage unit 1002 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 1021 or cache memory 1022, and may further include read-only memory (ROM) 1023.

[0216] Storage unit 1002 may also include a program / utility 1025 having a set (at least one) of program modules 1024, such program modules 1024 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0217] The computing device 1000 can also communicate with one or more external devices 1004 (e.g., keyboard, pointing device, etc.), and with one or more devices that enable a user to interact with the computing device 1000, or with any device that enables the computing device 1000 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 1005. Furthermore, the computing device 1000 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), or public network, such as the Internet) via a network adapter 1006. As shown, the network adapter 1006 communicates with other modules used in the computing device 1000 via bus 1003. It should be understood that, although not shown in the figures, other hardware or software modules can be used in conjunction with the computing device 1000, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0218] In some possible implementations, each aspect of the client update method provided in this application can also be implemented as a program product comprising program code that, when run on a computer device, causes the computer device to perform the steps of the client update method according to the various exemplary embodiments of this application described above. For example, the computer device may perform actions such as... Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 7 The steps are shown in the figure.

[0219] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may 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 (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable 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 thereof.

[0220] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0221] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A client update method, characterized in that, The method includes: Obtain a dynamic installation file for updating the client, and obtain a matching degree detection file corresponding to the dynamic installation file; wherein, the matching degree detection file contains a detection program, which is generated based on a set of target objects that the dynamic installation file depends on at runtime, the set of target objects including at least one object in the host application of the client; the detection program includes a class matching degree detection program and a method matching degree detection program, the class matching degree detection program is obtained by performing the following operations: according to the execution order of each target object in the target object set in the host application, concatenating the package name path and name information corresponding to each target object to obtain first code data, and generating the class matching degree detection program based on the obtained first code data; Run the detection program in the matching degree detection file; When the detection program is confirmed to be running normally, it is determined that the dynamic installation file matches the host application, and the dynamic installation file is run to update the client.

2. The method as described in claim 1, characterized in that... The step of determining that the detection program is operating normally includes: When running the class matching degree detection program in the detection program, it was determined that no class loading exception occurred; And when running the method matching degree detection program in the detection program, it is determined that no method loading anomaly has occurred.

3. The method as described in claim 2, characterized in that, Before obtaining the matching detection file corresponding to the dynamic installation file, the process also includes: Obtain the compilation file corresponding to each target object in the target object set from the compilation data corresponding to the host application; Based on the method code data contained in each compiled file, generate the corresponding sub-code data for each compiled file; The sub-code data corresponding to each of the compiled files are combined to form the second code data; The method matching degree detection program is generated based on the obtained second code data.

4. The method as described in claim 3, characterized in that, The step of generating sub-code data corresponding to each compiled file based on the method code data contained in each compiled file includes: Perform the following operations on each compiled file: If the class object corresponding to one of the compiled files is an abstract class object or an interface, then the method code data contained in the compiled file is updated through an anonymous inner class to obtain the sub-code data corresponding to the compiled file. If the class object corresponding to one of the compiled files is a regular class object, then based on the method code data contained in the compiled file, a test method with the same parameters as the method code data is constructed, and sub-code data that calls the test method is generated.

5. The method as described in claim 4, characterized in that, After obtaining the compiled files corresponding to each target object in the target object set from the compiled data corresponding to the host application, and before generating the sub-code data corresponding to each compiled file based on the method code data contained in each compiled file, the method code data corresponding to each compiled file is generated, and the process further includes: Based on the compilation script conversion process, each compiled file is modified to construct a class object corresponding to each compiled file.

6. A client update device, characterized in that, The device includes: An acquisition unit is configured to acquire a dynamic installation file for updating the client, and a matching degree detection file corresponding to the dynamic installation file; wherein, the matching degree detection file contains a detection program, which is generated based on a set of target objects that the dynamic installation file depends on at runtime, the set of target objects including at least one object in the host application of the client; the detection program includes a class matching degree detection program and a method matching degree detection program, the class matching degree detection program being obtained by the acquisition unit performing the following operations: according to the execution order of each target object in the target object set in the host application, concatenating the package name path and name information corresponding to each target object to obtain first code data, and generating the class matching degree detection program based on the obtained first code data; The processing unit is used to run the detection program in the matching degree detection file; The update unit is configured to, when the detection program is running normally, determine that the dynamic installation file matches the host application, and run the dynamic installation file to update the client.

7. The apparatus as claimed in claim 6, characterized in that, The update unit is specifically used for: When running the class matching degree detection program in the detection program, it was determined that no class loading exception occurred; And when running the method matching degree detection program in the detection program, it is determined that no method loading anomaly has occurred.

8. The apparatus as claimed in claim 7, characterized in that, The acquisition unit is also used for: Before obtaining the matching degree detection file corresponding to the dynamic installation file, obtain the compilation file corresponding to each target object in the target object set from the compilation data corresponding to the host application; Based on the method code data contained in each compiled file, generate the corresponding sub-code data for each compiled file; The sub-code data corresponding to each of the compiled files are combined to form the second code data; The method matching degree detection program is generated based on the obtained second code data.

9. The apparatus as claimed in claim 8, characterized in that, The acquisition unit is specifically used for: Perform the following operations on each compiled file: If the class object corresponding to one of the compiled files is an abstract class object or an interface, then the method code data contained in the compiled file is updated through an anonymous inner class to obtain the sub-code data corresponding to the compiled file. If the class object corresponding to one of the compiled files is a regular class object, then based on the method code data contained in the compiled file, a test method with the same parameters as the method code data is constructed, and sub-code data that calls the test method is generated.

10. The apparatus as claimed in claim 9, characterized in that, The acquisition unit is also used for: After obtaining the compilation files corresponding to each target object in the target object set from the compilation data corresponding to the host application, and before generating the sub-code data corresponding to each compilation file based on the method code data contained in each compilation file, the compilation files are modified according to the compilation script conversion process to construct the class objects corresponding to each compilation file.

11. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform any of the methods described in claims 1 to 5.

12. A computer-readable storage medium, characterized in that, It includes program code that, when run on an electronic device, causes the electronic device to perform any of the methods described in claims 1 to 5.