WO2020210955A1 - 应用程序启动的方法、装置、电子设备及存储介质 - Google Patents

应用程序启动的方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2020210955A1
WO2020210955A1 PCT/CN2019/082740 CN2019082740W WO2020210955A1 WO 2020210955 A1 WO2020210955 A1 WO 2020210955A1 CN 2019082740 W CN2019082740 W CN 2019082740W WO 2020210955 A1 WO2020210955 A1 WO 2020210955A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
optimized
application
damaged
optimized file
Prior art date
Application number
PCT/CN2019/082740
Other languages
English (en)
French (fr)
Inventor
莫斯挺
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2019/082740 priority Critical patent/WO2020210955A1/zh
Priority to CN201980091281.7A priority patent/CN113396391B/zh
Publication of WO2020210955A1 publication Critical patent/WO2020210955A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This application relates to the technical field of electronic equipment, and more specifically, to a method, device, electronic equipment, and storage medium for starting an application program.
  • terminal devices such as smart phones and tablet computers and the increasingly rich functions
  • users demand for these terminal devices is also increasing. Users often install various applications in the terminal devices to achieve various Features.
  • the electronic device sometimes has a black screen, a white screen or a freeze, which affects the user experience.
  • This application proposes a method, device, electronic device, and storage medium for starting an application program to solve the problem of a black screen, a white screen, or a freeze when the application program starts.
  • an embodiment of the present application provides a method for starting an application program, the method includes: receiving an application startup instruction; determining whether the optimized file of the application program is damaged; if the optimized file is damaged, directly loading the application
  • the unoptimized file of the program starts the application program, wherein the optimized file is a file optimized by the unoptimized file, and the unoptimized file and the optimized file include all operation instructions and running instructions of the application program. Time data.
  • an embodiment of the present application provides a device for starting an application program.
  • the device includes: a receiving module for receiving an application startup instruction; a judgment module for judging whether the optimized file of the application program is damaged;
  • the startup module is configured to directly load the unoptimized file of the application program to start the application program if the optimized file is damaged, wherein the optimized file is a file optimized by the unoptimized file, and the unoptimized file and
  • the optimized file includes all operating instructions and runtime data of the application program.
  • an embodiment of the present application provides an electronic device that includes one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory And is configured to be executed by the one or more processors, and the one or more programs are configured to execute the method applied to the electronic device as described above.
  • an embodiment of the present application provides a computer-readable storage medium in which program code is stored, wherein the above-mentioned method is executed when the program code is running.
  • the method, device, electronic device, and storage medium for starting an application program receive an application startup instruction; determine whether the optimized file of the application program is damaged; if the optimized file is Damaged, load the unoptimized file of the application directly to start the application, wherein the optimized file is a file optimized by the unoptimized file, and the unoptimized file and the optimized file include the All operating instructions and runtime data.
  • the optimized file of the application is damaged, the unoptimized file of the application is directly loaded to start the application, which avoids the phenomenon of black screen caused by the optimization operation when the optimized file is damaged during the startup of the application, thereby improving the application’s use user experience.
  • Fig. 1 shows a flowchart of a method for starting an application provided by an embodiment of the present application.
  • Fig. 2 shows a flowchart of a method for starting an application provided by another embodiment of the present application.
  • Fig. 3 shows a flowchart of a method for starting an application provided by another embodiment of the present application.
  • Fig. 4 shows a flow chart of a method for starting an application provided by still another embodiment of the present application.
  • Fig. 5 shows a functional module diagram of an application startup apparatus provided by an embodiment of the present application.
  • Fig. 6 shows a functional module diagram of a judgment module provided by an embodiment of the present application.
  • FIG. 7 shows a structural block diagram of an electronic device proposed by an embodiment of the present application for executing the method for starting an application program according to an embodiment of the present application.
  • FIG. 8 shows a storage medium provided by an embodiment of the present application for storing or carrying program code for implementing the application startup method according to the embodiment of the present application.
  • the main execution code is in the class.dex file, that is, the unoptimized file.
  • the Android system will optimize the class.dex file to a certain extent, and generate an odex file after optimization.
  • the odex file is the optimized file.
  • dex2oat The process of optimizing the class.dex file into an odex file is called dex2oat, which is the process of generating optimized files by performing optimization operations on unoptimized files in this application.
  • dex2oat the process of generating optimized files by performing optimization operations on unoptimized files in this application.
  • the time consumed by the optimization operation to generate the optimized file varies.
  • the second boot can be after installation, system upgrade, hot update, etc.
  • the system re-executes the optimization operation on the unoptimized file of the application to generate a new optimized file, and then loads the generated optimized file to start the application. It takes a long time to perform optimization operations on unoptimized files, causing a black screen, a white screen, or a freeze when starting up, and a poor user experience.
  • the inventor proposes the method, device, electronic device and storage medium for starting the application in this application, by receiving the starting instruction of the application; judging whether the optimized file of the application is damaged; if the optimized file is damaged, directly Load an unoptimized file of the application program to start the application program, where the optimized file is a file optimized by the unoptimized file, and the unoptimized file and the optimized file include all operation instructions of the application program And runtime data.
  • the unoptimized file of the application is directly loaded to start the application, which avoids the phenomenon of black screen caused by the optimization operation when the optimized file is damaged during the startup of the application, thereby improving the application’s use user experience.
  • an embodiment of the present application provides an application startup method, and the execution subject of the processing procedure described in this embodiment may be an electronic device.
  • the specific method may include:
  • Step S110 Receive an application startup instruction.
  • the application can be launched in various ways, such as being launched by the user according to demand, or launched by other applications. For example, when a user needs to start an application, he can start the application by clicking or touching the application on the electronic device as the start instruction, and the electronic device can receive the start instruction of the application initiated by the user; another example, an application needs to be used Another application program sends data, and the one application program can initiate a startup instruction to the other application program, and then a startup instruction to start the other application program is correspondingly received.
  • Step S120 Determine whether the optimized file of the application program is damaged.
  • the electronic device After receiving the start instruction of the application program, the electronic device can learn the application program that needs to be started. Thus, the electronic device can determine whether the optimized file corresponding to the application program is damaged.
  • the optimized file obtained after the electronic device performs an optimization operation on the unoptimized file of the application program is essentially a file in the ELF format.
  • the determination of whether the optimized file of the application program is damaged may be to determine whether the identification of the ELF file is correct, and if the identification of the ELF file is incorrect, it is determined that the optimized file of the application program is damaged.
  • an implementation mode is selected as the method for determining whether the optimized file is damaged in the examples of this application, in this embodiment, if it is determined that the optimized file is damaged, it can be determined that the optimized file is damaged; if the optimized file is determined in this embodiment If the file does not meet the damage condition, it is determined that the optimized file is not damaged. If more than one implementation is used as the implementation of the embodiments of this application, when it is determined that the optimized file is damaged in any one of the implementations, it is determined that the optimized file of the application is damaged; if all the implementations do not meet the damage determination conditions, it is determined that The optimized file is not damaged.
  • Step S130 if the optimized file is damaged, directly load the unoptimized file of the application to start the application, wherein the optimized file is the optimized file of the unoptimized file, the unoptimized file and the The optimized file includes all operation instructions of the application program and runtime data.
  • Optimized files are files generated after performing optimization operations on unoptimized files.
  • Unoptimized files are dex files, and optimized files are odex files.
  • the unoptimized file and the optimized file include all the operating instructions of the application program to run-time data.
  • the optimized file is extracted on the basis of the unoptimized file, that is, the required data is extracted before the application is started, so that the startup speed of the application can be accelerated when the application is started through the optimized file.
  • the unoptimized file of the application can be directly obtained, and the unoptimized file is used to start application.
  • the application startup method proposed in this application receives an application startup instruction; determines whether the optimized file of the application is damaged; if the optimized file is damaged, directly loads the unoptimized file of the application to start the application, wherein
  • the optimized file is a file optimized by the unoptimized file, and the unoptimized file and the optimized file include all operation instructions and runtime data of the application program.
  • the unoptimized file of the application is directly loaded to start the application, which avoids the phenomenon of black screen caused by the optimization operation when the optimized file is damaged during the startup of the application, thereby improving the application’s use user experience.
  • FIG. 2 another embodiment of the present application provides an application startup method. Based on the foregoing embodiments, this embodiment focuses on the process of judging that the optimized file is damaged through the identification of the optimized file.
  • the method may include :
  • Step S210 Receive an application start instruction.
  • step S210 reference may be made to the corresponding part of the foregoing embodiment, which will not be repeated here.
  • Step S220 Check whether the identification of the optimized file is correct.
  • the optimized file is a file generated after an optimization operation is performed on an unoptimized file. After receiving a startup instruction of the application program, it can be determined whether the optimized file is damaged. Specifically, it may be to determine whether the identification of the optimized file is correct.
  • the optimized file itself is a file in ELF format.
  • ELF type files the content of the first few bytes is fixed.
  • the file type can be determined based on the content of these bytes, and the content of these bytes is called the magic number.
  • ELF files also have ELF magic numbers. That is, the first 4 bytes of the ELF file are the identification codes that all ELF files must be the same, which are "0x7f", "0x45”, "0x4C”, and "0x46".
  • the first byte “0x7f” corresponds to the DEL control character in the ASCII byte
  • the second byte “0x45” corresponds to the capital letter “E” in the ASCII code
  • the third byte “0x4C” corresponds to the ASCII code
  • the fourth byte “0x46” corresponds to the uppercase letter "F” in ASCII code.
  • the first four bytes in the file header of the optimized file may be read; and it is determined whether the first four bytes are ELF magic numbers.
  • the first byte when the first byte is obtained, it can be determined whether the first byte is "0x7f"; if not, it is determined that the identification of the optimized file is incorrect; if it is, then Obtain the second byte.
  • the second byte When the second byte is obtained, it is determined whether the second byte is "0x45"; if not, it is determined that the identification of the optimized file is incorrect; if it is, the second byte is obtained.
  • step S230 if it is incorrect, it is determined that the optimized file is damaged, the damaged optimized file is deleted, and the unoptimized file of the application is directly loaded to start the application.
  • the optimized file is damaged. Delete the damaged optimized file, obtain the unoptimized file of the application, and directly load the unoptimized file to start the application. If it is determined that the identification of the optimized file is correct, it can be determined that the optimized file is not damaged, and the optimized file can be loaded to start the application.
  • the application startup method proposed in this application determines whether the optimized file is damaged by checking whether the file recognition of the optimized file is correct; if the optimized file is damaged, delete the damaged optimized file, and directly load the application program The optimized file starts the application. It avoids the situation that the optimization operation is performed during the startup of the application due to the damage of the optimized file, which causes a black screen, thereby improving the user experience of the application in use.
  • FIG. 3 another embodiment of the present application provides an application startup method. Based on the foregoing embodiments, this embodiment focuses on the process of judging and optimizing file damage through damage logs.
  • the method may include:
  • Step S310 Receive an application start instruction.
  • step S310 reference may be made to the corresponding part of the foregoing embodiment, which is not repeated here.
  • Step S320 Check whether there is a damage log corresponding to the optimized file.
  • a damage log will be generated. Then, in determining whether the optimized file is damaged, it can be checked whether there is a damage log corresponding to the optimized file. If the damage log exists, it can be determined that the optimized file is damaged. Specifically, in the Android system, there is a code that determines whether the optimized file is damaged. Through this code, it is determined whether the optimized file is damaged. If the optimized file is damaged, a corresponding damage log will be generated. Specifically, the content of this damage log can be "linker: dlopen failed: "/data/data/xxx/dex/oat/arm/dexpatch_merged.odex” has bad ELF magic, targetsdk: 26, retry”. If a damage log corresponding to the optimized file is checked, it is determined that the optimized file is damaged. If there is no damage log corresponding to the optimized file, it is determined that the optimized file is not damaged.
  • step S330 if it exists, it is determined that the optimized file is damaged, the damaged optimized file is deleted, and the unoptimized file of the application is directly loaded to start the application.
  • the optimized file is damaged.
  • the damaged optimized file can be deleted, the unoptimized file of the application program can be obtained, and the unoptimized file can be directly loaded to start the application program. If the damage log corresponding to the optimized file is not checked, it can be determined that the optimized file is not damaged, and the optimized file can be loaded to start the application.
  • the application startup method proposed in this application determines whether the optimized file is damaged by checking whether there is a damage log corresponding to the optimized file; if the optimized file is damaged, delete the damaged optimized file and directly load the unoptimized file of the application The file starts the application. It avoids the situation that the optimization operation is performed during the startup of the application due to the damage of the optimized file, which causes a black screen, thereby improving the user experience of the application in use.
  • FIG. 4 another embodiment of the present application provides an application startup method. Based on the foregoing embodiments, this embodiment focuses on the application startup process.
  • the method may include:
  • Step S410 Receive an application start instruction.
  • step S410 reference may be made to the corresponding part of the foregoing embodiment, which is not repeated here.
  • Step S420 Check whether there is an optimized file of the application program.
  • step S430 After receiving the start instruction of the application program, it can be found whether there is an optimized file of the application program, and if the optimized file exists, step S430 is executed.
  • the optimized file can be searched directly, such as searching through the storage directory of the optimized file, searching through the file suffix of the optimized file, and so on. If the optimized file of the application program does not exist, it indicates that the optimized file of the application program is lost or the application program is started for the first time. Then, the unoptimized file of the application program can be obtained, the optimization operation is performed on the unoptimized file to generate the optimized file of the application program, and then the application program is started according to the generated optimized file.
  • step S430 is executed.
  • Step S430 if there is an optimized file, it is determined whether the optimized file of the application program is damaged.
  • judging whether the optimized file of the application program is damaged can be checking whether the identification of the optimized file is correct; it can also be checking whether there is a damage log corresponding to the optimized file, etc. For details, please refer to the corresponding part of the foregoing embodiment, which will not be repeated here. If it is determined that the optimized file of the application program is damaged, step S440 is executed. If it is determined that the optimized file is not damaged, load the optimized file of the application to start the application.
  • Step S440 If the optimized file is damaged, delete the damaged optimized file, and directly load the unoptimized file of the application to start the application.
  • the corresponding damaged optimized file can be deleted, the unoptimized file corresponding to the application program can be directly obtained, and the application program can be started by loading the unoptimized file. This avoids re-executing optimization operations on unoptimized files when the optimized files are damaged, causing a black screen to start.
  • step S450 it is monitored whether the application program meets the optimized execution conditions.
  • the application program after the application program is successfully started, in the running state, it can be monitored whether the application program meets the optimized execution condition. Specifically, it may be to monitor whether the application program uses the unoptimized file during operation, and when it is detected that the application program uses the unoptimized file during operation, it is determined that the optimized execution condition is satisfied.
  • step S460 if it is satisfied, an optimization operation is performed on the unoptimized file to generate an optimized file of the application program.
  • an optimization operation is performed on the unoptimized file, and an optimized file corresponding to the application program is generated. This avoids performing optimization operations during the startup process, blocking the startup process, and enables the application to be started through the optimized file the next time it is started, thereby improving the startup speed.
  • the application startup method searches whether there is an optimized file of the application, and if it exists, it determines whether the optimized file of the application is damaged; if the optimized file of the application is damaged, deletes the damaged optimization file File, load the unoptimized file of the application program directly to start the application program; after the program is started, it is detected whether the application program meets the optimized execution conditions, and when the optimized execution conditions are met, the optimized file is optimized to generate the application program Optimized files. This avoids performing optimization operations during the startup process and blocking the black screen during the startup process, and improves the user experience of the application in use.
  • FIG. 5 shows a device 500 for starting an application program provided by an embodiment of the present application.
  • the device 500 includes a receiving module 510, a determining module 520, and a starting module 530.
  • the receiving module 510 is used to receive the start instruction of the application program; the judgment module 520 is used to judge whether the optimized file of the application program is damaged; the starting module 530 is used to directly load the unoptimized file of the application program if the optimized file is damaged
  • the application program is started, wherein the optimized file is a file optimized by the unoptimized file, and the unoptimized file and the optimized file include all operation instructions and runtime data of the application program.
  • the activation module 530 is also used to delete the damaged optimized file if the optimized file is damaged.
  • FIG. 6 shows a functional module diagram of a judgment module 520 provided by an embodiment of the present application.
  • the judgment module 520 includes a first inspection unit 521 and a second inspection unit 522.
  • the first checking unit 521 is configured to check whether the file identifier of the optimized file is correct; if it is not correct, determine that the optimized file is damaged.
  • the second checking unit is used to check whether there is a damage log corresponding to the optimized file; if there is a damage log of the optimized file, it is determined that the optimized file is damaged.
  • the first checking unit 521 is also configured to read the first four bytes in the file header of the optimized file; determine whether the first four bytes are ELF magic numbers; if the first four If the byte is not an ELF magic number, it is determined that the identification of the optimized file is incorrect.
  • the first checking unit 521 is also used to compare whether the values of the first four bytes are sequentially "0x7f”, “0x45”, “0x4C”, and "0x46"; if the first four characters are The value of the section is not “0x7f”, “0x45”, “0x4C”, "0x46", and it is determined that the first four bytes are not ELF magic numbers.
  • the judging module 520 is also used to find whether there is an optimized file of the application program; if it exists, execute the judgment of whether the optimized file of the application program is damaged. step.
  • the activation module 530 is also configured to, if the optimized file of the application does not exist, obtain the unoptimized file corresponding to the application, perform an optimization operation on the unoptimized file to generate an optimized file corresponding to the application, and generate The optimized file starts the application.
  • the judgment module 520 is also used to judge whether the application program is started for the first time; if not, execute the judgment whether the optimized file of the application program is Damaged steps.
  • the startup module 530 is also configured to, if the application is started for the first time, obtain the unoptimized file corresponding to the application, perform an optimization operation on the unoptimized file to generate an optimized file corresponding to the application, and generate The optimized file starts the application.
  • startup module 530 is also used to monitor whether the application program meets the optimized execution conditions; if so, perform an optimization operation on the unoptimized file, and generate an optimized file corresponding to the application program.
  • the starting module 530 is also used to load the optimized file of the application program to start the application program if the optimized file is not damaged.
  • the unoptimized file is a dex file
  • the optimized file is an odex file
  • the application startup method receives an application startup instruction; determines whether the optimized file of the application is damaged; if the optimized file is damaged, directly loads the unoptimized file startup location of the application
  • the application program wherein the optimized file is a file optimized by the unoptimized file, and the unoptimized file and the optimized file include all operation instructions and runtime data of the application program.
  • the optimized file of the application is damaged, the unoptimized file of the application is directly loaded to start the application, which avoids the phenomenon of black screen caused by the optimization operation when the optimized file is damaged during the startup of the application, thereby improving the application’s use user experience.
  • the coupling or direct coupling or communication connection between the displayed or discussed modules may be through some interfaces.
  • the indirect coupling or communication connection of the devices or modules may be electrical, Mechanical or other forms.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • the electronic device 600 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book.
  • the electronic device 600 in this application may include one or more of the following components: a processor 610, a memory 620, and one or more application programs, where one or more application programs may be stored in the memory 620 and configured to be configured by One or more processors 610 execute, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
  • the processor 610 may include one or more processing cores.
  • the processor 610 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 620, and calling data stored in the memory 620.
  • the processor 610 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 610 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented by a communication chip alone.
  • the memory 620 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 620 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 620 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions for implementing the following method embodiments, etc.
  • the storage data area can also store data created by the electronic device 600 during use (such as phone book, audio and video data, chat record data) and the like.
  • FIG. 8 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable storage medium 700 stores program codes, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
  • the computer-readable storage medium 700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 700 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 700 has a storage space for the program code 710 for executing any method steps in the above methods. These program codes can be read out from or written into one or more computer program products.
  • the program code 710 may be compressed in a suitable form, for example.

Landscapes

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

Abstract

一种应用程序启动的方法、装置、电子设备及存储介质。所述方法包括:接收应用程序的启动指令(S110);判断所述应用程序的优化文件是否损坏(S120);若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时的数据(S130)。通过判断应用程序的优化文件是否损坏,在损坏时直接加载应用程序的未优化文件启动应用程序,避免了应用程序在启动过程中优化文件损坏时,执行优化操作引起黑屏等现象,从而提升了应用程序在使用中的用户体验。

Description

应用程序启动的方法、装置、电子设备及存储介质 技术领域
本申请涉及电子设备技术领域,更具体地,涉及一种应用程序启动的方法、装置、电子设备及存储介质。
背景技术
随着智能手机、平板电脑等终端设备的硬件配置不断提升、功能日益丰富,用户对这些终端设备的需求也在增强,用户往往会在终端设备中安装各种各样的应用程序以实现各种功能。但是,应用程序在启动时,电子设备有时候会出现黑屏、白屏或者卡顿的现象,影响用户体验。
发明内容
本申请提出了一种应用程序启动的方法、装置、电子设备及存储介质,以解决应用程序启动黑屏、白屏或者卡顿的问题。
第一方面,本申请实施例提供了一种应用程序启动的方法,该方法包括:接收应用程序的启动指令;判断所述应用程序的优化文件是否损坏;若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时数据。
第二方面,本申请实施例提供了一种应用程序启动的装置,该装置包括:接收模块,用于接收应用程序的启动指令;判断模块,用于判断所述应用程序的优化文件是否损坏;启动模块,用于若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进 行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时数据。
第三方面,本申请实施例提供了一种电子设备,该电子设备包括一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如上述应用于电子设备的方法。
第四方面,本申请实施列提供一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。
相对于现有技术,本申请实施例提供的应用程序启动的方法、装置、电子设备及存储介质,通过接收应用程序的启动指令;判断所述应用程序的优化文件是否损坏;若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时数据。在应用程序的优化文件损坏时直接加载应用程序的未优化文件启动应用程序,避免了应用程序在启动过程中优化文件损坏时,执行优化操作引起黑屏等现象,从而提升了应用程序在使用中的用户体验。
本申请的这些方面或其他方面在以下实施例的描述中会更加简明易懂。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了本申请一个实施例提供的应用程序启动的方法的流程图。
图2示出了本申请另一个实施例提供的应用程序启动的方法的流程图。
图3示出了本申请又一个实施例提供的应用程序启动的方法的流程图。
图4示出了本申请再一个实施例提供的应用程序启动的方法的流程图。
图5示出了本申请一个实施例提供的应用程序启动的装置的功能模块图。
图6示出了本申请一个实施例提供的一种判断模块的功能模块图。
图7示出了本申请实施例提出的用于执行根据本申请实施例的应用程序启动的方法的电子设备的结构框图。
图8示出了本申请实施例提供的用于保存或者携带实现根据本申请实施例的应用程序启动方法的程序代码的存储介质。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
现有的移动终端几乎都可以安装应用程序,用户可以根据需求安装不同的应用程序。对于应用程序在启动过程中出现的黑屏、白屏以及卡顿等现象,发明人经过研究发现,有时候是由于应用程序的优化文件损坏,该应用程序在启动过程中重新生成优化文件,而该重新生成优化文件的耗时较长,导致应用程序在无法快速启动,产生黑屏、白屏或者卡顿等现象。
具体的,例如,对于一个Android系统的apk应用程序,其主要的执行代码都在其中的class.dex文件即未优化文件中。在应用程序第一次被加载的时候,为了提高以后的启动速度和执行效率,Android系统会对这个class.dex文件做一定程度的优化,优化后生成一个odex文件,odex文件即为优化文件。 以后再启动这个应用程序的时候,可以直接加载应用程序的优化文件,节省了每次都要对未优化文件进行优化的时间,从而提升了应用程序的启动速度。
将class.dex文件优化为odex文件的过程称为dex2oat,即为本申请中的对未优化文件执行优化操作生成优化文件的过程。根据未优化文件的大小,优化操作生成优化文件的过程所消耗的时间不一样。在一般情况下,应用程序在电子设备中第一次启动时容易对未优化文件执行优化操作,在这种场景下,可以通过提频或开多线程来缩短做优化操作的时间,该第一次启动可以是安装后、系统升级后、热更新后等。但是在应用程序并非第一次的启动过程中,若应用程序的优化文件损坏,系统重新对应用程序的未优化文件执行优化操作生成新的优化文件,再加载生成的优化文件启动应用程序,该对未优化文件执行优化操作所需要的时间较长,引起启动黑屏、白屏或者卡顿,给用户带来不良的使用体验。
因此,发明人提出了本申请中应用程序启动的方法、装置、电子设备及存储介质,通过接收应用程序的启动指令;判断所述应用程序的优化文件是否损坏;若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时数据。在应用程序的优化文件损坏时直接加载应用程序的未优化文件启动应用程序,避免了应用程序在启动过程中优化文件损坏时,执行优化操作引起黑屏等现象,从而提升了应用程序在使用中的用户体验。
下面将对本申请实施例进行详细的说明。
请参阅图1,本申请实施例提供了一种应用程序启动方法,本实施例描述 的处理流程的执行主体可以是电子设备。具体的该方法可以包括:
步骤S110,接收应用程序的启动指令。
在电子设备中,用户可以根据自己的需求安装相应的应用程序。应用程序可以通过各种方式启动,如由用户根据需求启动,或者由其他应用开启。例如,用户在需要启动应用程序时,可以通过点击或触摸电子设备上的应用程序作为启动指令启动应用程序,电子设备可以接收到用户发起的应用程序的启动指令;又如,一个应用程序需要使用另一个应用程序进行数据发送,该一个应用程序则可以向该另一个应用程序发起启动指令,则对应接收到对该另一个应用程序进行启动的启动指令。
步骤S120,判断所述应用程序的优化文件是否损坏。
电子设备在接收到应用程序的启动指令后,可以获知需要启动的应用程序。由此,电子设备可以判断应用程序对应的优化文件是否损坏。
在一种实施方式中,由于电子设备对应用程序的未优化文件进行优化操作后得到的优化文件,本质上是一个ELF格式的文件。判断所述应用程序的优化文件是否损坏可以是判断ELF文件的标识是否正确,若所述ELF文件的标识不正确,则判定所述应用程序的优化文件损坏。
在另一种实施方式中,可以判断系统中是否存在着应用程序的优化文件的损坏日志,若存在着应用程序的优化文件的损坏日志,则判定所述应用程序的优化文件损坏。
需要说明的是,上述两种实施方式可以择一作为本申请实施例的实施方式,或者均作为本申请实施例的实施方式。另外,本申请实施例中也可以通过其他实施方式判断优化文件是否损坏,如通过电子设备的系统中其他的判断优化文 件是否损坏的代码。
若选择一种实施方式作为本申请实施例中优化文件是否损坏的判定方式,则在该实施方式下,若判定优化文件损坏,则可以确定该优化文件损坏;若在该实施方式下判定该优化文件不满足损坏条件,则确定优化文件未损坏。若不止一个实施方式均作为本申请实施例的实施方式,当任意一个实施方式下判定优化文件损坏,则判定该应用程序的优化文件损坏;若所有实施方式均不满足损坏判定条件,则判定该优化文件未损坏。
步骤S130,若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时的数据。
若所述优化文件损坏,可以获取应用程序的未优化文件,直接加载应用程序的未优化文件启动应用程序。优化文件为对未优化文件执行优化操作后生成的文件,未优化文件为dex文件,优化文件为odex文件。其中,未优化文件和优化文件中包括了应用程序的全部操作指令以运行时的数据。优化文件是在未优化文件的基础上提取的,即在应用程序启动之前就将需要的数据提取出来,以通过优化文件启动应用程序时可以加快应用程序的启动速度。在优化文件损坏的情况下,为了避免在启动过程中对未优化文件执行优化操作而产生黑屏、白屏或者卡顿等问题,可以直接获取应用程序的未优化文件,通过所述未优化文件启动应用程序。
本申请提出的应用程序启动方法,通过接收应用程序的启动指令;判断所述应用程序的优化文件是否损坏;若所述优化文件损坏,直接加载应用程序的 未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时数据。在应用程序的优化文件损坏时直接加载应用程序的未优化文件启动应用程序,避免了应用程序在启动过程中优化文件损坏时,执行优化操作引起黑屏等现象,从而提升了应用程序在使用中的用户体验。
请参阅图2,本申请另一实施例提供了一种应用程序启动方法,本实施例在前述实施例的基础上,重点描述了通过优化文件的标识判断优化文件损坏的过程,该方法可以包括:
步骤S210,接收应用程序的启动指令。
步骤S210可参照前述实施例对应部分,在此不再赘述。
步骤S220,检查所述优化文件的标识是否正确。
优化文件为对未优化文件执行优化操作后生成的文件,在接收到应用程序的启动指令后,可以判断所述优化文件是否损坏。具体的,可以是判断所述优化文件的标识是否正确。
其中,优化文件本身是一个ELF格式的文件。在ELF类型的文件,其起始的几个字节的内容是固定的。根据这几个字节的内容就可以确定出文件类型,这几个字节的内容被称为魔数。同样的,ELF文件也存在ELF魔数。即在ELF文件最开始的4个字节是所有ELF文件都必须相同的标识码,分别为“0x7f”,“0x45”,“0x4C”,“0x46”。其中,第一个字节“0x7f”对应ASCII字节里面的DEL控制符,第二个字节“0x45”对应ASCII码中的大写字母“E”,第三个字节“0x4C”对应ASCII码中的大写字母“L”,第四个字节“0x46”对应ASCII码中的大写字母“F”。
因此,可以读取所述优化文件的文件头中的前四个字节;判断所述前四个字节是否为ELF魔数;若所述前四个字节不为ELF魔数,判定所述优化文件的标识不正确。具体的,可以在获取到所述优化文件后,读取优化文件的文件头中的前四个字节;判断所述前四个字节是否为ELF魔数。
在一种实施方式中,可以是判断所述前四个字节是否依次为“0x7f”,“0x45”,“0x4C”,“0x46”,若获取到的前四个字节的内容的顺序不为“0x7f”,“0x45”,“0x4C”,“0x46”,则可判定所述优化文件的标识不正确。若是前四个字节不为“0x7f”,“0x45”,“0x4C”,“0x46”,也可以判定所述优化文件的标识不正确。
在另一种实施方式中,可以在获取到第一个字节时,判断所述第一个字节是否为“0x7f”;若不是,则判定所述优化文件的标识不正确;若是,则获取第二个字节,获取到第二个字节时,则判断所述第二个字节是否为“0x45”;若不是,则判定所述优化文件的标识不正确;若是,则获取第三个字节,获取到第三个字节时,则判断所述第三个字节是否为“0x4C”;若不是,则判定所述优化文件的标识不正确;若是,则获取第四个字节,获取到第四个字节时,则判断所述第四个字节是否为“0x46”;若不是,则判定所述优化文件的标识不正确;若是,则可以认为获取的文件头的前四个字节的内容依次为“0x7f”,“0x45”,“0x4C”,“0x46”,为ELF魔数,则判定所述优化文件的标识正确。
步骤S230,若不正确,判定所述优化文件损坏,删除损坏的所述优化文件,直接加载应用程序的未优化文件启动所述应用程序。
若判定所述优化文件的标识不正确,则可判定所述优化文件损坏。删除损坏的优化文件,获取应用程序的未优化文件,直接加载所述未优化文件启动所述应用程序。若判定所述优化文件的标识正确,则可判定所述优化文件未损坏, 则可以加载所述优化文件启动所述应用程序。
本申请提出的应用程序启动方法,通过检查所述优化文件的文件识别是否正确,来确定所述优化文件是否损坏;若所述优化文件损坏,则删除损坏的优化文件,直接加载应用程序的未优化文件启动所述应用程序。避免了因为优化文件的损坏,而在应用程序启动过程中执行优化操作,从而引起黑屏的情况,从而提升了应用程序在使用中的用户体验。
请参阅图3,本申请又一实施例提供了一种应用程序启动方法,本实施例在前述实施例的基础上,重点描述了通过损坏日志判断优化文件损坏的过程,该方法可以包括:
步骤S310,接收应用程序的启动指令。
步骤S310可参照前述实施例对应部分,在此不再赘述。
步骤S320,检查是否存在优化文件对应的损坏日志。
其中,若应用程序的优化文件损坏后,会产生一个损坏日志。那么在判断所述优化文件是否损坏,可以检查是否存在优化文件对应的损坏日志。若存在所述损坏日志,则可判定所述优化文件损坏。具体的,在Android系统中,存在着判断优化文件是否损坏的代码,通过这个代码,判断出优化文件是否损坏,若优化文件损坏后,会生成对应的损坏日志。具体的,这个损坏日志的内容可以是“linker:dlopen failed:“/data/data/xxx/dex/oat/arm/dexpatch_merged.odex”has bad ELF magic,targetsdk:26,retry”。若检查到有优化文件对应的损坏日志,则判定所述优化文件损坏。若未检查到有优化文件对应的损坏日志,则判定所述优化文件未损坏。
步骤S330,若存在,判定所述优化文件损坏,删除损坏的所述优化文件, 直接加载应用程序的未优化文件启动所述应用程序。
若检查到存在所述优化文件对应的损坏日志,则可判定所述优化文件损坏。可以删除损坏的优化文件,获取应用程序的未优化文件,直接加载所述未优化文件启动所述应用程序。若未检查到所述优化文件对应的损坏日志,则可判定所述优化文件未损坏,则可以加载所述优化文件启动所述应用程序。
本申请提出的应用程序启动方法,通过检查是否存在优化文件对应的损坏日志,来确定所述优化文件是否损坏;若所述优化文件损坏,则删除损坏的优化文件,直接加载应用程序的未优化文件启动所述应用程序。避免了因为优化文件的损坏,而在应用程序启动过程中执行优化操作,从而引起黑屏的情况,从而提升了应用程序在使用中的用户体验。
请参阅图4,本申请再一实施例提供了一种应用程序启动方法,本实施例在前述实施例的基础上,重点描述了应用程序启动的过程,该方法可以包括:
步骤S410,接收应用程序的启动指令。
步骤S410可参照前述实施例对应的部分,在此不再赘述。
步骤S420,查找是否存在所述应用程序的优化文件。
在接收到应用程序的启动指令后,可以查找是否存在所述应用程序的优化文件,若存在所述优化文件,则执行步骤S430。
作为一种实施方式,可以直接对优化文件进行查找,如通过优化文件的存储目录进行查找,通过优化文件的文件后缀进行查找等。若不存在所述应用程序的优化文件,表明该应用程序的优化文件丢失或是该应用程序为第一次启动。则可以获取应用程序的未优化文件,对所述未优化文件执行优化操作生成应用程序的优化文件,再根据生成的优化文件启动所述应用程序。
作为另一种实施方式,由于在应用程序第一次启动时,不会存在优化文件。因此,可以在接收到应用程序的启动指令后,可以判断所述应用程序是否是第一次启动。正常的,应用程序在安装后,系统升级后或热更新后,都可以称为第一次启动。若为第一次启动,系统内则不会有应用程序的优化文件,则可以获取以获取应用程序的未优化文件,对所述未优化文件执行优化操作生成应用程序的优化文件,再根据生成的优化文件启动所述应用程序。若不是第一次启动,在查找到应用程序的优化文件后,则执行步骤S430。
步骤S430,若存在优化文件,判断所述应用程序的优化文件是否损坏。
其中,判断应用程序的优化文件是否损坏可以是检查所述优化文件的标识是否正确;也可以是检查是否存在优化文件对应的损坏日志等。具体可参照前述实施例对应部分,在此不再赘述。若判定所述应用程序的优化文件损坏,则执行步骤S440。若判定所述优化文件未损坏,则加载应用程序的优化文件启动所述应用程序。
步骤S440,若优化文件损坏,删除损坏的所述优化文件,直接加载应用程序的未优化文件启动所述应用程序。
在判定所述应用程序的优化文件损坏后,可以删除对应的损坏的优化文件,直接获取应用程序对应的未优化文件,通过加载所述未优化文件启动所述应用程序。从而避免在优化文件损坏时,重新对未优化文件执行优化操作,导致启动黑屏。
步骤S450,监测所述应用程序是否满足优化执行条件。
其中,在应用程序启动成功后,进行运行状态时,可以监测所述应用程序是否满足优化执行条件。具体的,可以是监测所述应用程序在运行过程中是否 使用所述未优化文件,当监测到应用程序在运行中使用所述未优化文件,则判定监测到满足所述优化执行条件。
步骤S460,若满足,则对所述未优化文件执行优化操作,生成应用程序的优化文件。
若满足所述优化执行条件,则对所述未优化文件执行优化操作,生成应用程序对应的优化文件。从而避免在启动过程中执行优化操作,阻塞启动过程,并且使该应用程序在下一次启动时可以通过优化文件进行启动,提高启动速度。
本申请提供的应用程序启动方法,通过查找是否存在应用程序的优化文件,若存在,则判断所述应用程序的优化文件是否损坏;若所述应用程序的优化文件损坏,删除损坏的所述优化文件,直接加载应用程序的未优化文件启动所述应用程序;在程序启动后检测应用程序是否满足优化执行条件,在满足所述优化执行条件时,对所述优化文件执行优化操作,生成应用程序的优化文件。从而避免在启动过程中执行优化操作,阻塞启动过程出现黑屏的情况,提升了应用程序在使用中的用户体验。
请参阅图5,其示出了本申请实施例提供的一种应用程序启动装置500,所述装置500包括接收模块510、判断模块520、启动模块530。
接收模块510用于接收应用程序的启动指令;判断模块520,用于判断所述应用程序的优化文件是否损坏;启动模块530,用于若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时的数据。
进一步的,所述启动模块530还用于若所述优化文件损坏,删除损坏的所 述优化文件。
请参阅图6,示出了本申请实施例提供的一种判断模块520的功能模块图。
进一步的,所述判断模块520包括第一检查单元521和第二检查单元522。所述第一检查单元521用于检查所述优化文件的文件标识是否正确;若不正确,判定所述优化文件损坏。所述第二检查单元用于检查是否存在优化文件对应的损坏日志;若存在所述优化文件的损坏日志,判定所述优化文件损坏。
进一步的,所述第一检查单元521还用于读取所述优化文件的文件头中的前四个字节;判断所述前四个字节是否为ELF魔数;若所述前四个字节不为ELF魔数,判定所述优化文件的标识不正确。
进一步的,所述第一检查单元521还用于比对所述前四个字节的值是否依次为“0x7f”,“0x45”,“0x4C”,“0x46”;若所述前四个字节的值不为“0x7f”,“0x45”,“0x4C”,“0x46”,判定所述前四个字节不为ELF魔数。
进一步的,判断所述应用程序的优化文件是否损坏之前,所述判断模块520还用于查找是否存在所述应用程序的优化文件;若存在,则执行判断所述应用程序的优化文件是否损坏的步骤。
进一步的,所述启动模块530还用于若所述应用程序的优化文件不存在,获取应用程序对应的未优化文件,对所述未优化文件执行优化操作生成应用程序对应的优化文件,根据生成的优化文件启动所述应用程序。
进一步的,判断所述应用程序的优化文件是否损坏之前,所述判断模块520还用于判断所述应用程序是否是第一次启动;若否,执行所述判断所述应用程序的优化文件是否损坏的步骤。
进一步的,所述启动模块530还用于若所述应用程序是第一次启动,获取 应用程序对应的未优化文件,对所述未优化文件执行优化操作生成应用程序对应的优化文件,根据生成的优化文件启动所述应用程序。
进一步的,所述启动模块530还要用于监测所述应用程序是否满足优化执行条件;若满足,则对所述未优化文件执行优化操作,生成应用程序对应的优化文件。
进一步的,所述启动模块530还要用于若所述优化文件未损坏,加载应用程序的优化文件启动所述应用程序。
进一步的,所述未优化文件为dex文件,所述优化文件为odex文件。
需要说明的是,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
综上所述,本申请提供的应用程序启动方法,通过接收应用程序的启动指令;判断所述应用程序的优化文件是否损坏;若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时数据。在应用程序的优化文件损坏时直接加载应用程序的未优化文件启动应用程序,避免了应用程序在启动过程中优化文件损坏时,执行优化操作引起黑屏等现象,从而提升了应用程序在使用中的用户体验。
在本申请所提供的几个实施例中,所显示或讨论的模块相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中, 也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
请参考图7,其示出了本申请实施例提供的一种电子设备的结构框图。该电子设备600可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备600可以包括一个或多个如下部件:处理器610、存储器620、以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器620中并被配置为由一个或多个处理器610执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
处理器610可以包括一个或者多个处理核。处理器610利用各种接口和线路连接整个电子设备600内的各个部分,通过运行或执行存储在存储器620内的指令、程序、代码集或指令集,以及调用存储在存储器620内的数据,执行电子设备600的各种功能和处理数据。可选地,处理器610可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器610可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器610中,单独通过一块通信芯片进行实现。
存储器620可以包括随机存储器(Random Access Memory,RAM),也可 以包括只读存储器(Read-Only Memory)。存储器620可用于存储指令、程序、代码、代码集或指令集。存储器620可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储电子设备600在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
请参考图8,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读存储介质700中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质700可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质700包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质700具有执行上述方法中的任何方法步骤的程序代码710的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码710可以例如以适当形式进行压缩。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种应用程序启动的方法,其特征在于,所述方法包括:
    接收应用程序的启动指令;
    判断所述应用程序的优化文件是否损坏;
    若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时的数据。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若所述优化文件损坏,删除损坏的所述优化文件。
  3. 根据权利要求1或2所述的方法,其特征在于,所述判断所述应用程序的优化文件是否损坏,包括:
    检查所述优化文件的文件标识是否正确;
    若不正确,判定所述优化文件损坏。
  4. 根据权利要求3所述的方法,其特征在于,所述检查所述优化文件的文件标识是否正确,包括:
    读取所述优化文件的文件头中的前四个字节;
    判断所述前四个字节是否为ELF魔数;
    若所述前四个字节不为ELF魔数,判定所述优化文件的标识不正确。
  5. 根据权利要求4所述的方法,其特征在于,所述判断所述前四个字节是否为ELF魔数,包括:
    比对所述前四个字节的值是否依次为“0x7f”,“0x45”,“0x4C”,“0x46”;
    若所述前四个字节的值不为“0x7f”,“0x45”,“0x4C”,“0x46”,判定所述前四个字节不为ELF魔数。
  6. 根据权利要求1或2所述的方法,其特征在于,所述判断所述优化文件是否损坏,包括:
    检查是否存在优化文件对应的损坏日志;
    若存在所述优化文件的损坏日志,判定所述优化文件损坏。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述判断所述应用程序的优化文件是否损坏之前,包括:
    查找是否存在所述应用程序的优化文件;
    若存在,则执行判断所述应用程序的优化文件是否损坏的步骤。
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:
    若所述应用程序的优化文件不存在,获取应用程序对应的未优化文件,对所述未优化文件执行优化操作生成应用程序对应的优化文件,根据生成的优化文件启动所述应用程序。
  9. 根据权利要求1-6任一项所述的方法,其特征在于,所述判断所述应用程序的优化文件是否损坏之前,还包括:
    判断所述应用程序是否是第一次启动;
    若否,执行所述判断所述应用程序的优化文件是否损坏的步骤。
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:
    若所述应用程序是第一次启动,获取应用程序对应的未优化文件,对所述未优化文件执行优化操作生成应用程序对应的优化文件,根据生成的优化文件启动所述应用程序。
  11. 根据权利要求1-10任一项所述的方法,其特征在于,所述直接加载应用程序的未优化文件启动所述应用程序之后,还包括:
    监测所述应用程序是否满足优化执行条件;
    若满足,则对所述未优化文件执行优化操作,生成应用程序对应的优化文件。
  12. 根据权利要求11所述的方法,其特征在于,判断所述应用程序是否满足优化执行条件,包括:
    监测所述应用程序运行过程中是否使用所述未优化文件;
    当监测到使用所述未优化文件时,判定监测到满足所述优化执行条件。
  13. 根据权利要求1-12所述的方法,其特征在于,所述方法还包括:
    若所述优化文件未损坏,加载应用程序的优化文件启动所述应用程序。
  14. 根据权利要求1-12所述的方法,其特征在于,所述未优化文件为dex文件,所述优化文件为odex文件。
  15. 一种应用程序启动装置,其特征在于,所述装置包括:
    接收模块,用于接收应用程序的启动指令;
    判断模块,用于判断所述应用程序的优化文件是否损坏;
    启动模块,用于若所述优化文件损坏,直接加载应用程序的未优化文件启动所述应用程序,其中,所述优化文件为所述未优化文件进行优化后的文件,所述未优化文件以及所述优化文件包括所述应用程序的全部操作指令以及运行时的数据。
  16. 根据权利要求15所述的装置,其特征在于,所述启动模块还包括:
    执行单元,用于若所述优化文件损坏,删除损坏的所述优化文件。
  17. 根据权利要求15或16所述的装置,其特征在于,所述判断模块还包括:
    第一检查单元,用于检查所述优化文件的文件标识是否正确;若不正确,判定所述优化文件损坏。
  18. 根据权利要求15或16所述的装置,其特征在于,所述判断模块还包括:
    第二检查单元,用于检查是否存在优化文件对应的损坏日志;若存在所述优化文件的损坏日志,判定所述优化文件损坏。
  19. 一种电子设备,其特征在于,所述电子设备包括:
    一个或多个处理器;
    存储器,与所述一个或多个处理器电连接;
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1至14任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1至14任一项所述的方法。
PCT/CN2019/082740 2019-04-15 2019-04-15 应用程序启动的方法、装置、电子设备及存储介质 WO2020210955A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/082740 WO2020210955A1 (zh) 2019-04-15 2019-04-15 应用程序启动的方法、装置、电子设备及存储介质
CN201980091281.7A CN113396391B (zh) 2019-04-15 2019-04-15 应用程序启动的方法、装置、电子设备及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/082740 WO2020210955A1 (zh) 2019-04-15 2019-04-15 应用程序启动的方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020210955A1 true WO2020210955A1 (zh) 2020-10-22

Family

ID=72837708

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/082740 WO2020210955A1 (zh) 2019-04-15 2019-04-15 应用程序启动的方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN113396391B (zh)
WO (1) WO2020210955A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296827A (zh) * 2021-12-30 2022-04-08 河南紫联物联网技术有限公司 数据文件处理方法、装置、设备及存储介质
CN115658185B (zh) * 2022-12-29 2023-03-28 北京海誉动想科技股份有限公司 一种云应用快速启动的方法、装置、存储介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2172841A1 (fr) * 2008-10-01 2010-04-07 Converteam Technology Ltd Procédé de redémarrage d'une application par un automate
CN104346194A (zh) * 2014-04-18 2015-02-11 腾讯科技(深圳)有限公司 一种启动文件加载方法、装置及电子设备
CN104866365A (zh) * 2015-06-12 2015-08-26 联想(北京)有限公司 提升开机速度的方法、装置及电子设备
CN105975311A (zh) * 2016-05-09 2016-09-28 腾讯科技(深圳)有限公司 一种应用启动方法及装置
CN106066805A (zh) * 2016-05-31 2016-11-02 宇龙计算机通信科技(深圳)有限公司 一种终端应用程序启动的方法、装置及终端

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2172841A1 (fr) * 2008-10-01 2010-04-07 Converteam Technology Ltd Procédé de redémarrage d'une application par un automate
CN104346194A (zh) * 2014-04-18 2015-02-11 腾讯科技(深圳)有限公司 一种启动文件加载方法、装置及电子设备
CN104866365A (zh) * 2015-06-12 2015-08-26 联想(北京)有限公司 提升开机速度的方法、装置及电子设备
CN105975311A (zh) * 2016-05-09 2016-09-28 腾讯科技(深圳)有限公司 一种应用启动方法及装置
CN106066805A (zh) * 2016-05-31 2016-11-02 宇龙计算机通信科技(深圳)有限公司 一种终端应用程序启动的方法、装置及终端

Also Published As

Publication number Publication date
CN113396391A (zh) 2021-09-14
CN113396391B (zh) 2023-12-01

Similar Documents

Publication Publication Date Title
US7743292B2 (en) Apparatus and method for memory card testing
CN107463500B (zh) 测试脚本的调试方法、介质、系统和计算设备
CN110704335A (zh) 一种基于异步环形缓冲区的数据读取、写入方法及装置
US10191838B2 (en) Method and device for checking influence of deleting cache file, and mobile terminal
WO2015078294A1 (en) Kernel module loading method and apparatus
WO2017206899A1 (zh) 信息处理方法及相关设备
US20130138934A1 (en) Loading configuration information
CN110597542A (zh) 软件自动ota升级方法及装置、电子设备
WO2020210955A1 (zh) 应用程序启动的方法、装置、电子设备及存储介质
CN106843947B (zh) 代码缺陷的处理方法和装置
KR102545765B1 (ko) 메모리 오류를 검출하는 방법 및 시스템
CN111258613B (zh) 固件升级方法、装置、电子设备以及存储介质
CN112162795A (zh) 一种插件启动方法、装置、计算机设备和存储介质
CN114035818A (zh) 固件升级方法、装置、计算机设备和存储介质
US9928134B2 (en) Method and apparatus for repairing dynamic link library file
US8826264B1 (en) Non-disruptive upgrade of applications
CN117539554A (zh) 探针处理方法、装置、存储介质及电子设备
CN103617053A (zh) 一种软件升级的方法及装置
WO2020223862A1 (zh) 挂载处理方法、装置、电子设备及计算机可读取存储介质
CN110442380B (zh) 一种数据预热方法及计算设备
CN116305100A (zh) 识别热插拔硬盘的方法、系统、计算机设备和存储介质
CN110865920A (zh) 开机异常处理方法、装置、电子设备以及存储介质
CN111625302A (zh) 函数耗时跟踪方法、设备和存储介质
CN108279937B (zh) 参数的调用方法、装置、存储介质及电子设备
WO2021097626A1 (zh) 触摸屏固件加载方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19924772

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.03.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19924772

Country of ref document: EP

Kind code of ref document: A1