Method, device, and storage medium for running an application
By setting up multiple storage partitions in the electronic devices of the embedded system, storing different versions of application packages, and using an older version to start the application when the upgrade fails, the problem of not being able to start normally after the upgrade fails and improving the user experience.
Patent Information
- Application Number
- CN202411859026.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2044-12-17
AI Technical Summary
In embedded systems, after the application upgrade fails, it cannot start normally, resulting in poor user experience.
By setting the first storage partition and the second storage partition in the electronic device, different versions of the packages of the target application are stored respectively, and when the upgrade fails, the application is started based on the older version of the package to ensure the normal startup of the application.
It realizes that the application can still be started normally when the application upgrade fails, improving the user experience.
Smart Images

Figure CN119322628B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technology, and more particularly, to a method, device, and storage medium for running an application program in the field of storage technology. Background Art
[0002] Upgrading an application program in an embedded system refers to updating the version of an application program that has been deployed on an embedded device to fix existing problems, add new features, or improve performance.
[0003] When upgrading an application program, there may be a situation where the application program upgrade fails. Correspondingly, there will be a situation where the upgraded failed application program starts abnormally. Since the upgraded failed application program cannot be started normally and the application program before the upgrade cannot be obtained, the application program deployed on the embedded device cannot be started normally, resulting in a poor user experience.
[0004] Therefore, how to start the application program normally in case of upgrade failure is a problem that needs to be solved currently. Summary of the Invention
[0005] This application provides a method, device, and storage medium for running an application program, which can start the application program normally in case of upgrade failure.
[0006] In a first aspect, a method for running an application program is provided, which is applied to an electronic device; the storage space of the target hard disk in the electronic device includes a first storage partition and a second storage partition, and the target hard disk is any hard disk in the electronic device; the method includes: when running the target application program based on a first program package and the remaining storage space of the electronic device is greater than a threshold, obtaining a second program package of the target application program; wherein, the first program package is stored in the first storage partition, and the version of the second program package is higher than that of the first program package; storing the second program package in the second storage partition; when there is a restart of the target application program, starting and running the target application program based on the second program package; when starting based on the second program package fails, starting and running the target application program based on the first program package.
[0007] In an embodiment of the present application, when the target application is running based on the first package and the remaining storage space of the electronic device is greater than the threshold, obtain the second package of the target application; and store the second package in the second storage partition; since the version of the second package is higher than that of the first package, the target application can be upgraded in the second storage partition; when there is a restart of the target application, start and run the target application based on the second package; when the startup based on the second package fails, start and run the target application based on the first package, so that it is possible to realize the normal startup of the target application based on the first package even when the upgrade of the target application fails; based on this, the embodiment of the present application can normally start the application when the upgrade fails.
[0008] In combination with the first aspect, in some implementation manners of the first aspect, the method provided by the embodiment of the present application further includes: when the target application is running based on the second package and the remaining storage space of the electronic device is greater than the threshold, obtain the third package; the version of the third package is higher than that of the second package; store the third package in the first storage partition; when there is a restart of the target application, start and run the target application based on the third package; when the startup based on the third package fails, start and run the target application based on the second package; when the startup based on the third package is successful, start and run the target application based on the third package.
[0009] In an embodiment of the present application, through the first storage partition and the second storage partition, the target application can be upgraded without user perception while the target application is running; and when there is an abnormality in the upgrade data, it is possible to ensure the normal startup of the target application, thereby improving the user experience.
[0010] In combination with the first aspect and the above implementation manners, in some implementation manners of the first aspect, the flash memory module of the electronic device includes a third storage partition; the third storage partition stores the initial package of the target application; the method provided by the embodiment of the present application further includes: when the startups based on both the first package and the second package fail, start and run the target application based on the initial package; send a first prompt message; wherein, the first prompt message is used to prompt that the first package and the second package are in an abnormal state.
[0011] In an embodiment of the present application, when the startups based on both the first package and the second package fail, the target application can be started and run based on the initial package to ensure the normal operation of the target application and to promptly prompt the user that the first package and the second package are in an abnormal state.
[0012] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, when none of the program packages of the target application is stored in the first storage partition and the second storage partition, the method provided by the embodiments of the present application further includes: obtaining a first program package based on an initial program package, where the version of the first program package is higher than the version of the initial program package; storing the first program package in the first storage partition; and starting and running the target application based on the first program package.
[0013] In the embodiments of the present application, when the program packages of the target application are generally not stored in the first storage partition and the second storage partition, a first program package can be obtained through the initial program package in the third storage partition, so as to realize the normal operation of the target application.
[0014] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, the method provided by the embodiments of the present application further includes: when the obtaining of the first program package fails, obtaining the initial program package from the third storage partition; storing the initial program package in the first storage partition; and starting and running the target application based on the initial program package in the first storage partition.
[0015] In the embodiments of the present application, when the obtaining of the first program package fails, the target application can be started and run based on the initial program package, so as to realize the normal operation of the target application.
[0016] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, the first storage partition and the second storage partition have read-write permissions; the third storage partition has a read-only permission.
[0017] In the embodiments of the present application, since the first storage partition and the second storage partition have read-write permissions and the third storage partition has a read-only permission, the write operations of the third storage partition can be reduced to extend the service life of the flash memory module.
[0018] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, the flash memory module of the electronic device includes a path configuration partition; the path configuration partition includes a first path parameter and a second path parameter; the first path parameter is used to indicate the currently running version; the second path parameter is used to indicate the upgraded version; before starting and running the target application based on a second program package, the method provided by the embodiments of the present application further includes: updating the parameter value of the second path parameter to the storage path of the second program package, where the priority of the second path parameter is higher than the priority of the first path parameter; starting and running the target application based on the second program package includes: obtaining the second path parameter; and starting the target application based on the parameter value of the second path parameter.
[0019] In an embodiment of the present application, by updating the parameter value of the second path parameter to the storage path of the second package, it is possible to ensure that the upgraded target application can be launched when the electronic device is started next time after the target application is upgraded.
[0020] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, the path configuration partition further includes a third path parameter; wherein, the priority of the third path parameter is lower than the priorities of the first path parameter and the second path parameter; in the case of restarting the target application, after the target application is launched and run based on the second package, the method provided by the embodiment of the present application further includes: updating the parameter value of the third path parameter to the storage path of the first package; updating the parameter value of the first path parameter to the storage path of the second package; in the case of failure to launch based on the second package, launching and running the target application based on the first package, including: in the case of failure to launch based on the second package, obtaining the parameter value of the third path parameter based on the identifier of the third path parameter; launching the target application based on the parameter value of the third path parameter.
[0021] In an embodiment of the present application, by updating the first path parameter to the storage path of the second package, it is possible to avoid overwriting the storage path of the second package when the target application is upgraded next time; by updating the parameter value of the third path parameter to the storage path of the first package, it is possible to quickly launch the target application based on the first package according to the parameter value of the third path parameter in the case of failure to launch the second package, so as to realize the normal operation of the target application.
[0022] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, the method provided by the embodiment of the present application further includes: determining whether there is a target script in the electronic device; wherein, the target script is used to trigger the electronic device to preferentially execute the function corresponding to the target script; if there is a target script, automatically execute the target script; if there is no target script, launch the target application based on the first package.
[0023] In an embodiment of the present application, by executing the target script, the electronic device can be debugged and detected to reduce the occurrence of abnormal startup of the target application caused by electronic device anomalies.
[0024] In a second aspect, an electronic device is provided, including a memory and a processor, the memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the electronic device executes the method of the electronic device in the above first aspect or any possible implementation manner of the first aspect.
[0025] In a third aspect, a computer program product is provided, which includes: computer program code that, when running on a computer, causes the computer to execute the method for running an application program in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0026] In a fourth aspect, a computer-readable storage medium is provided, which stores computer program code that, when running on a computer, causes the computer to execute the method for running an application program in the above-mentioned first aspect or any possible implementation manner of the first aspect. Description of the Drawings
[0027] Figure 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0028] Figure 2 is a schematic flowchart of a method for running an application program provided by an embodiment of the present application;
[0029] Figure 3 is a schematic flowchart of another method for running an application program provided by an embodiment of the present application;
[0030] Figure 4 is a schematic flowchart of a third method for running an application program provided by an embodiment of the present application;
[0031] Figure 5 is a schematic structural diagram of a starting device for an application program provided by an embodiment of the present application;
[0032] Figure 6 is a schematic structural diagram of another electronic device provided by an embodiment of the present application. Detailed Embodiments
[0033] Hereinafter, the technical solutions in the present application will be clearly and elaborately described in conjunction with the drawings. Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B. The "and / or" in the text is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two.
[0034] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or indicating relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features.
[0035] Upgrading an application program in an embedded system refers to updating the version of an application program that has been deployed on an embedded device to fix existing problems, add new features, or improve performance. However, when upgrading an application program, there may be a situation where the application program upgrade fails; correspondingly, there will be a situation where the application program that fails to upgrade starts abnormally. At this time, since the application program that fails to upgrade cannot be started normally and the application program before the upgrade cannot be obtained, the application program deployed on the embedded device cannot be started normally, resulting in a poor user experience.
[0036] Therefore, how to start the application program normally in the case of upgrade failure is a problem that needs to be solved currently.
[0037] In view of this, the present application provides a method, device, and storage medium for running an application program. The method includes: when running a target application program package based on a first program package and the remaining storage space of the electronic device is greater than a threshold, obtaining and storing a second program package in a second storage partition; when restarting the target application program fails based on the second program package, starting and running the target application program based on the first program package. The embodiments of the present application can start the application program normally in the case of upgrade failure.
[0038] The following combines Figures 1 to 6 to elaborate in detail on the method, device, and storage medium for running an application program provided by the embodiments of the present application.
[0039] Figure 1 It is a schematic structural diagram in an electronic device provided by an embodiment of the present application.
[0040] Exemplarily, Figure 1 the electronic device 100 in includes a flash memory module 110 and at least one hard disk 120; wherein, the flash memory module 110 includes a bootloader partition 111, a boot partition 112, a rootfs partition 113, a misc partition 114, and an oem partition 115. The storage space of the target hard disk in at least one hard disk 120 includes a first storage partition 121, a second storage partition 122, and a data partition 113.
[0041] Among them, the bootloader partition 111 is used to load the operating system and can store the boot loader. The boot partition 112 can be used to store the startup kernel of the operating system, such as the Linux kernel. The rootfs partition 113 can be used to store the root file system, including the system files, library files, application programs, etc. of the operating system. The misc partition 114 can be used to store various miscellaneous data, such as system configurations, log files, storage paths, etc.; for example, the misc partition 114 can store the storage paths of the program packages of the target application programs in the first storage partition 121, the second storage partition 122 or the oem partition. The oem partition 115 can be used to store the initial version of the target application program; the oem partition 115 can detect the target application program through the initial version of the target application program in the oem partition 115 when the target application program in the first storage partition 121 or the second storage partition 122 has an exception, so as to determine the abnormal location in the target application program, thereby reducing the maintenance cost.
[0042] Among them, each of the at least one hard disk 120 can be used to store the data of one or more application programs. For example, the data of the target application program can be stored in the first storage partition 121 and / or the second storage partition 122 included in the storage space of the target hard disk; the first storage partition 121 and the second storage partition 122 can store the program packages of the same version of the target application program respectively, or can store the program packages of different versions of the target application program respectively. The data partition 133 can be used to store the user's data, such as documents, videos, etc.
[0043] Exemplarily, the bootloader partition 111, the boot partition 112, the rootfs partition 113, the misc partition 114 and the oem partition 115 in the flash memory module 110 can be set to read-only permissions; in this way, the data in any partition in the flash memory module 110 can be read, but the data in each partition in the flash memory module 110 cannot be modified.
[0044] Exemplarily, any one of the at least one hard disk 120 (for example, the target hard disk) can be set to read-write permissions; in this way, not only the data in any hard disk 120 can be read, but also the data in any hard disk 120 can be modified.
[0045] It can be understood that considering that the frequency of system upgrades in an electronic device may be low, while the updates of application programs are frequent; since the flash memory module 110 will wear out when erasing and writing data, reducing the write operation can extend the service life of the flash memory module 110. Therefore, the system data stored in the flash memory module 110 (such as the Linux kernel, root file system, etc.) can be set to read-only permission; then, the application programs are stored in the hard disk 120, and the hard disk 120 is set to read-write permission, so that the high write durability and large capacity characteristics of the hard disk 120 can be utilized to update the target program; at the same time, the pressure on the flash memory module 110 is also reduced. In addition, due to the operation of modifying the flash memory module 110, there may be a situation where if suddenly, the data in the flash memory module 110 is damaged or lost; therefore, storing the application programs in the hard disk 120 can reduce the write operation of the flash memory module 110, thereby reducing the risk of data damage or loss.
[0046] Figure 2 It is a schematic flowchart of a method for running an application program provided by an embodiment of the present application.
[0047] It should be understood that the embodiment of the present application does not particularly limit the execution subject of the method for running an application program. As long as a program recording the code of the method for running an application program of the embodiment of the present application can be run to communicate according to the method for running an application program of the embodiment of the present application. For example, the execution subject of the method for running an application program provided by the embodiment of the present application can be the electronic device described in the above embodiment, or a functional module in the electronic device that can call and execute the program, such as a chip. The present application does not limit this.
[0048] Exemplarily, the electronic device can be a terminal device such as a computer, a mobile phone, a smart interactive tablet, etc. The embodiment of the present application does not make specific limitations on this.
[0049] As Figure 2 shown, the method 200 for running an application program includes S210 to S240, which will be described in detail below.
[0050] Among them, the running method 200 is applied to an electronic device. Exemplarily, the electronic device can be a terminal device such as a computer, a mobile phone, a smart interactive tablet, etc. The embodiment of the present application does not make specific limitations on this.
[0051] Among them, the storage space of the target hard disk in the electronic device includes a first storage partition and a second storage partition. The target hard disk is any hard disk in the electronic device.
[0052] Exemplarily, an electronic device may include at least one hard disk; the storage space of each hard disk may include one or more storage partitions, and each storage partition may be used to store data of one or more application programs. The same application program (the same version of the application program or different versions of the application program) may be stored in different storage partitions. The first storage partition and the second storage partition are any two of the one or more storage partitions used to store the program packages of the target application program.
[0053] For example, the at least one hard disk includes hard disk A and hard disk B; the storage partitions of hard disk A may include storage partition A1 and storage partition A2; the storage partitions of hard disk B may include storage partition B1, storage partition B2, and storage partition B3. Among them, storage partition A1 stores package 1.1 of application program 1 and package 2.1 of application program 2; storage partition A2 stores package 1.2 of application program 1 and package 2.2 of application program 2; storage partition B1 stores package 1.1 of application program 1 and package 3.1 of application program 3; storage partition B2 stores package 1.1 of application program 1 and package 3.2 of application program 3; storage partition B3 stores package 1.1 of application program 1 and package 3.3 of application program 3.
[0054] Exemplarily, the target hard disk may be any one of the at least one hard disk. The storage partitions of the target hard disk may include at least two storage partitions. It should be noted that the first storage partition and the second storage partition mentioned in the embodiments of the present application are used to store the program packages of the target application program to implement the upgrade, backup, and detection of the target application program; for details, reference may be made to the following embodiments and will not be elaborated here.
[0055] S210. When the target application program is running based on the first program package and the remaining storage space of the electronic device is greater than the threshold, obtain the second program package of the target application program.
[0056] Among them, the first program package is stored in the first storage partition. The version of the second program package is higher than the version of the first program package.
[0057] It should be understood that different versions of an application program usually have a corresponding program package; the program package may be an Android Package Kit (APK) file. The program package includes the code, resources, and configurations unique to the corresponding version of the program package. It can be understood that the APK file is the installation package format of Android operating system application programs, containing all necessary components such as the code, resources, assets, and libraries of the application program. Users can install the application program on an Android device by downloading the APK file.
[0058] Exemplarily, the second package can be obtained from a server, or can be obtained by connecting an electronic device to a target device (such as a flash drive or a computer, etc.); the embodiments of the present application do not make specific limitations in this regard.
[0059] Exemplarily, the target application can include multiple versions, and the data of each version can be the package corresponding to the target application. In this way, different operating system versions, device types, or user requirements can be satisfied.
[0060] Exemplarily, the target application can include an initial package, a first package, a second package, a third package, etc. Among them, the initial package can be the first released version of the target application, that is, the initial version. The initial package usually contains the core functions of the application. The version of the first package is higher than that of the initial package; the version of the second package is higher than that of the first package; the version of the third package is higher than that of the second package. For example, the initial package can correspond to version 1.0, the first package can correspond to version 2.0, the second package can correspond to version 3.0, and the third package can correspond to version 4.0.
[0061] Exemplarily, the threshold value can be a value pre-configured by the electronic device or a value set manually, and the embodiments of the present application do not make specific limitations in this regard.
[0062] It should be understood that the remaining storage space of the above-mentioned electronic device being greater than the threshold value can mean that the current operating load of the electronic device is relatively low, which can support the action of obtaining the second package and will not affect the operation of the first package in the first storage area; of course, it can also mean that the storage space of the current electronic device can support storing the second package.
[0063] Exemplarily, when running the target application based on the first package, it can be determined that there is a version update for the target application according to the received version update prompt information from the server. For example, there is a second package, and the version of the second package is higher than that of the first package. Then, when the current service is in an idle state, the second package is obtained.
[0064] S220. Store the second package in the second storage partition.
[0065] Exemplarily, before writing the second package to the second storage partition, the second storage partition can store packages of other versions of the target application, or can not store any version of the target application. The embodiments of the present application do not make specific limitations in this regard.
[0066] As an example, when a package of another version of the target application (e.g., the fourth package with a version lower than the second package) is stored in the second storage partition, the fourth package in the second storage partition can be replaced with the second package. For example, the fourth package is at the first location in the second storage partition (e.g., the storage address of the first location can be / mnt / partition2 / Package4); replace the fourth package at the first location with the second package so that the storage address of the first location can be / mnt / partition2 / Package2.
[0067] As another example, when no package of any version of the target application is stored in the second storage partition, the second package can be stored at an available location in the second storage partition, such as the second location, and a corresponding storage address can be created, such as: mnt / partition2 / Package2.
[0068] Exemplarily, after obtaining the second package, the second package can be decompressed, then the decompressed second package can be written to the second storage partition, and a file check can be performed on the second package.
[0069] S230. In the case of restarting the target application, start and run the target application based on the second package.
[0070] It can be understood that when the first package in the first storage partition is in a running state, if there is a version update of the target application, the second package can be obtained and written to the second storage partition different from the first storage partition; then, in the case of restarting the target application, the second package can be run through the second storage partition to achieve a seamless upgrade of the target application, reduce the impact on the user during the upgrade process, and improve the user experience.
[0071] Exemplarily, the case of restarting the target application can be: when the electronic device is restarted, start the target application; or, it can also be when starting the target application after the operation of the target application based on the first package ends; the embodiments of the present application do not make specific limitations on this.
[0072] S240. In the case of failure to start based on the second package, start and run the target application based on the first package.
[0073] Exemplarily, in the case where the second package is damaged, missing, etc., it may cause the failure to start the target application based on the second package. For example, a certain key data in the second package is deleted, damaged, or the necessary configuration file is lost; or when writing the second package to the second storage partition, due to insufficient storage space in the second storage partition, part of the data of the second package cannot be written; or when obtaining the second package, due to power failure, network fluctuations, etc., the data of the obtained second package may be incomplete; or due to the operation permission problem of the second package in the target hard disk, the second package cannot be started normally. Therefore, in the case where it is detected that the target application fails to start based on the second package, the first package in the first storage partition can be started to ensure that the target application can be started normally, thereby improving the user experience.
[0074] In an embodiment of the present application, when running the target application based on the first package and the remaining storage space of the electronic device is greater than the threshold, obtain the second package of the target application; and store the second package in the second storage partition; since the version of the second package is higher than that of the first package, the target application can be upgraded in the second storage partition; in the case of restarting the target application, start and run the target application based on the second package; in the case where the start based on the second package fails, start and run the target application based on the first package, so that it is possible to realize that in the case of the failure of upgrading the target application, the target application can still be started normally based on the first package; based on this, the embodiment of the present application can start the application normally in the case of the failure of upgrading.
[0075] In a possible embodiment of the present application, the method provided by the embodiment of the present application further includes: when running the target application based on the second package and the remaining storage space of the electronic device is greater than the threshold, obtain the third package; the version of the third package is higher than that of the second package; store the third package in the first storage partition; in the case of restarting the target application, start and run the target application based on the third package; in the case where the start based on the third package fails, start and run the target application based on the second package; in the case where the start based on the third package is successful, start and run the target application based on the third package.
[0076] Among them, the version of the third package is higher than that of the second package.
[0077] Exemplarily, in the case of running the target application based on the second package, the prompt information of the version update of the server can be obtained to determine that there is a version update for the target application.
[0078] For example, the prompt message may carry the identifier of the third package of the target application. When the electronic device receives the prompt message, it can determine that there is version update data for the target application based on the identifier of the third package, and then obtain the third package.
[0079] As another example, the prompt message may only carry version update information. When the electronic device receives the prompt message, it can directly determine that there is version update data for the target application, and then obtain the third package from the server.
[0080] Exemplarily, after running the target application based on the second package in the second storage partition to achieve seamless upgrade, if a new version of the target application is released, for example, there is a third package of the target application, the third package can be obtained and stored in the first storage partition. When the target application needs to be restarted, the target application is started and run based on the third package to achieve seamless upgrade of the target application again. In addition, when starting the target application based on the third package fails, the target application can also be started and run based on the second package in the second storage partition to ensure that the target application can be determined normally.
[0081] In the embodiments of the present application, through the first storage partition and the second storage partition, the target application can be seamlessly upgraded while running the target application. And when the upgrade data is abnormal, the target application can be started normally, thereby improving the user experience.
[0082] In a possible embodiment of the present application, the flash memory module of the electronic device includes a third storage partition. The third storage partition stores the initial package of the target application. The method provided by the embodiments of the present application further includes: when starting based on both the first package and the second package fails, starting and running the target application based on the initial package; and sending a first prompt message.
[0083] Wherein, the first prompt message is used to prompt that the first package and the second package are in an abnormal state.
[0084] In an actual application scenario, the third storage partition may be the oem partition as shown in Figure 1 to store the initial package of the target application. Since the oem partition in the flash memory module can be set to read-only permission, this can avoid modifying the data in the oem partition, avoid modifying the initial package, and at the same time reduce the impact of power-off and other situations on the data in the oem partition.
[0085] Exemplarily, the first prompt message can be sent to the user via email. Alternatively, the first prompt message can also be sent by displaying it on the display screen of the electronic device to promptly prompt the user that the first program package and the second program package are in an abnormal state. In addition, through the first prompt message, the user can be prompted about the abnormal location when the first program package and the second program package are in an abnormal state, thereby reducing the maintenance cost.
[0086] In an embodiment of the present application, in the case where both the first program package and the second program package fail to start, the target application can be started and run based on the initial program package to ensure that the target application can run normally and the user can be promptly prompted that the first program package and the second program package are in an abnormal state.
[0087] In a possible embodiment of the present application, in the case where neither the first storage partition nor the second storage partition stores any program package of the target application, the method provided by the embodiment of the present application further includes: obtaining the first program package based on the initial program package; storing the first program package in the first storage partition; and starting and running the target application based on the first program package.
[0088] Among them, the version of the first program package is higher than the version of the initial program package.
[0089] Exemplarily, in the case where the program packages of the target application are not stored in the first storage partition and the second storage partition, the first program package can be obtained based on the initial program package and stored in the first storage partition to realize starting and running the target application based on the first program package in the first storage partition.
[0090] It should be understood that in the case of starting the electronic device for the first time, the first storage partition and the second storage partition usually do not store the program packages of the target application. At this time, if the target application needs to be upgraded, the first program package can be obtained through the initial program package. For example, based on the application identifier of the initial program package, the first program package with the same application identifier as the initial program package can be obtained from the server or the target device. The application identifier of the initial program package can be the name of the target application, the unique encoding of the application, or the license of the application, etc.
[0091] In an embodiment of the present application, in the case where the first storage partition and the second storage partition usually do not store the program packages of the target application, the first program package can be obtained through the initial program package in the third storage partition, thereby realizing the normal operation of the target application.
[0092] In an embodiment of the present application, the method provided by the embodiment of the present application further includes: in the case of failing to obtain the first program package, obtaining an initial program package from a third storage partition; storing the initial program package in the first storage partition; and starting to run a target application based on the initial program package in the first storage partition.
[0093] Exemplarily, in the case where the electronic device is in a network isolation state, or there is no program package of the target application in the server, etc., the initial program package can also be directly obtained from the third storage partition and stored in the first storage partition.
[0094] In an embodiment of the present application, in the case of failing to obtain the first program package, the target application can be started and run based on the initial program package, thereby realizing the normal operation of the target application.
[0095] In a possible embodiment of the present application, the first storage partition and the second storage partition have read-write permissions; the third storage partition has read-only permissions.
[0096] In an actual application scenario, the first storage partition and the second storage partition are partitions divided from the storage space of the target hard disk. The third storage partition can be an oem partition in the flash module. The third storage partition is set to read-only permission, so that the data in the third storage partition can be read, but the data in the third storage partition cannot be modified. The first storage partition and the second storage partition in the storage space of the target hard disk are set to read-write permissions; in this way, not only can the data in the first storage partition and the second storage partition be read, but also the data in the first storage partition and the second storage partition can be modified.
[0097] It can be understood that considering that the frequency of system upgrades in the electronic device may be low, while the updates of application programs are frequent; since the flash module will wear out when erasing and writing data, reducing the write operation can extend the service life of the flash module. Therefore, the third storage partition for storing the initial program package can be set to read-only permission; thereby reducing the pressure on the third storage partition. In addition, due to the operation of modifying the third storage partition, there may be a situation where if suddenly, the data in the third storage partition is damaged or lost; therefore, the program package of the target application that is frequently used for upgrading is stored in the target hard disk, so as to utilize the high write durability and large capacity characteristics of the target hard disk to update the target program; it can also reduce the write operation of the flash module, thereby reducing the risk of data loss
[0098] In an embodiment of the present application, since the first storage partition and the second storage partition have read-write permissions, and the third storage partition has read-only permissions, the service life of the flash module can be extended by reducing the write operation of the third storage partition.
[0099] In a possible embodiment of the present application, the flash memory module of the electronic device includes a path configuration partition; the path configuration partition includes a first path parameter and a second path parameter; the first path parameter is used to indicate the currently running version; the second path parameter is used to indicate the upgraded version; before the above S230, the method provided by the embodiment of the present application further includes: updating the parameter value of the second path parameter to the storage path of the second program package; the above S230 includes: obtaining the second path parameter; based on the parameter value of the second path parameter, starting the target application. Among them, the priority of the second path parameter is higher than that of the first path parameter.
[0100] In an actual application scenario, the path configuration partition can be, for example, Figure 1 the misc partition in the flash memory module as shown.
[0101] Exemplarily, the electronic device can start the program package at the storage path corresponding to the path parameter based on the path parameter in the path configuration partition. Since the first path parameter is used to indicate the storage path of the first program package; therefore, when the parameter value of the second path parameter is empty, the first program package can be started based on the parameter value of the first path parameter; when the parameter value of the second path parameter is updated to the storage path of the second program package, since the priority of the second path parameter is higher than that of the first path parameter, the parameter value of the second path parameter is preferentially read, and the second program package is started based on the parameter value of the second path parameter.
[0102] In the embodiment of the present application, by updating the parameter value of the second path parameter to the storage path of the second program package, it can be ensured that the upgraded target application can be started when the electronic device is started next time after the target application is upgraded.
[0103] In a possible embodiment of the present application, the path configuration partition further includes a third path parameter; after the above S230, the method provided by the embodiment of the present application further includes: updating the parameter value of the third path parameter to the storage path of the first program package; updating the parameter value of the first path parameter to the storage path of the second program package; the above S240 includes: when starting based on the second program package fails, obtaining the parameter value of the third path parameter based on the identifier of the third path parameter; starting the target application based on the parameter value of the third path parameter.
[0104] Among them, the priority of the third path parameter is lower than that of the first path parameter and the second path parameter.
[0105] Exemplarily, when updating the parameter value of the first path parameter to the storage path of the second package and updating the parameter value of the third path parameter to the storage path of the first package, in the case of detecting a version update (e.g., there is a third package) next time, after writing the third package to the first storage partition, the parameter value of the second path parameter can be updated to the storage path of the third package, avoiding the loss of the storage path of the second package due to the overwriting of the parameter value of the second path parameter.
[0106] Exemplarily, since the parameter value of the third path parameter is updated to the storage path of the first package, the first package can be used as a backup, so that in the case of the failure of starting the second package in the second storage partition, according to the identifier of the third path parameter, the parameter value of the third path parameter can be quickly obtained; and according to the parameter value of the third path parameter, the first package can be started.
[0107] As an example, the path configuration partition includes a first path parameter, a second path parameter, and a third path parameter. According to the first path parameter, the second path parameter, and the third path parameter, actions corresponding to the parameter values of the first path parameter, the parameter value of the second path parameter, and the parameter value of the third path parameter can be executed.
[0108] For example, as shown in Table 1, Table 1 is a schematic execution table of path parameters in a path configuration partition. Among them, the second path parameter is: MISC_NEXT, the first path parameter is MISC_CURR, and the third path parameter is MISC_BAK. Among them, the priority of MISC_NEXT is higher than that of MISC_CURR and MISC_BAK, and the priority of MISC_CURR is higher than that of MISC_BAK. In other words, the package corresponding to the storage path indicated by the parameter value of MISC_NEXT is started preferentially; in the case where the parameter value of MISC_NEXT is NULL, the package corresponding to the storage path indicated by the parameter value of MISC_CURR is started; in the case where the parameter values of MISC_NEXT and MISC_CURR are both NULL, the package corresponding to the storage path indicated by the parameter value of MISC_BAK is started. It should be noted that PATH_NEXT, PATH_CURR, and PATH_BAK are only used for illustration and do not represent the specific meanings of related terms in the embodiments of the present application.
[0109] Table 1
[0110]
[0111] For example: When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is NULL, and the parameter value of MISC_BAK is NULL, it can be considered that the electronic device is started for the first time, and the target application is started based on the initial package in the third storage partition. When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is NULL, and the parameter value of MISC_BAK is PATH_BAK, the target application is started based on the initial package in the third storage partition. When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is PATH_CURR, and the parameter value of MISC_BAK is PATH_BAK, it can be considered that after the target application is upgraded (for example, the second package is obtained) and the target application is started, the parameter value of the path parameter. When the parameter value of MISC_NEXT is PATH_NEXT, the parameter value of MISC_CURR is PATH_CURR, and the parameter value of MISC_BAK is PATH_BAK, it can be considered that the latest version of the package has been written to the storage partition, and at least one upgrade of the target application has been performed before; then, update the parameter value of MISC_NEXT to the path of the latest version of the package, the target application can be started based on the package corresponding to PATH_NEXT, update the parameter value of MISC_CURR to PATH_NEXT, update the parameter value of MISC_BAK to PATH_CURR, and update the parameter value of MISC_NEXT to NULL. When the parameter value of MISC_NEXT is PATH_NEXT, the parameter value of MISC_CURR is PATH_CURR, and the parameter value of MISC_BAK is NULL, it can be considered that the latest version of the package has been written to the storage partition, and the target application has not been upgraded before; then, update the parameter value of MISC_NEXT to the path of the latest version of the package, the target application can be started based on the package corresponding to PATH_NEXT, update the parameter value of MISC_CURR to PATH_NEXT, update the parameter value of MISC_BAK to PATH_CURR, and update the parameter value of MISC_NEXT to NULL. When the parameter value of MISC_NEXT is PATH_NEXT, the parameter value of MISC_CURR is NULL, and the parameter value of MISC_BAK is PATH_BAK, the target application can be started based on the package corresponding to PATH_NEXT; update the parameter value of MISC_CURR to PATH_NEXT; update the parameter value of MISC_NEXT to NULL.When the parameter value of MISC_NEXT is PATH_NEXT, the parameter value of MISC_CURR is NULL, and the parameter value of MISC_BAK is NULL, it can be considered that at this time, the target application is upgraded through the initial package in the third storage partition, and the first package is written to the first storage partition; then, the target application is started based on the package corresponding to PATH_NEXT, the parameter value of MISC_CURR is updated to PATH_NEXT, and the parameter value of MISC_NEXT is updated to NULL. When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is PATH_CURR, and the parameter value of MISC_BAK is NULL, it can be considered that at this time, it is the scenario of upgrading the target application for the first time and starting the target application.
[0112] To more clearly explain how to start the target program according to the first path parameter, the second path parameter, and the third path parameter in the embodiments of the present application. As shown in Table 2, Table 2 is a schematic table of the changes in the parameter values of each path parameter after the target application is upgraded. Among them, PATH_A represents the storage path of the first package in the first storage partition, and PATH_B represents the storage path of the second package in the second storage partition.
[0113] Table 2
[0114]
[0115] For example, when the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is NULL, and the parameter value of MISC_BAK is NULL, it is considered that when the electronic device is started for the first time, the target application is started, and the program package corresponding to the target application is not stored in the first storage partition and the second storage partition; at this time, the target application is started based on the initial program package in the third storage partition. When the parameter value of MISC_NEXT is PATH_A, the parameter value of MISC_CURR is NULL, and the parameter value of MISC_BAK is NULL, it is considered that the first program package has been obtained through the initial program package in the third storage partition and the first program package is written to the first storage partition; at this time, the target application can be started based on the first program package in the first storage partition. When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is PATH_A, and the parameter value of MISC_BAK is NULL, it is considered that the first program package has been obtained through the initial program package in the third storage partition and the first program package is written to the first storage partition, and the target application has been started based on the first program package; at this time, the target application can be started based on the first program package in the first storage partition; and, if no version update is detected, the path parameters do not change each time the target application is started later. When the parameter value of MISC_NEXT is PATH_B, the parameter value of MISC_CURR is PATH_A, and the parameter value of MISC_BAK is NULL, it can be considered that when the first program package is in the running state, the second program package is obtained and the second program package is written to the second storage partition; at this time, the target application can be started based on the second program package in the second storage partition. When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is PATH_B, and the parameter value of MISC_BAK is PATH_A, it can be considered the change situation of the path parameters after writing the second program package to the second storage partition and starting the target application based on the second program package; at this time, the target application can be started based on the second program package in the second storage partition; and, if no version update is detected, the path parameters do not change each time the target application is started later. When the parameter value of MISC_NEXT is PATH_A, the parameter value of MISC_CURR is PATH_B, and the parameter value of MISC_BAK is PATH_A, it can be considered that when the second program package is in the running state, the third program package is obtained and the third program package is written to the second storage partition to replace the first program package; at this time, the target application can be started based on the third program package in the first storage partition.When the parameter value of MISC_NEXT is NULL, the parameter value of MISC_CURR is PATH_A, and the parameter value of MISC_BAK is PATH_B, it can be considered the change situation of each path parameter after writing the third package to the first storage partition and starting the target application based on the third package; at this time, the target application can be started based on the third package in the first storage partition; and if no version update is detected, each path parameter will not change every time the target application is started later.
[0116] It should be noted that when the electronic device is started for the first time, if the target application is not upgraded, even if there are the first storage partition and the second storage partition, no matter how many times the target application is restarted, the parameter values of the path parameters MISC_NEXT, MISC_CURR, and MISC_BAK are all NULL. In other words, the parameter value of MISC_NEXT is generally updated after the target application is upgraded. The parameter values of MISC_CURR and MISC_BAK can be updated according to the upgrade and start situation of the target application.
[0117] It should be noted that if the parameter value of MISC_NEXT is not NULL, then the target application is started based on the package corresponding to the storage path indicated by the parameter value of MISC_NEXT; if the parameter value of MISC_NEXT is NULL and the parameter value of MISC_CURR is not NULL, then the target application is started based on the package corresponding to the storage path indicated by the parameter value of MISC_CURR; if the parameter values of MISC_NEXT and MISC_CURR are both NULL, the target application is started based on the initial package in the third storage partition.
[0118] It should be noted that MISC_BAK is mainly used to restore starting the target application based on the package corresponding to the previous version in the case of abnormal start after the target application is upgraded.
[0119] In the embodiments of the present application, by updating the first path parameter to the storage path of the second package, the storage path of the second package can be avoided being overwritten when the target application is upgraded next time; by updating the parameter value of the third path parameter to the storage path of the first package, when starting the target application based on the second package fails, the target application can be quickly started based on the first package according to the parameter value of the third path parameter to achieve the normal operation of the target application.
[0120] As a possible implementation manner, the method provided by the embodiments of the present application further includes: determining whether there is a target script in the electronic device; if there is a target script, automatically executing the target script; if there is no target script, starting the target application based on the first program package.
[0121] Wherein, the target script is used to trigger the electronic device to preferentially execute the function corresponding to the target script.
[0122] Exemplarily, if there is a target script, it can be considered that the function corresponding to the target script is preferentially executed, such as functions like repair and detection.
[0123] Exemplarily, the manner of determining whether there is a target script in the electronic device can be by determining whether there is a storage path corresponding to the target script or the identifier of the target script. For example, the storage path corresponding to the target script can be / media / udisk0 / debug.sh; the identifier of the target script can be the file format of debug.sh. For instance, if / media / udisk0 / debug.sh exists, it can be considered that the electronic device is connected to the target device (such as a USB flash drive), and the target device stores the data of the target script. At this time, the target script can be automatically executed. If there is no target script, the target application can be started based on the first program package.
[0124] For example, inserting a USB flash drive with a target script into the electronic device triggers the specific behavior corresponding to the target script. First, if it is detected that a USB flash drive is inserted into the electronic device, the USB flash drive will be mounted to a specific directory, such as / media / udisk0. Then, the electronic device can detect whether there is a target script (such as debug.sh) in the USB flash drive. If the target script exists, the target application is not executed, but the target script is executed.
[0125] In the embodiments of the present application, by executing the target script, the electronic device can be debugged and detected to reduce the occurrence of abnormal startup of the target application caused by the abnormality of the electronic device.
[0126] Figure 3 It is a schematic flowchart of another method for running an application provided by the embodiments of the present application.
[0127] Exemplarily, Figure 3 The running method 300 of the application shown can be executed by the electronic device or by a startup device of an application in the electronic device, such as a chip.
[0128] As Figure 3 shown, the running method 300 of the application includes S301 to S313, and S301 to S313 will be described in detail below.
[0129] S301. Receive a start instruction for the target application.
[0130] As an example, the start instruction for the target application can be an operation performed by the user on the electronic device.
[0131] As another example, when the electronic device starts up, a start instruction for the target application is automatically received.
[0132] S302. Determine whether there is a target script. If so, execute S303; if not, execute S304.
[0133] Exemplarily, the way to determine whether there is a target script can be by judging whether there is a storage path corresponding to the target script or the identifier of the target script. For example, the storage path corresponding to the target script can be / media / udisk0 / debug.sh; the identifier of the target script can be the file format of debug.sh. For instance, if / media / udisk0 / debug.sh exists, it can be considered that the electronic device is connected to the target device (e.g., a USB flash drive), and the target device stores the data of the target script.
[0134] S303. Execute the target script.
[0135] S304. Obtain MISC_NEXT, MISC_CURR, and MISC_BAK from the misc partition.
[0136] Exemplarily, MISC_NEXT, MISC_CURR, and MISC_BAK are used to represent the path parameters of the storage path of the target application. In the case where there is no target script, MISC_NEXT, MISC_CURR, and MISC_BAK can be obtained from the misc partition, and then corresponding actions can be executed according to the parameter values of MISC_NEXT, MISC_CURR, and MISC_BAK.
[0137] S305. Determine whether the parameter value of MISC_NEXT is NULL; if so, execute S306; if not, execute S308.
[0138] S306. Determine whether the parameter value of MISC_CURR is NULL; if so, execute S307; if not, execute S309.
[0139] S307. Start the target application based on the initial package in the oem partition.
[0140] S308. Start the target application based on the package corresponding to the storage path indicated by the parameter value of MISC_NEXT.
[0141] For example, if the parameter value of MISC_NEXT is PATH_A; PATH_A is the storage path of the first package in the first storage partition; then start the target application based on the first package.
[0142] For another example, if the parameter value of MISC_NEXT is PATH_B; PATH_B is the storage path of the second package in the second storage partition; then start the target application based on the second package.
[0143] S309. Start the target application based on the package corresponding to the storage path indicated by the parameter value of MISC_CURR.
[0144] For example, if the parameter value of MISC_CURR is PATH_A; PATH_A is the storage path of the first package in the first storage partition; then start the target application based on the first package.
[0145] For another example, if the parameter value of MISC_CURR is PATH_B; PATH_B is the storage path of the second package in the second storage partition; then start the target application based on the second package.
[0146] S310. Determine whether the package starts abnormally. If so, execute S311.
[0147] S311. Determine whether the parameter value of MISC_BAK is NULL; if so, execute S307; if not, execute S312.
[0148] S312. Start the target application based on the backup package corresponding to the storage path indicated by the parameter value of MISC_BAK.
[0149] For example, if the parameter value of MISC_BAK is PATH_A; PATH_A is the storage path of the first package in the first storage partition; then start the target application based on the first package.
[0150] For another example, if the parameter value of MISC_BAK is PATH_B; PATH_B is the storage path of the second package in the second storage partition; then start the target application based on the second package.
[0151] S313. Determine whether the backup package starts abnormally. If so, execute S307.
[0152] For the specific descriptions of S301 to S313, please refer to Figures 1 to 2The related description is not repeated here.
[0153] In the embodiments of the present application, by obtaining MISC_NEXT, MISC_CURR, and MISC_BAK from the misc partition, the package of the program based on which storage partition can be determined according to the parameter values of MISC_NEXT, MISC_CURR, and MISC_BAK, and the target application can be started; and in the case of abnormal startup of the package, the target application can be started based on the backup package or the initial package through the path parameters MISC_NEXT, MISC_CURR, and MISC_BAK to achieve the normal operation of the target application.
[0154] Figure 4 It is a schematic flowchart of the third method for running an application provided by the embodiments of the present application;
[0155] Exemplarily, Figure 4 The running method 400 of the application shown can be executed by an electronic device or by a startup device of an application in the electronic device, such as a chip.
[0156] As Figure 4 shown, the running method 400 of the application includes S401 to S411, and S401 to S411 are described in detail below.
[0157] S401. Start the target application based on the first package in the first storage partition.
[0158] S402. Determine whether to actively upgrade; if so, execute S403; if not, execute S405.
[0159] S403. When the target device is connected to the electronic device, display an upgrade page on the electronic device.
[0160] S404. In response to the user's operation on the upgrade page, obtain the upgrade package.
[0161] S405. Receive a prompt message for version update of the target application from the server.
[0162] S406. Determine whether the current running state of the electronic device is in an idle state; if so, execute S407.
[0163] S407. Obtain the upgrade package from the server.
[0164] S408. Decompress the upgrade package to obtain a second package.
[0165] S409. Write the decompressed second package to the second storage partition and perform file verification.
[0166] S410. Update the parameter value of MISC_NEXT to the storage path of the second package in the second storage partition.
[0167] S411. When restarting the target application, start the target application based on the second package in the second storage partition.
[0168] For the specific descriptions of S401 to S411, reference can be made to Figures 1 to 3 the relevant descriptions, which will not be elaborated here.
[0169] In the embodiments of the present application, when starting the target application based on the first package in the first storage partition and the remaining storage space of the electronic device is greater than the threshold, the second package can be obtained and decompressed; then the decompressed second package is written to the second storage partition; in this way, when running the target application based on the first package in the first storage partition, the upgrade package can be obtained, thereby reducing the interference to the running of the target application; then, by updating the parameter value of MISC_NEXT to the storage path of the second package in the second storage partition, when the electronic device is started next time, the target application can be started based on the second package in the second storage partition, thereby realizing the seamless upgrade of the target application.
[0170] As described above in conjunction with Figures 1 to 4 the running method of the application program provided in the embodiments of the present application is described in detail; hereinafter, in conjunction with Figure 5 and Figure 6 the device embodiments of the present application will be described in detail. It should be understood that the devices in the embodiments of the present application can execute the various methods in the foregoing embodiments of the present application, that is, the specific working processes of the following various products can refer to the corresponding processes in the foregoing method embodiments.
[0171] Figure 5 is a schematic structural diagram of a starting device for an application program provided in an embodiment of the present application.
[0172] Exemplarily, the electronic device can be a terminal device such as a computer, a mobile phone, a smart interactive tablet, etc., and the embodiments of the present application do not make specific limitations thereto.
[0173] Exemplarily, as Figure 5 shown, the starting device 500 of the application program includes:
[0174] An obtaining module 510, configured to obtain a second package of the target application when running the target application based on the first package and the remaining storage space of the electronic device is greater than the threshold; wherein, the first package is stored in the first storage partition, and the version of the second package is higher than the version of the first package;
[0175] A storage module 520, configured to store the second program package in a second storage partition;
[0176] A start module 530, configured to, when there is a restart of the target application, start and run the target application based on the second program package;
[0177] The start module 530 is further configured to, when the start based on the second program package fails, start and run the target application based on the first program package.
[0178] Optionally, as an embodiment, the acquisition module 510 is further configured to, when running the target application based on the second program package and the remaining storage space of the electronic device is greater than a threshold, acquire a third program package; the version of the third program package is higher than the version of the second program package; the storage module 520 is further configured to store the third program package in a first storage partition; the start module 530 is further configured to, when there is a restart of the target application, start and run the target application based on the third program package; when the start based on the third program package fails, start and run the target application based on the second program package; when the start based on the third program package is successful, start and run the target application based on the third program package.
[0179] Optionally, as an embodiment, the start module 530 is further configured to, when the starts based on both the first program package and the second program package fail, start and run the target application based on an initial program package; and send a first prompt message; wherein, the first prompt message is used to prompt that the first program package and the second program package are in an abnormal state.
[0180] Optionally, as an embodiment, the acquisition module 510 is further configured to acquire the first program package based on the initial program package; wherein, the version of the first program package is higher than the version of the initial program package; the storage module 520 is further configured to store the first program package in the first storage partition; the start module 530 is further configured to start and run the target application based on the first program package.
[0181] Optionally, as an embodiment, the acquisition module 510 is further configured to, when the acquisition of the first program package fails, acquire the initial program package from a third storage partition; the storage module 520 is further configured to store the initial program package in the first storage partition; the start module 530 is further configured to start and run the target application based on the initial program package in the first storage partition.
[0182] Optionally, as an embodiment, the startup device 500 of the application further includes: an update module, configured to update the parameter value of the second path parameter to the storage path of the second program package; wherein the priority of the second path parameter is higher than that of the first path parameter; a startup module 530, specifically configured to obtain the second path parameter; and based on the parameter value of the second path parameter, start the target application.
[0183] Optionally, as an embodiment, the update module updates the parameter value of the third path parameter to the storage path of the first program package; and is further configured to update the parameter value of the first path parameter to the storage path of the second program package.
[0184] Optionally, as an embodiment, the startup module 530 is specifically configured to, when the startup based on the second program package fails, obtain the parameter value of the third path parameter based on the identifier of the third path parameter; and based on the parameter value of the third path parameter, start the target application.
[0185] Optionally, as an embodiment, the startup module 530 is further configured to determine whether a target script exists in the electronic device; wherein the target script is used to trigger the electronic device to preferentially execute the function corresponding to the target script; if the target script exists, automatically execute the target script; if the target script does not exist, start the target application based on the first program package.
[0186] It should be noted that the above startup device 500 of the application is embodied in the form of functional units. The term "module" here can be implemented in software and / or hardware forms, and no specific limitation is made thereto.
[0187] For example, the "module" can be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group of processors, etc.) for executing one or more software or firmware programs, a memory, a merged logic circuit, and / or other suitable components that support the described functions.
[0188] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0189] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
[0190] Exemplarily, the electronic device 600 may be a terminal device such as a computer, a mobile phone, a smart interactive tablet, etc., and the embodiments of the present application do not make specific limitations thereto.
[0191] Exemplarily, the electronic device 600 includes: a processor 610, a memory 620, and executable program code 630.
[0192] Exemplarily, the electronic device 600 includes one or more processors 610, and the one or more processors 610 can support the electronic device 600 to implement the generation method of the electronic device in the method embodiments. The processor 610 may be a general-purpose processor or a dedicated processor. For example, the processor 610 may be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, such as discrete gates, transistor logic devices, or discrete hardware components.
[0193] Exemplarily, the processor 610 can be used to control the electronic device 600, execute software programs, and process the data of the software programs. The electronic device 600 may further include a communication unit for implementing signal input (reception) and output (transmission).
[0194] Exemplarily, the electronic device 600 may include one or more memories 620, on which the executable program code 630 is stored. The executable program code 630 can be run by the processor 610 to generate instructions, so that the processor 610 executes the generation method described in the above method embodiments according to the instructions.
[0195] Optionally, data may also be stored in the memory 620. Optionally, the processor 610 may also read the data stored in the memory 620. This data may be stored at the same storage address as the executable program code 630, or it may be stored at a different storage address from the executable program code 630.
[0196] Exemplarily, the processor 610 and the memory 620 may be separately provided or integrated together. For example, they may be integrated on a system on chip (SOC) of the terminal device.
[0197] Exemplarily, the memory 620 can be used to store relevant programs for the generation method of the electronic device provided in the embodiments of the present application. The processor 610 can be used to call the executable program code 630 stored in the memory 620 when controlling the electronic device 600, and execute the running method of the application program in the embodiments of the present application. For example, when the first program package of the target application in the first storage partition is in a running state, obtain the second program package of the target application from the server; wherein, the version of the second program package is higher than that of the first program package; write the second program package to the second storage partition; when the electronic device is powered on again, start the second program package; when the start of the second program package fails, start the first program package.
[0198] The present application also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the steps of the running method of the application program in any of the foregoing embodiments.
[0199] Among them, the computer-readable storage medium can include but is not limited to any type of disk, including floppy disks, optical discs, digital versatile discs (DVDs), compact disc read-only memories (CD-ROMs), microdrives, and magneto-optical discs, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), dynamic random access memories (DRAMs), video random access memories (VRAMs), flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0200] The present application also provides a computer program product, when the computer program product runs on a computer, it causes the computer to execute the above-related steps to implement a running method of an application program in the above embodiments.
[0201] In addition, the electronic device provided by the embodiments of the present application may specifically be a chip, a component or a module. The electronic device may include a processor and a memory connected to each other. The memory is used to store instructions. When the electronic device runs, the processor may call and execute the instructions so that the chip executes the running method of an application program in the above embodiments.
[0202] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided by the present application are all used to execute the corresponding running method of the application program provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding running method of the application program provided above, and will not be elaborated here.
[0203] Through the description of the above embodiments, those skilled in the art can understand that for the convenience and conciseness of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0204] In the embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.
[0205] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for running an application, characterized in that: Applied to an electronic device; the storage space of a target hard disk in the electronic device includes a first storage partition and a second storage partition, and the target hard disk is any hard disk in the electronic device; the first storage partition and the second storage partition have read and write permissions; the flash memory module of the electronic device includes a path configuration partition; the path configuration partition includes a first path parameter, a second path parameter and a third path parameter; the first path parameter is used to indicate the current running version; the second path parameter is used to indicate the upgraded version; The priority of the third path parameter is lower than the priority of the first path parameter and the priority of the second path parameter; the operation method includes: When the target application is run based on the first program package and the remaining storage space of the electronic device is greater than a threshold, a second program package of the target application is obtained; wherein the first program package is stored in the first storage partition, and the version of the second program package is higher than the version of the first program package; the remaining storage space of the electronic device being greater than the threshold is used to indicate that the running load of the electronic device is low, and the second program package can be obtained without affecting the running of the first program package; storing the second program package in the second storage partition; updating the parameter value of the second path parameter to the storage path of the second program package; wherein the priority of the second path parameter is higher than the priority of the first path parameter; In the case where the target application needs to be restarted, obtaining the second path parameter, and starting the target application based on a parameter value of the second path parameter; Updating the parameter value of the third path parameter to the storage path of the first program package; Updating the parameter value of the first path parameter to the storage path of the second program package; In the case that the startup based on the second program package fails, obtaining a parameter value of the third path parameter based on the identifier of the third path parameter, and starting the target application based on the parameter value of the third path parameter; When the target application is run based on the second program package and the remaining storage space of the electronic device is greater than a threshold, obtaining a third program package; the version of the third program package is higher than the version of the second program package; storing the third program package in the first storage partition; Updating the parameter value of the second path parameter to the storage path of the third program package; In the case where the target application needs to be restarted, obtaining the second path parameter, and starting the target application based on a parameter value of the second path parameter; Updating the parameter value of the third path parameter to the storage path of the second program package; Updating the parameter value of the first path parameter to the storage path of the third program package; In the case that the startup based on the third program package fails, obtaining a parameter value of the third path parameter based on the identifier of the third path parameter, and starting the target application based on the parameter value of the third path parameter; In the case where the startup based on the third program package is successful, the target application is started and executed based on the third program package.
2. The method according to claim 1, characterized in that The flash memory module of the electronic device comprises a third storage partition; the third storage partition stores an initial program package of the target application; The operation method further comprises: In the case that both the first program package and the second program package fail to be started, starting and running the target application based on the initial program package; Sending a first prompt message; wherein the first prompt message is used to prompt that the first program package and the second program package are in an abnormal state.
3. The method according to claim 2, characterized in that In the case that neither the first storage partition nor the second storage partition stores any program package of the target application, the operation method further includes: Based on the initial program package, acquiring the first program package; wherein the version of the first program package is higher than the version of the initial program package; storing the first program package in the first storage partition; The target application is started and executed based on the first program package.
4. The method according to claim 3, characterized in that The operation method further comprises: In case of failure in obtaining the first program package, obtaining the initial program package from the third storage partition; storing the initial program package in the first storage partition; The target application is started and executed based on the initial program package in the first storage partition.
5. The method according to claim 2, characterized in that: The third storage partition has a readable permission.
6. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the electronic device executes the method for running the application program as claimed in any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for running the application program according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method and device for starting application program, storage medium and electronic equipment
CN112433775A