Application upgrade processing method, related device and medium

CN122985201APending Publication Date: 2026-10-27TENCENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510541527.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

这一方式会由于用户未及时手动更新而导致版本更新及时性差

Benefits of technology

[0087]本公开实施例中,针对相关技术的在应用程序的升级处理中,需要经过服务运营商对应用程序的安装包进行审核,也需要用户手动完成安装包文件下载和授权安装操作导致的应用程序的版本更新及时性差的问题,实现了应用程序的自动化更新。具体地,本公开实施例中,在终端上安装应用程序的时候会自动绑定插件,并在预下载插件到终端时,在开机例程中嵌入用于在开机时激活插件的代码。由于在预下载时在开机例程中嵌入了一开机就激活插件的代码,使得终端一执行开机例程就会激活插件,从而通过插件自动地获取应用程序的已公开版本中发布时间最新的版本的版本信息作为目标版本信息,并在目标版本信息大于终端上安装的应用程序的当前版本信息时,自动下载目标版本信息对应的目标安装包,提高了应用程序的版本升级及时性。同时,在版本更新过程中,识别应用程序在终端的运行状态,如果运行状态满足第一条件,就用目标安装包对终端上应用程序的当前版本对应的版本安装包进行全量替换。这样一来,就能对应用程序进行全量功能迭代,并对应用程序中所有功能模块进行完整覆盖更新,从而实现对应用程序的版本升级。这一方式只要通过插件检测到应用程序存在新版本,就能通过插件自动下载新版本的安装包并执行版本升级操作,实现对应用程序的静默更新,提高了应用程序的版本升级及时性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985201A_ABST
    Figure CN122985201A_ABST
Patent Text Reader

Abstract

The present disclosure provides an application upgrade processing method, related device and medium. The method comprises: in response to the terminal on which the application is installed being powered on, performing a startup routine to activate a plug-in bound to the application, the plug-in being pre-downloaded to the terminal along with the application and embedded in the startup routine with code for activating the plug-in at startup; obtaining, by the plug-in, target version information of the application, the target version information being version information of a version of the application that is the latest in terms of release time among published versions of the application; if the target version information is greater than current version information of the application installed on the terminal, downloading a target installation package corresponding to the target version information; and if a running state of the application on the terminal satisfies a first condition, performing full replacement of a version installation package corresponding to a current version of the application on the terminal with the target installation package. The present disclosure can improve the timeliness of version upgrade of the application. The present disclosure can be applied to various scenarios such as big data and cloud technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to an application upgrade processing method, related apparatus and medium. Background Technology

[0002] Currently, application version upgrades on mobile terminals (such as smartphones and tablets) are typically implemented through two upgrade modes: The first mode involves developers submitting the installation package files corresponding to each version of the application to the application center of various service providers. These service providers then review the received installation package files according to a pre-defined review mechanism. Once approved, they deploy the corresponding installation package files to the application center according to the version push strategy and then push them to ordinary users. This method suffers from delays in application version updates due to the review and push process by service providers. The second upgrade mode automatically detects the application's release version on the user's terminal and relies on version comparison and user interaction guidance. The application version upgrade is only performed after the user manually downloads the installation package file and authorizes the installation. This method suffers from poor timeliness of version updates if users do not manually update in a timely manner. Summary of the Invention

[0003] This disclosure provides an application upgrade processing method, related apparatus, and medium that can improve the timeliness of application version upgrades.

[0004] According to one aspect of this disclosure, an application upgrade processing method is provided, the method comprising:

[0005] In response to the power-on of a terminal with the application installed, a startup routine is executed to activate a plugin bound to the application, wherein the plugin is pre-downloaded to the terminal along with the application, and code for activating the plugin at power-on is embedded in the startup routine;

[0006] The plugin is used to obtain the target version information of the application, which is the latest version of the publicly available version of the application.

[0007] If the target version information is greater than the current version information of the application installed on the terminal, download the target installation package corresponding to the target version information;

[0008] Identify the running status of the application on the terminal;

[0009] If the running state meets the first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal.

[0010] According to one aspect of this disclosure, an application upgrade processing apparatus is provided, the apparatus comprising:

[0011] An execution unit is configured to execute a startup routine in response to the power-on of a terminal on which the application is installed, to activate a plugin bound to the application, wherein the plugin is pre-downloaded to the terminal along with the application, and code for activating the plugin at power-on is embedded in the startup routine;

[0012] The acquisition unit is used to acquire the target version information of the application through the plugin, wherein the target version information is the version information of the latest version released in the publicly available versions of the application;

[0013] The download unit is configured to download the target installation package corresponding to the target version information if the target version information is greater than the current version information of the application installed on the terminal.

[0014] The identification unit is used to identify the running status of the application on the terminal;

[0015] An upgrade unit is configured to, if the running state meets a first condition, fully replace the current version installation package of the application on the terminal with the target installation package.

[0016] Optionally, the running status includes the functions enabled by the application and the time elapsed since the last time the function was invoked.

[0017] The upgrade unit is used for:

[0018] Calculate the average stop call duration based on the stop call duration of each enabled function;

[0019] Based on the average call stop duration, a first score is calculated, where the first score is an increasing function of the average call stop duration.

[0020] Based on the total number of functions enabled, a second score is calculated, which is a subtractive function of the total number.

[0021] Calculate the first total score based on the first score and the second score;

[0022] If the first total score is greater than the first threshold, the application is closed, and the current version installation package of the application on the terminal is fully replaced with the target installation package.

[0023] Optionally, the upgrade unit includes:

[0024] The acquisition module is used to acquire the execution environment parameters of the application if the running state meets the first condition;

[0025] The first replacement module is used to perform a full replacement of the version installation package corresponding to the current version of the application on the terminal with the target installation package based on the execution environment parameters.

[0026] Optionally, the execution environment parameters include the terminal's network speed, remaining memory size, and remaining computing power.

[0027] The first replacement module is used for:

[0028] Based on the network speed, a third score is determined, which is an increasing function of the network speed;

[0029] Based on the remaining memory size, a fourth fraction is determined, wherein the fourth fraction is an increasing function of the remaining memory size;

[0030] Based on the remaining computing power, a fifth score is determined, wherein the fifth score is an increasing function of the remaining computing power.

[0031] Calculate the second total score based on the third score, the fourth score, and the fifth score;

[0032] If the second total score is greater than the second threshold, the target installation package is used to fully replace the current version installation package of the application on the terminal.

[0033] Optionally, the download unit includes:

[0034] The determining module is configured to determine the terminal summary information corresponding to the terminal if the target version information is greater than the current version information of the application installed on the terminal;

[0035] The download module is used to download the target version of the target installation package if it is determined from the terminal summary information that the terminal has download permissions.

[0036] Optionally, the determining module is used to:

[0037] The step of determining that the terminal has download permission based on the terminal summary information includes:

[0038] Get the first value corresponding to the terminal with download permission at the current time;

[0039] Based on the terminal summary information and the number of installed terminals corresponding to the application, a modulo operation is performed to obtain the target remainder;

[0040] If the target remainder is the same as the first value, then the terminal is determined to have download permission.

[0041] Optionally, the target version of the target installation package includes target code files;

[0042] The application upgrade processing apparatus further includes an optimization unit, which is used for:

[0043] The bytes in the target code file are aligned to obtain an aligned code file;

[0044] Perform field validation on the class files in the alignment code file to obtain the field validation results;

[0045] Based on the field validation results and the calling frequency of the class file, the target class file is determined in the class file of the alignment code file, and the memory layout of the target class file is optimized.

[0046] Optionally, the upgrade unit includes:

[0047] The decompression module is used to decompress the target installation package to obtain target resource files and target code files;

[0048] The verification module is used to perform a first verification on the target resource file and the target code file based on the target version information;

[0049] The second replacement module is used to perform a full replacement of the version installation package with the target resource file and the target code file if the first verification passes.

[0050] Optionally, the verification module is used for:

[0051] Obtain the installation package signature of the target installation package;

[0052] Extract the installation package verification code from the target version information;

[0053] Perform a digest operation on the target resource file and the target code file to obtain the installation package digest;

[0054] Based on the comparison between the installation package verification code and the installation package digest, a first sub-verification is performed on the target resource file and the target code file;

[0055] Based on the installation package signature, a second sub-verification is performed on the target resource file and the target code file.

[0056] Optionally, the version installation package includes the current code file and current resource file currently being used by the application on the terminal; the target resource file includes a first target sub-resource file and a second target sub-resource file; the current resource file includes a first current sub-resource file and a second current sub-resource file;

[0057] The second replacement module is used for:

[0058] The target code file is used to completely replace the current code file corresponding to the current version of the application;

[0059] The first target sub-resource file is used to fully replace the first current sub-resource file corresponding to the current version of the application, and the second target sub-resource file is used to fully replace the second current sub-resource file corresponding to the current version of the application.

[0060] Optionally, the application upgrade processing apparatus further includes a rollback unit, the rollback unit being used for:

[0061] If the first verification fails, the downloaded files of the target installation package are cleared;

[0062] Load the code file from the installation package corresponding to the current version to launch the application.

[0063] Optionally, the download unit is used for:

[0064] Determine the network connection status of the terminal at the current time;

[0065] If it is determined that the network connection status and the current time meet the preset download conditions, then the target version information and the current version information of the application installed on the terminal are compared.

[0066] If the target version information is greater than the current version information of the application installed on the terminal, then the target installation package corresponding to the target version information is downloaded.

[0067] Optionally, the application upgrade processing apparatus further includes a first cleaning unit, the first cleaning unit being used for:

[0068] If it is determined that the network connection status and the current time meet the preset download conditions, then an invalid installation package is identified among the multiple application installation packages that the application has already downloaded;

[0069] Clean up the invalid installation packages, wherein the version of the invalid installation packages is lower than the current version.

[0070] Optionally, the download unit is used for:

[0071] Get the timestamp of the last time the target version information was fetched;

[0072] If the difference between the timestamp and the current time is greater than or equal to a preset threshold, then the target version information and the current version information are compared.

[0073] If the target version information is greater than the current version information, then download the target installation package corresponding to the target version information.

[0074] Optionally, the download unit is used for:

[0075] Get the timestamp of the last time the target version information was fetched;

[0076] If the difference between the timestamp and the current time is less than a preset threshold, then the download task list of the terminal is obtained, wherein the download task list is used to store intermediate installation packages that have not been downloaded in the terminal.

[0077] If an intermediate installation package corresponding to the target version information exists in the download task list, and the target version information is greater than the current version information, then continue downloading the intermediate installation package corresponding to the target version information, and use it as the target installation package corresponding to the target version information.

[0078] Optionally, the application upgrade processing apparatus further includes a second cleaning unit, the second cleaning unit being used for:

[0079] If the intermediate installation package corresponding to the application exists in the download task list, and the version information of the intermediate installation package is less than the target version information, then download the target installation package corresponding to the target version information;

[0080] Remove the intermediate installation package corresponding to the application from the download task list.

[0081] Optionally, the application upgrade processing apparatus further includes a restart unit, the restart unit being used for:

[0082] In response to a restart request for the application, a pre-defined empty process is started;

[0083] Based on the empty process, terminate all processes in the application other than the empty process so that the target installation package corresponding to the target version information of the application becomes effective.

[0084] According to one aspect of this disclosure, an electronic device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the application upgrade processing method described above.

[0085] According to one aspect of this disclosure, a computer-readable storage medium is provided, the storage medium storing a computer program that, when executed by a processor, implements the application upgrade processing method described above.

