CN107329783B - Method for loading patch based on class file in android system - Google Patents

Method for loading patch based on class file in android system Download PDF

Info

Publication number
CN107329783B
CN107329783B CN201710497339.0A CN201710497339A CN107329783B CN 107329783 B CN107329783 B CN 107329783B CN 201710497339 A CN201710497339 A CN 201710497339A CN 107329783 B CN107329783 B CN 107329783B
Authority
CN
China
Prior art keywords
patch
class
package
application program
dex file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710497339.0A
Other languages
Chinese (zh)
Other versions
CN107329783A (en
Inventor
纪琦华
蒲珂
曾泽基
李哲山
赵永超
胡彬
方宏
蔡忠善
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cbc Cloud Technology Co ltd
Original Assignee
Cbc Cloud Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cbc Cloud Technology Co ltd filed Critical Cbc Cloud Technology Co ltd
Priority to CN201710497339.0A priority Critical patent/CN107329783B/en
Publication of CN107329783A publication Critical patent/CN107329783A/en
Application granted granted Critical
Publication of CN107329783B publication Critical patent/CN107329783B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method for loading a patch based on a class file, which comprises the steps of firstly obtaining a patch package from a server; finding a class to be patched from the dex file; and performing sub-packet processing on the first dex file to obtain a second dex file and a third dex file, loading the patch class into a patch class, inserting the patch class into the second dex file to form a new fourth dex file, inserting a jump instruction between the to-be-patched class and the previous class adjacent to the to-be-patched class, executing the patch class by the jump instruction, inserting a jump instruction in front of the to-be-patched class by determining the to-be-patched class, and directly jumping to execute the patch class when the program is executed to the position so as to update the patch of the application program.

Description

Method for loading patch based on class file in android system
Technical Field
The invention belongs to the field of APP patch loading, and particularly relates to a method for loading a patch based on a class file in an android system.
Background
In the prior art, after an android application is released, a serious bug is suddenly found to be repaired, and at this time, the android application needs to be repaired, specifically, the operations include repacking the APP, testing, exchanging packages for each application market and channel, prompting a user to upgrade, downloading the user, and covering installation. Sometimes, just to modify a line of code, a significant cost is also required for the unpacking and reissuing. For the user, the user experience is greatly reduced by the repeated upgrading and re-downloading and installing processes of the android application. In order to solve the problems in the prior art, a dynamic hot Patch repairing technology is provided in a QQ space, the technology issues Patch to a user, Patch repairing is performed without perception of the user, package changing and reinstallation are not needed, and the use experience of the user is improved, for example, a hot Patch repairing method, device, server and system for android application disclosed in CN106095502, and a hot Patch inserting method and device for an application disclosed in CN106484444 are all used.
The hot patching repair technology is based on an android dex subpackaging scheme (subpackaging scheme: a ClassLoader can contain a plurality of dex files, each dex file is an Element, the dex files are arranged into an ordered array of dexElements, when classes are found, the dex files are traversed in sequence, then the classes are found from the currently traversed dex file, if the classes are found, the step is returned, and if the next dex file cannot be found, the searching is continued. However, this technique has the following problems in practical operation: modifying a certain CLASS, packaging into dex, inserting into classloader, and when loading the CLASS, generating an error because the first layer relation, namely a referrer, is marked with a CLASS _ ISPREVERIFIED mark, and when the mark exists, checking the dex is required. If the directly referenced CLASS (first level relationship, no recursive search is done) and clazz are both in the same dex, then this CLASS is labeled CLASS _ ISPREVERIFIED; therefore, in order to implement the patch scheme, the hot patch repair technology must prevent classes from being marked with CLASS _ ISPREVERIFIED, so that files to be modified are packaged into separate classes, and thus when an apk is installed, classes in classes are referenced to classes in different dex, so that the classes are prevented from being marked with CLASS _ ISPREVERIFIED, and then the patch operation can be implemented.
The method can well realize hot patch repair, but the problem in the prior art is that the CLASS _ ISPREVERIFIED mark is marked on a certain type to improve the application performance of the APP, and when the mark is marked on a hard prevention mark, the application performance of the APP is reduced, and the phenomena of crash and the like can occur after the APP is started.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a method for loading a patch based on a class file in an android system, which can keep the existing performance of an APP and can also realize hot patch repair, thereby improving the use experience of a user.
The specific technical scheme of the invention is as follows:
the invention provides a method for loading patches based on class files in an android system, which comprises the following steps:
s1: obtaining a patch package;
s2: acquiring a first dex file where a class to be patched is located, and marking the class to be patched in the first dex file;
s3: performing sub-packaging on the first dex file found in the step S2 to obtain a second dex file consisting of classes related to the class to be patched and a third dex file consisting of other classes in the first dex file;
s4: loading the patch package into a patch class through a class loader, inserting the patch class into the second dex file obtained in the step S3 to form a fourth dex file, and assigning the class in the fourth dex file back to the third dex file in a reflection mode;
s5: and inserting a jump instruction between the marked class to be patched in the third dex file after the value is assigned in the step S4 and the adjacent previous class, wherein the jump instruction points to the patch class in the third dex file.
In a further improvement, the method further comprises:
s6: receiving a silent message pushed by a push server at a moment, wherein the silent message comprises a patch parameter of a latest patch version of the application program, and the patch parameter comprises a patch unique identifier;
s7: and comparing the patch data corresponding to the unique patch identifier obtained in the step S6 with the patch data of the patch package obtained in the step S1, and performing steps S2-S5 if the comparison is consistent.
In a further improvement, the method further comprises:
s8: when the comparison in the step S7 is inconsistent, determining whether the patch data corresponding to the unique patch identifier obtained in the step S6 is the update data of the patch data in the patch package obtained in the step S1, if so, performing the step S9, if not, re-obtaining the patch package corresponding to the unique patch identifier obtained in the step S6, performing the steps S2-S4, and then performing the step S11;
s9: calculating a patch delta package of the patch package corresponding to the unique patch identifier obtained in the step S6 and the patch package obtained in the step S1;
s10: comparing the patch delta packet with the patch delta packet threshold, performing steps S2-S5 when the patch delta packet is not larger than the patch delta packet threshold, re-acquiring the patch packet corresponding to the unique patch identifier obtained in the step S6 when the patch delta packet is larger than the patch delta packet threshold, performing steps S2-S4, and then performing step S11;
s11: and inserting a long jump instruction between each adjacent class in the third dex file subjected to assignment processing in the step S4.
In a further improvement, the method further comprises:
s12: judging whether the latter class of the long jump instruction is a class to be complemented, if not, performing step S13, and if so, performing step S14;
s13: the long jump instruction is empty;
s14: the long jump instruction points to a correction class corresponding to the latter class.
In a further improvement, the following steps are performed before the step S1 is performed:
s0: judging whether the application program runs on the client for the first time, if so, performing step S01:
s01: and judging whether the client locally stores the patch package of the application program, if so, performing the step S2-5 on the patch package in the application program, and if not, performing the step S1-S5.
In a further improvement, the method further comprises:
s02: when the judgment of the step S0 is no, counting the number G of patch versions released by the application program, comparing the number G with the number G1 of times that the client updates the patch versions of the application program, if 3/5G is greater than G1 and is less than or equal to G, performing the step S1-5, and if G1 is less than or equal to 3/5G, performing the step S03;
s03: and judging whether to acquire the patch package according to the weight value of the patch package.
In a further improvement, step S03 includes:
s31: calculating the ratio W of the latest patch version weight value released by the application program to the latest patch version weight value loaded by the client through the following formula
W=aX+b△T+cY
a. b and c represent coefficients, the values of the coefficients are 0-1, X is a difference package of a patch package corresponding to the latest patch version released by the application program and a patch package corresponding to the latest patch version loaded by the client, △ T is the time from the start of the patch package corresponding to the latest patch version loaded by the client to the completion of the patch package corresponding to the latest patch version released by the application program, Y is the ratio of the severity corresponding to the latest patch version released by the application program and the severity corresponding to the latest patch version loaded by the client;
s32: comparing the ratio W calculated in the step S31 with a ratio threshold W1, performing a step S1 when W is more than or equal to W1, and performing a step S04 when W is less than W1;
s04: no patch package is obtained.
In a further improvement, step S1 includes:
s11: counting the number N of the obtained patch packages, if N is equal to 1, performing step S2, and if N is greater than 1, performing step S12;
s12: the type of the patch data in each patch package is analyzed, and step S2 is performed with the patch type being the type of the patch package that replaces the original application program preferentially.
In a further improvement, step S12 includes:
s121: monitoring the memory size C of the client where the application program is located, wherein C1 is larger than C, performing step S122, and if C is not larger than C1, performing step S123, wherein C1 represents the sum of the sizes of patch packages of which the patch types are used for replacing the original application program;
s122: analyzing the type of the patch data in each patch package, and performing step S2 on the patch package with the type of the patch being the type of the replacement original application program preferentially;
s123: the update time of each patch package is calculated, and the patch package having the longest update time is preferentially subjected to step S2.
The invention provides a method for loading a patch based on a class file in an android system, which comprises the steps of firstly obtaining a patch package from a server; the hot patching technology is based on an android dex sub-package scheme, and the scheme traverses each dex file from the dex files, finds a class with bugs, namely a class to be patched, and a corresponding first dex file, and marks the class to be patched; then, the first dex file is subjected to sub-packet processing, classes related to classes to be complemented, namely a referrer of classes to be patched, are separated to form a new second dex file, other classes in the first dex file form a third dex file, patches are loaded into patches and are inserted into the second dex file to form a new fourth dex file, so that when a virtual machine is started for verify verification, a CLASS _ ISPREVERIFIED mark is marked, although the CLASS of the referrer is marked with a CLASS _ ISPREVERIFIED mark, the referrer and the patches are in the same dex file, and therefore an error cannot be reported in the further verification process, and the technical problem that the CLASS of the referrer in the prior art is marked with CLASS _ ISPREVERIFIED to influence the application program performance is solved; and the invention further inserts a jump instruction between the class to be patched and the previous class adjacent to the class, the jump instruction executes the patch class, and by determining the class to be patched and inserting a jump instruction in front of the class, when the program is executed to the position, the jump instruction directly jumps to the patch class execution, and then updates the patch of the application program.
Drawings
Fig. 1 is a flowchart of a method for loading a patch based on a class file in an android system in embodiment 1;
fig. 2 is a flowchart of steps S6-S14 in a method for loading a patch based on a class file in an android system in embodiment 2;
fig. 3 is a flowchart of steps S0-S03 in a method for loading a patch based on a class file in an android system in embodiment 3;
FIG. 4 is a flowchart of step S03 in example 3;
FIG. 5 is a flowchart of step S1 in example 4;
FIG. 6 is a flowchart of step S12 in example 4.
Detailed Description
The present invention will be described in further detail with reference to the following examples and drawings.
Example 1
Embodiment 1 of the present invention provides a method for loading a patch based on a class file in an android system, and as shown in fig. 1, the method includes the following steps:
a method for loading patches based on class files in an android system is characterized by comprising the following steps:
s1: obtaining a patch package;
s2: acquiring a first dex file where a class to be patched is located, and marking the class to be patched in the first dex file;
s3: performing sub-packaging on the first dex file found in the step S2 to obtain a second dex file consisting of classes related to the class to be patched and a third dex file consisting of other classes in the first dex file;
s4: loading the patch package into a patch class through a class loader, inserting the patch class into the second dex file obtained in the step S3 to form a fourth dex file, and assigning the class in the fourth dex file back to the third dex file in a reflection mode;
s5: and inserting a jump instruction between the marked class to be patched in the third dex file after the value is assigned in the step S4 and the adjacent previous class, wherein the jump instruction points to the patch class in the third dex file.
The invention provides a method for loading a patch based on a class file in an android system, which comprises the steps of firstly obtaining a patch package from a server; the hot patching technology is based on an android dex sub-package scheme, and the scheme traverses each dex file from the dex files, finds a class with bugs, namely a class to be patched, and a corresponding first dex file, and marks the class to be patched; then, the first dex file is subjected to sub-packet processing, classes related to classes to be complemented, namely a referrer of classes to be patched, are separated to form a new second dex file, other classes in the first dex file form a third dex file, patches are loaded into patches and are inserted into the second dex file to form a new fourth dex file, so that when a virtual machine is started for verify verification, a CLASS _ ISPREVERIFIED mark is marked, although the CLASS of the referrer is marked with a CLASS _ ISPREVERIFIED mark, the referrer and the patches are in the same dex file, and therefore an error cannot be reported in the further verification process, and the technical problem that the CLASS of the referrer in the prior art is marked with CLASS _ ISPREVERIFIED to influence the application program performance is solved; and the invention further inserts a jump instruction between the class to be patched and the previous class adjacent to the class, the jump instruction executes the patch class, and by determining the class to be patched and inserting a jump instruction in front of the class, when the program is executed to the position, the jump instruction directly jumps to the patch class execution, and then updates the patch of the application program.
Example 2
An embodiment 2 of the present invention provides a method for loading a patch based on a class file in an android system, where the method is basically the same as that in embodiment 1, except that as shown in fig. 2, the method further includes:
s6: receiving a silent message pushed by a push server at a moment, wherein the silent message comprises a patch parameter of a latest patch version of the application program, and the patch parameter comprises a patch unique identifier;
s7: comparing the patch data corresponding to the unique patch identifier obtained in the step S6 with the patch data of the patch package obtained in the step S1, and performing steps S2-S5 if the comparison is consistent;
s8: when the comparison in the step S7 is inconsistent, determining whether the patch data corresponding to the unique patch identifier obtained in the step S6 is the update data of the patch data in the patch package obtained in the step S1, if so, performing the step S9, if not, re-obtaining the patch package corresponding to the unique patch identifier obtained in the step S6, performing the steps S2-S4, and then performing the step S11;
s9: calculating a patch delta package of the patch package corresponding to the unique patch identifier obtained in the step S6 and the patch package obtained in the step S1;
s10: comparing the patch delta packet with the patch delta packet threshold, performing steps S2-S5 when the patch delta packet is not larger than the patch delta packet threshold, re-acquiring the patch packet corresponding to the unique patch identifier obtained in the step S6 when the patch delta packet is larger than the patch delta packet threshold, performing steps S2-S4, and then performing step S11;
s11: inserting a long jump instruction between each adjacent class in the third dex file subjected to assignment processing in the step S4;
s12: judging whether the latter class of the long jump instruction is a class to be complemented, if not, performing step S13, and if so, performing step S14;
s13: the long jump instruction is empty;
s14: the long jump instruction points to a correction class corresponding to the latter class.
Because the downloaded patch file is loaded when the application program is started, the application program can be replaced by the patch when the bug occurs in the application program, but if the bug is in the starting process of the application program, the client is not ready to download a new patch file, and the application program is crashed, so that the user can not use the current application program, and in order to solve the technical problem, the invention further limits the method for loading the patch, and specifically comprises the following steps: the client receives the silent message pushed by the push server at any time, the silent message includes the patch parameter of the latest patch version of the application program, then the received patch parameter is compared with the patch data in the patch package obtained in step S1, and if the comparison is consistent, the application program is indicated to have obtained the patch package of the latest version before starting; if the patch parameters of the latest patch version are not consistent with the patch data in the patch package obtained in step S1, it is determined whether the data in the latest version of the patch package is the update data of the patch package obtained in step S1, if the data is updated, calculating the differential packs of the two patch packs, if the differential packs are overlarge, acquiring the new version of the patch pack again, and then proceeds to steps S2-S4, since the patch package is downloaded during the application startup process, so, after step S4 is performed, a long jump instruction is inserted between each adjacent class in the third dex file subjected to the assignment processing in step S4, then judging whether the latter class of the long jump instruction is a class to be supplemented, if so, pointing the long jump instruction to a supplement class corresponding to the latter class, and if not, changing the long jump instruction into a null instruction; the method and the device can find the bugs existing in the running application program at any time in the process of continuously receiving the silent message, and judge whether the patch package needs to be acquired according to the conditions of the bugs, so that the normal and efficient running of the whole application program can be ensured, the bugs appearing in the application program can be repaired in time, and the running efficiency of the application program is improved.
Example 3
Embodiment 3 of the present invention provides a method for loading a patch based on a class file in an android system, which is basically the same as that in embodiment 1, except that, as shown in fig. 3, the following steps are performed before step S1 is performed:
s0: judging whether the application program runs on the client for the first time, if so, performing step S01:
s01: judging whether the client locally stores the patch package of the application program, if so, performing the step S2-5 on the patch package in the application program, and if not, performing the step S1-S5;
s02: when the judgment of the step S0 is no, counting the number G of patch versions released by the application program, comparing the number G with the number G1 of times that the client updates the patch versions of the application program, if 3/5G is greater than G1 and is less than or equal to G, performing the step S1-5, and if G1 is less than or equal to 3/5G, performing the step S03;
s03: judging whether a patch package is acquired or not according to the weight value of the patch package;
as shown in fig. 4, step S03 includes:
s31: calculating the ratio W of the weight value of the latest patch version released by the application program to the weight value of the latest patch version loaded by the client by the following formula;
W=aX+b△T+cY
a. b and c represent coefficients, the values of the coefficients are 0-1, X is a difference package of a patch package corresponding to the latest patch version released by the application program and a patch package corresponding to the latest patch version loaded by the client, △ T is the time from the start of the patch package corresponding to the latest patch version loaded by the client to the completion of the patch package corresponding to the latest patch version released by the application program, Y is the ratio of the severity corresponding to the latest patch version released by the application program and the severity corresponding to the latest patch version loaded by the client;
s32: comparing the ratio W calculated in the step S31 with a ratio threshold W1, performing a step S1 when W is more than or equal to W1, and performing a step S04 when W is less than W1;
s04: no patch package is obtained.
Before acquiring a patch package, the method firstly judges whether patch repair is carried out, and comprises the following specific processes: firstly, whether the client starts the application program for the first time is judged, if so, whether the client already has the patch package is judged, if so, the steps S2-S5 are directly carried out, and if not, the patch package is obtained from the server and then the steps S2-S5 are carried out. If the client does not operate the application program for the first time, judging the number G of patch versions released by the application program, comparing the number G with the number G1 of times for updating the patch versions of the application program by the client, if the number of patch packages loaded by the client exceeds 3/5 of the number of the released versions of the application program, performing steps S1-S5, if the number does not exceed 3/5, judging the weight value of the released latest patch version, if the weight value of the latest patch version is higher than the weight value of the latest patch version downloaded by the client, acquiring the patch package again, and if the weight value is not high, not downloading the patch package, so that the normal operation of the application program can be ensured, and unnecessary patch downloading is avoided.
Example 4
Embodiment 4 of the present invention provides a method for loading a patch based on a class file in an android system, where the method is basically the same as that in embodiment 1, except that, as shown in fig. 5, step S1 includes:
s11: counting the number N of the obtained patch packages, if N is equal to 1, performing step S2, and if N is greater than 1, performing step S12;
s12: analyzing the type of the patch data in each patch package, and performing step S2 on the patch package with the type of the patch being the type of the replacement original application program preferentially;
as shown in fig. 6, step S12 includes:
s121: monitoring the memory size C of the client where the application program is located, wherein C1 is larger than C, performing step S122, and if C is not larger than C1, performing step S123, wherein C1 represents the sum of the sizes of patch packages of which the patch types are used for replacing the original application program;
s122: analyzing the type of the patch data in each patch package, and performing step S2 on the patch package with the type of the patch being the type of the replacement original application program preferentially;
s123: the update time of each patch package is calculated, and the patch package having the longest update time is preferentially subjected to step S2.
In order to solve the technical problems, the invention judges the type of the patch, judges the sequence of the patch repair according to the type of the patch and the size of the memory, and gradually performs the patch repair under the condition of ensuring that the application can normally run.
The present invention is not limited to the above-mentioned preferred embodiments, and any other products in various forms can be obtained by anyone in the light of the present invention, but any changes in the shape or structure thereof, which have the same or similar technical solutions as those of the present application, fall within the protection scope of the present invention.

Claims (9)

1. A method for loading patches based on class files in an android system is characterized by comprising the following steps:
s1: obtaining a patch package;
s2: acquiring a first dex file where a class to be patched is located, and marking the class to be patched in the first dex file;
s3: performing sub-packaging on the first dex file found in the step S2 to obtain a second dex file consisting of classes related to the class to be patched and a third dex file consisting of other classes in the first dex file;
s4: loading the patch package into a patch class through a class loader, inserting the patch class into the second dex file obtained in the step S3 to form a fourth dex file, and assigning the class in the fourth dex file back to the third dex file in a reflection mode;
s5: and inserting a jump instruction between the marked class to be patched in the third dex file after the value is assigned in the step S4 and the adjacent previous class, wherein the jump instruction points to the patch class in the third dex file.
2. The method for loading a patch based on a class file in an android system of claim 1, the method further comprising:
s6: receiving a silent message pushed by a push server at a moment, wherein the silent message comprises a patch parameter of a latest patch version of an application program, and the patch parameter comprises a unique patch identifier;
s7: and comparing the patch data corresponding to the unique patch identifier obtained in the step S6 with the patch data of the patch package obtained in the step S1, and performing steps S2-S5 if the comparison is consistent.
3. The method for loading patches based on class files in the android system of claim 2, wherein the method further comprises:
s8: when the comparison in the step S7 is inconsistent, determining whether the patch data corresponding to the unique patch identifier obtained in the step S6 is the update data of the patch data in the patch package obtained in the step S1, if so, performing the step S9, if not, re-obtaining the patch package corresponding to the unique patch identifier obtained in the step S6, performing the steps S2-S4, and then performing the step S11;
s9: calculating a patch delta package of the patch package corresponding to the unique patch identifier obtained in the step S6 and the patch package obtained in the step S1;
s10: comparing the patch delta packet with the patch delta packet threshold, performing steps S2-S5 when the patch delta packet is not larger than the patch delta packet threshold, re-acquiring the patch packet corresponding to the unique patch identifier obtained in the step S6 when the patch delta packet is larger than the patch delta packet threshold, performing steps S2-S4, and then performing step S11;
s11: and inserting a long jump instruction between each adjacent class in the third dex file subjected to assignment processing in the step S4.
4. The method for loading patches based on class files in the android system of claim 3, the method further comprising:
s12: judging whether the latter class of the long jump instruction is a class to be complemented, if not, performing step S13, and if so, performing step S14;
s13: the long jump instruction is empty;
s14: the long jump instruction points to the patch class corresponding to the latter class.
5. The method for loading patches based on class files in the android system as claimed in claim 1, wherein before performing step S1, the following steps are performed:
s0: judging whether the application program runs on the client for the first time, if so, performing step S01:
s01: and judging whether the client locally stores the patch package of the application program, if so, performing the steps S2-S5 on the patch package in the application program, and if not, performing the steps S1-S5.
6. The method for loading patches based on class files in the android system of claim 5, the method further comprising:
s02: when the judgment of the step S0 is no, counting the number G of patch versions released by the application program, comparing the number G with the number G1 of times that the client updates the patch versions of the application program, if 3/5G is greater than G1 and is less than or equal to G, performing the steps S1-S5, and if G1 is less than or equal to 3/5G, performing the step S03;
s03: and judging whether to acquire the patch package according to the weight value of the patch package.
7. The method for loading patches based on class files in the android system as claimed in claim 6, wherein step S03 includes:
s31: calculating the ratio W of the latest patch version weight value released by the application program to the latest patch version weight value loaded by the client through the following formula
W=aX+b△T+cY
a. b and c represent coefficients, the values of the coefficients are 0-1, X is a difference package of a patch package corresponding to the latest patch version released by the application program and a patch package corresponding to the latest patch version loaded by the client, △ T is the time from the start of the patch package corresponding to the latest patch version loaded by the client to the completion of the patch package corresponding to the latest patch version released by the application program, Y is the ratio of the severity corresponding to the latest patch version released by the application program and the severity corresponding to the latest patch version loaded by the client;
s32: comparing the ratio W calculated in the step S31 with a ratio threshold W1, performing a step S1 when W is more than or equal to W1, and performing a step S04 when W is less than W1;
s04: no patch package is obtained.
8. The method for loading patches based on class files in the android system as claimed in claim 1, wherein step S1 includes:
s11: counting the number N of the obtained patch packages, if N is equal to 1, performing step S2, and if N is greater than 1, performing step S12;
s12: the type of the patch data in each patch package is analyzed, and step S2 is performed with the patch type being the type of the patch package that replaces the original application program preferentially.
9. The method for loading patches based on class files in the android system as claimed in claim 5, wherein step S12 includes:
s121: monitoring the memory size C of the client where the application program is located, wherein C1 is larger than C, performing step S122, and if C is not larger than C1, performing step S123, wherein C1 represents the sum of the sizes of patch packages of which the patch types are used for replacing the original application program;
s122: analyzing the type of the patch data in each patch package, and performing step S2 on the patch package with the type of the patch being the type of the replacement original application program preferentially;
s123: the update time of each patch package is calculated, and the patch package having the longest update time is preferentially subjected to step S2.
CN201710497339.0A 2017-06-26 2017-06-26 Method for loading patch based on class file in android system Active CN107329783B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710497339.0A CN107329783B (en) 2017-06-26 2017-06-26 Method for loading patch based on class file in android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710497339.0A CN107329783B (en) 2017-06-26 2017-06-26 Method for loading patch based on class file in android system

Publications (2)

Publication Number Publication Date
CN107329783A CN107329783A (en) 2017-11-07
CN107329783B true CN107329783B (en) 2020-04-10

Family

ID=60198032

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710497339.0A Active CN107329783B (en) 2017-06-26 2017-06-26 Method for loading patch based on class file in android system

Country Status (1)

Country Link
CN (1) CN107329783B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109240723B (en) * 2018-09-03 2024-09-13 中国平安人寿保险股份有限公司 Application program updating method, system, computer device and storage medium
CN110134432B (en) * 2019-04-19 2024-09-17 平安科技(深圳)有限公司 Bug repairing method and device for application and computer equipment
CN113342396B (en) * 2021-06-07 2023-05-05 金陵科技学院 Method for pre-selecting targets in Android system image recognition
CN113797553B (en) * 2021-09-17 2024-08-27 网易(杭州)网络有限公司 Subcontracting resource downloading method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014040424A1 (en) * 2012-09-12 2014-03-20 International Business Machines Corporation Method and apparatus for patching
CN106020873A (en) * 2016-05-13 2016-10-12 腾讯科技(深圳)有限公司 Service pack loading method and device
CN106055368A (en) * 2016-06-02 2016-10-26 腾讯科技(深圳)有限公司 Application updating method and device
CN106095502A (en) * 2016-06-13 2016-11-09 北京奇虎科技有限公司 Hot restorative procedure, device, server and the system of a kind of Android application
CN106502725A (en) * 2016-09-30 2017-03-15 歌尔科技有限公司 The upgrade method of application program, equipment and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014040424A1 (en) * 2012-09-12 2014-03-20 International Business Machines Corporation Method and apparatus for patching
CN106020873A (en) * 2016-05-13 2016-10-12 腾讯科技(深圳)有限公司 Service pack loading method and device
CN106055368A (en) * 2016-06-02 2016-10-26 腾讯科技(深圳)有限公司 Application updating method and device
CN106095502A (en) * 2016-06-13 2016-11-09 北京奇虎科技有限公司 Hot restorative procedure, device, server and the system of a kind of Android application
CN106502725A (en) * 2016-09-30 2017-03-15 歌尔科技有限公司 The upgrade method of application program, equipment and electronic equipment

Also Published As

Publication number Publication date
CN107329783A (en) 2017-11-07

Similar Documents

Publication Publication Date Title
CN107329783B (en) Method for loading patch based on class file in android system
CN106020873B (en) Patch package loading method and device
CN107301070B (en) Upgrading method and terminal
CN110083360B (en) Compiling method, device, equipment and storage medium of application program code
CN108874437B (en) Online cloud updating method for android application program
CN104461873A (en) Testing method and device of application programs
WO2018024198A1 (en) Application upgrade method and system for set-top box, and set-top box
CN104866293A (en) Method and device for extending Android application program function
WO2015105486A1 (en) Dynamically applying a software patch to a computer program
WO2020029967A1 (en) Method and apparatus for repairing fault in operating system
US8549320B2 (en) Verifying loaded module during debugging
CN115543429A (en) Project environment building method, electronic equipment and computer readable storage medium
CN110837383A (en) Application installation-free upgrading method and device
CN102087607B (en) Method and device for installing patch packets
CN111061486A (en) Android application program increment method
CN113721948A (en) Database upgrading method, system and storage medium
CN103810006B (en) The installation method and device of service packs
CN103823693A (en) Service pack installation method
CN106445601A (en) Device and method for plugin upgrading
CN115495460A (en) Map data updating method, map data updating system, electronic equipment and storage medium
CN116028084A (en) Cross-version hot upgrading method, system and terminal based on OpenStack cloud platform
CN107967160B (en) Method and device for updating operating system file through Boot Loader
CN112882733A (en) Application updating method and device, electronic equipment and storage medium
CN111475220B (en) Cold start method and device, electronic equipment and computer storage medium
CN110659504A (en) Vulnerability attack verification method, vulnerability attack verification system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant