[go: up one dir, main page]

CN119322628B - Application program running method, device and storage medium - Google Patents

Application program running method, device and storage medium Download PDF

Info

Publication number
CN119322628B
CN119322628B CN202411859026.1A CN202411859026A CN119322628B CN 119322628 B CN119322628 B CN 119322628B CN 202411859026 A CN202411859026 A CN 202411859026A CN 119322628 B CN119322628 B CN 119322628B
Authority
CN
China
Prior art keywords
program package
path
target application
storage
package
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411859026.1A
Other languages
Chinese (zh)
Other versions
CN119322628A (en
Inventor
许锡聪
黄坚鹏
詹俊俞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Kaidelian Software Technology Co ltd
Original Assignee
Guangzhou Kaidelian Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Kaidelian Software Technology Co ltd filed Critical Guangzhou Kaidelian Software Technology Co ltd
Priority to CN202411859026.1A priority Critical patent/CN119322628B/en
Publication of CN119322628A publication Critical patent/CN119322628A/en
Application granted granted Critical
Publication of CN119322628B publication Critical patent/CN119322628B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/66Updates of program code stored in read-only memory [ROM]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

The application provides an application program running method, equipment and a storage medium, relating to the technical field of storage, wherein the scheme comprises the following steps: under the condition that the target application program is operated based on the first program package and the residual storage space of the electronic equipment is larger than a threshold value, acquiring a second program package of the target application program; the method comprises the steps of storing a first program package in a first storage partition, storing a second program package in a second storage partition, starting a running target application program based on the second program package when a restarting target application program exists, and starting the running target application program based on the first program package when the starting of the second program package fails. The scheme can normally start the application program under the condition of failed upgrading.

Description

应用程序的运行方法、设备及存储介质Application program operation method, device and storage medium

技术领域Technical Field

本申请涉及存储技术领域,并且更具体地,涉及存储技术领域中的一种应用程序的运行方法、设备及存储介质。The present application relates to the field of storage technology, and more specifically, to a method, device and storage medium for running an application in the field of storage technology.

背景技术Background Art

针对嵌入式系统中的应用程序升级是指对已经部署在嵌入式设备上的应用程序进行版本更新,以修复存在的问题、添加新功能或改善性能。Application upgrades in embedded systems refer to version updates of applications that have been deployed on embedded devices to fix existing problems, add new features, or improve performance.

对应用程序进行升级时,可能存在应用程序升级失败的情况,相应的,会出现升级失败的应用程序启动异常的情况。由于升级失败的应用程序无法正常启动,且无法获取升级前的应用程序,从而导致部署在嵌入式设备上的应用程序无法正常启动,用户体验感差。When upgrading an application, there may be a situation where the application upgrade fails, and accordingly, the application startup of the failed upgrade application will be abnormal. Since the application that failed to upgrade cannot be started normally and the application before the upgrade cannot be obtained, the application deployed on the embedded device cannot be started normally, resulting in a poor user experience.

因此,如何在升级失败的情况下,正常启动应用程序,是当前需要解决的问题。Therefore, how to start the application normally in case of upgrade failure is a problem that needs to be solved at present.

发明内容Summary of the invention

本申请提供了一种应用程序的运行方法、设备及存储介质,该方法能够在升级失败的情况下,正常启动应用程序。The present application provides a method, device and storage medium for running an application program, which method can start the application program normally when an upgrade fails.

第一方面,提供了一种应用程序的运行方法,应用于电子设备;电子设备中目标硬盘的存储空间包括第一存储分区和第二存储分区,目标硬盘为电子设备中的任一硬盘;该方法包括:在基于第一程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取目标应用程序的第二程序包;其中,第一程序包存储于第一存储分区,第二程序包的版本高于第一程序包的版本;将第二程序包存储于第二存储分区;在存在重新启动目标应用程序的情况下,基于第二程序包启动运行目标应用程序;在基于第二程序包启动失败的情况下,基于第一程序包启动运行目标应用程序。In a first aspect, a method for running an application is provided, which is 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 method includes: when the target application is run 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; 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; storing the second program package in the second storage partition; when there is a need to restart the target application, starting to run the target application based on the second program package; and when starting to run the target application based on the first program package fails.

在本申请的实施例中,在基于第一程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取目标应用程序的第二程序包;并将第二程序包存储于第二存储分区;由于第二程序包的版本高于第一程序包的版本,这样可以在第二存储分区中对目标应用程序进行升级;在存在重新启动目标应用程序的情况下,基于第二程序包启动运行目标应用程序;在基于第二程序包启动失败的情况下,基于第一程序包启动运行目标应用程序,进而能够实现在目标应用程序升级失败的情况下,依然能够基于第一程序包实现目标应用程序的正常启动;基于此,本申请实施例能够在升级失败的情况下,正常启动应用程序。In an embodiment of the present application, 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; and the second program package is stored in the second storage partition; since the version of the second program package is higher than the version of the first program package, the target application can be upgraded in the second storage partition; in the case of restarting the target application, the target application is started and run based on the second program package; in the case of failure to start based on the second program package, the target application is started and run based on the first program package, so that in the case of failure to upgrade the target application, the target application can still be started normally based on the first program package; based on this, the embodiment of the present application can start the application normally in the case of upgrade failure.

结合第一方面,在第一方面的某些实现方式中,本申请实施例所提供的方法还包括:在基于第二程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取第三程序包;第三程序包的版本高于第二程序包的版本;将第三程序包存储于第一存储分区;在存在重新启动目标应用程序的情况下,基于第三程序包启动运行目标应用程序;在基于第三程序包启动失败的情况下,基于第二程序包启动运行目标应用程序;在基于第三程序包启动成功的情况下,基于第三程序包启动运行目标应用程序。In combination with the first aspect, in certain implementations of the first aspect, the method provided in the embodiments of the present application also includes: when the target application is running 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; when there is a restart target application, starting to run the target application based on the third program package; when starting based on the third program package fails, starting to run the target application based on the second program package; when starting based on the third program package is successful, starting to run the target application based on the third program package.

在本申请的实施例中,通过第一存储分区和第二存储分区,可以在运行目标应用程序的同时,对目标应用程序进行无感升级;且在升级数据存在异常的情况下,可以确保正常启动目标应用程序,进而提高用户的使用体验。In an embodiment of the present application, through the first storage partition and the second storage partition, the target application can be seamlessly upgraded while the target application is running; and in the event that there is an abnormality in the upgrade data, the target application can be ensured to be started normally, thereby improving the user experience.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,电子设备的闪存模块包括第三存储分区;第三存储分区存储目标应用程序的初始程序包;本申请实施例所提供的方法还包括:在基于第一程序包和第二程序包均启动失败的情况下,基于初始程序包启动运行目标应用程序;发送第一提示信息;其中,第一提示信息用于提示第一程序包和第二程序包处于异常状态。In combination with the first aspect and the above-mentioned implementation methods, in some implementation methods of the first aspect, the flash memory module of the electronic device includes a third storage partition; the third storage partition stores the initial program package of the target application; the method provided in the embodiment of the present application also includes: in the case where both the first program package and the second program package fail to start, starting 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.

在本申请的实施例中,在基于第一程序包和第二程序包均启动失败的情况下,可以基于初始程序包启动运行目标应用程序,以确保能够正常运行目标应用程序,且能够及时提示用户第一程序包和第二程序包处于异常状态。In an embodiment of the present application, when both the first program package and the second program package fail to start, the target application can be started 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.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,在第一存储分区和第二存储分区中均未存储有目标应用程序的任一程序包的情况下,本申请实施例所提供的方法还包括:基于初始程序包,获取第一程序包;其中,第一程序包的版本高于初始程序包的版本;将第一程序包存储于第一存储分区;基于第一程序包启动运行目标应用程序。In combination with the first aspect and the above-mentioned implementation methods, in some implementation methods of the first aspect, when no program package of the target application is stored in the first storage partition and the second storage partition, the method provided in the embodiment of the present application also includes: obtaining a 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; storing the first program package in the first storage partition; and starting to run the target application based on the first program package.

在本申请的实施例中,在第一存储分区和第二存储分区通常没有存储目标应用程序的程序包的情况下,可以通过第三存储分区中的初始程序包,获取第一程序包,进而实现目标应用程序的正常运行。In an embodiment of the present application, when the first storage partition and the second storage partition usually do not store the program package of the target application, the first program package can be obtained through the initial program package in the third storage partition, thereby achieving normal operation of the target application.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,本申请实施例所提供的方法还包括:在获取第一程序包失败的情况下,从第三存储分区中获取初始程序包;将初始程序包存储于第一存储分区;基于第一存储分区中的初始程序包启动运行目标应用程序。In combination with the first aspect and the above-mentioned implementation methods, in certain implementation methods of the first aspect, the method provided in the embodiments of the present application also includes: in the event that obtaining the first program package fails, obtaining an initial program package from a third storage partition; storing the initial program package in the first storage partition; and starting to run the target application based on the initial program package in the first storage partition.

在本申请的实施例中,在获取第一程序包失败的情况下,可以基于初始程序包启动运行目标应用程序,进而实现目标应用程序的正常运行。In an embodiment of the present application, in the case of failure to obtain the first program package, the target application can be started based on the initial program package to achieve normal operation of the target application.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,第一存储分区和第二存储分区具有可读写权限;第三存储分区具有可读权限。In combination with the first aspect and the above implementations, in some implementations of the first aspect, the first storage partition and the second storage partition have read and write permissions; and the third storage partition has read permission.

在本申请实施例中,由于第一存储分区和第二存储分区具有可读写权限,第三存储分区具有可读权限,这样可以通过减少第三存储分区的写入操作,以延长闪存模块的使用寿命。In the embodiment of the present application, since the first storage partition and the second storage partition have read and write permissions, and the third storage partition has read permissions, the service life of the flash memory module can be extended by reducing the write operation of the third storage partition.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,电子设备的闪存模块包括路径配置分区;路径配置分区包括第一路径参数和第二路径参数;第一路径参数用于指示当前运行版本;第二路径参数用于指示升级版本;基于第二程序包启动运行目标应用程序之前,本申请实施例所提供的方法还包括:将第二路径参数的参数值更新为第二程序包的存储路径;其中,第二路径参数的优先级高于第一路径参数的优先级;基于第二程序包启动运行目标应用程序,包括:获取第二路径参数;基于第二路径参数的参数值,启动目标应用程序。In combination with the first aspect and the above-mentioned implementation methods, in some implementation methods 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 current running version; the second path parameter is used to indicate the upgraded version; before starting to run the target application based on the second program package, the method provided in the embodiment of the present application also includes: 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; starting to run 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.

在本申请的实施例中,通过将第二路径参数的参数值更新为第二程序包的存储路径,这样可以在对目标应用程序进行升级后,保证下一次启动电子设备时,可以启动升级后的目标应用程序。In an embodiment of the present application, by updating the parameter value of the second path parameter to the storage path of the second program package, after the target application is upgraded, it can be ensured that the upgraded target application can be started the next time the electronic device is started.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,路径配置分区还包括第三路径参数;其中,第三路径参数的优先级低于第一路径参数和第二路径参数的优先级;在存在重新启动目标应用程序的情况下,基于第二程序包启动运行目标应用程序之后,本申请实施例所提供的方法还包括:将第三路径参数的参数值更新为第一程序包的存储路径;将第一路径参数的参数值更新为第二程序包的存储路径;在基于第二程序包启动失败的情况下,基于第一程序包启动运行目标应用程序,包括:在基于第二程序包启动失败的情况下,基于第三路径参数的标识,获取第三路径参数的参数值;基于第三路径参数的参数值,启动目标应用程序。In combination with the first aspect and the above-mentioned implementation manner, in some implementation manners of the first aspect, the path configuration partition also includes a third path parameter; wherein the priority of the third path parameter is lower than the priority of the first path parameter and the second path parameter; in the case of restarting the target application, after starting to run the target application based on the second program package, the method provided in the embodiment of the present application also 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; in the case of failure to start based on the second program package, starting to run the target application based on the first program package, including: in the case of failure to start based on the second program package, based on the identifier of the third path parameter, obtaining the parameter value of the third path parameter; starting the target application based on the parameter value of the third path parameter.

在本申请的实施例中,通过更新第一路径参数为第二程序包的存储路径,这样可以在下一次对目标应用程序进行升级时,避免第二程序包的存储路径被覆盖;通过更新第三路径参数的参数值为第一程序包的存储路径,这样可以在第二程序包启动失败时,根据第三路径参数的参数值,基于第一程序包快速启动目标应用程序,以实现目标应用程序的正常运行。In an embodiment of the present application, by updating the first path parameter to the storage path of the second program package, the storage path of the second program package can be avoided from 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 program package, when the second program package fails to start, the target application can be quickly started based on the first program package according to the parameter value of the third path parameter to achieve normal operation of the target application.

结合第一方面和上述实现方式,在第一方面的某些实现方式中,本申请实施例所提供的方法还包括:判断电子设备中是否存在目标脚本;其中,目标脚本用于触发电子设备优先执行与目标脚本对应的功能;若存在目标脚本,自动执行目标脚本;若不存在目标脚本,基于第一程序包启动目标应用程序。In combination with the first aspect and the above-mentioned implementation methods, in some implementation methods of the first aspect, the method provided in the embodiments of the present application also includes: determining 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, the target script is automatically executed; if the target script does not exist, the target application is started based on the first program package.

在本申请的实施例中,通过执行目标脚本,可以对电子设备进行调试和检测,以减少电子设备异常导致目标应用程序启动异常的情况发生。In the embodiments of the present application, by executing the target script, the electronic device can be debugged and tested to reduce the occurrence of abnormalities in the start-up of the target application due to abnormalities in the electronic device.

第二方面,提供了一种电子设备,包括存储器和处理器,该存储器用于存储可执行程序代码,该处理器用于从存储器中调用并运行该可执行程序代码,使得该电子设备执行上述第一方面或第一方面任意一种可能的实现方式中的电子设备的方法。In a second aspect, an electronic device is provided, comprising a memory and a processor, wherein 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-mentioned first aspect or any possible implementation of the first aspect.

第三方面,提供了一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行上述第一方面或第一方面任意一种可能的实现方式中的应用程序的运行方法。In a third aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute a method for running an application in the first aspect or any possible implementation of the first aspect.

第四方面,提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行上述第一方面或第一方面任意一种可能的实现方式中的应用程序的运行方法。In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method for running the application in the above-mentioned first aspect or any possible implementation of the first aspect.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本申请实施例提供的一种电子设备中的结构示意图;FIG1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

图2是本申请实施例提供的一种应用程序的运行方法的示意性流程图;FIG2 is a schematic flow chart of a method for running an application program provided in an embodiment of the present application;

图3是本申请实施例提供的另一种应用程序的运行方法的示意性流程图;FIG3 is a schematic flow chart of another method for running an application program provided in an embodiment of the present application;

图4是本申请实施例提供的第三种应用程序的运行方法的示意性流程图;FIG4 is a schematic flow chart of a method for running a third application program provided in an embodiment of the present application;

图5是本申请实施例提供的一种应用程序的启动装置的结构示意图;FIG5 is a schematic diagram of the structure of a device for starting an application program provided in an embodiment of the present application;

图6是本申请实施例提供的另一种电子设备中的结构示意图。FIG. 6 is a schematic diagram of the structure of another electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

下面将结合附图,对本申请中的技术方案进行清楚、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B:文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B: "and/or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

以下,术语“第一”“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或隐含指明所指示的技术特征的数量。由此,限定有“第一”“第二”的特征可以明示或者隐含地包括一个或者多个该特征。In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

针对嵌入式系统中的应用程序升级是指对已经部署在嵌入式设备上的应用程序进行版本更新,以修复存在的问题、添加新功能或改善性能。但在对应用程序进行升级时,可能存在应用程序升级失败的情况;相应的,会出现升级失败的应用程序启动异常的情况。而此时,由于升级失败的应用程序无法正常启动,且无法获取升级前的应用程序,从而导致部署在嵌入式设备上的应用程序无法正常启动,用户体验感差。Application upgrades in embedded systems refer to updating the versions of applications that have been deployed on embedded devices to fix existing problems, add new features, or improve performance. However, when upgrading applications, there may be cases where the application upgrade fails; accordingly, there will be abnormal startup of the application that failed to upgrade. At this time, since the application that failed to upgrade cannot be started normally and the application before the upgrade cannot be obtained, the application deployed on the embedded device cannot be started normally, resulting in a poor user experience.

因此,如何在升级失败的情况下,正常启动应用程序,是当前需要解决的问题。Therefore, how to start the application normally in case of upgrade failure is a problem that needs to be solved at present.

有鉴于此,本申请提供了一种应用程序的运行方法、设备及存储介质,该方法包括:在基于第一程序包运行目标应用程序包,且电子设备的剩余存储空间大于阈值的情况下,获取并在第二存储分区存储第二程序包;在基于第二程序包重新启动目标应用程序失败的情况下,基于第一程序包启动运行目标应用程序。本申请实施例能够在升级失败的情况下,正常启动应用程序。In view of this, the present application provides an application running method, device and storage medium, the method comprising: when a target application package is run based on a first program package and the remaining storage space of the electronic device is greater than a threshold, acquiring and storing a second program package in a second storage partition; when restarting the target application based on the second program package fails, starting and running the target application based on the first program package. The embodiment of the present application can start the application normally when the upgrade fails.

下面结合图1至图6对本申请实施例提供的应用程序的运行方法、设备及存储介质进行详细说明。The following is a detailed description of the application running method, device and storage medium provided in the embodiments of the present application in conjunction with Figures 1 to 6.

图1是本申请实施例提供的一种电子设备中的结构示意图。FIG. 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

示例性的,图1中的电子设备100包括闪存模块110和至少一个硬盘120;其中,闪存模块110包括bootloader分区111,boot分区112,rootfs分区113,misc分区114和oem分区115。至少一个硬盘120中的目标硬盘的存储空间包括第一存储分区121,第二存储分区122和数据分区113。Exemplarily, the electronic device 100 in FIG1 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 the at least one hard disk 120 includes a first storage partition 121, a second storage partition 122 and a data partition 113.

其中,bootloader分区111用于加载操作系统,可以存储引导加载程序。boot分区112可以用于存储操作系统的启动内核,例如Linux内核。rootfs分区113可以用于存储根文件系统,包括操作系统的系统文件、库文件、应用程序等。misc分区114可以用于存储各种杂项数据,如系统配置、日志文件、存储路径等;例如,misc分区114可以存储第一存储分区121、第二存储分区122或者oem分区中目标应用程序的程序包的存储路径。oem分区115可以用于存放初始版本的目标应用程序;oem分区115可以通过oem分区115中初始版本的目标应用程序,在第一存储分区121或者第二存储分区122中目标应用程序出现异常时,对目标应用程序进行检测,以确定目标应用程序中的异常位置,进而减少维护成本。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, applications, etc. of the operating system. The misc partition 114 can be used to store various miscellaneous data, such as system configuration, log files, storage paths, etc.; for example, the misc partition 114 can store the storage path of the program package of the target application 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; the oem partition 115 can detect the target application through the initial version of the target application in the oem partition 115 when the target application in the first storage partition 121 or the second storage partition 122 is abnormal, so as to determine the abnormal location in the target application, thereby reducing maintenance costs.

其中,至少一个硬盘120中的每一个硬盘120可以用于存储一个或多个应用程序的数据。例如,可以在目标硬盘的存储空间包括的第一存储分区121和/或第二存储分区122中存储目标应用程序的数据;第一存储分区121和第二存储分区122中可以分别存储目标应用程序的相同版本的程序包,也可以分别存储目标应用程序的不同版本的程序包。数据分区133可以用于存储用户的数据,例如,文档、视频等。Each of the at least one hard disk 120 can be used to store data of one or more applications. For example, the data of the target application 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 same version of the target application program package, or can store different versions of the target application program package. The data partition 133 can be used to store user data, such as documents, videos, etc.

示例性的,可以将闪存模块110中的bootloader分区111,boot分区112,rootfs分区113,misc分区114和oem分区115设置为只读权限;这样,可以读取闪存模块110中的任一分区中的数据,而无法对闪存模块110中的每一分区中的数据进行修改。Exemplarily, the bootloader partition 111, boot partition 112, rootfs partition 113, misc partition 114 and 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.

示例性的,可以将至少一个硬盘120中的任一个硬盘120(例如,目标硬盘)设置为可读写权限;这样,不仅可以读取任一个硬盘120中的数据,也可以对任一硬盘120中的数据进行修改。Exemplarily, any hard disk 120 (eg, the target hard disk) of the at least one hard disk 120 may be set to have read/write permissions; thus, not only can data in any hard disk 120 be read, but data in any hard disk 120 may also be modified.

可以理解的是,考虑到电子设备中可能针对系统升级的频率少,而针对应用程序的更新频繁;由于闪存模块110在擦除和写入数据时会产生磨损,因此,减少写入操作可以延长闪存模块110的使用寿命。因此,可以将存储在闪存模块110中的系统数据(例如Linux内核、根文件系统等)设置为只读权限;然后。将应用程序存放在硬盘120中,并将硬盘120设置为可读写权限,进而可以利用硬盘120的高写入耐久性和大容量特性,对目标程序进行更新;同时也减少了闪存模块110的压力。此外,由于针对闪存模块110进行修改的操作,可能存在如果突然,导致闪存模块110中的数据损坏或丢失;因此,将应用程序存放至硬盘120中可以减少闪存模块110的写入操作,进而降低数据或丢失的风险。It is understandable that, considering that the frequency of system upgrades in electronic devices may be low, while the frequency of application updates is frequent; since the flash memory module 110 will be worn when erasing and writing data, reducing the write operation can extend the service life of the flash memory module 110. Therefore, the system data (such as the Linux kernel, the root file system, etc.) stored in the flash memory module 110 can be set to read-only permissions; then. The application is stored in the hard disk 120, and the hard disk 120 is set to have read-write permissions, so that the high write durability and large capacity characteristics of the hard disk 120 can be used 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 possibility that the data in the flash memory module 110 is damaged or lost if it is sudden; therefore, storing the application in the hard disk 120 can reduce the write operation of the flash memory module 110, thereby reducing the risk of data or loss.

图2是本申请实施例提供的一种应用程序的运行方法的示意性流程图。FIG. 2 is a schematic flowchart of a method for running an application program provided in an embodiment of the present application.

应理解,本申请实施例并未特别限定应用程序的运行方法的执行主体,只要可以通过运行记录有本申请实施例的应用程序的运行方法的代码的程序,以根据本申请实施例的应用程序的运行方法进行通信即可。例如,本申请实施例提供的应用程序的运行方法的执行主体可以是上述实施例中所描述的电子设备,也可以是电子设备中能够调用程序并执行程序的功能模块,例如,芯片,本申请对此不进行限定。It should be understood that the embodiments of the present application do not specifically limit the execution subject of the application program's running method, as long as the program that records the code of the application program's running method of the embodiments of the present application can be run to communicate according to the application program's running method of the embodiments of the present application. For example, the execution subject of the application program's running method provided by the embodiments of the present application can be the electronic device described in the above embodiments, or it can be a functional module in the electronic device that can call and execute the program, such as a chip, and the present application does not limit this.

示例性的,电子设备可以是电脑、手机、智能交互平板等终端设备,本申请实施例对此不做具体限制。Exemplarily, the electronic device may be a terminal device such as a computer, a mobile phone, or a smart interactive tablet, and the embodiments of the present application do not impose specific limitations on this.

如图2所示,应用程序的运行方法200包括S210至S240,下面对S210至S240进行详细描述。As shown in FIG. 2 , the application program running method 200 includes S210 to S240 , and S210 to S240 are described in detail below.

其中,运行方法200应用于电子设备。示例性的,电子设备可以是电脑、手机、智能交互平板等终端设备,本申请实施例对此不做具体限制。The operation method 200 is applied to an electronic device. For example, the electronic device may be a terminal device such as a computer, a mobile phone, or a smart interactive tablet, and the present application embodiment does not impose any specific limitation on this.

其中,电子设备中目标硬盘的存储空间包括第一存储分区和第二存储分区。目标硬盘为电子设备中的任一硬盘。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.

示例性的,电子设备中可以包括至少一个硬盘;每一个硬盘的存储空间可以包括一个或多个存储分区,每个存储分区中可以用于存储一个或多个应用程序的数据。不同的存储分区中可以存储相同的应用程序(相同版本的应用程序或者不同版本的应用程序)。第一存储分区和第二存储分区为一个或多个存储分区中的任意两个用于存储目标应用程序的程序包的存储分区。Exemplarily, the 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 applications. The same application (the same version of the application or different versions of the application) may be stored in different storage partitions. The first storage partition and the second storage partition are any two storage partitions of the one or more storage partitions used to store the program package of the target application.

例如,至少一个硬盘包括硬盘A和硬盘B;硬盘A的存储分区可以包括存储分区A1和存储分区A2;硬盘B的存储分区可以包括存储分区B1、存储分区B2和存储分区B3。其中,存储分区A1存储应用程序1的程序包1.1和应用程序2的程序包2.1;存储分区A2存储应用程序1的程序包1.2和应用程序2的程序包2.2;存储分区B1存储应用程序1的程序包1.1和应用程序3的程序包3.1;存储分区B2存储应用程序1的程序包1.1和应用程序3的程序包3.2;存储分区B3存储应用程序1的程序包1.1和应用程序3的程序包3.3。For example, at least one hard disk includes hard disk A and hard disk B; storage partitions of hard disk A may include storage partition A1 and storage partition A2; storage partitions of hard disk B may include storage partitions B1, storage partition B2, and storage partition B3. Storage partition A1 stores package 1.1 of application 1 and package 2.1 of application 2; storage partition A2 stores package 1.2 of application 1 and package 2.2 of application 2; storage partition B1 stores package 1.1 of application 1 and package 3.1 of application 3; storage partition B2 stores package 1.1 of application 1 and package 3.2 of application 3; storage partition B3 stores package 1.1 of application 1 and package 3.3 of application 3.

示例性的,目标硬盘可以是至少一个硬盘中的任一个硬盘。目标硬盘的存储分区可以包括至少两个存储分区。需要解释的是,本申请实施例中所提及的第一存储分区和第二存储分区用于存储目标应用程序的程序包,以实现对目标应用程序的升级、备份和检测;具体可以参考下述实施例,此处不再赘述。Exemplarily, the target hard disk may be any one of the at least one hard disk. The storage partition of the target hard disk may include at least two storage partitions. It should be explained that the first storage partition and the second storage partition mentioned in the embodiment of the present application are used to store the program package of the target application to achieve the upgrade, backup and detection of the target application; the details can be referred to the following embodiment, which will not be repeated here.

S210. 在基于第一程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取目标应用程序的第二程序包。S210. 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, obtain a second program package of the target application.

其中,第一程序包存储于第一存储分区。第二程序包的版本高于第一程序包的版本。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.

应理解,应用程序的不同版本通常会有一个对应的程序包;该程序包可以是安卓应用程序包(Android Package Kit, APK)文件。程序包中包括与程序包对应版本所特有的代码、资源和配置。可以理解的是,APK文件是安卓操作系统应用程序的安装包格式,包含了应用程序的代码、资源、资产、库等所有必要的组件。用户可以通过下载APK文件来安装应用程序到安卓设备上。It should be understood that different versions of an application usually have a corresponding package; the package can be an Android Package Kit (APK) file. The package includes code, resources, and configurations specific to the corresponding version of the package. It is understood that the APK file is the installation package format of the application program of the Android operating system, which contains all necessary components of the application program such as code, resources, assets, libraries, etc. Users can install the application program on an Android device by downloading the APK file.

示例性的,可以从服务器中获取第二程序包,也可以通过电子设备与目标设备(例如,闪存盘或者电脑等设备)连接的方式获取第二程序包;本申请实施例对此不做具体限制。Exemplarily, the second program package may be obtained from a server, or by connecting an electronic device to a target device (eg, a flash drive or a computer); the embodiment of the present application does not impose any specific limitation on this.

示例性的,目标应用程序可以包括多种版本,每种版本的数据可以为目标应用程序对应的程序包。通过这样的方式,可以满足不同的操作系统版本、设备类型或者用户需求。Exemplarily, the target application may include multiple versions, and the data of each version may be a program package corresponding to the target application. In this way, different operating system versions, device types or user requirements may be met.

示例性的,目标应用程序可以包括初始程序包、第一程序包、第二程序包、第三程序包等。其中,初始程序包可以是目标应用程序的第一个发布的版本,即初始版本。初始程序包通常包含应用程序的核心功能。第一程序包的版本高于初始程序包的版本;第二程序包的版本高于第一程序包的版本;第三程序包的版本高于第二程序包的版本。例如,初始程序包可以对应版本1.0,第一程序包可以对应版2.0,第二程序包可以对应版本3.0,第三程序包可以对应版本4.0。Exemplarily, the target application may include an initial package, a first package, a second package, a third package, etc. Among them, the initial package may 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 the version of the initial package; the version of the second package is higher than the version of the first package; the version of the third package is higher than the version of the second package. For example, the initial package may correspond to version 1.0, the first package may correspond to version 2.0, the second package may correspond to version 3.0, and the third package may correspond to version 4.0.

示例性的,阈值可以是电子设备所预配置的数值,也可以是人工设置的数值,本申请实施例对此不作具体限制。Exemplarily, the threshold value may be a value preconfigured by the electronic device, or a value set manually, and the embodiments of the present application do not impose any specific limitation on this.

应理解,上文所述的电子设备的剩余存储空间大于阈值,可以指当前电子设备的运行负载较低,可以支持执行获取第二程序包的动作,且不会影响到第一存储区域中的第一程序包的运行;当然,也可以指当前电子设备的存储空间能够支持存储第二程序包。It should be understood that the remaining storage space of the electronic device mentioned above is greater than the threshold value, which may mean that the operating load of the current electronic device is low, and can support the execution of the action of obtaining the second program package without affecting the operation of the first program package in the first storage area; of course, it may also mean that the storage space of the current electronic device can support the storage of the second program package.

示例性的,在基于第一程序包运行目标应用程序的情况下,可以根据接收到的服务器的版本更新的提示信息,确定目标应用程序存在版本更新,例如存在第二程序包,且第二程序包的版本高于第一程序包的版本。接着,在当前业务处于空闲状态的情况下,获取第二程序包。For example, when the target application is running based on the first program package, it can be determined that there is a version update of the target application, for example, there is a second program package, and the version of the second program package is higher than the version of the first program package, based on the prompt information of the version update received from the server. Then, when the current service is in an idle state, the second program package is obtained.

S220. 将第二程序包存储于第二存储分区。S220. Store the second program package in the second storage partition.

示例性的,在向第二存储分区写入第二程序包之前,第二存储分区中可以存储目标应用程序的其他版本的程序包,也可以不存储目标应用程序的任何版本的程序包,本申请实施例对此不做具体限制。Exemplarily, before writing the second program package to the second storage partition, the second storage partition may store program packages of other versions of the target application, or may not store program packages of any version of the target application, which is not specifically limited in the embodiments of the present application.

作为一种示例,在第二存储分区中存储目标应用程序的其他版本的程序包(例如,版本低于第二程序包的第四程序包)的情况下,可以将第二存储分区中的第四程序包替换为第二程序包。例如,第四程序包在第二存储分区的第一位置(例如,第一位置的存储地址可以是/mnt/partition2/Package4);将第一位置上的第四程序包替换为第二程序包,以使得第一位置的存储地址可以是/mnt/partition2/Package2。As an example, when a package of another version of the target application is stored in the second storage partition (for example, a fourth package whose version is lower than the second package), the fourth package in the second storage partition may be replaced with the second package. For example, the fourth package is in the first position of the second storage partition (for example, the storage address of the first position may be /mnt/partition2/Package4); the fourth package in the first position is replaced with the second package, so that the storage address of the first position may be /mnt/partition2/Package2.

作为另一种示例,在第二存储分区中不存储目标应用程序的任何版本的程序包的情况下,可以将第二程序包存储在第二存储分区中的可用位置,例如第二位置,并创建相应的存储地址,例如:mnt/partition2/Package2。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 in an available location in the second storage partition, such as the second location, and a corresponding storage address is created, such as: mnt/partition2/Package2.

示例性的,在获取到第二程序包之后,可以对第二程序包进行解压处理,然后向第二存储分区写入解压后的第二程序包,并对第二程序包进行文件校验。Exemplarily, after the second program package is acquired, the second program package may be decompressed, and then the decompressed second program package is written into the second storage partition, and a file check is performed on the second program package.

S230. 在存在重新启动目标应用程序的情况下,基于第二程序包启动运行目标应用程序。S230. In the case where the target application program needs to be restarted, the target application program is started based on the second program package.

可以理解的是,在第一存储分区中的第一程序包处于运行状态时,如果有目标应用程序的版本更新,可以获取第二程序包,并向区别于第一存储分区的第二存储分区写入第二程序包;然后,在重新启动目标应用程序的情况下,可以通过第二存储分区运行第二程序包,以实现目标应用程序的无感升级,减少升级过程对用户的影响,提高了用户的使用体验。It can be understood that when the first program package in the first storage partition is in a running state, if there is a version update of the target application, the second program package can be obtained and written to a second storage partition different from the first storage partition; then, when the target application is restarted, the second program package can be run through the second storage partition to achieve a seamless upgrade of the target application, reduce the impact of the upgrade process on users, and improve the user experience.

示例性的,存在重新启动目标应用程序的情况可以是:在电子设备重新启动的情况下,启动目标应用程序;或者,也可以在基于第一程序包运行目标应用程序结束之后,启动目标应用程序时;本申请实施例对此不作具体限制。Exemplarily, there is a situation where the target application is restarted: when the electronic device is restarted, the target application is started; or, the target application can be started after the target application is run based on the first program package. The embodiment of the present application does not impose any specific restrictions on this.

S240. 在基于第二程序包启动失败的情况下,基于第一程序包启动运行目标应用程序。S240. In the case that the startup based on the second program package fails, the target application is started and run based on the first program package.

示例性的,在第二程序包损坏、缺失等情况下,可能会导致基于第二程序包启动目标应用程序失败。例如,第二程序包汇总的某个关键数据删除、损坏、或者必要的配置文件丢失;或者在向第二存储分区写入第二程序包时,由于第二存储分区的存储空间不足,导致无法写入第二程序包的部分数据;或者,在获取第二程序包时,由于断电、网络波动等影响,可能导致获取的第二程序包的数据不完整;或者,由于目标硬盘中第二程序包的操作权限问题,导致无法正常启动第二程序包。因此,在检测到基于第二程序包启动目标应用程序失败的情况下,可以启动第一存储分区中的第一程序包,以确保能够正常启动目标应用程序,进而提高用户的使用体验。Exemplarily, in the case where the second program package is damaged or missing, the target application may fail to be started based on the second program package. For example, some key data summarized in the second program package is deleted or damaged, or a necessary configuration file is lost; or when writing the second program package to the second storage partition, part of the data of the second program package cannot be written due to insufficient storage space in the second storage partition; or when obtaining the second program package, the data of the obtained second program package may be incomplete due to power outages, network fluctuations, etc.; or, due to the operation permission problem of the second program package in the target hard disk, the second program package cannot be started normally. Therefore, in the case where it is detected that the target application fails to be started based on the second program package, the first program package in the first storage partition can be started to ensure that the target application can be started normally, thereby improving the user experience.

在本申请的实施例中,在基于第一程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取目标应用程序的第二程序包;并将第二程序包存储于第二存储分区;由于第二程序包的版本高于第一程序包的版本,这样可以在第二存储分区中对目标应用程序进行升级;在存在重新启动目标应用程序的情况下,基于第二程序包启动运行目标应用程序;在基于第二程序包启动失败的情况下,基于第一程序包启动运行目标应用程序,进而能够实现在目标应用程序升级失败的情况下,依然能够基于第一程序包实现目标应用程序的正常启动;基于此,本申请实施例能够在升级失败的情况下,正常启动应用程序。In an embodiment of the present application, 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; and the second program package is stored in the second storage partition; since the version of the second program package is higher than the version of the first program package, the target application can be upgraded in the second storage partition; in the case of restarting the target application, the target application is started and run based on the second program package; in the case of failure to start based on the second program package, the target application is started and run based on the first program package, so that in the case of failure to upgrade the target application, the target application can still be started normally based on the first program package; based on this, the embodiment of the present application can start the application normally in the case of upgrade failure.

在本申请的一种可能的实施例中,本申请实施例所提供的方法还包括:在基于第二程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取第三程序包;第三程序包的版本高于第二程序包的版本;将第三程序包存储于第一存储分区;在存在重新启动目标应用程序的情况下,基于第三程序包启动运行目标应用程序;在基于第三程序包启动失败的情况下,基于第二程序包启动运行目标应用程序;在基于第三程序包启动成功的情况下,基于第三程序包启动运行目标应用程序。In a possible embodiment of the present application, the method provided in the embodiment of the present application also includes: 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; when there is a restart target application, starting to run the target application based on the third program package; when the startup based on the third program package fails, starting to run the target application based on the second program package; when the startup based on the third program package is successful, starting to run the target application based on the third program package.

其中,第三程序包的版本高于第二程序包的版本。The version of the third program package is higher than the version of the second program package.

示例性的,可以在基于第二程序包运行目标应用程序的情况下,获取服务器的版本更新的提示信息,确定目标应用程序存在版本更新。Exemplarily, when the target application is run based on the second program package, version update prompt information of the server can be obtained to determine whether there is a version update for the target application.

例如,提示信息可以携带有目标应用程序的第三程序包的标识;在电子设备接收到提示信息的情况下,可以根据第三程序包的标识,确定目标应用程序存在版本更新数据,进而获取第三程序包。For example, the prompt information may carry the identifier of the third program package of the target application; when the electronic device receives the prompt information, it may determine that the target application has version update data based on the identifier of the third program package, and then obtain the third program package.

作为另一种示例,提示信息也可以仅携带有版本更新的信息;在电子设备接收到提示信息的情况下,可以直接确定目标应用程序存在版本更新数据,进而从服务器中获取第三程序包。As another example, the prompt information may also only carry version update information; when the electronic device receives the prompt information, it can directly determine that the target application has version update data, and then obtain the third program package from the server.

示例性的,在基于第二存储分区中的第二程序包运行目标应用程序,进而实现无感升级之后,若目标应用程序发布新版本,例如存在目标应用程序的第三程序包,可以获取第三程序包,并将第三程序包存储于第一存储分区;在存在重新启动目标应用程序的情况下,基于第三程序包启动运行目标应用程序,进而再一次实现目标应用程序的无感升级;此外,在基于第三程序包启动目标应用程序失败的情况下,也可以基于第二存储分区中的第二程序包启动运行目标应用程序,以确保能够正常确定目标应用程序。Exemplarily, after the target application is run based on the second program package in the second storage partition to achieve a seamless upgrade, if the target application releases a new version, for example, there is a third program package of the target application, the third program package can be obtained and stored in the first storage partition; in the case of restarting the target application, the target application is started and run based on the third program package, thereby once again achieving a seamless upgrade of the target application; in addition, in the event that starting the target application based on the third program package fails, the target application can also be started and run based on the second program package in the second storage partition to ensure that the target application can be determined normally.

在本申请的实施例中,通过第一存储分区和第二存储分区,可以在运行目标应用程序的同时,对目标应用程序进行无感升级;且在升级数据存在异常的情况下,可以确保正常启动目标应用程序,进而提高用户的使用体验。In an embodiment 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 in the event of an abnormality in the upgrade data, the target application can be ensured to be started normally, thereby improving the user experience.

在本申请的一种可能的实施例中,电子设备的闪存模块包括第三存储分区;第三存储分区存储目标应用程序的初始程序包;本申请实施例所提供的方法还包括:在基于第一程序包和第二程序包均启动失败的情况下,基于初始程序包启动运行目标应用程序;发送第一提示信息。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 an initial program package of the target application; the method provided in the embodiment of the present application also includes: in the event that both the first program package and the second program package fail to start, starting the target application based on the initial program package; and sending a first prompt message.

其中,第一提示信息用于提示第一程序包和第二程序包处于异常状态。The first prompt information is used to prompt that the first program package and the second program package are in an abnormal state.

在实际应用场景中,第三存储分区可以是如图1所示的oem分区,用于存储目标应用程序的初始程序包。由于可以将闪存模块中的oem分区设置为只读权限,这样可以避免对oem分区中的数据进行修改,以避免对初始程序包进行修改,同时减少断电等情况对oem分区中数据的影响。In actual application scenarios, the third storage partition may be an OEM partition as shown in FIG1, which is used to store the initial program package of the target application. Since the OEM partition in the flash memory module can be set to read-only permission, the data in the OEM partition can be avoided from being modified, so as to avoid modifying the initial program package, and at the same time reduce the impact of power failure and the like on the data in the OEM partition.

示例性的,可以通过邮件的方式,向用户发送第一提示信息。或者,也可以通过在电子设备的显示屏上显示的方式,发送第一提示信息,以及时提示用户第一程序包和第二程序包处于异常状态。此外,通过第一提示信息,可以提示用户第一程序包和第二程序包处于异常状态时的异常位置,进而减少维护成本。For example, the first prompt information may be sent to the user by email. Alternatively, the first prompt information may be sent by displaying it on a display screen of an electronic device to promptly remind the user that the first program package and the second program package are in an abnormal state. In addition, the first prompt information may remind the user of the abnormal location when the first program package and the second program package are in an abnormal state, thereby reducing maintenance costs.

在本申请的实施例中,在基于第一程序包和第二程序包均启动失败的情况下,可以基于初始程序包启动运行目标应用程序,以确保能够正常运行目标应用程序,且能够及时提示用户第一程序包和第二程序包处于异常状态。In an embodiment of the present application, when both the first program package and the second program package fail to start, the target application can be started 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.

在本申请的一种可能的实施例中,在第一存储分区和第二存储分区中均未存储有目标应用程序的任一程序包的情况下,本申请实施例所提供的方法还包括:基于初始程序包,获取第一程序包;将第一程序包存储于第一存储分区;基于第一程序包启动运行目标应用程序。In a possible embodiment of the present application, when no program package of the target application is stored in the first storage partition and the second storage partition, the method provided in the embodiment of the present application also includes: obtaining a first program package based on the initial program package; storing the first program package in the first storage partition; and starting to run the target application based on the first program package.

其中,第一程序包的版本高于初始程序包的版本。The version of the first program package is higher than the version of the initial program package.

示例性的,在第一存储分区和第二存储分区中没有存储目标应用程序的程序包的情况下,可以基于初始程序包,获取第一程序包,并将第一程序包存储于第一存储分区,以实现基于第一存储分区中的第一程序包启动运行目标应用程序。Exemplarily, when no program package of the target application is stored in the first storage partition and the second storage partition, a first program package can be obtained based on the initial program package and stored in the first storage partition to start running the target application based on the first program package in the first storage partition.

应理解,在第一次启动电子设备的情况下,第一存储分区和第二存储分区通常没有存储目标应用程序的程序包。此时,若需要对目标应用程序进行升级,可以通过初始程序包,获取第一程序包。例如,可以基于初始程序包的应用标识,从服务器或者目标设备中获取到与初始程序包具有相同应用标识的第一程序包。初始程序包的应用标识可以是目标应用程序的名称、应用程序的唯一编码或者应用程序的许可证等。It should be understood that when the electronic device is started for the first time, the first storage partition and the second storage partition usually do not store the program package 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, a 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 code of the application, or the license of the application.

在本申请的实施例中,在第一存储分区和第二存储分区通常没有存储目标应用程序的程序包的情况下,可以通过第三存储分区中的初始程序包,获取第一程序包,进而实现目标应用程序的正常运行。In an embodiment of the present application, when the first storage partition and the second storage partition usually do not store the program package of the target application, the first program package can be obtained through the initial program package in the third storage partition, thereby achieving normal operation of the target application.

在本申请的实施例中,本申请实施例所提供的方法还包括:在获取第一程序包失败的情况下,从第三存储分区中获取初始程序包;将初始程序包存储于第一存储分区;基于第一存储分区中的初始程序包启动运行目标应用程序。In an embodiment of the present application, the method provided in the embodiment of the present application also includes: in the event that obtaining 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 to run the target application based on the initial program package in the first storage partition.

示例性的,在电子设备处于网络隔绝状态,或者服务器中不存在目标应用程序的任何程序包等的情况下,也可以直接从第三存储分区中获取初始程序包,并将初始程序包存储于第一存储分区。Exemplarily, when the electronic device is in a network-isolated state, or when no program package of the target application exists in the server, the initial program package may be directly obtained from the third storage partition and stored in the first storage partition.

在本申请的实施例中,在获取第一程序包失败的情况下,可以基于初始程序包启动运行目标应用程序,进而实现目标应用程序的正常运行。In an embodiment of the present application, in the case of failure to obtain the first program package, the target application can be started based on the initial program package to achieve normal operation of the target application.

在本申请的一种可能的实施例中,第一存储分区和第二存储分区具有可读写权限;第三存储分区具有可读权限。In a possible embodiment of the present application, the first storage partition and the second storage partition have read and write permissions; and the third storage partition has read permission.

在实际应用场景中,第一存储分区和第二存储分区为目标硬盘的存储空间所划分的分区。第三存储分区可以是闪存模块中的oem分区。将第三存储分区设置为只读权限,这样可以读第三存储分区中的数据,而无法对第三存储分区中的数据进行修改。将目标硬盘的存储空间中的第一存储分区和第二存储分区设置为可读写权限;这样,不仅可以读取第一存储分区和第二存储分区中的数据,也可以对第一存储分区和第二存储分区中的数据进行修改。In actual application scenarios, the first storage partition and the second storage partition are partitions divided by the storage space of the target hard disk. The third storage partition can be an OEM partition in the flash memory 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 permission; in this way, not only can the data in the first storage partition and the second storage partition be read, but the data in the first storage partition and the second storage partition can also be modified.

可以理解的是,考虑到电子设备中可能针对系统升级的频率少,而针对应用程序的更新频繁;由于闪存模块在擦除和写入数据时会产生磨损,因此,减少写入操作可以延长闪存模块的使用寿命。因此,可以将用于存储初始程序包的第三存储分区设置为只读权限;进而可以减少第三存储分区的压力。此外,由于针对第三存储分区进行修改的操作,可能存在如果突然,导致第三存储分区中的数据损坏或丢失;因此,将频繁用于升级的目标应用程序的程序包存放至目标硬盘中,这样利用目标硬盘的高写入耐久性和大容量特性,对目标程序进行更新;也可以减少闪存模块的写入操作,进而降低数据丢失的风险It is understandable that, considering that the frequency of system upgrades in electronic devices may be low, while the frequency of application updates is high; and since the flash memory module will wear out when erasing and writing data, reducing write operations can extend the service life of the flash memory module. Therefore, the third storage partition used to store the initial program package can be set to read-only permissions, thereby reducing the pressure on the third storage partition. In addition, due to the modification operation on the third storage partition, there is a possibility that the data in the third storage partition may be damaged or lost if it is sudden; therefore, the program package of the target application that is frequently used for upgrading is stored in the target hard disk, so that the high write durability and large capacity characteristics of the target hard disk can be used to update the target program; it can also reduce the write operation of the flash memory module, thereby reducing the risk of data loss.

在本申请实施例中,由于第一存储分区和第二存储分区具有可读写权限,第三存储分区具有可读权限,这样可以通过减少第三存储分区的写入操作,以延长闪存模块的使用寿命。In the embodiment of the present application, since the first storage partition and the second storage partition have read and write permissions, and the third storage partition has read permissions, the service life of the flash memory module can be extended by reducing the write operation of the third storage partition.

在本申请的一种可能的实施例中,电子设备的闪存模块包括路径配置分区;路径配置分区包括第一路径参数和第二路径参数;第一路径参数用于指示当前运行版本;第二路径参数用于指示升级版本;上述S230之前,本申请实施例所提供的方法还包括:将第二路径参数的参数值更新为第二程序包的存储路径;上述S230,包括:获取第二路径参数;基于第二路径参数的参数值,启动目标应用程序。其中,第二路径参数的优先级高于第一路径参数的优先级。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 current running version; the second path parameter is used to indicate the upgrade version; before the above S230, the method provided in the embodiment of the present application also 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. Wherein, the priority of the second path parameter is higher than the priority of the first path parameter.

在实际应用场景中,路径配置分区可以是如图1所示的闪存模块中的misc分区。In an actual application scenario, the path configuration partition may be a misc partition in a flash memory module as shown in FIG1 .

示例性的,电子设备可以基于路径配置分区中的路径参数,启动路径参数对应存储路径的程序包。由于第一路径参数用于指示第一程序包的存储路径;因此,在第二路径参数的参数值为空的情况下,可以基于第一路径参数的参数值,启动第一程序包;在将第二路径参数的参数值更新为第二程序包的存储路径的情况下,由于第二路径参数的优先级高于第一路径参数的优先级,因此优先读取第二路径参数的参数值,并基于第二路径参数的参数值,启动第二程序包。Exemplarily, the electronic device can start the program package of 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 the priority of the first path parameter, the parameter value of the second path parameter is read first, and the second program package is started based on the parameter value of the second path parameter.

在本申请的实施例中,通过将第二路径参数的参数值更新为第二程序包的存储路径,这样可以在对目标应用程序进行升级后,保证下一次启动电子设备时,可以启动升级后的目标应用程序。In an embodiment of the present application, by updating the parameter value of the second path parameter to the storage path of the second program package, after the target application is upgraded, it can be ensured that the upgraded target application can be started the next time the electronic device is started.

在本申请的一种可能的实施例中,路径配置分区还包括第三路径参数;上述S230之后,本申请实施例所提供的方法还包括:将第三路径参数的参数值更新为第一程序包的存储路径;将第一路径参数的参数值更新为第二程序包的存储路径;上述S240,包括:在基于第二程序包启动失败的情况下,基于第三路径参数的标识,获取第三路径参数的参数值;基于第三路径参数的参数值,启动目标应用程序。In a possible embodiment of the present application, the path configuration partition also includes a third path parameter; after the above S230, the method provided in the embodiment of the present application also 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: in the event of a failure to start the second program package, based on the identifier of the third path parameter, obtaining the parameter value of the third path parameter; based on the parameter value of the third path parameter, starting the target application.

其中,第三路径参数的优先级低于第一路径参数和第二路径参数的优先级。The priority of the third path parameter is lower than the priorities of the first path parameter and the second path parameter.

示例性的,在将第一路径参数的参数值更新为第二程序包的存储路径,将第三路径参数的参数值更新为第一程序包的存储路径,这样可以在下一次检测到版本更新(例如,存在第三程序包)的情况下,向第一存储分区写入第三程序包之后,将第二路径参数的参数值更新为第三程序包的存储路径,避免由于第二路径参数的参数值的覆盖,导致第二程序包的存储路径丢失。Exemplarily, the parameter value of the first path parameter is updated to the storage path of the second program package, and the parameter value of the third path parameter is updated to the storage path of the first program package. In this way, when a version update is detected next time (for example, the existence of the third program package), after the third program package is written to the first storage partition, the parameter value of the second path parameter is updated to the storage path of the third program package, thereby avoiding the loss of the storage path of the second program package due to the overwriting of the parameter value of the second path parameter.

示例性的,由于将第三路径参数的参数值更新为第一程序包的存储路径,这样可以将第一程序包作为备份,以在第二存储分区中的第二程序包启动失败的情况下,根据第三路径参数的标识,快速获取到第三路径参数的参数值;并根据第三路径参数的参数值,启动第一程序包。Exemplarily, since the parameter value of the third path parameter is updated to the storage path of the first program package, the first program package can be used as a backup. When the second program package in the second storage partition fails to start, the parameter value of the third path parameter can be quickly obtained according to the identifier of the third path parameter; and the first program package can be started according to the parameter value of the third path parameter.

作为一种示例,路径配置分区包括第一路径参数、第二路径参数和第三路径参数。根据第一路径参数、第二路径参数和第三路径参数,可以执行第一路径参数的参数值、第二路径参数的参数值和第三路径参数的参数值对应的动作。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, an action corresponding to the parameter value 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.

例如,如表1所示,表1为一种路径配置分区中路径参数的执行示意表。其中,第二路径参数为:MISC_NEXT,第一路径参数为MISC_CURR,第三路径参数为MISC_BAK。其中,MISC_NEXT的优先级高于MISC_CURR和MISC_BAK,MISC_CURR的优先级高于MISC_BAK。换句话说,优先启动MISC_NEXT的参数值所指示的存储路径对应的程序包;在MISC_NEXT的参数值为NULL的情况下,启动MISC_CURR的参数值所指示的存储路径对应的程序包;在MISC_NEXT的参数值、MISC_CURR的参数值皆为NULL的情况下,启动MISC_BAK的参数值所指示的存储路径对应的程序包。需要说明的是,PATH_NEXT、PATH_CURR、PATH_BAK仅用于举例说明,并不代表本申请实施例中相关名词的具体含义。For example, as shown in Table 1, Table 1 is a schematic diagram of the execution 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 MISC_CURR and MISC_BAK, and the priority of MISC_CURR is higher than MISC_BAK. In other words, the program package corresponding to the storage path indicated by the parameter value of MISC_NEXT is started first; when the parameter value of MISC_NEXT is NULL, the program package corresponding to the storage path indicated by the parameter value of MISC_CURR is started; when the parameter value of MISC_NEXT and the parameter value of MISC_CURR are both NULL, the program 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 meaning of the relevant terms in the embodiments of the present application.

表1Table 1

举例说明:在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为NULL,MISC_BAK的参数值为NULL的情况下,此时可以认为第一次启动电子设备,基于第三存储分区中的初始程序包启动目标应用程序。在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为NULL,MISC_BAK的参数值为PATH_BAK的情况下,基于第三存储分区中的初始程序包启动目标应用程序。在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为PATH_CURR,MISC_BAK的参数值为PATH_BAK的情况下,此时可以认为在对目标应用程序进行升级(例如获取到第二程序包),并启动目标应用程序之后的路径参数的参数值。在MISC_NEXT的参数值为PATH_NEXT,MISC_CURR的参数值为PATH_CURR,MISC_BAK的参数值为PATH_BAK的情况下,此时可以认为已向存储分区写入最新版本的程序包,且在此之前已执行过至少一次对目标应用程序的升级;接着,将MISC_NEXT的参数值更新为最新版本的程序包的路径,可以基于PATH_NEXT对应的程序包启动目标应用程序,并将MISC_CURR的参数值更新为PATH_NEXT,将MISC_BAK的参数值更新为PATH_CURR,将MISC_NEXT的参数值更新为NULL。在MISC_NEXT的参数值为PATH_NEXT,MISC_CURR的参数值为PATH_CURR,MISC_BAK的参数值为NULL的情况下,此时可以认为已向存储分区写入最新版本的程序包,且在此之前未执行过对目标应用程序的升级;接着,将MISC_NEXT的参数值更新为最新版本的程序包的路径,可以基于PATH_NEXT对应的程序包启动目标应用程序,并将MISC_CURR的参数值更新为PATH_NEXT,将MISC_BAK的参数值更新为PATH_CURR,将MISC_NEXT的参数值更新为NULL。在MISC_NEXT的参数值为PATH_NEXT,MISC_CURR的参数值为NULL,MISC_BAK的参数值为PATH_BAK的情况下,可以基于PATH_NEXT对应的程序包启动目标应用程序;将MISC_CURR的参数值更新为PATH_NEXT;将MISC_NEXT的参数值更新为NULL。在MISC_NEXT的参数值为PATH_NEXT,MISC_CURR的参数值为NULL,MISC_BAK的参数值为NULL的情况下,可以认为此时为通过第三存储分区中的初始程序包对目标应用程序进行升级,并向第一存储分区写入第一程序包的场景;接着,基于PATH_NEXT对应的程序包启动目标应用程序,并将MISC_CURR的参数值更新为PATH_NEXT,将MISC_NEXT的参数值更新为NULL。在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为PATH_CURR,MISC_BAK的参数值为NULL的情况下,可以认为此时为第一次对目标应用程序进行升级并启动目标应用程序的场景。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 program 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 program 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 the parameter value of the path parameter is after the target application is upgraded (for example, the second program package is obtained) and the target application is started. 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, the parameter value of MISC_NEXT is updated to the path of the latest version of the package, the target application can be started based on the package corresponding to PATH_NEXT, and the parameter value of MISC_CURR is updated to PATH_NEXT, the parameter value of MISC_BAK is updated to PATH_CURR, and the parameter value of MISC_NEXT is updated 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, the parameter value of MISC_NEXT is updated to the path of the latest version of the package, the target application can be started based on the package corresponding to PATH_NEXT, and the parameter value of MISC_CURR is updated to PATH_NEXT, the parameter value of MISC_BAK is updated to PATH_CURR, and the parameter value of MISC_NEXT is updated 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; the parameter value of MISC_CURR is updated to PATH_NEXT; the parameter value of MISC_NEXT is updated 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 this is the scenario where 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, and 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 this is the first time to upgrade the target application and start the target application.

为了更清楚地解释本申请实施例中如何根据第一路径参数、第二路径参数和第三路径参数,启动目标程序。如表2所示,表2为在对目标应用程序进行升级后,各路径参数的参数值的变化情况的示意表。其中,PATH_A代表第一存储分区中第一程序包的存储路径,PATH_B代表第二存储分区中第二程序包的存储路径。In order 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 embodiment 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 program package in the first storage partition, and PATH_B represents the storage path of the second program package in the second storage partition.

表2Table 2

举例说明,在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为NULL,MISC_BAK的参数值为NULL的情况下,此时认为第一次启动电子设备时,启动目标应用程序,第一存储分区和第二存储分区中未存储目标应用程序对应的程序包;此时基于第三存储分区中的初始程序包启动目标应用程序。在MISC_NEXT的参数值为PATH_A,MISC_CURR的参数值为NULL,MISC_BAK的参数值为NULL的情况下,此时认为已通过第三存储分区中的初始程序包获取到第一程序包,并向第一存储分区写入第一程序包;此时可以启基于第一存储分区中的第一程序包启动目标应用程序。在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为PATH_A,MISC_BAK的参数值为NULL的情况下,此时认为通过第三存储分区中的初始程序包获取到第一程序包,并向第一存储分区写入第一程序包,且已基于第一程序包启动目标应用程序;此时可以基于第一存储分区中的第一程序包启动目标应用程序;并且,若未检测到版本更新,后面每次启动目标应用程序后,各路径参数不发生改变。在MISC_NEXT的参数值为PATH_B,MISC_CURR的参数值为PATH_A,MISC_BAK的参数值为NULL的情况下,可以认为在第一程序包处于运行状态时,获取第二程序包,并向第二存储分区写入第二程序包;此时可以基于第二存储分区中的第二程序包启动目标应用程序。在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为PATH_B,MISC_BAK的参数值为PATH_A的情况下,可以认为在向第二存储分区写入第二程序包,并基于第二程序包启动目标应用程序之后,各路径参数的变化情况;此时,可以基于第二存储分区中的第二程序包启动目标应用程序;并且,若未检测到版本更新,后面每次启动目标应用程序后,各路径参数不发生改变。在MISC_NEXT的参数值为PATH_A,MISC_CURR的参数值为PATH_B,MISC_BAK的参数值为PATH_A的情况下,可以认为在第二程序包处于运行状态时,获取到第三程序包,并向第二存储分区写入第三程序包以替换第一程序包;此时可以基于第一存储分区中的第三程序包启动目标应用程序。在MISC_NEXT的参数值为NULL,MISC_CURR的参数值为PATH_A,MISC_BAK的参数值为PATH_B的情况下,可以认为在向第一存储分区写入第三程序包,并基于第三程序包启动目标应用程序之后,各路径参数的变化情况;此时,可以基于第一存储分区中的第三程序包启动目标应用程序;并且,若未检测到版本更新,后面每次启动目标应用程序后,各路径参数不发生改变。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 has been 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 is 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 is 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, each subsequent start of the target application will not change the path parameters. 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 that after the second package is written to the second storage partition and the target application is started based on the second package, the changes in the path parameters can be considered; at this time, the target application can be started based on the second package in the second storage partition; and if no version update is detected, each subsequent start of the target application will not change the path parameters. 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 package is in the running state, the third package is obtained and the third package is written to the second storage partition to replace the first package; at this time, the target application can be started based on the third 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 that the changes in each path parameter after the third program package is written to the first storage partition and the target application is started based on the third program package; at this time, the target application can be started based on the third program package in the first storage partition; and, if no version update is detected, the path parameters will not change each time the target application is started thereafter.

需要解释的是,在电子设备第一次启动时,如果没有对目标应用程序进行升级,即使存在第一存储分区和第二存储分区,不论重启多少次目标应用程序,路径参数MISC_NEXT,MISC_CURR,MISC_BAK的参数值都为NULL。换句话说,MISC_NEXT的参数值一般是在目标应用程序进行升级后进行更新的。MISC_CURR和MISC_BAK的参数值,可以根据目标应用程序的升级和启动情况进行更新。It should be explained that when the electronic device is started for the first time, if the target application is not upgraded, even if the first storage partition and the second storage partition exist, 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 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 startup of the target application.

需要解释的是,若MISC_NEXT的参数值不为NULL,那么基于MISC_NEXT的参数值所指示的存储路径对应的程序包启动目标应用程序;若MISC_NEXT的参数值为NULL且MISC_CURR的参数值不为NULL,那么基于MISC_CURR的参数值所指示的存储路径对应的程序包启动目标应用程序;如果MISC_NEXT、MISC_CURR的参数值都为NULL,则基于第三存储分区的初始程序包启动目标应用程序。It should be explained that if the parameter value of MISC_NEXT is not NULL, 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, 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 of the third storage partition.

需要解释的是,MISC_BAK主要用于在目标应用程序升级后启动异常的情况下,恢复基于上一个版本对应的程序包启动目标应用程序。It should be explained that MISC_BAK is mainly used to restore and start the target application based on the package corresponding to the previous version when the target application fails to start normally after being upgraded.

在本申请的实施例中,通过更新第一路径参数为第二程序包的存储路径,这样可以在下一次对目标应用程序进行升级时,避免第二程序包的存储路径被覆盖;通过更新第三路径参数的参数值为第一程序包的存储路径,这样可以在基于第二程序包启动目标应用程序失败时,根据第三路径参数的参数值,基于第一程序包快速启动目标应用程序,以实现目标应用程序的正常运行。In an embodiment of the present application, by updating the first path parameter to the storage path of the second program package, the storage path of the second program package can be avoided from 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 program package, when the target application fails to be started based on the second program package, the target application can be quickly started based on the first program package according to the parameter value of the third path parameter to achieve normal operation of the target application.

作为一种可能实现的方式,本申请实施例所提供的方法还包括:判断电子设备中是否存在目标脚本;若存在目标脚本,自动执行目标脚本;若不存在目标脚本,基于第一程序包启动目标应用程序。As a possible implementation method, the method provided in the embodiment of the present application also includes: determining whether a target script exists in the electronic device; if the target script exists, automatically executing the target script; if the target script does not exist, starting the target application based on the first program package.

其中,目标脚本用于触发电子设备优先执行与目标脚本对应的功能。Among them, the target script is used to trigger the electronic device to preferentially execute the function corresponding to the target script.

示例性的,若存在目标脚本,可以认为优先执行目标脚本对应的功能,例如修复、检测等功能。For example, if a target script exists, it can be considered that the functions corresponding to the target script are executed first, such as repair, detection and other functions.

示例性的,判断电子设备中是否存在目标脚本的方式,可以是通过判断是否存在目标脚本对应的存储路径,或者是目标脚本的标识。例如,目标脚本对应的存储路径可以是/media/udisk0/debug.sh;目标脚本的标识可以是debug.sh的文件格式。比如,若存在/media/udisk0/debug.sh,可以认为电子设备与目标设备(例如,优盘)连接,并且目标设备中存储有目标脚本的数据。此时可以自动执行目标脚本。若不存在目标脚本,可以基于第一程序包启动目标应用程序。Exemplarily, a method for determining whether a target script exists in an electronic device may be to determine whether there is a storage path corresponding to the target script, or an identifier of the target script. For example, the storage path corresponding to the target script may be /media/udisk0/debug.sh; the identifier of the target script may be the file format of debug.sh. For example, if /media/udisk0/debug.sh exists, it can be considered that the electronic device is connected to a target device (e.g., a USB flash drive), and the target device stores data of the target script. At this time, the target script can be automatically executed. If the target script does not exist, the target application can be started based on the first program package.

比如,通过在电子设备中插入带有目标脚本的优盘来触发目标脚本对应的特定行为。首先,若检测有优盘插入到电子设备中,此时优盘会被挂载到一个特定的目录,如/media/udisk0。然后,电子设备可以检测优盘中是否存在目标脚本(例如,debug.sh)。若目标脚本存在,则不执行目标应用程序,而执行该目标脚本。For example, a specific behavior corresponding to a target script can be triggered by inserting a USB drive with a target script into an electronic device. First, if a USB drive is detected to be inserted into the electronic device, the USB drive will be mounted to a specific directory, such as /media/udisk0. Then, the electronic device can detect whether the target script (for example, debug.sh) exists in the USB drive. If the target script exists, the target script is executed instead of the target application.

在本申请的实施例中,通过执行目标脚本,可以对电子设备进行调试和检测,以减少电子设备异常导致目标应用程序启动异常的情况发生。In the embodiments of the present application, by executing the target script, the electronic device can be debugged and tested to reduce the occurrence of abnormalities in the start-up of the target application due to abnormalities in the electronic device.

图3是本申请实施例提供的另一种应用程序的运行方法的示意性流程图。FIG3 is a schematic flowchart of another method for running an application provided in an embodiment of the present application.

示例性的,图3所示的应用程序的运行方法300可以由电子设备执行,也可以由电子设备中的一种应用程序的启动装置执行,例如芯片。Exemplarily, the application program running method 300 shown in FIG. 3 may be executed by an electronic device, or may be executed by a startup device of an application program in the electronic device, such as a chip.

如图3所示,应用程序的运行方法300包括S301至S313,下面对S301至S313进行详细描述。As shown in FIG. 3 , the application program running method 300 includes S301 to S313 , and S301 to S313 are described in detail below.

S301. 接收针对目标应用程序的启动指令。S301. Receive a startup instruction for a target application.

作为一种示例,针对目标应用程序的启动指令可以是用户在电子设备所进行的操作。As an example, the start instruction for the target application may be an operation performed by a user on the electronic device.

作为另一种示例,在电子设备启动的情况下,自动接收针对目标应用程序的启动指令。As another example, when the electronic device is started, a startup instruction for a target application is automatically received.

S302. 判断是否存在目标脚本。若是,则执行S303;若否,则执行S304。S302. Determine whether the target script exists. If yes, execute S303; if no, execute S304.

示例性的,判断是否存在目标脚本的方式,可以是通过判断是否存在目标脚本对应的存储路径,或者是目标脚本的标识。例如,目标脚本对应的存储路径可以是/media/udisk0/debug.sh;目标脚本的标识可以是debug.sh的文件格式。比如,若存在/media/udisk0/debug.sh,可以认为电子设备与目标设备(例如,优盘)连接,并且目标设备中存储有目标脚本的数据。Exemplarily, the method of determining whether the target script exists may be to determine whether there is a storage path corresponding to the target script, or an identifier of the target script. For example, the storage path corresponding to the target script may be /media/udisk0/debug.sh; the identifier of the target script may be the file format of debug.sh. For example, 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 data of the target script.

S303. 执行目标脚本。S303. Execute the target script.

S304. 从misc分区中获取MISC_NEXT、MISC_CURR、MISC_BAK。S304. Get MISC_NEXT, MISC_CURR, and MISC_BAK from the misc partition.

示例性的,MISC_NEXT,MISC_CURR,MISC_BAK用于表示目标应用程序的存储路径的路径参数。在不存在目标脚本的情况下,可以从misc分区中获取MISC_NEXT,MISC_CURR,MISC_BAK,然后根据MISC_NEXT,MISC_CURR,MISC_BAK的参数值,执行对应的动作。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 absence of the target script, MISC_NEXT, MISC_CURR, and MISC_BAK can be obtained from the misc partition, and then the corresponding action is performed according to the parameter values of MISC_NEXT, MISC_CURR, and MISC_BAK.

S305. 判断MISC_NEXT的参数值是否为NULL;若是,则执行S306;若否,则执行S308。S305. Determine whether the parameter value of MISC_NEXT is NULL; if so, execute S306; if not, execute S308.

S306. 判断MISC_CURR的参数值是否为NULL;若是,则执行S307;若否,则执行S309。S306. Determine whether the parameter value of MISC_CURR is NULL; if so, execute S307; if not, execute S309.

S307. 基于oem分区中的初始程序包,启动目标应用程序。S307. Based on the initial program package in the OEM partition, start the target application.

S308. 基于MISC_NEXT的参数值所指示的存储路径对应的程序包,启动目标应用程序。S308. Start the target application based on the program package corresponding to the storage path indicated by the parameter value of MISC_NEXT.

例如,若MISC_NEXT的参数值为PATH_A;PATH_A为第一存储分区中第一程序包的存储路径;则基于第一程序包,启动目标应用程序。For example, if the parameter value of MISC_NEXT is PATH_A; PATH_A is the storage path of the first program package in the first storage partition; then based on the first program package, the target application is started.

再例如,若MISC_NEXT的参数值为PATH_B;PATH_B为第二存储分区中第二程序包的存储路径;则基于第二程序包,启动目标应用程序。For another example, if the parameter value of MISC_NEXT is PATH_B; PATH_B is the storage path of the second program package in the second storage partition; then based on the second program package, the target application is started.

S309. 基于MISC_CURR的参数值所指示的存储路径对应的程序包,启动目标应用程序。S309. Start the target application based on the program package corresponding to the storage path indicated by the parameter value of MISC_CURR.

例如,若MISC_CURR的参数值为PATH_A;PATH_A为第一存储分区中第一程序包的存储路径;则基于第一程序包,启动目标应用程序。For example, if the parameter value of MISC_CURR is PATH_A; PATH_A is the storage path of the first program package in the first storage partition; then based on the first program package, the target application is started.

再例如,若MISC_CURR的参数值为PATH_B;PATH_B为第二存储分区中第二程序包的存储路径;则基于第二程序包,启动目标应用程序。For another example, if the parameter value of MISC_CURR is PATH_B; PATH_B is the storage path of the second program package in the second storage partition; then based on the second program package, the target application is started.

S310. 判断程序包是否启动异常。若是,则执行S311。S310. Determine whether the program package is started abnormally. If so, execute S311.

S311. 判断MISC_BAK的参数值是否为NULL;若是,则执行S307;若否,则执行S312。S311. Determine whether the parameter value of MISC_BAK is NULL; if so, execute S307; if not, execute S312.

S312. 基于MISC_BAK的参数值所指示的存储路径对应的备用程序包,启动目标应用程序。S312. Start the target application based on the backup program package corresponding to the storage path indicated by the parameter value of MISC_BAK.

例如,若MISC_BAK的参数值为PATH_A;PATH_A为第一存储分区中第一程序包的存储路径;则基于第一程序包,启动目标应用程序。For example, if the parameter value of MISC_BAK is PATH_A; PATH_A is the storage path of the first program package in the first storage partition; then based on the first program package, the target application is started.

再例如,若MISC_BAK的参数值为PATH_B;PATH_B为第二存储分区中第二程序包的存储路径;则基于第二程序包,启动目标应用程序。For another example, if the parameter value of MISC_BAK is PATH_B; PATH_B is the storage path of the second program package in the second storage partition; then based on the second program package, the target application is started.

S313. 判断备用程序包是否启动异常。若是,则执行S307。S313. Determine whether the standby program package is started abnormally. If so, execute S307.

关于S301至S313的具体描述,可以参见图1至图2的相关描述,此处不再赘述。For the detailed description of S301 to S313 , please refer to the relevant description of FIG. 1 to FIG. 2 , which will not be repeated here.

在本申请的实施例中,通过从misc分区中获取MISC_NEXT、MISC_CURR、MISC_BAK,这样可以根据MISC_NEXT、MISC_CURR、MISC_BAK的参数值,确定基于哪个存储分区的程序包,启动目标应用程序;并在程序包启动异常的情况下,通过路径参数MISC_NEXT、MISC_CURR、MISC_BAK,基于备份程序包或者初始程序包,启动目标应用程序,以实现目标应用程序的正常运行。In an embodiment of the present application, by obtaining MISC_NEXT, MISC_CURR, and MISC_BAK from the misc partition, it is possible to determine based on the parameter values of MISC_NEXT, MISC_CURR, and MISC_BAK which storage partition's package is used to start the target application; and in the event of an abnormal package startup, the target application is started based on the backup package or the initial package through the path parameters MISC_NEXT, MISC_CURR, and MISC_BAK to achieve normal operation of the target application.

图4是本申请实施例提供的第三种应用程序的运行方法的示意性流程图;FIG4 is a schematic flow chart of a method for running a third application program provided in an embodiment of the present application;

示例性的,图4所示的应用程序的运行方法400可以由电子设备执行,也可以由电子设备中的应用程序的启动装置执行,例如芯片。Exemplarily, the application program running method 400 shown in FIG. 4 may be executed by an electronic device, or may be executed by an application program starting device in the electronic device, such as a chip.

如图4所示,应用程序的运行方法400包括S401至S411,下面对S401至S411进行详细描述。As shown in FIG. 4 , the application program running method 400 includes S401 to S411 , and S401 to S411 are described in detail below.

S401. 基于第一存储分区中的第一程序包,启动目标应用程序。S401. Start a target application based on a first program package in a first storage partition.

S402. 判断是否主动升级;若是,则执行S403;若否,则执行S405。S402. Determine whether to actively upgrade; if so, execute S403; if not, execute S405.

S403. 当目标设备与电子设备连接时,在电子设备上显示升级页面。S403. When the target device is connected to the electronic device, an upgrade page is displayed on the electronic device.

S404. 响应于用户在升级页面上的操作,获取升级包。S404. In response to the user's operation on the upgrade page, obtain an upgrade package.

S405. 接收来自服务器的针对目标应用程序的版本更新的提示信息。S405. Receive a prompt message for a version update of the target application from the server.

S406. 判断当前电子设备的运行状态是否处于空闲状态;若是,则执行S407。S406. Determine whether the current operation state of the electronic device is in an idle state; if so, execute S407.

S407. 从服务器中获取升级包。S407. Obtain the upgrade package from the server.

S408. 对升级包进行解压,得到第二程序包。S408. Decompress the upgrade package to obtain a second program package.

S409. 向第二存储分区写入解压后的第二程序包,并进行文件校验。S409. Write the decompressed second program package into the second storage partition and perform file verification.

S410. 将MISC_NEXT的参数值更新为第二存储分区中第二程序包的存储路径。S410. Update the parameter value of MISC_NEXT to the storage path of the second program package in the second storage partition.

S411. 当重启目标应用程序时,基于第二存储分区中的第二程序包,启动目标应用程序。S411. When restarting the target application, start the target application based on the second program package in the second storage partition.

关于S401至S411的具体描述,可以参见图1至图3的相关描述,此处不再赘述。For the detailed description of S401 to S411, please refer to the relevant description of Figures 1 to 3, which will not be repeated here.

在本申请的实施例中,当基于第一存储分区的第一程序包启动目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,则可以获取并解压第二程序包;然后向第二存储分区写入解压后的第二程序包;这样可以实现在基于第一存储分区的第一程序包运行目标应用程序时,获取升级包,进而减少对目标应用程序运行的干扰;然后,通过将MISC_NEXT的参数值更新为第二存储分区中第二程序包的存储路径,这样可以在下一次电子设备启动时,基于第二存储分区中的第二程序包启动目标应用程序,进而实现对目标应用程序进行无感升级。In an embodiment of the present application, when the target application is started by the first program package based on the first storage partition and the remaining storage space of the electronic device is greater than a threshold, the second program package can be obtained and decompressed; then the decompressed second program package is written to the second storage partition; in this way, when the target application is run by the first program package based on the first storage partition, the upgrade package can be obtained, thereby reducing interference with the operation of the target application; then, by updating the parameter value of MISC_NEXT to the storage path of the second program package in the second storage partition, the target application can be started based on the second program package in the second storage partition the next time the electronic device is started, thereby achieving a seamless upgrade of the target application.

上文结合图1至图4详细描述了本申请实施例提供的应用程序的运行方法;下面将结合图5与图6详细描述本申请的装置实施例。应理解,本申请实施例中的装置可以执行前述本申请实施例的各种方法,即以下各种产品的具体工作过程,可以参考前述方法实施例中的对应过程。The above describes in detail the operation method of the application provided by the embodiment of the present application in conjunction with Figures 1 to 4; the following describes in detail the device embodiment of the present application in conjunction with Figures 5 and 6. It should be understood that the device in the embodiment of the present application can execute the various methods of the aforementioned embodiment of the present application, that is, the specific working process of the following various products can refer to the corresponding process in the aforementioned method embodiment.

图5是本申请实施例提供的一种应用程序的启动装置的结构示意图。FIG. 5 is a schematic diagram of the structure of a device for starting an application program provided in an embodiment of the present application.

示例性的,电子设备可以是电脑、手机、智能交互平板等终端设备,本申请实施例对此不做具体限制。Exemplarily, the electronic device may be a terminal device such as a computer, a mobile phone, or a smart interactive tablet, and the embodiments of the present application do not impose specific limitations on this.

示例性的,如图5所示,应用程序的启动装置500包括:Exemplarily, as shown in FIG5 , the application startup device 500 includes:

获取模块510,用于在基于第一程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取目标应用程序的第二程序包;其中,第一程序包存储于第一存储分区,第二程序包的版本高于第一程序包的版本;The acquisition module 510 is used to acquire a second program package of the target application 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; 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;

存储模块520,用于将第二程序包存储于第二存储分区;The storage module 520 is used to store the second program package in the second storage partition;

启动模块530,用于在存在重新启动目标应用程序的情况下,基于第二程序包启动运行目标应用程序;A starting module 530, configured to start running the target application based on the second program package when there is a restart of the target application;

启动模块530,还用于在基于第二程序包启动失败的情况下,基于第一程序包启动运行目标应用程序。The startup module 530 is further configured to start and run the target application based on the first program package if the startup based on the second program package fails.

可选地,作为一个实施例,获取模块510,还用于在基于第二程序包运行目标应用程序,且电子设备的剩余存储空间大于阈值的情况下,获取第三程序包;第三程序包的版本高于第二程序包的版本;存储模块520,还用于将第三程序包存储于第一存储分区;启动模块530,还用于在存在重新启动目标应用程序的情况下,基于第三程序包启动运行目标应用程序;在基于第三程序包启动失败的情况下,基于第二程序包启动运行目标应用程序;在基于第三程序包启动成功的情况下,基于第三程序包启动运行目标应用程序。Optionally, as an embodiment, the acquisition module 510 is further used to acquire a third program package when the target application is running based on the second program package and the remaining storage space of the electronic device is greater than a threshold; the version of the third program package is higher than the version of the second program package; the storage module 520 is further used to store the third program package in the first storage partition; the startup module 530 is further used to start running the target application based on the third program package when there is a restart target application; start running the target application based on the second program package when the startup based on the third program package fails; and start running the target application based on the third program package when the startup based on the third program package succeeds.

可选地,作为一个实施例,启动模块530,还用于在基于第一程序包和第二程序包均启动失败的情况下,基于初始程序包启动运行目标应用程序;发送第一提示信息;其中,第一提示信息用于提示第一程序包和第二程序包处于异常状态。Optionally, as an embodiment, the startup module 530 is also used to start running the target application based on the initial program package when both the first program package and the second program package fail to start; 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.

可选地,作为一个实施例,获取模块510,还用于基于初始程序包,获取第一程序包;其中,第一程序包的版本高于初始程序包的版本;存储模块520,还用于将第一程序包存储于第一存储分区;启动模块530,还用于基于第一程序包启动运行目标应用程序。Optionally, as an embodiment, the acquisition module 510 is also used to acquire a 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 also used to store the first program package in a first storage partition; the startup module 530 is also used to start running the target application based on the first program package.

可选地,作为一个实施例,获取模块510,还用于在获取第一程序包失败的情况下,从第三存储分区中获取初始程序包;存储模块520,还用于将初始程序包存储于第一存储分区;启动模块530,还用于基于第一存储分区中的初始程序包启动运行目标应用程序。Optionally, as an embodiment, the acquisition module 510 is also used to obtain the initial program package from the third storage partition when the acquisition of the first program package fails; the storage module 520 is also used to store the initial program package in the first storage partition; the startup module 530 is also used to start running the target application based on the initial program package in the first storage partition.

可选地,作为一个实施例,应用程序的启动装置500还包括:更新模块,用于将第二路径参数的参数值更新为第二程序包的存储路径;其中,第二路径参数的优先级高于第一路径参数的优先级;启动模块530,具体用于获取第二路径参数;基于第二路径参数的参数值,启动目标应用程序。Optionally, as an embodiment, the application startup device 500 also includes: an update module, used 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 the priority of the first path parameter; a startup module 530, specifically used to obtain the second path parameter; and based on the parameter value of the second path parameter, start the target application.

可选地,作为一个实施例,更新模块,将第三路径参数的参数值更新为第一程序包的存储路径;还用于将第一路径参数的参数值更新为第二程序包的存储路径。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 also used to update the parameter value of the first path parameter to the storage path of the second program package.

可选地,作为一个实施例,启动模块530,具体用于在基于第二程序包启动失败的情况下,基于第三路径参数的标识,获取第三路径参数的参数值;基于第三路径参数的参数值,启动目标应用程序。Optionally, as an embodiment, the startup module 530 is specifically used to obtain the parameter value of the third path parameter based on the identifier of the third path parameter when the startup based on the second program package fails; and start the target application based on the parameter value of the third path parameter.

可选地,作为一个实施例,启动模块530,还用于判断电子设备中是否存在目标脚本;其中,目标脚本用于触发电子设备优先执行与目标脚本对应的功能;若存在目标脚本,自动执行目标脚本;若不存在目标脚本,基于第一程序包启动目标应用程序。Optionally, as an embodiment, the startup module 530 is also used 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, the target script is automatically executed; if the target script does not exist, the target application is started based on the first program package.

需要说明的是,上述应用程序的启动装置500以功能单元的形式体现。这里的术语“模块”可以通过软件和/或硬件形式实现,对此不作具体限定。It should be noted that the application startup device 500 is implemented in the form of a functional unit. The term "module" here can be implemented in the form of software and/or hardware, and is not specifically limited to this.

例如,“模块”可以是实现上述功能的软件程序、硬件电路或二者结合。硬件电路可能包括应用特有集成电路(application specific integrated circuit,ASIC)、电子电路、用于执行一个或多个软件或固件程序的处理器(例如共享处理器、专有处理器或组处理器等)和存储器、合并逻辑电路和/或其它支持所描述的功能的合适组件。For example, a "module" may 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 processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and/or other suitable components that support the described functions.

因此,在本申请的实施例中描述的各示例的单元,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

图6是本申请实施例提供的一种电子设备的结构示意图。FIG. 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

示例性的,电子设备600可以是电脑、手机、智能交互平板等终端设备,本申请实施例对此不做具体限制。Exemplarily, the electronic device 600 may be a terminal device such as a computer, a mobile phone, or a smart interactive tablet, and the embodiments of the present application do not impose any specific restrictions on this.

示例性的,电子设备600包括:处理器610、存储器620和可执行程序代码630。Exemplarily, the electronic device 600 includes: a processor 610 , a memory 620 , and an executable program code 630 .

示例性的,电子设备600包括一个或多个处理器610,该一个或多个处理器610可支持电子设备600实现方法实施例中的电子设备的生成方法。处理器610可以是通用处理器或者专用处理器。例如,处理器610可以是中央处理器(central processing unit,CPU)、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specificintegrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件,如分立门、晶体管逻辑器件或分立硬件组件。Exemplarily, the electronic device 600 includes one or more processors 610, which can support the electronic device 600 to implement the method for generating an electronic device in the method embodiment. The processor 610 can be a general-purpose processor or a special-purpose processor. For example, the processor 610 can 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.

示例性的,处理器610可以用于对电子设备600进行控制,执行软件程序,处理软件程序的数据。电子设备600还可以包括通信单元,用以实现信号的输入(接收)和输出(发送)。Exemplarily, the processor 610 may be used to control the electronic device 600, execute software programs, and process data of the software programs. The electronic device 600 may also include a communication unit to implement input (reception) and output (transmission) of signals.

示例性的,电子设备600中可以包括一个或多个存储器620,其上存有可执行程序代码630,可执行程序代码630可被处理器610运行,生成指令,使得处理器610根据指令执行上述方法实施例中描述的生成方法。Exemplarily, the electronic device 600 may include one or more memories 620 on which executable program code 630 is stored. The executable program code 630 can be executed by the processor 610 to generate instructions, so that the processor 610 executes the generation method described in the above method embodiment according to the instructions.

可选地,存储器620中还可以存储有数据。可选地,处理器610还可以读取存储器620中存储的数据,该数据可以与可执行程序代码630存储在相同的存储地址,该数据也可以与可执行程序代码630存储在不同的存储地址。Optionally, data may be stored in the memory 620. Optionally, the processor 610 may read data stored in the memory 620, which may be stored at the same storage address as the executable program code 630, or may be stored at a different storage address from the executable program code 630.

示例性地,处理器610和存储器620可以单独设置,也可以集成在一起,例如,集成在终端设备的系统级芯片(system on chip,SOC)上。Exemplarily, the processor 610 and the memory 620 may be provided separately or integrated together, for example, integrated on a system on chip (SOC) of the terminal device.

示例性地,存储器620可以用于存储本申请实施例中提供的电子设备的生成方法的相关程序,处理器610可以用于在控制电子设备600时调用存储器620中存储的可执行的程序代码630,执行本申请实施例的应用程序的运行方法;例如,当第一存储分区中的目标应用程序的第一程序包处于运行状态时,从服务器中获取目标应用程序的第二程序包;其中,第二程序包的版本高于第一程序包的版本;向第二存储分区写入第二程序包;当电子设备重新上电时,启动第二程序包;当第二程序包启动失败时,启动第一程序包。Exemplarily, the memory 620 can be used to store relevant programs of the generation method of the electronic device provided in the embodiment of the present application, and 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 of the embodiment 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 the version 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 second program package fails to start, start the first program package.

本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前述任一实施例的应用程序的运行方法的步骤。The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for running the application program of any of the aforementioned embodiments.

其中,计算机可读存储介质可以包括但不限于任何类型的盘,包括软盘、光盘、数字通用光盘(Digital Video Disc,DVD)、紧凑型光盘只读储存器(Compact Disc Read-Only Memory,CD-ROM)、微型驱动器以及磁光盘、只读储存器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、可擦除可编程只读存储器(ErasableProgrammable Read-Only Memory,EPROM)、带电可擦可编程只读存储器(ElectricallyErasable Programmable read only memory,EEPROM)、动态随机存取存储器(DynamicRandom Access Memory,DRAM)、影像随机接达记忆器(Video Random Access Memory,VRAM)、闪速存储器设备、磁卡或光卡、纳米系统(包括分子存储器IC),或适合于存储指令和/或数据的任何类型的媒介或设备。Among them, computer-readable storage media may include, but are not limited to, any type of disk, including floppy disks, optical disks, digital versatile disks (DVD), compact disc read-only memory (CD-ROM), microdrives and magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read only memory (EEPROM), dynamic random access memory (DRAM), video random access memory (VRAM), 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.

本申请还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的一种应用程序的运行方法。The present application also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement a method for running an application program in the above-mentioned embodiment.

另外,本申请的实施例提供的电子设备具体可以是芯片,组件或模块,该电子设备可包括相连的处理器和存储器;其中,存储器用于存储指令,当电子设备运行时,处理器可调用并执行指令,以使芯片执行上述实施例中的一种应用程序的运行方法。In addition, the electronic device provided in the embodiments of the present application may specifically be a chip, a component or a module, and the electronic device may include a connected processor and a memory; wherein the memory is used to store instructions, and when the electronic device is running, the processor may call and execute instructions so that the chip executes a method for running an application in the above-mentioned embodiments.

其中,本申请提供的电子设备、计算机可读存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的应用程序的运行方法,因此,其所能达到的有益效果可参考上文所提供的对应的应用程序的运行方法中的有益效果,此处不再赘述。Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this application is used to execute the operating method of the corresponding application provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the operating method of the corresponding application provided above, and will not be repeated here.

通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (7)

1.一种应用程序的运行方法,其特征在于,应用于电子设备;所述电子设备中目标硬盘的存储空间包括第一存储分区和第二存储分区,所述目标硬盘为所述电子设备中的任一硬盘;所述第一存储分区和所述第二存储分区具有可读写权限;所述电子设备的闪存模块包括路径配置分区;所述路径配置分区包括第一路径参数、第二路径参数和第三路径参数;所述第一路径参数用于指示当前运行版本;所述第二路径参数用于指示升级版本;所述第三路径参数的优先级低于所述第一路径参数的优先级和所述第二路径参数的优先级;所述运行方法包括:1. A method for running an application, characterized in that it is 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 running method comprises: 在基于第一程序包运行目标应用程序,且所述电子设备的剩余存储空间大于阈值的情况下,获取所述目标应用程序的第二程序包;其中,所述第一程序包存储于所述第一存储分区,所述第二程序包的版本高于所述第一程序包的版本;所述电子设备的剩余存储空间大于阈值用于表示所述电子设备的运行负载较低,支持获取所述第二程序包,且不影响所述第一程序包的运行;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.根据权利要求1所述的方法,其特征在于,所述电子设备的闪存模块包括第三存储分区;所述第三存储分区存储所述目标应用程序的初始程序包;所述运行方法还包括:2. The method according to claim 1 is characterized in that the flash memory module of the electronic device includes a third storage partition; the third storage partition stores the initial program package of the target application; and 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.根据权利要求2所述的方法,其特征在于,在所述第一存储分区和所述第二存储分区中均未存储有所述目标应用程序的任一程序包的情况下,所述运行方法还包括:3. The method according to claim 2, characterized in that, when neither the first storage partition nor the second storage partition stores any program package of the target application, the running method further comprises: 基于所述初始程序包,获取所述第一程序包;其中,所述第一程序包的版本高于所述初始程序包的版本;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.根据权利要求3所述的方法,其特征在于,所述运行方法还包括: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.根据权利要求2所述的方法,其特征在于,所述第三存储分区具有可读权限。5. The method according to claim 2, characterized in that the third storage partition has readable permission. 6.一种电子设备,其特征在于,所述电子设备包括:6. An electronic device, characterized in that the electronic device comprises: 存储器,用于存储可执行程序代码;A memory for storing executable program codes; 处理器,用于从所述存储器中调用并运行所述可执行程序代码,使得所述电子设备执行如权利要求1至5中任一项所述的应用程序的运行方法。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.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至5中任一项所述的应用程序的运行方法。7. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method for running the application program according to any one of claims 1 to 5.
CN202411859026.1A 2024-12-17 2024-12-17 Application program running method, device and storage medium Active CN119322628B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411859026.1A CN119322628B (en) 2024-12-17 2024-12-17 Application program running method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411859026.1A CN119322628B (en) 2024-12-17 2024-12-17 Application program running method, device and storage medium

Publications (2)

Publication Number Publication Date
CN119322628A CN119322628A (en) 2025-01-17
CN119322628B true CN119322628B (en) 2025-05-30

Family

ID=94234275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411859026.1A Active CN119322628B (en) 2024-12-17 2024-12-17 Application program running method, device and storage medium

Country Status (1)

Country Link
CN (1) CN119322628B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112433775A (en) * 2019-08-20 2021-03-02 比亚迪股份有限公司 Method and device for starting application program, storage medium and electronic equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626060B (en) * 2021-08-06 2023-08-01 天津津航计算技术研究所 Online upgrade method based on separate storage under vxworks system
CN114035828A (en) * 2021-12-14 2022-02-11 北京天融信网络安全技术有限公司 Program upgrading method and device, electronic equipment and storage medium
CN118113319A (en) * 2022-11-30 2024-05-31 海尔优家智能科技(北京)有限公司 Equipment operation control method and device, storage medium and electronic device
CN117492788A (en) * 2023-10-23 2024-02-02 广州禾多阡陌科技有限公司 Chip program upgrading method, device, electronic equipment and computer readable medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112433775A (en) * 2019-08-20 2021-03-02 比亚迪股份有限公司 Method and device for starting application program, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN119322628A (en) 2025-01-17

Similar Documents

Publication Publication Date Title
US8719810B2 (en) Program upgrade system and method for over the air-capable mobile terminal
US9471435B2 (en) Information processing device, information processing method, and computer program
CN110825563B (en) System recovery method and device and electronic equipment
CN108509215B (en) System software replacing method and device, terminal equipment and storage medium
US20240378042A1 (en) Operating System Update Method, Electronic Device, and Storage Medium
US20130007439A1 (en) Multicore processor system, computer product, and notification method
US20060064576A1 (en) Boot systems and methods
CN113032183A (en) System management method, device, computer equipment and storage medium
CN113138791B (en) Upgrade processing method, device and electronic equipment based on embedded system
CN114385418A (en) Protection method, device, equipment and storage medium for communication equipment
CN119322628B (en) Application program running method, device and storage medium
CN109634782B (en) A system robustness detection method, device, storage medium and terminal
CN116719670B (en) Data processing method, electronic device and readable storage medium
US11630714B2 (en) Automated crash recovery
US20240176887A1 (en) Method for Running Startup Program of Electronic Device, and Electronic Device
CN111158733A (en) A kind of BMC upgrade method, apparatus, equipment and computer readable storage medium
US20240330006A1 (en) Bootloader startup procedure monitoring method and apparatus, embedded device, and storage medium
CN116719564A (en) Device starting method and device based on memory partition and electronic device
CN111258617B (en) Electronic equipment
CN114153481A (en) Driving system updating method and device and computer equipment
JP2011054212A (en) Program, method, and mechanism for taking panic dump
CN112667444A (en) System upgrading method, storage medium and terminal equipment
KR101420026B1 (en) A method, apparatus and computer program for loading files during a boot-up process
CN112579113A (en) Application program upgrading method and device, storage medium and terminal
CN115048244B (en) A server hardware repair method, system, computer equipment and medium

Legal Events

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