[0086] According to one aspect of this disclosure, a computer program product is provided, the computer program product including a computer program that is read and executed by a processor of an electronic device, causing the electronic device to perform the application upgrade processing method as described above.

[0087] In this embodiment, addressing the issue of poor timeliness in application version updates caused by the need for service operators to review application installation packages and users to manually download and authorize installation during application upgrades, this embodiment achieves automated application updates. Specifically, in this embodiment, a plugin is automatically bound when the application is installed on the terminal. During the pre-download of the plugin to the terminal, code for activating the plugin at startup is embedded in the boot routine. Because the code for activating the plugin upon startup is embedded in the boot routine during pre-download, the plugin is activated as soon as the terminal executes the boot routine. This allows the plugin to automatically obtain the latest version information from the publicly available versions of the application as the target version information. If the target version information is greater than the current version information of the application installed on the terminal, the target installation package corresponding to the target version information is automatically downloaded, improving the timeliness of application version upgrades. Simultaneously, during the version update process, the running status of the application on the terminal is identified. If the running status meets a first condition, the current version installation package of the application on the terminal is fully replaced with the target installation package. This allows for a full feature iteration of the application, providing a complete overhaul update to all functional modules, thus enabling application version upgrades. This method automatically downloads the new version's installation package and performs the upgrade process as soon as the plugin detects a new version, achieving silent updates and improving the timeliness of application version upgrades.

[0088] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objectives and other advantages of this disclosure may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description

[0089] The accompanying drawings are provided to further understand the technical solutions of this disclosure and constitute a part of the specification. They are used together with the embodiments of this disclosure to explain the technical solutions of this disclosure and do not constitute a limitation on the technical solutions of this disclosure.

[0090] Figure 1 This is a system architecture diagram of the application upgrade processing method applied according to an embodiment of the present disclosure;

[0091] Figures 2A-2C A schematic diagram is shown illustrating the application upgrade processing method according to an embodiment of the present disclosure in an application version update scenario;

[0092] Figure 3 This is a flowchart of an application upgrade processing method according to an embodiment of the present disclosure;

[0093] Figure 4 This is a flowchart illustrating the download of a target installation package according to an embodiment of this disclosure;

[0094] Figure 5 This is a flowchart illustrating the download of a target installation package according to another embodiment of this disclosure;

[0095] Figure 6 This is a flowchart illustrating the download of a target installation package according to another embodiment of this disclosure;

[0096] Figure 7 This is a flowchart illustrating an embodiment of the present disclosure of downloading a target installation package based on a download task list;

[0097] Figure 8 This is a schematic diagram illustrating the implementation process of downloading a target installation package based on a download task list, according to an embodiment of this disclosure.

[0098] Figure 9 This is a schematic diagram illustrating the implementation process of downloading a target installation package based on a download task list, according to another embodiment of this disclosure.

[0099] Figure 10 This is a schematic diagram illustrating the overall implementation process of downloading the target installation package according to an embodiment of this disclosure;

[0100] Figure 11 This is a flowchart illustrating the full replacement of a version installation package with a target installation package according to an embodiment of the present disclosure;

[0101] Figure 12 This is a flowchart illustrating the full replacement of a version installation package with a target installation package according to another embodiment of the present disclosure;

[0102] Figure 13This is a flowchart illustrating the introduction of a first verification during a full replacement according to an embodiment of this disclosure;

[0103] Figure 14 This is a flowchart of the first verification according to an embodiment of the present disclosure;

[0104] Figures 15A-15B This is a schematic diagram illustrating the implementation process of a full replacement of a version installation package with a target installation package according to an embodiment of the present disclosure;

[0105] Figure 16 This is a flowchart of pre-optimization of code files in a target installation package according to an embodiment of the present disclosure;

[0106] Figure 17 This is a flowchart of automatically restarting an application according to an embodiment of the present disclosure;

[0107] Figure 18 This is a detailed implementation diagram of an application upgrade processing method according to an embodiment of the present disclosure;

[0108] Figure 19 This is a block diagram of an application upgrade processing apparatus according to an embodiment of the present disclosure;

[0109] Figure 20 This is a terminal structure diagram of an application upgrade processing method according to an embodiment of the present disclosure;

[0110] Figure 21 This is a server architecture diagram of an application upgrade processing method according to an embodiment of the present disclosure. Detailed Implementation

[0111] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this disclosure.

[0112] The system architecture and scenarios in which this disclosure is applied are described below.

[0113] Figure 1 This is a system architecture diagram of the application upgrade processing method according to embodiments of the present disclosure. It includes a target terminal 140, an Internet 130, a gateway 120, a server 110, etc.

[0114] The target terminal 140 includes various forms such as desktop computers, laptops, PDAs (Personal Digital Assistants), tablets, mobile phones, in-vehicle terminals, home theater terminals, smart TVs, and dedicated terminals. Furthermore, it can be a single device or a collection of multiple devices. The target terminal 140 can communicate with the Internet 130 via wired or wireless means to exchange data. The target terminal 140 contains installed applications and plugins bound to those applications. The applications are used to implement various functional services on the terminal; the plugins are activated when the target terminal is powered on and periodically send version detection requests to the server corresponding to the application to obtain the latest publicly available version of the application. When the current version of the application on the target terminal is lower than the latest publicly available version, the plugin downloads the installation package corresponding to that latest version and uses the downloaded installation package to upgrade the application on the target terminal.

[0115] Server 110 refers to a computer system that can provide certain services to object terminal 140. Compared to ordinary object terminal 140, server 110 has higher requirements in terms of stability, security, and performance. Server 110 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a portion of a high-performance computer (e.g., a virtual machine), a combination of portions of multiple high-performance computers (e.g., virtual machines), or a cloud server, etc. Server 110 contains various types of services, and the implementation of each service of server 110 is often associated with some intermediate databases or storage media. Server 110 is used to store and record version information of each released version of the application, as well as the installation package file corresponding to each released version. Server 110 is also used to provide the plugin with the version information of the latest publicly available version of the application based on the received version detection request, and to provide the plugin with the installation package file of the latest version based on the download request sent by the plugin.

[0116] Gateway 120, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from target terminal 140 to server 110 are forwarded to the corresponding server via gateway 120. Messages sent from server 110 to target terminal 140 are also forwarded to the corresponding target terminal 140 via gateway 120.

[0117] The embodiments disclosed herein can be applied in various scenarios, such as Figures 2A-2CThe examples shown include application version update scenarios.

[0118] like Figure 2A As shown, the terminal has application K and plugins bound to it installed. The current version of application K on the terminal is xxx.v2.23. Data can be uploaded and downloaded between the terminal and the server corresponding to application K. The server corresponding to application K records the released versions of application K, as well as the release date and installation package file for each released version. Specifically, the release date of the released version xxx.v1.01 is Xxxx.3.14, and the installation package file is installation package file 1; the release date of the released version xxx.v2.23 is Xxxx.3.17, and the installation package file is installation package file 10; the release date of the released version xxx.v2.24 is Xxxx.3.20, and the installation package file is installation package file 11.

[0119] like Figure 2B As shown, the plugin periodically retrieves version information of released versions from the server corresponding to application K. It detects that the latest released version is xxx.v2.24, which is newer than the current version of application K, indicating a new version of application K has been released. Based on this, the plugin detects an installation package file with version number xxx.v2.24 on the server, which is newer than the current version xxx.v2.23 used by application K. It then automatically downloads the installation package file 11 to the local terminal so that it can update the version of application K installed on the terminal at an appropriate time.

[0120] like Figure 2C As shown, it is generally not suitable to update application K when it is being used by the user on the terminal. Therefore, the plugin will only replace the installation package file 10 corresponding to version number xxx.v2.23 with the downloaded installation package file 11 when it detects that the various functions of application K are not being called and application K is not running in the foreground. This upgrades application K so that it can run with the latest version.

[0121] The embodiments of this disclosure are described in general below.

[0122] According to one embodiment of this disclosure, an application upgrade processing method is provided.

[0123] This application upgrade process is typically used in business scenarios where applications on target terminals need to be updated, for example... Figures 2A-2CThe examples illustrate application version update scenarios, etc. This disclosure provides a scheme for silent application upgrades based on plugins bound to applications on a terminal, which can improve the timeliness of application version upgrades.

[0124] like Figure 3 As shown, an application upgrade processing method according to an embodiment of this disclosure can be executed by a plugin bound to the application in the target terminal. An application upgrade processing method according to an embodiment of this disclosure may include:

[0125] Step 310: In response to the terminal with the application installed booting up, execute the boot routine to activate the plugins bound to the application;

[0126] Step 320: Obtain the target version information of the application through the plugin;

[0127] Step 330: If the target version information is greater than the current version information of the application installed on the terminal, download the target installation package corresponding to the target version information;

[0128] Step 340: Identify the application's running status on the terminal;

[0129] Step 350: If the running status meets the first condition, use the target installation package to fully replace the current version of the application installation package on the terminal.

[0130] Steps 310-350 are described in detail below.

[0131] In step 310, in response to the terminal with the application installed being powered on, a startup routine is executed to activate the plugins bound to the application.

[0132] Applications refer to various software programs installed and running on a terminal. Applications interact with users through the terminal to provide them with various functions and services.

[0133] A boot routine refers to a series of initialization and configuration operations performed by a terminal during the startup process. Boot routines enable the terminal to boot from hardware to full loading and running of the operating system, providing a usable computing environment for applications.

[0134] For example, the boot routine is a series of steps in the terminal startup process, from pressing the power button to the operating system fully loading and displaying the user interface. It involves multiple stages such as hardware initialization, firmware loading, and operating system booting.

[0135] The plugins in this disclosure are independently developed software modules, specifically designed to extend or enhance the functionality of applications. Specifically, the plugins bound to the application rely on the runtime environment and interfaces provided by the application to achieve silent updates to the application. In this disclosure, the plugins are pre-downloaded to the terminal along with the application, and code for activating the plugins at startup is embedded in the boot routine.

[0136] Silent updates refer to the process where, when a plugin detects a new version of the application, it automatically downloads the new version's installation package without the user's knowledge and upgrades the application accordingly.

[0137] In a specific implementation of this embodiment, for applications designed to be silently updated during development, the application is installed on the terminal for the first time with the user's authorization. During the first installation of the application, the plugins bound to the application can be pre-downloaded to the terminal along with the application. At the same time, the code for activating the plugins at startup is embedded in the terminal's startup routine, so that the plugins can be activated when the terminal starts up.

[0138] Furthermore, when a user powers on the terminal where the application is installed, the terminal responds to the power-on operation by executing the power-on routine. During the execution of the power-on routine, the plugin bound to the application is activated based on the code embedded in the power-on routine for activating the plugin, so that the plugin runs on the terminal according to the predetermined code logic.

[0139] It should be noted that the operating system used by the terminal in this embodiment of the disclosure may be the Android operating system.

[0140] In step 320, the target version information of the application is obtained through the plugin.

[0141] The target version information refers to the version information of the last publicly available version of the application. This last version refers to the version with the latest release date among multiple publicly available versions. The target version information is used to indicate the version number, release date, license, etc., of the most recently released version of the application. "Latest release date" means the smallest time difference between the release date and the current time. In this embodiment of the disclosure, the latest publicly available version of the application is considered the target version.

[0142] For example, if an application has three publicly available versions: version 1 released at 12:00 on a certain day, version 2 released at 14:00 on the same day, and version 3 released at 15:00 on the same day, then if three different versions of the application are released on the same day, then since version 3 has the latest release time (the time difference between the release time of version 3 and the current time is the smallest compared to version 1 and version 2), the target version information refers to the version information corresponding to version 3.

[0143] In this specific implementation, with authorization, the plugin sends a version retrieval request to the server corresponding to the application. Upon receiving the request, the server sends the version information of the latest released version of the application from its published versions to the plugin installed on the terminal. Based on this, the plugin can obtain the version information of the latest released version of the application from its published versions as the target version information.

[0144] In step 330, if the target version information is greater than the current version information of the application installed on the terminal, the target installation package corresponding to the target version information is downloaded.

[0145] The current version information is used to indicate the version number, release date, version type, license, etc. of the application currently in use.

[0146] A target installer package refers to a collection of all necessary files and installation scripts corresponding to the target version of an application. Specifically, the target installer package includes the executable file, dependent libraries, configuration files, resource files (such as images and documents), and installation scripts corresponding to the latest publicly available version of the application (the target version).

[0147] It should be noted that the version information of different versions of an application usually has a logical order of importance. This order of importance is often used to indicate the chronological order and age of different versions. The order of importance of the version information of different versions of an application is reflected by the version number in the version information.

[0148] Specifically, first, the version number of the latest release version of the application is extracted from the target version information, and the version number of the current version of the application installed on the terminal is extracted from the current version information. If the version number extracted from the target version information is greater than the version number extracted from the current version information, then the target version information is greater than the current version information of the application installed on the terminal, and the latest release version is newer than the version used by the application installed on the terminal. For example, for a certain application, if the version number in the target version information is v3.15 and the version number in the current version information is v2.89, then version number v3.15 is greater than version number v2.89, and the target version information is greater than the current version information of the application installed on the terminal.

[0149] To save space, the specific process of downloading the target installation package corresponding to the target version information in this embodiment will be described in detail below, and will not be repeated here.

[0150] In step 340, the running status of the application on the terminal is identified.

[0151] Running status indicates whether the application is running in the foreground and being used by the user at the current time. Running status also indicates which functions are enabled in the application while it is running in the foreground.

[0152] In this specific implementation, since terminals often have built-in tools and API interfaces to collect and manage the running status of various applications, this embodiment, with authorization, obtains the process status, resource usage, and network connection status of the terminal collected by the built-in tools and API interfaces, and then determines the current status of the application based on the terminal's process status, resource usage, and network connection status.

[0153] For example, command-line tools can generate various commands to obtain the running status of an application. Specifically, the `tasklist` command can be used to view the list of currently running application processes to determine if the application is running; the `netstat` command can be used to view the network connectivity of the terminal where the application is located; the `top` or `htop` command can be used to view the resource usage of the terminal where the application is located, and so on.

[0154] In step 350, if the running status meets the first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal.

[0155] The first condition indicates the specific state requirements that the application must meet in order to perform an application upgrade operation.

[0156] A version installation package refers to a compressed file containing the code files, resource files, etc., corresponding to the current version.

[0157] A full replacement means completely replacing all the contents of the current version of the application installed on the terminal with the contents of the target version, without retaining any content from the current version.

[0158] To save space, the specific process of replacing the current version installation package of the application on the terminal with the target installation package in this embodiment of the present disclosure will be described in detail below, and will not be repeated here.

[0159] Through steps 310-350 above, this embodiment of the present disclosure addresses the problem of poor timeliness of application version updates caused by the need for service operators to review application installation packages and for users to manually download and authorize installation during application upgrades. Specifically, in this embodiment, a plugin is automatically bound when the application is installed on the terminal. When the plugin is pre-downloaded to the terminal, code for activating the plugin at startup is embedded in the boot routine. Because the code for activating the plugin upon startup is embedded in the boot routine during pre-download, the plugin is activated as soon as the terminal executes the boot routine. This allows the plugin to automatically obtain the latest version information from the publicly available versions of the application as the target version information. If the target version information is greater than the current version information of the application installed on the terminal, the target installation package corresponding to the target version information is automatically downloaded, improving the timeliness of application version upgrades. Simultaneously, during the version update process, the running status of the application on the terminal is identified. If the running status meets a first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal. This allows for a full feature iteration of the application, providing a complete overhaul update to all functional modules, thus enabling application version upgrades. This method automatically downloads the new version's installation package and performs the upgrade process as soon as the plugin detects a new version, achieving silent updates and improving the timeliness of application version upgrades.

[0160] The above is a general description of steps 310-350. Since steps 310, 320, and 3340 have been detailed in the above general description, the specific implementations of steps 330 and 350 will be described in detail below.

[0161] Step 330 will be described in detail below.

[0162] In step 330, if the target version information is greater than the current version information of the application installed on the terminal, the target installation package corresponding to the target version information is downloaded.

[0163] If multiple terminals simultaneously request to download the application's installation package file from the server corresponding to the application, the server will need to process multiple download requests concurrently, leading to a rapid consumption of server bandwidth and potential bandwidth bottlenecks and network congestion, thus slowing down the download speed. Simultaneously processing multiple download requests also consumes significant CPU and memory resources, placing a heavy burden on the server. Therefore, this disclosure provides an installation package download scheme that matches permissions for each terminal, effectively controlling the number of terminals downloading the application's installation package file within the same timeframe, thereby ensuring download speed and reducing server load.

[0164] Please refer to Figure 4 In one embodiment, step 330 specifically includes, but is not limited to, the following steps 410-420:

[0165] Step 410: If the target version information is greater than the current version information of the application installed on the terminal, then determine the terminal summary information corresponding to the terminal.

[0166] Step 420: If it is determined that the terminal has download permission based on the terminal summary information, then download the target installation package of the target version.

[0167] Steps 410-420 are described in detail below.

[0168] In step 410, the terminal summary information is used to characterize the specific information of the terminal in summary form.

[0169] In this specific implementation, if the target version information is greater than the current version information of the application installed on the terminal, it indicates that a new version of the application exists. Based on this, the plugin installed on the terminal and bound to the application can, with authorization, obtain the terminal information and perform hash calculation on the terminal information using a hash function to convert the terminal information into a digest value, thus obtaining the terminal digest information. The terminal information includes, but is not limited to, the terminal model, hardware serial number, MAC address, operating system type, and IP address, etc.

[0170] In another embodiment, the terminal information can also be converted into a byte array, and the terminal information can be converted from text form to binary form to obtain a target byte. The target byte is used as terminal digest information, wherein the size of the target byte generally does not exceed 256.

[0171] In step 420, download permission is used to indicate whether the terminal is allowed to download the installation package file corresponding to the target version information from the server at the current time.

[0172] In this specific implementation, if the terminal is determined to have download permissions based on the terminal summary information, the server will provide the plugin installed on the terminal with an entry point for downloading the installation package corresponding to the target version information. Based on this, the plugin can download the target installation package file corresponding to the target version information from the server according to the installation package download entry point.

[0173] The advantage of this embodiment is that when the target version information is greater than the current version information of the application installed on the terminal, the plugin determines whether the terminal has download permission based on the terminal summary information. Only when it is determined that the terminal has download permission at the current time can the server download the installation package file corresponding to the target version information. This takes into account the permission matching of the terminal when upgrading the application. In this way, the number of terminals downloading the application installation package file in the same time can be effectively controlled, thereby ensuring the download speed of the installation package on each terminal and reducing the computing pressure on the server.

[0174] In one embodiment, the specific process of determining whether a terminal has download permissions based on terminal summary information may include, but is not limited to, the following steps:

[0175] Get the first value corresponding to the terminal with download permission at the current time;

[0176] The target remainder is obtained by performing a modulo operation based on the terminal summary information and the number of installed terminals corresponding to the application.

[0177] If the target remainder is the same as the first value, then the terminal is determined to have download permission.

[0178] The first value refers to an integer value randomly selected by the server at various time periods. The number of installed terminals refers to the total number of terminals with the application installed.

[0179] Specifically, first, after setting the range of the first value, the server uses a random number generator to output a random integer, which is then used as the first value corresponding to the terminal with download permission at the current time. Next, the server performs a modulo operation between the terminal digest information provided by the plugin and the number of installed terminals, dividing the terminal digest information by the number of installed terminals to obtain the target remainder. Further, the target remainder is compared with the first value. If the target remainder and the first value are the same, it indicates that the terminal has download permission and has been granted permission by the server to download the application's installation package file at the current time; therefore, the terminal is confirmed to have download permission. If the target remainder and the first value are different, it indicates that the terminal has not received download permission, and the server has not granted it permission to download the application's installation package file at the current time. In this case, the server will refuse to provide the plugin installed on that terminal with the download entry for the application's installation package file.

[0180] For example, at a certain time, the server uses the integer value 10 output by the random number generator as the first value. When the modulo operation is performed based on the terminal digest information of terminal A and the number of installed terminals, and the target remainder is 12, since 10 is not equal to 12, it is assumed that the plugin installed on terminal A does not have permission to download the application's installation package at the current time. Therefore, the server will not provide an entry point for downloading the application's installation package file. However, when the modulo operation is performed based on the terminal digest information of terminal B and the number of installed terminals, and the target remainder is 10, it is assumed that the plugin installed on terminal B does not have permission to download the application's installation package at the current time. Therefore, the server will provide an entry point for downloading the application's installation package file, allowing the plugin on terminal B to download the latest version of the application's installation package file.

[0181] The advantage of this embodiment is that by using terminal summary information and the number of installed terminals to perform a modulo operation to obtain the target remainder, and by using the mapping relationship between various values ​​of the target remainder and the first value, the terminal with download permission can be identified from multiple terminals that have submitted download requests. The download entry is only provided to the plugins installed on the terminals with download permission, which can more conveniently determine the download permission of each terminal and control the number of terminal plugins downloading the installation package at the same time, thereby improving the security and efficiency of application installation package download.

[0182] Since unstable networks can lead to download failures, lack of Wi-Fi connection consumes mobile data, and real-time detection and downloading can result in high resource consumption, this disclosure provides a condition-based application upgrade scheme. This scheme ensures that the latest application installation package is downloaded only when the terminal's network connection status and the current time meet the conditions, thereby improving the success rate of installation package downloads and reducing the consumption of mobile data resources during installation package downloads.

[0183] Please refer to Figure 5 In one embodiment, step 330 specifically includes, but is not limited to, the following steps 510-530:

[0184] Step 510: Determine the network connection status of the terminal at the current time;

[0185] Step 520: If the network connection status and current time meet the preset download conditions, compare the target version information with the current version information of the application installed on the terminal.

[0186] Step 530: If the target version information is greater than the current version information of the application installed on the terminal, then download the target installation package corresponding to the target version information.

[0187] Steps 510-530 are described in detail below.

[0188] In step 510, the network connection status is used to indicate whether the terminal is connected to a mobile hotspot (WiFi) at the current time, and to indicate the terminal's upload speed and download speed at the current time, etc.

[0189] In this specific implementation, firstly, it is detected whether the terminal is connected to a mobile hotspot at the current time. Then, if the terminal is connected to a mobile hotspot at the current time, the network connection status of the terminal is determined to be connected; if the terminal is not connected to a mobile hotspot at the current time, the network connection status of the terminal is determined to be disconnected.

[0190] In steps 520-530, the preset download conditions are used to indicate that the target installation package corresponding to the target version information will only be automatically downloaded when the terminal is connected to a mobile hotspot and the current time is the download trigger time.

[0191] In this specific implementation, if the network connection status is "connected" and the current time is the download trigger time, then the network connection status and the current time are considered to meet the preset download conditions. Based on this, firstly, the target version information and the current version information of the application installed on the terminal are compared to determine whether a downloaded installation package does not exist on the terminal, and whether the version of the installation package currently used by the application on the terminal is lower than the latest version released on the server. Next, if the target version information is greater than the current version information of the application installed on the terminal, it indicates that the latest version released on the server is newer than the current version used by the application. Therefore, the target installation package corresponding to the target version information is downloaded via a plugin. To improve version comparison efficiency, the version number in the target version information is generally compared with the version number in the current version information.

[0192] For example, if the download trigger time is preset to start from the current time, and every hour thereafter is a download trigger moment, where the current time is 12 o'clock, then when 1 o'clock arrives, if the terminal is connected to a mobile hotspot, the plugin will automatically download the target installation package corresponding to the target version information that is greater than the current version from the server, and clean up expired installation package files.

[0193] The advantage of this embodiment is that download conditions are preset during the application upgrade process. Only when the terminal's network connection status and current time meet the preset download conditions will the installation package corresponding to the target version information higher than the current version of the application be downloaded from the server. This can improve the success rate of installation package download and reduce the consumption of traffic resources for installation package download.

[0194] Because the continuous storage of downloaded installation packages for all versions of the application on the local machine as the application is constantly upgraded can lead to the occupation of local resources. Therefore, in one embodiment, after determining the network connection status of the terminal at the current time, the application upgrade process further includes the following steps:

[0195] If the network connection status and the current time are determined to meet the preset download conditions, then identify the invalid installation package among the multiple application installation packages that the application has already downloaded;

[0196] Clean up invalid installation packages.

[0197] Among them, the version of the invalid installation package is lower than the current version.

[0198] Specifically, if the network connection status and current time meet the preset download conditions, it indicates that the target installation package corresponding to the target version information can be successfully downloaded. The useful installation packages on the terminal are generally the target installation package and the version installation package corresponding to the current version information. This is because if the application upgrade is successful, the application's operation depends on the target installation package; if the application upgrade fails, the application's operation still depends on the version installation package corresponding to the current version information, and not on installation packages of other versions preceding the current version information. Based on this, if the network connection status and current time meet the preset download conditions, the system finds the downloaded installation packages corresponding to versions preceding the current version information in the application's multiple downloaded application installation packages. These downloaded installation packages are then identified as invalid installation packages and the application's invalid installation packages are cleaned up.

[0199] The advantage of this embodiment is that, as the application is continuously upgraded, once the network connection status and the current time meet the preset download conditions during each upgrade, the installation packages corresponding to versions prior to the current version are cleared as invalid installation packages. This ensures that the terminal only stores the installation packages corresponding to the current version and the installation packages corresponding to the versions used before upgrading to the current version, and no longer stores installation packages of earlier versions. This reduces the occupation of terminal resources and improves the effective utilization rate of terminal resources.

[0200] In practical applications, users often check for new application releases periodically and update immediately upon release. Since plugins perform periodic version checks, situations arise where users want to update their applications before the trigger time for checking and downloading has arrived. Frequent user requests for version checks and upgrades lead to wasted network resources due to frequent upload requests and data interaction with the server. Therefore, this disclosure provides an application upgrade scheme based on a time-series comparison of user requests, which can alleviate the problem of frequent upload requests and data interaction with the server to some extent, reducing network resource waste.

[0201] Please refer to Figure 6 In one embodiment, step 330 specifically includes, but is not limited to, the following steps 610-630:

[0202] Step 610: Obtain the timestamp of the last time the target version information was fetched;

[0203] Step 620: If the difference between the timestamp and the current time is greater than or equal to a preset threshold, then compare the target version information and the current version information.

[0204] Step 630: If the target version information is greater than the current version information, then download the target installation package corresponding to the target version information.

[0205] Steps 610-630 are described in detail below.

[0206] In step 610, the timestamp of the last time the target version information was fetched is used to indicate the specific time when the user fetched the target version information of the application from the server through interactive operations with the terminal.

[0207] In this specific implementation, each user request to retrieve the version information of a released version of the application is recorded in the terminal log. Based on this, with authorization, a plugin can extract the request event closest to the current time from the terminal log to retrieve the version information of the released version of the application, and parse the specific time point of the application version information retrieval from that request event to obtain the timestamp of the last retrieval of the target version information.

[0208] In steps 620-630, firstly, the difference between the timestamp and the current time is compared with a preset threshold. Next, if the difference between the timestamp and the current time is greater than or equal to the preset threshold, it indicates that the time interval between two consecutive requests for application version checking by the user exceeds the minimum trigger interval, meeting the requirement to check the application version again. Based on this, the target version information is compared with the current version information of the application installed on the terminal to determine whether the downloaded installation package does not exist on the terminal and whether the version of the installation package currently used by the application on the terminal is lower than the latest version released on the server. Next, if the target version information is greater than the current version information of the application installed on the terminal, it indicates that the latest version released on the server is newer than the current version used by the application. Therefore, the target installation package corresponding to the target version information is downloaded via the plugin.

[0209] The advantage of this embodiment is that when a user requests to obtain application version information, the difference between the timestamp of the user's last fetch of the target version information and the current time is compared with a preset threshold. This determines whether the time interval between two consecutive requests for application version detection is greater than the minimum trigger interval. Only when the time interval between two consecutive requests is greater than the minimum trigger interval will the plugin respond to the user's current request to perform version comparison and installation package download operations. This method compares the time difference of user requests in terms of timing, which to some extent solves the problem of frequent upload requests and data interaction with the server, and can reduce the waste of network resources caused by application upgrade processing.

[0210] Because when users frequently request information retrieval and upgrades for applications, the latest version of the application's installation package may have been partially downloaded, but due to factors such as network interruptions, the download may not have been complete and requires a waiting period before the conditional download can resume, resulting in a certain delay. When a user requests the latest version of the installation package and finds that only a portion has been downloaded, the user tends to continue downloading the latest version. Therefore, this disclosure provides an application installation package download scheme based on querying the terminal's local download list, enabling rapid download of the installation package based on user requests, thus improving download efficiency and timeliness.

[0211] Please refer to Figure 7 In one embodiment, step 330 specifically includes, but is not limited to, the following steps 710-730:

[0212] Step 710: Obtain the timestamp of the last time the target version information was fetched;

[0213] Step 720: If the difference between the timestamp and the current time is less than a preset threshold, then obtain the terminal's download task list;

[0214] Step 730: If an intermediate installation package corresponding to the target version information exists in the download task list, and the target version information is greater than the current version information, then continue to download the intermediate installation package corresponding to the target version information, and use it as the target installation package corresponding to the target version information.

[0215] Steps 710-730 are described in detail below.

[0216] In step 710, the process of obtaining the timestamp of the last time the target version information was fetched is similar to that in step 610 above. To save space, it will not be described in detail again.

[0217] In step 720, the download task list is used to store intermediate installation packages that have not yet been downloaded on the terminal. These intermediate installation packages refer to the installation packages corresponding to various applications installed on the terminal that have not yet been fully downloaded.

[0218] In this specific implementation, if the difference between the timestamp and the current time is less than a preset threshold, it indicates that the time interval between two consecutive requests by the user to check the application version did not exceed the minimum trigger interval. The user's requests are too frequent, and the current time should not be used for version checking or downloading new target installation packages from the server via the plugin. Instead, it should only check if there are any incomplete installation packages on the terminal that need to be downloaded according to the user's request. Based on this, with authorization, the plugin obtains the terminal's download task list to check if there are any incomplete installation package files related to the application in the download task list.

[0219] In step 730, firstly, the download task list is queried based on the application's application identifier to check if there is an incomplete installation package corresponding to that application identifier. Next, if an intermediate installation package corresponding to the target version information exists in the download task list, and the target version information is greater than the current version information, it indicates that a portion of the installation package corresponding to the target version information has already been downloaded. Therefore, the incomplete installation package file is directly downloaded via the plugin, and the completed intermediate installation package is used as the target installation package.

[0220] like Figure 8 As shown, when the difference between the timestamp and the current time is less than a preset threshold, the plugin calls the terminal's local download task list, which records incomplete download tasks and their progress. Specifically, the incomplete download tasks include: an installation package for application version number xxxk.v4.01 with a download progress of 50%; an installation package for application K with version number Xxx.v2.24 with a download progress of 12%; and an installation package for another application with version number xxxxXxxbb.v3.17 with a download progress of 88%. These download tasks were temporarily stopped because the terminal disconnected from the mobile hotspot. Based on this, since the latest version of application K is Xxx.v2.24, and the download task list already shows a 12% download progress for the corresponding version number, continuing to download that installation package will yield the target installation package.

[0221] The advantage of this embodiment is that it takes into account situations where the target installation package corresponding to the target version information of the application is downloaded from the server via a plugin, but the target installation package is not completely downloaded due to factors such as network interruption. The system searches for the installation package corresponding to the application in the local download task list on the terminal. If an intermediate installation package corresponding to the target version information exists in the download task list, and the target version information is greater than the current version information, this intermediate installation package is considered the incomplete target installation package. The system can then directly continue downloading this intermediate installation package based on the user's request, ensuring that the incomplete target installation package is completely downloaded to the local terminal. This improves the download efficiency of the installation package. In this way, in addition to periodically triggered upgrade operations, the installation package download and upgrade operations can also be completed based on user requests, which is beneficial for improving the timeliness of application upgrades.

[0222] In one embodiment, after obtaining the terminal's download task list, the application upgrade method further includes the following steps:

[0223] If an intermediate installation package for the application exists in the download task list, and the version information of the intermediate installation package is less than the target version information, then download the target installation package corresponding to the target version information.

[0224] Clear the intermediate installation packages corresponding to the application from the download task list.

[0225] Specifically, if an intermediate installation package for an application exists in the download task list, and the version information of the intermediate installation package is lower than the target version information, it indicates that the incomplete intermediate installation package of the application in the download task list is no longer the latest version installation package, and continuing to keep it will occupy terminal memory. Therefore, the intermediate installation package corresponding to the application is removed from the download task list, and the target installation package corresponding to the target version information is downloaded when the user request meets the requirements after a certain period of time, or when the network connection status and time meet the preset download conditions.

[0226] like Figure 9As shown, when the difference between the timestamp and the current time is less than a preset threshold, the plugin calls the local download task list on the terminal. This list records incomplete download tasks and their progress. Specifically, the incomplete download tasks include: an installation package for application version number xxxk.v4.01 with a download progress of 50%; an installation package for application K with version number Xxx.v2.22 with a download progress of 78%; and an installation package for a third application, distinct from the other two, with version number xxxxXxxbb.v3.17, with a download progress of 88%. Based on this, since the version number of the incomplete installation package for application K in the download task list is less than the latest target version published on the server, it indicates that the incomplete installation package is no longer the latest version. Therefore, the incomplete installation package can be directly deleted, and the target installation package corresponding to the target version information will be downloaded when the user request meets the requirements, or when the network connection status and time meet the preset download conditions.

[0227] The advantage of this embodiment is that it takes into account the situation where the version of an intermediate installation package that was previously downloaded but not fully downloaded is lower than the version of the target installation package. Such intermediate installation packages are not very meaningful for application version upgrades, but they will occupy terminal memory and terminal resources. Therefore, if there is an intermediate installation package corresponding to the application in the download task list, and the version information of the intermediate installation package is lower than the target version information, the intermediate installation package of the application is cleared, thereby releasing the occupied terminal memory and terminal resources, and the target installation package is downloaded at an appropriate time to update the application, which can reduce the occupation of terminal resources.

[0228] like Figure 10The diagram shows the overall flowchart for intelligently downloading the target installation package corresponding to the target version information of the application. Specifically, steps 1001 and 1002 are executed to set periodic triggers and detect the arrival of a preset download trigger time. Periodic and conditional triggers for application upgrade processing are set through a plugin. Specifically, when the terminal is connected to WiFi, version detection of the application is actively triggered, and when the terminal is disconnected from WiFi, the download of the installation package corresponding to the new version of the application from the server is stopped. When actively triggering version detection of the application when the terminal is connected to WiFi, it is also necessary to check whether the current time has reached the preset download trigger time. Only when the current time reaches the preset download trigger time will the version detection and installation package download operations be actually performed. Further, step 1003 is executed to delete expired installation package files. Specifically, during the version detection and installation package download process, the plugin cleans up expired installation package files in the terminal's local storage that have expired configurations and are no longer needed. Next, steps 1004 and 1005 are executed to retrieve the target installation package file from the server and save the configuration information and retrieval time information. Specifically, the plugin retrieves the target installation package corresponding to the target version information from the server to obtain the latest download data. Based on the target version information, the current configuration information of the application installed on the terminal is determined, and the current configuration information and the time information of the target version information retrieval are saved. Further, step 1006 is executed to determine whether the target installation package downloaded from the server is newer than the version currently used by the application, and whether the application installation package is not available locally on the terminal. If the target installation package is newer than the version currently used by the application, or if the application installation package is not available locally on the terminal, the download operation in step 1007 is executed, and the target installation package is downloaded to the terminal for storage via the plugin, and the intelligent download process ends. If the application installation package is available locally on the terminal, and the target installation package is not newer than the version currently used by the application, it indicates that the current version of the application is the latest and does not need to be updated. On the other hand, considering the scenario where the user actively triggers an application version update, steps 1008 and 1009 are executed. When the user requests to read the configuration information of the application installed on the terminal and requests a version upgrade, the plugin reads the time when the user last pulled the application's configuration and version information. Further, step 1010 is executed to determine if the time difference between the current request time and the last pull time is greater than the minimum trigger time. If the time difference is greater than the minimum trigger time, then operations such as deleting expired installation package files are performed, similar to the specific process of the periodic and conditional triggering described above. If the time difference is less than the minimum trigger time, then step 1011 is further executed to determine if there is a download list of incomplete installation packages on the terminal.If the terminal has a download list of incomplete installation packages, proceed to step 1006 to determine if the target installation package downloaded from the server is newer than the application's current version, or if the terminal does not have the application's installation package locally. Then proceed to step 1007 to download the target installation package based on the determination. The specific process is similar to steps 710-730 above. Therefore, automatically downloading the target installation package corresponding to the target version information via a plugin generally involves multiple steps, including periodic checks, data retrieval, version comparison, and download execution. Automatically downloading the target installation package corresponding to the target version information via a plugin allows for automatic download of the latest installation package in a Wi-Fi environment, while also cleaning up expired files, ensuring the application remains up-to-date.

[0229] Step 350 will be described in detail below.

[0230] In step 350, if the running status meets the first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal.

[0231] In this specific implementation, if the running status indicates that the application is not running in the foreground and no functions are enabled, then the application's running status is determined to meet the first condition, and the application installed on the terminal can be directly upgraded. Based on this, the target installation package is used to completely replace the current version of the application's installation package on the terminal, thus completely overwriting the current version and achieving the application upgrade.

[0232] Since applications often contain multiple types of functions, and the demand for these functions varies at different times, the specific types of functions invoked, as well as the actual number and duration of these invocations, will also differ. If, when an application detects that a function is enabled, it waits indefinitely for the function to be manually disabled so that the application runs in the background, the waiting time can be quite long, leading to poor application update timeliness. Therefore, this disclosure provides a solution for automatically detecting the running status of an application and promptly shutting down and updating the application. Under certain conditions, it can promptly disable enabled functions within the application, thereby improving the timeliness of application updates.

[0233] In this embodiment of the disclosure, the running state includes the functions enabled by the application and the time elapsed since the last time the function was called until the current time.

[0234] The functions enabled by an application refer to a specific set of functions that are activated within the application. These functions may include, but are not limited to: office functions for creating spreadsheets and documents; multimedia processing functions for handling audio, video, and images; and conversational functions for information exchange between users.

[0235] The pause duration refers to the time interval between the last time the call was made and the current time. The pause duration can be quantified by the time difference between the last time the call was made and the current time.

[0236] In this embodiment, the first condition is used to indicate the number of functions enabled in the application and under what circumstances the invocation meets the upgrade requirements.

[0237] Please refer to Figure 11 In one embodiment, step 350 specifically includes, but is not limited to, the following steps 1110-1150:

[0238] Step 1110: Calculate the average stop call duration based on the stop call duration of each enabled function;

[0239] Step 1120: Calculate the first score based on the average time the call is stopped;

[0240] Step 1130: Calculate the second score based on the total number of enabled functions;

[0241] Step 1140: Calculate the first total score based on the first score and the second score;

[0242] Step 1150: If the first total score is greater than the first threshold, close the application and replace the current version of the application on the terminal with the target installation package.

[0243] Steps 1110-1150 are described in detail below.

[0244] In step 1110, the average stop call duration is used to indicate the average duration during which all functions in the application that are in the enabled state are stopped from being called.

[0245] In the specific implementation of this embodiment, firstly, for each enabled function, the time difference between the last call time and the current time is calculated, and this time difference is used as the stop call duration for that function. Next, the stop call durations of all enabled functions are averaged to obtain the average stop call duration.

[0246] In step 1120, the first score indicates the score assigned to the application based on the average downtime of its enabled functions when considering whether to close the application. Since a longer average downtime indicates that all enabled functions have not been invoked for a long time and are not currently needed, these functions can be directly disabled for upgrade purposes. Therefore, the first score is an increasing function of the average downtime.

[0247] In this specific implementation, firstly, with authorization, an increasing function is invoked, using the average call-to-stop duration as the independent variable and the score as the dependent variable. Next, the calculated average call-to-stop duration is input into a preset function, and the score output by the preset function is used as the first score.

[0248] In step 1130, the second score indicates the score assigned to the application based on the total number of functions enabled, in determining whether to close the application. A higher total number of enabled functions indicates a greater current demand for those functions, and these enabled functions should not be directly disabled for upgrade purposes. The second score is a subtractive function of the total number of functions.

[0249] In the specific implementation of this embodiment, the process of calculating the second score based on the total number of enabled functions is similar to step 1120 above. To save space, it will not be described again.

[0250] In step 1140, in this specific implementation, firstly, a first weight and a second weight are determined, wherein the first weight is used to indicate the importance of on-chain resource overhead in screening candidate transactions, and the second weight is used to indicate the importance of transaction timestamps in screening candidate transactions. Next, the product of the first weight and the first score, and the product of the second weight and the second score are added together to obtain a first total score.

[0251] In step 1150, firstly, the first total score is compared with the first threshold. If the first total score is greater than the first threshold, it indicates that there are not many functions currently enabled, and these enabled functions have not been called for a long time. For upgrade purposes, these enabled functions can be directly turned off. Therefore, the application is closed, and the current version installation package of the application on the terminal is fully replaced with the target installation package. However, if the first total score is not greater than the first threshold, it indicates that there are many functions currently enabled, and these enabled functions are frequently called. For upgrade purposes, these enabled functions cannot be directly turned off. Therefore, after waiting for a period of time, the application's running status is identified again to see if it meets the first condition. Only after the running status meets the first condition is the upgrade process performed.

[0252] The advantage of this embodiment is that it automatically detects the functions that are running in the application and the duration of each function's shutdown. It combines the average duration of the running functions and the total number of running functions to determine when to stop the application. It takes into account both the average duration of the running functions and the total number of running functions. Based on a score calculation and weighted calculation method, it can close the running functions in the application in a timely manner under certain conditions, realize the application version upgrade, and improve the timeliness of application upgrades.

[0253] Since network interruptions or latency often lead to application version updates failing, as do insufficient terminal memory and computing resources, this disclosure provides a scheme for pre-detecting the execution environment during version upgrades, which can improve the stability and success rate of application upgrades.

[0254] Please refer to Figure 12 In one embodiment, step 350 specifically includes, but is not limited to, the following steps 1210-1220:

[0255] Step 1210: If the running status meets the first condition, obtain the execution environment parameters of the application;

[0256] Step 1220: Based on the execution environment parameters, replace the current version of the application on the terminal with the target installation package.

[0257] Steps 1210-1220 are described in detail below.

[0258] In step 1210, execution environment parameters refer to various parameters used to describe and control the operating environment during the upgrade process when performing an upgrade operation on the application installed on the terminal. These execution environment parameters may include the terminal's network speed, remaining memory size, and remaining computing power.

[0259] In this specific implementation, if the running state meets the first condition, it indicates that, considering the application's own performance, the application installed on the terminal can be directly upgraded. However, considering whether the terminal meets the hardware and software environment requirements for performing the application upgrade operation, it is also necessary to obtain the application's execution environment parameters. Based on this, with authorization, a plugin is used to collect hardware and software parameters such as network speed, remaining memory size, and remaining computing power of the terminal where the application is installed, and the collected parameters are integrated into execution environment parameters.

[0260] In step 1220, the specific process of replacing the current version of the application on the terminal with the target installation package based on the execution environment parameters includes, but is not limited to, the following steps:

[0261] Determine the third score based on network speed;

[0262] The fourth score is determined based on the remaining memory size;

[0263] The fifth score is determined based on the remaining computational capacity.

[0264] Calculate the second total score based on the third, fourth, and fifth scores;

[0265] If the second total score is greater than the second threshold, the target installation package will be used to fully replace the current version of the application on the terminal.

[0266] The third score quantifies the impact of the terminal's network speed on application upgrades. Since a higher network speed is more suitable for application upgrades, the third score is an increasing function of network speed.

[0267] The fourth score quantifies the impact of the terminal's remaining memory size on application upgrades. Since a larger remaining memory size allows for the smooth storage of even large target installation packages containing target version information, making it more suitable for application upgrades, the fourth score is an increasing function of the remaining memory size.

[0268] The fifth score quantifies the impact of the terminal's remaining computing power on application upgrades. Since a larger remaining computing power on the terminal better meets the computational needs of application version upgrades, the fifth score is an increasing function of the remaining computing power.

[0269] In this specific implementation, the process of determining the third score based on network speed, the fourth score based on remaining memory size, and the fifth score based on remaining computing power size is similar to step 1120 above. The process of calculating the second total score based on the third, fourth, and fifth scores is similar to step 1140 above. If the second total score is greater than the second threshold, the process of fully replacing the current version of the application on the terminal with the target installation package is similar to step 1150 above. For brevity, these details will not be elaborated further.

[0270] The advantage of this embodiment is that it takes into account the pre-detection of the execution environment during version upgrades, obtains various execution environment parameters such as the terminal's network speed, remaining memory size, and remaining computing power, and introduces a score calculation and weighted operation method to quantify the parameter values ​​of the execution environment. At the same time, it uses a threshold comparison method to measure whether the execution environment at the current time meets the requirements for upgrading the application. The application upgrade process is only executed when the second total score is greater than the second threshold, which can improve the stability and success rate of application upgrades.

[0271] Because the contents of application installation packages are often arbitrarily modified during the download process from servers, this can lead to application update failures when using the downloaded packages, resulting in low update security and success rate. Therefore, this disclosure provides an application upgrade scheme based on security verification, which performs security verification on the target installation package downloaded to the local terminal, improving the security and success rate of application upgrades.

[0272] Please refer to Figure 13 In one embodiment, the specific process of fully replacing the current version installation package of the application on the terminal with the target installation package may include, but is not limited to, the following steps 1310-1330:

[0273] Step 1310: Decompress the target installation package to obtain the target resource files and target code files;

[0274] Step 1320: Based on the target version information, perform the first verification on the target resource files and target code files;

[0275] Step 1330: If the first verification passes, then replace the entire version installation package with the target resource files and target code files.

[0276] Steps 1310-1330 are described in detail below.

[0277] In step 1310, the target resource file refers to any format of resource file corresponding to the target version information of the application, such as text files, image files, audio files, and .so files, etc. The target code file refers to the bytecode data of each function corresponding to the target version information of the application. Among them, the .so file is a dynamic link library file, mainly used to implement code sharing and modularity in the terminal operating system.

[0278] In this specific implementation, with authorization, a local decompression tool is run via a plugin on the terminal. This tool browses the file structure of the target installation package and decompresses the entire package to a specified folder, yielding target resource files and target code files. The target resource files often contain images, layout files, etc., and are typically located within the res folder; the target code files are the bytecode files (classes.dex files) corresponding to the application.

[0279] In step 1320, the first verification is used to verify the integrity and validity of the target installation package.

[0280] To save space, the specific process of performing the first verification of the target resource file and the target code file in this embodiment will be described in detail below.

[0281] In step 1330, if the first verification passes, it indicates that the target installation package files are complete and valid, have not been modified during the download process, and that the target installation package is indeed the installation package provided by the object that released the target version. Based on this, the version installation package is completely replaced with the target resource files and target code files, thereby completely overwriting the current version with the target version and achieving a complete upgrade of the application.

[0282] The advantage of this embodiment is that it takes into account the security verification of the target resource files and target code files in the target installation package. The target code files cover the bytecode data that implements the various functions corresponding to the target version information, and the target resource files cover the audio-visual data such as pictures, text, and audio-visual data corresponding to the target version information. In this way, the target installation package is verified at both the underlying logic level and the application representation level, which can improve the security and success rate of application upgrades.

[0283] Please refer to Figure 14 In one embodiment, step 1320 may specifically include, but is not limited to, the following steps 1410-1450:

[0284] Step 1410: Obtain the installation package signature of the target installation package;

[0285] Step 1420: Extract the installation package verification code from the target version information;

[0286] Step 1430: Perform a digest operation on the target resource file and the target code file to obtain the installation package digest;

[0287] Step 1440: Based on the comparison between the installation package checksum and the installation package digest, perform the first sub-verification on the target resource file and the target code file;

[0288] Step 1450: Based on the installation package signature, perform a second sub-verification on the target resource files and target code files.

[0289] Steps 1410-1450 are described in detail below.

[0290] In step 1410, the installation package signature is bound to the target installation package, identifying that the target installation package is signed by a trusted developer.

[0291] In this specific implementation, since the installation package signature is generally bound to the target installation package, the portion storing the signature information is located in the target installation package, and the contents of the signature file in the target installation package are read to obtain the installation package signature of the target installation package. This installation package signature is generally obtained by encrypting the target installation package using the private key of the trusted developer who released the target installation package corresponding to the target version information.

[0292] In step 1420, the installation package verification code refers to the string provided by the trusted developer who released the target installation package in the target version information. The installation package verification code can be the MD5 value or digest value corresponding to the target installation package provided in the target version information.

[0293] In the specific implementation of this embodiment, the target version information can be parsed and the installation package verification code can be extracted from the parsing result.

[0294] In step 1430, the installation package summary is used to characterize the overall situation of the target installation package in summary form.

[0295] In this specific implementation, when the installation package checksum is an MD5 value, the MD5 algorithm is used to process the entire target installation package (including target resource files and target code files) into a fixed-length 128-bit hash value, and this hash value is used as the installation package digest. Alternatively, if the installation package checksum is calculated based on the digests of all files in the target installation package, then digest operations can be performed on each file (target resource files and target code files) in the target installation package to generate a digest value for each file. These digest values ​​are then concatenated sequentially to obtain a merged result. A digest operation is performed on the merged result to generate a final digest, which is used as the installation package digest.

[0296] In step 1440, firstly, the installation package checksum is compared with the installation package digest. Next, if the installation package checksum matches the installation package digest, it indicates that the target resource files and target code files have not been tampered with, and the first sub-verification passes. If the installation package checksum does not match the installation package digest, it indicates that the target resource files and / or target code files may have been tampered with, and the first sub-verification fails.

[0297] In step 1450, firstly, the public key of the development object providing the target installation package corresponding to the target version information is obtained from the server. The object information of the development object is generally recorded in the target version information. Next, the installation package signature is decrypted using the public key to obtain the original digest value. Then, a digest operation is performed on the target resource file and the target code file to obtain the digest value to be verified. If the original digest value is the same as the digest value to be verified, the second sub-verification is considered to have passed; if the original digest value is different from the digest value to be verified, the second sub-verification is considered to have failed.

[0298] Based on this, the target installation package is considered to have been released by a trusted developer and not modified during transmission only if both the first and second sub-verifications pass, thus confirming that the first verification has passed; if either the first or second sub-verification fails, the first verification is considered to have failed.

[0299] The advantage of this embodiment is that it performs dual verification on the target installation package. First, by comparing the installation package checksum with the installation package digest, it ensures that the integrity of the target resource files and target code files has not been tampered with (first sub-verification). Second, based on the installation package signature, it further verifies the integrity and source credibility of the files in the target installation package (second sub-verification). In this way, not only is the security of the installation package improved, but the source of the installation files used for application upgrades is also guaranteed to be reliable, protecting the security of the terminal device.

[0300] In this embodiment of the disclosure, the version installation package includes the current code file and the current resource file currently being used by the application on the terminal; the target resource file includes a first target sub-resource file and a second target sub-resource file; and the current resource file includes a first current sub-resource file and a second current sub-resource file.

[0301] The current code file refers to the bytecode data of each function corresponding to the current version information of the application.

[0302] The current resource file refers to any resource file in any format that corresponds to the current version information of the application. The first current sub-resource file refers to audio-visual files such as text files, image files, and audio files that correspond to the current version information of the application. The second current sub-resource file refers to the So file that corresponds to the current version information of the application.

[0303] The first target sub-resource file refers to the text files, image files, audio files, and other audio-visual files that correspond to the target version information of the application.

[0304] The second target sub-resource file refers to the So file corresponding to the target version information of the application.

[0305] In one embodiment, step 1330 may specifically include, but is not limited to, the following steps:

[0306] Use the target code file to perform a full replacement of the current code file corresponding to the current version of the application;

[0307] The first target sub-resource file is used to fully replace the first current sub-resource file corresponding to the current version of the application, and the second target sub-resource file is used to fully replace the second current sub-resource file corresponding to the current version of the application.

[0308] Specifically, firstly, the target resource files are categorized to obtain a first target sub-resource file and a second target sub-resource file. Then, the current resource files are categorized to obtain a first current sub-resource file and a second current sub-resource file. Next, the target code file is used to completely replace the current code file corresponding to the current version of the application, achieving a complete upgrade of the application installed on the terminal at the underlying logic level. Further, the first target sub-resource file is used to completely replace the first current sub-resource file corresponding to the current version of the application, and the second target sub-resource file is used to completely replace the second current sub-resource file corresponding to the current version of the application, achieving a complete upgrade of the application installed on the terminal at the application representation level.

[0309] like Figure 15AThe diagram illustrates how to update and upgrade an application as an independent module. Applications with the same shell project version are compatible, and a single application upgrade package can cover all applications with the same shell project version. During application upgrades, the shell project version remains unchanged, while the main project version is fully replaced as an independent module. This covers application upgrade needs across all business scenarios and eliminates the performance impact of reflection calls caused by plugin-based application management. Specifically, for an application installed on the terminal, the current version is application version 1, using shell project version 1 and main project version 1. Shell project version 1 includes the main framework startup logic and the XxxManifest.xml file. Main project version 1 includes Dex bytecode, static files, SO files, etc. When an application version 2, which is larger than application version 1, is detected, the shell project version in application version 2 remains shell project version 1, but the main project version becomes main project version 2. Therefore, when upgrading the application, replacing main project version 1 with main project version 2 achieves a complete application upgrade.

[0310] like Figure 15B The diagram illustrates the full replacement of application code files and resource files during an application upgrade. Specifically, for the array of code files corresponding to the current version of the application, a full replacement is performed using the target code files corresponding to the target version information. Specifically, the `class.dex` file in the current version's code file array is replaced with the `class.dex` file from the target code file array; the `class.2dex` file in the current version's code file array is replaced with the `class2.dex` file from the target code file array; and the `class3.dex` file in the current version's code file array is replaced with the `class3.dex` file from the target code file array. For classes in the application used to manage internal application resources, the resource class files in the current version are replaced with the target resource files corresponding to the target version information. Specifically, the resource class file `Res1` is replaced with the resource class file `NewRes1`; and the resource class file `Res2` is replaced with the resource class file `NewRes2`.

[0311] It's important to note that a shell project is a crucial concept in component-based development. It's a lightweight project, serving as the infrastructure version used to manage and organize components in an application. Its primary responsibility is managing the various business components within the application and providing a host environment for their execution. The shell project itself typically doesn't contain concrete business logic; instead, it integrates various independent business components to form a complete application. Reflection refers to the technique of dynamically loading and manipulating classes and resources within plugins in plug-in application development.

[0312] The advantage of this embodiment is that it completely replaces the current version's resource files and code files of the application with target resource files and target code files, performing a full-scale functional iteration of the application. This overcomes the limitations of dynamic frameworks and plug-in architectures in related technologies, achieving complete coverage updates for all functional modules within the application. Furthermore, compared to incremental updates, the full replacement method used in this embodiment reduces version management complexity and maintenance costs, and improves the success rate of application version updates. In addition, this embodiment achieves full version compatibility for applications installed on the terminal through a single upgrade package, effectively avoiding the version fragmentation problem of hot update patches and improving the integrity of installation files during application upgrades.

[0313] The following is a detailed description of a process for pre-optimizing code files in a target installation package according to an embodiment of this disclosure.

[0314] Please refer to Figure 16 In one embodiment, the specific process of pre-optimizing the target code files in the target installation package before fully replacing the current version of the application on the terminal with the target installation package may include, but is not limited to, the following steps 1610-1630:

[0315] Step 1610: Align the bytes in the target code file to obtain an aligned code file;

[0316] Step 1620: Perform field validation on the class files in the aligned code file to obtain the field validation results;

[0317] Step 1630: Based on the field validation results and the calling frequency of class files, determine the target class file in the class files of the aligned code file, and optimize the memory layout of the target class file.

[0318] Steps 1610-1630 are described in detail below.

[0319] In step 1610, firstly, the contents of the target code file are loaded into the terminal memory via a plugin. The target code file is typically a binary file. Next, according to the application's format requirements, the loaded target code file is aligned to 4 or 8 bytes. The contents of the target code file are traversed byte by byte, checking the alignment of each data unit. For data units that do not meet the alignment requirements, necessary padding bytes are inserted to ensure that all data units meet the alignment requirements. This updates the offset and length information of the aligned target code file, and the updated code data is written back to the target code file, resulting in the aligned code file. Here, a data unit refers to instructions, data fields, etc., within the target code file.

[0320] In step 1620, the class file refers to a file used to manage the application's internal resources. The field validation result indicates whether each field in the class file meets preset constraints. These preset constraints may include ensuring that the field type in the class file is valid, the field name conforms to naming conventions, and the field's access permissions are appropriate, etc.

[0321] In the specific implementation of this embodiment, firstly, class files are identified in the aligned code files. Next, for each class file, the class file is traversed, and the corresponding field information is extracted. The field type, field name, access permissions, and initial value of each field are then validated. If the field type of each field in the class file is valid, the field name conforms to naming conventions, the access permissions are reasonable, and the initial value is as expected, then the field validation result for the class file is considered successful. Otherwise, the field validation result for the class file is determined to be unsuccessful.

[0322] In step 1630, the call frequency is used to indicate the total number of times each class file is called within the same time period. The target class file refers to a subset of class files that are called frequently among multiple class files.

[0323] In this specific implementation, firstly, based on the field validation results of each class file, class files whose field validation results pass are selected as candidate class files. Next, a preset static analysis tool is used to analyze the call relationships of the code for each candidate class file, thereby estimating the call frequency of each candidate class file; alternatively, with authorization, the number of calls recorded during application runtime for each candidate class file within a certain time period is retrieved as the call frequency. Further, based on the call frequency, candidate class files with call frequencies exceeding a preset frequency threshold are selected as target class files, and memory layout optimization is performed on the target class files. Specifically, in memory layout optimization, the order of fields in the target class file can be rearranged according to the access frequency or size of the fields to reduce memory access latency; memory alignment optimization is performed on the rearranged fields of the target class file to improve the efficiency of field access; simultaneously, unused or redundant fields in the target class file are removed to reduce memory consumption. Finally, the target class file with optimized memory layout is written back to the aligned code file, and the content and structure of the aligned code file are updated, so that the pre-optimized target code file is used as the target code file for the full replacement operation.

[0324] The advantage of this embodiment is that it performs byte alignment and field validation on the target code file, and optimizes the memory layout based on the field validation results and call frequency. This process not only ensures that the structure of the target code file meets the expected requirements, but also improves the correctness and reliability of the target code file through field validation. Simultaneously, memory layout optimization improves the running efficiency of the target class file and reduces memory usage, thereby enhancing the overall performance and operational stability of the application after it is upgraded to the target version.

[0325] The process of restarting an application according to an embodiment of this disclosure will be described in detail below.

[0326] Please refer to Figure 17 In one embodiment, after the target installation package is used to completely replace the current version of the application on the terminal, the application upgrade process may further include, but is not limited to, the following steps 1710-1720:

[0327] Step 1710: In response to a restart request for the application, start a pre-defined empty process;

[0328] Step 1720: Based on the empty process, terminate all processes in the application except the empty process so that the target installation package corresponding to the target version information of the application can take effect.

[0329] Steps 1710-1720 are described in detail below.

[0330] A restart request is a request triggered to restart the application. An empty process is a process created in the application but not assigned any actual tasks; it is only initialized but does not execute any code.

[0331] In this specific implementation, when the plugin detects an event related to automatic restart in the application, it responds to the application's restart request by running an empty process within the application. Then, the empty process uses a legitimate inter-process communication mechanism to control the behavior of other processes, sending signals to them requesting the termination of all processes in the application except the empty process. Once the other processes receive and process the signals, they will exit voluntarily as requested. When all processes in the application except the empty process have terminated, the application restarts, and after restarting, the target installation package corresponding to the application's target version information becomes effective.

[0332] The advantage of this embodiment is that by starting a preset empty process, the empty process is used as an independent control unit to coordinate the termination of other processes in the application. This approach avoids directly terminating the main process of the application, thereby reducing abnormal situations caused by process termination. This makes the restart process more stable and reliable, allowing the application to smoothly transition to the new target version during the restart process, and enabling the new version's target installation package to take effect smoothly, thus improving the reliability and success rate of application version switching.

[0333] The implementation details of the application upgrade processing method according to the embodiments of this disclosure are described below.

[0334] like Figure 18The diagram shows the overall flowchart for upgrading the application. Specifically, steps 1801 and 1802 are executed first, where the plugin checks for updates to the application, retrieving the target version information corresponding to the latest release date from the server's released versions of the application to determine if a new version has been released. If no new version has been released, the process ends directly; if a new version has been released (the target version information corresponding to the latest release date is greater than the current version information of the application currently in use), step 1803 is further executed to determine if the terminal where the application is installed has met the smart download policy, the specific process of which is similar to steps 410-420 above. If the smart download policy has not been met, the process ends directly; if the smart download policy has been met, step 1804 is executed to trigger smart download, automatically downloading the target installation package corresponding to the target version information from the server through the plugin. Next, steps 1805 and 1806 are executed to decompress the downloaded target installation package and store the version information corresponding to the target installation package locally on the terminal. Next, step 1807 is executed to pre-optimize the target code file, a process similar to steps 1610-1630 above. Further, step 1808 is executed to determine if the application is running in the foreground. If so, step 1809 is executed to wait for the application to run in the background; if not, step 1810 is executed to trigger a process restart. Next, step 1811 is executed to determine if the target installation package has passed verification, a process similar to steps 1410-1450 above. Then, if the target installation package fails verification, steps 1812 and 1813 are executed to clear the downloaded files corresponding to the target version information and load the current version to start the application. If the target installation package passes verification, steps 1814-1817 are executed to overwrite and load new code files, new resource files, and new SO files, thus enabling the application to start with the new version.

[0335] The apparatus and device according to embodiments of this disclosure will now be described.

[0336] It is understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this embodiment, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.

[0337] It should be noted that in various specific embodiments of this application, when processing is required based on data related to the characteristics of the target object, such as target object attribute information or a set of attribute information, the permission or consent of the target object will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require obtaining target object attribute information, separate permission or consent from the target object will be obtained through pop-ups or redirection to a confirmation page. Only after obtaining the target object's separate permission or consent will the necessary target object-related data for the normal operation of the embodiments of this application be obtained.

[0338] Figure 19 A schematic diagram of the structure of an application upgrade processing apparatus 1900 provided in this embodiment of the disclosure. The application upgrade processing apparatus 1900 includes:

[0339] Execution unit 1910 is configured to execute a startup routine in response to the startup of a terminal with an installed application, to activate a plugin bound to the application, wherein the plugin is pre-downloaded to the terminal along with the application and code for activating the plugin at startup is embedded in the startup routine;

[0340] The acquisition unit 1920 is used to acquire the target version information of the application through a plugin. The target version information is the version information of the latest version released in the publicly available versions of the application.

[0341] Download unit 1930 is used to download the target installation package corresponding to the target version information if the target version information is greater than the current version information of the application installed on the terminal;

[0342] The identification unit 1940 is used to identify the running status of an application on the terminal.

[0343] Upgrade unit 1950 is used to fully replace the current version installation package of the application on the terminal with the target installation package if the running status meets the first condition.

[0344] Optionally, the running status includes the functions enabled by the application and the time elapsed since the function was last invoked until the current time.

[0345] Upgrade Unit 1950 is used for:

[0346] Calculate the average downtime based on the downtime of each enabled function;

[0347] Based on the average time to stop calling, a first score is calculated, which is an increasing function of the average time to stop calling.

[0348] Based on the total number of functions enabled, calculate the second score, which is a subtractive function of the total number;

[0349] Calculate the first total score based on the first score and the second score;

[0350] If the first total score is greater than the first threshold, close the application and replace the current version of the application on the terminal with the target installation package.

[0351] Optionally, the upgrade unit 1950 includes:

[0352] A module (not shown) is used to obtain the execution environment parameters of the application if the running state meets the first condition.

[0353] The first replacement module (not shown) is used to perform a full replacement of the current version installation package of the application on the terminal with the target installation package based on the execution environment parameters.

[0354] Optionally, the execution environment parameters include the terminal's network speed, remaining memory size, and remaining computing power.

[0355] The first replacement module (not shown) is used for:

[0356] Based on network speed, a third fraction is determined, which is an increasing function of network speed;

[0357] Based on the remaining memory size, determine the fourth fraction, which is an increasing function of the remaining memory size;

[0358] Based on the remaining computing power, a fifth fraction is determined, which is an increasing function of the remaining computing power.

[0359] Calculate the second total score based on the third, fourth, and fifth scores;

[0360] If the second total score is greater than the second threshold, the target installation package will be used to fully replace the current version of the application on the terminal.

[0361] Optionally, the download unit 1930 includes:

[0362] A determination module (not shown) is used to determine the terminal summary information corresponding to the terminal if the target version information is greater than the current version information of the application installed on the terminal.

[0363] A download module (not shown) is used to download the target installation package of the target version if it is determined from the terminal summary information that the terminal has download permissions.

[0364] Optionally, the determining module (not shown) is used for:

[0365] Determining that a terminal has download permissions based on terminal summary information includes:

[0366] Get the first value corresponding to the terminal with download permission at the current time;

[0367] The target remainder is obtained by performing a modulo operation based on the terminal summary information and the number of installed terminals corresponding to the application.

[0368] If the target remainder is the same as the first value, then the terminal is determined to have download permission.

[0369] Optionally, the target installation package for the target version includes target code files;

[0370] The application upgrade processing apparatus 1900 also includes an optimization unit (not shown), which is used for:

[0371] The bytes in the target code file are aligned to obtain an aligned code file.

[0372] Perform field validation on the class files in the aligned code file to obtain the field validation results;

[0373] Based on the field validation results and the frequency of class file calls, the target class file is determined in the class files of the aligned code file, and the memory layout of the target class file is optimized.

[0374] Optionally, the upgrade unit 1950 includes:

[0375] The decompression module (not shown) is used to decompress the target installation package to obtain the target resource files and target code files;

[0376] A verification module (not shown) is used to perform a first verification on the target resource files and target code files based on the target version information;

[0377] The second replacement module (not shown) is used to perform a full replacement of the version installation package with the target resource files and target code files if the first verification passes.

[0378] Optionally, the verification module (not shown) is used for:

[0379] Obtain the installation package signature of the target installation package;

[0380] Extract the installation package verification code from the target version information;

[0381] Perform a digest operation on the target resource files and target code files to obtain the installation package digest;

[0382] Based on the comparison between the installation package checksum and the installation package digest, the first sub-verification is performed on the target resource file and the target code file;

[0383] Based on the installation package signature, a second sub-verification is performed on the target resource files and target code files.

[0384] Optionally, the version installation package includes the current code file and current resource file currently being used by the application on the terminal; the target resource file includes a first target sub-resource file and a second target sub-resource file; the current resource file includes a first current sub-resource file and a second current sub-resource file;

[0385] The second replacement module (not shown) is used for:

[0386] Use the target code file to perform a full replacement of the current code file corresponding to the current version of the application;

[0387] The first target sub-resource file is used to fully replace the first current sub-resource file corresponding to the current version of the application, and the second target sub-resource file is used to fully replace the second current sub-resource file corresponding to the current version of the application.

[0388] Optionally, the application upgrade processing apparatus 1900 further includes a rollback unit (not shown), which is used for:

[0389] If the first verification fails, the downloaded files of the target installation package will be deleted;

[0390] Load the code files from the installation package corresponding to the current version to start the application.

[0391] Optionally, the download unit 1930 is used for:

[0392] Determine the terminal's network connection status at the current time;

[0393] If the network connection status and current time meet the preset download conditions, then compare the target version information with the current version information of the application installed on the terminal.

[0394] If the target version information is greater than the current version information of the application installed on the terminal, then download the target installation package corresponding to the target version information.

[0395] Optionally, the application upgrade processing apparatus 1900 further includes a first clearing unit (not shown), which is used for:

[0396] If the network connection status and the current time are determined to meet the preset download conditions, then identify the invalid installation package among the multiple application installation packages that the application has already downloaded;

[0397] Clean up invalid installation packages, where the version of the invalid installation package is lower than the current version.

[0398] Optionally, the download unit 1930 is used for:

[0399] Get the timestamp of the last time the target version information was fetched;

[0400] If the difference between the timestamp and the current time is greater than or equal to a preset threshold, then the target version information and the current version information are compared.

[0401] If the target version information is greater than the current version information, then download the target installation package corresponding to the target version information.

[0402] Optionally, the download unit 1930 is used for:

[0403] Get the timestamp of the last time the target version information was fetched;

[0404] If the difference between the timestamp and the current time is less than a preset threshold, then the download task list of the terminal is obtained, wherein the download task list is used to store intermediate installation packages that have not been downloaded in the terminal.

[0405] If an intermediate installation package corresponding to the target version information exists in the download task list, and the target version information is greater than the current version information, then continue downloading the intermediate installation package corresponding to the target version information, and use it as the target installation package corresponding to the target version information.

[0406] Optionally, the application upgrade processing apparatus 1900 further includes a second cleaning unit (not shown), which is used for:

[0407] If an intermediate installation package for the application exists in the download task list, and the version information of the intermediate installation package is less than the target version information, then download the target installation package corresponding to the target version information.

[0408] Clear the intermediate installation packages corresponding to the application from the download task list.

[0409] Optionally, the application upgrade processing device 1900 further includes a restart unit (not shown), which is used for:

[0410] In response to a restart request for the application, a pre-defined empty process is launched;

[0411] Based on empty processes, terminate all processes in the application except for the empty process so that the target installation package corresponding to the target version information of the application can take effect.

[0412] Reference Figure 20 , Figure 20 The structural block diagram of the terminal portion of the application upgrade processing method according to the embodiments of this disclosure is shown. The terminal may be... Figure 1 The terminal shown includes: a radio frequency (RF) circuit 2010, a memory 2015, an input unit 2030, a display unit 2040, a sensor 2050, an audio circuit 2060, a wireless fidelity (WiFi) module 2070, a processor 2080, and a power supply 2090, among other components. Those skilled in the art will understand that... Figure 20 The terminal structure shown does not constitute a limitation on mobile phones or computers and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0413] The RF circuit 2010 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 2080; in addition, it transmits uplink data to the base station.

[0414] The memory 2015 can be used to store software programs and modules, and the processor 2080 executes various functional applications and data processing of the target terminal by running the software programs and modules stored in the memory 2015.

[0415] The input unit 2030 can be used to receive input numeric or character information, and to generate key signal inputs related to the settings and function control of the target terminal. Specifically, the input unit 2030 may include a touch panel 2031 and other input devices 2032.

[0416] The display unit 2040 can be used to display input or provided information, as well as various menus of the target terminal. The display unit 2040 may include a display panel 2041.

[0417] Audio circuitry 2060, speaker 2061, and microphone 2062 provide an audio interface.

[0418] In this embodiment, the processor 2080 included in the terminal can execute the application upgrade processing method of the previous embodiment.

[0419] Figure 21 This is a structural block diagram of a server portion for implementing the application upgrade processing method of the embodiments of this disclosure. The server may be... Figure 1The server shown is a complex example. Servers can vary significantly in configuration and performance, and may include one or more Central Processing Units (CPUs) 2122 (e.g., one or more processors) and memory 2132, and one or more storage media 2130 (e.g., one or more mass storage devices) for storing application programs 2142 or data 2144. The memory 2132 and storage media 2130 can be temporary or persistent storage. The program stored in the storage media 2130 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 2122 may be configured to communicate with the storage media 2130 and execute the series of instruction operations stored in the storage media 2130 on the server.

[0420] The server may also include one or more power supplies 2126, one or more wired or wireless network interfaces 2150, one or more input / output interfaces 2158, and / or one or more operating systems 2141, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0421] The central processing unit 2122 in the server can be used to execute the application upgrade processing method of the embodiments of this disclosure.

[0422] This disclosure also provides a computer-readable storage medium for storing a computer program for executing the application upgrade processing method of the foregoing embodiments.

[0423] This disclosure also provides a computer program product comprising a computer program. A processor of an electronic device reads and executes the computer program, causing the electronic device to perform the application upgrade processing method described above.

[0424] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “including,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.

[0425] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0426] It should be understood that in the description of the embodiments of this disclosure, "multiple" means two or more, "greater than", "less than", "exceeding" etc. are understood to exclude the number itself, and "above", "below", "within" etc. are understood to include the number itself.

[0427] In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0428] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0429] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0430] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0431] It should also be understood that the various implementation methods provided in this disclosure can be combined arbitrarily to achieve different technical effects.

[0432] The above is a detailed description of the embodiments of this disclosure. However, this disclosure is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this disclosure. All such equivalent modifications or substitutions are included within the scope defined by the claims of this disclosure.

Claims

1. A method for upgrading an application, characterized in that, The method includes: In response to the power-on of a terminal with the application installed, a startup routine is executed to activate a plugin bound to the application, wherein the plugin is pre-downloaded to the terminal along with the application, and code for activating the plugin at power-on is embedded in the startup routine; The plugin is used to obtain the target version information of the application, which is the latest version of the publicly available version of the application. If the target version information is greater than the current version information of the application installed on the terminal, download the target installation package corresponding to the target version information; Identify the running status of the application on the terminal; If the running state meets the first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal.

2. The method according to claim 1, characterized in that, The running status includes the functions enabled by the application and the time elapsed since the last time the function was invoked. If the running state meets the first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal, including: Calculate the average stop call duration based on the stop call duration of each enabled function; Based on the average call stop duration, a first score is calculated, where the first score is an increasing function of the average call stop duration. Based on the total number of functions enabled, a second score is calculated, which is a subtractive function of the total number. Calculate the first total score based on the first score and the second score; If the first total score is greater than the first threshold, the application is closed, and the current version installation package of the application on the terminal is fully replaced with the target installation package.

3. The method according to claim 1, characterized in that, If the running state meets the first condition, the target installation package is used to completely replace the current version installation package of the application on the terminal, including: If the running state meets the first condition, obtain the execution environment parameters of the application; Based on the execution environment parameters, the target installation package is used to completely replace the current version installation package of the application on the terminal.

4. The method according to claim 3, characterized in that, The execution environment parameters include the terminal's network speed, remaining memory size, and remaining computing power. The step of replacing the current version installation package of the application on the terminal with the target installation package based on the execution environment parameters includes: Based on the network speed, a third score is determined, which is an increasing function of the network speed; Based on the remaining memory size, a fourth fraction is determined, wherein the fourth fraction is an increasing function of the remaining memory size; Based on the remaining computing power, a fifth score is determined, wherein the fifth score is an increasing function of the remaining computing power. Calculate the second total score based on the third score, the fourth score, and the fifth score; If the second total score is greater than the second threshold, the target installation package is used to fully replace the current version installation package of the application on the terminal.

5. The method according to claim 1, characterized in that, If the target version information is greater than the current version information of the application installed on the terminal, downloading the target installation package corresponding to the target version information includes: If the target version information is greater than the current version information of the application installed on the terminal, then the terminal summary information corresponding to the terminal is determined; If it is determined that the terminal has download permission based on the terminal summary information, then the target version of the target installation package is downloaded.

6. The method according to claim 5, characterized in that, The step of determining that the terminal has download permission based on the terminal summary information includes: Get the first value corresponding to the terminal with download permission at the current time; Based on the terminal summary information and the number of installed terminals corresponding to the application, a modulo operation is performed to obtain the target remainder; If the target remainder is the same as the first value, then the terminal is determined to have download permission.

7. The method according to claim 1, characterized in that, The target installation package of the target version includes target code files; Before performing a full replacement of the current version installation package of the application on the terminal with the target installation package, the method further includes: The bytes in the target code file are aligned to obtain an aligned code file; Perform field validation on the class files in the alignment code file to obtain the field validation results; Based on the field validation results and the calling frequency of the class file, the target class file is determined in the class file of the alignment code file, and the memory layout of the target class file is optimized.

8. The method according to claim 1, characterized in that, The step of replacing the current version installation package of the application on the terminal with the target installation package includes: The target installation package is decompressed to obtain target resource files and target code files; Based on the target version information, the target resource file and the target code file are subjected to a first verification; If the first verification passes, the version installation package is completely replaced with the target resource file and the target code file.

9. The method according to claim 8, characterized in that, The first verification of the target resource file and the target code file based on the target version information includes: Obtain the installation package signature of the target installation package; Extract the installation package verification code from the target version information; Perform a digest operation on the target resource file and the target code file to obtain the installation package digest; Based on the comparison between the installation package verification code and the installation package digest, a first sub-verification is performed on the target resource file and the target code file; Based on the installation package signature, a second sub-verification is performed on the target resource file and the target code file.

10. The method according to claim 8, characterized in that, The version installation package includes the current code file and current resource file currently being used by the application on the terminal; the target resource file includes a first target sub-resource file and a second target sub-resource file; the current resource file includes a first current sub-resource file and a second current sub-resource file; The step of replacing the entire version installation package with the target resource file and the target code file includes: The target code file is used to completely replace the current code file corresponding to the current version of the application; The first target sub-resource file is used to fully replace the first current sub-resource file corresponding to the current version of the application, and the second target sub-resource file is used to fully replace the second current sub-resource file corresponding to the current version of the application.

11. The method according to claim 8, characterized in that, After performing a first verification on the target resource file and the target code file based on the target version information, the method further includes: If the first verification fails, the downloaded files of the target installation package are cleared; Load the code file from the installation package corresponding to the current version to launch the application.

12. The method according to claim 1, characterized in that, If the target version information is greater than the current version information of the application installed on the terminal, downloading the target installation package corresponding to the target version information includes: Determine the network connection status of the terminal at the current time; If it is determined that the network connection status and the current time meet the preset download conditions, then the target version information and the current version information of the application installed on the terminal are compared. If the target version information is greater than the current version information of the application installed on the terminal, then the target installation package corresponding to the target version information is downloaded.

13. The method according to claim 1, characterized in that, After replacing the current version installation package of the application on the terminal with the target installation package, the method further includes: In response to a restart request for the application, a pre-defined empty process is started; Based on the empty process, terminate all processes in the application other than the empty process so that the target installation package corresponding to the target version information of the application becomes effective.

14. An application upgrade processing apparatus, characterized in that, The device includes: An execution unit is configured to execute a startup routine in response to the power-on of a terminal on which the application is installed, to activate a plugin bound to the application, wherein the plugin is pre-downloaded to the terminal along with the application, and code for activating the plugin at power-on is embedded in the startup routine; The acquisition unit is used to acquire the target version information of the application through the plugin, wherein the target version information is the version information of the latest version released in the publicly available versions of the application; The download unit is configured to download the target installation package corresponding to the target version information if the target version information is greater than the current version information of the application installed on the terminal. The identification unit is used to identify the running status of the application on the terminal; An upgrade unit is configured to, if the running state meets a first condition, fully replace the current version installation package of the application on the terminal with the target installation package.

15. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the application upgrade processing method according to any one of claims 1 to 13.

16. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the application upgrade processing method according to any one of claims 1 to 13.

17. A computer program product comprising a computer program that is read and executed by a processor of an electronic device, causing the electronic device to perform an application upgrade processing method according to any one of claims 1 to 13.