Application program compiling method and electronic equipment

By compiling the target application in advance during the system version upgrade and restart phase of electronic devices, the problem of decreased user experience caused by system version upgrades is solved, and the application startup speed is improved.

CN121918831APending Publication Date: 2026-04-24HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-10-23
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

When electronic device system versions are upgraded, applications need to be recompiled, resulting in a decline in user experience.

Method used

When electronic devices undergo system version upgrades, the target application is compiled in advance during the restart phase. This includes determining whether the compilation time is less than a preset time threshold and performing different levels of compilation optimization when the compilation time is too long.

Benefits of technology

It improves application startup speed, enhances user experience, and avoids the problem of prolonged restart time due to compilation affecting user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121918831A_ABST
    Figure CN121918831A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is applicable to the field of data processing, and provides an application program compiling method and electronic equipment, which can compile a target application program in advance in a restart stage of configuring a system version when the electronic equipment performs version switching, so that the situation that the target application program cannot be compiled in advance after a second operating system starts to run can be avoided. According to the present invention, the starting speed of the target application program can be improved and the user experience can be improved under the condition that the electronic device is started and then the target application program is compiled, and the method comprises the steps of downloading and installing the second operating system in the running first operating system, and compiling the target application program when the installation of the second operating system is completed and the electronic device is restarted. And then running the second operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more specifically, to a method for compiling an application and an electronic device. Background Technology

[0002] Electronic devices typically have a large number of applications installed. These applications usually need to be compiled before use, converting the application's development language into assembly language that can be executed by the electronic device, so that the electronic device can run these applications.

[0003] For example, application A is developed in Java. When application A is installed on a mobile phone, the phone compiles it, converting the Java code into assembly language that the phone can execute, allowing the phone to run application A based on the assembly language. During this compilation process, some target functions in the electronic device's system version file are typically called, and compilation is performed based on these functions. However, when the electronic device's system version is upgraded, these target functions may change. This necessitates the electronic device compiling the application before it is used (i.e., during a system version upgrade), resulting in a situation where the application must be compiled before it can be used, impacting the user experience.

[0004] Therefore, how to compile applications in advance when upgrading the system version of electronic devices has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a method for compiling an application that can compile the application in advance when the system version of an electronic device is upgraded.

[0006] Firstly, a method for compiling an application is provided, which is applied to electronic devices and includes:

[0007] Download and install the second operating system on the running first operating system;

[0008] The target application is compiled when the second operating system is installed and the electronic device is restarted;

[0009] Run a second operating system.

[0010] The first operating system is the operating system currently running on the electronic device, while the second operating system is the operating system not yet running on the electronic device. The system version of the first operating system can be lower than that of the second operating system. Downloading and installing the second operating system on the running first operating system is equivalent to the electronic device undergoing a system version upgrade.

[0011] It should be noted that after installing the second operating system, the electronic device usually needs to be restarted, and during the restart process, the newly installed second operating system is configured accordingly. The embodiments of this application utilize the restart stage of configuring the newly installed second operating system to compile the target application in advance.

[0012] The application compilation method provided in this application embodiment is applied to electronic devices. A second operating system is downloaded and installed in a running first operating system. When the second operating system is installed and the electronic device is restarted, the target application is compiled and then the second operating system is run. That is to say, when the electronic device switches versions, the target application can be compiled in advance during the restart phase when configuring the system version. This avoids the situation where the target application is compiled after the second operating system starts running, which can improve the startup speed of the target application and improve the user experience.

[0013] In conjunction with the first aspect, in some embodiments of the first aspect, when the installation of the second operating system is completed and the electronic device is restarted, the target application is compiled, including: determining whether the compilation time is less than a preset time threshold; if the compilation time is less than the preset time threshold, the application to be processed at the current moment is compiled as the target application.

[0014] If the compilation time is too long, for example, exceeding a preset time threshold, the electronic device can stop the compilation of the target application during the restart phase to avoid affecting the user experience due to the excessive restart time of the electronic device.

[0015] In conjunction with the first aspect, in some embodiments of the first aspect, if the compilation time is less than a preset time threshold, the application to be processed at the current moment is compiled as the target application, including: compiling the application to be processed at the current moment as the target application at a first level, wherein the first level of compilation includes speed profile level compilation.

[0016] The first level of compilation includes speed profile level compilation, which typically refers to not only compiling the application's source code into executable code for electronic devices for verification, but also performing optimizations.

[0017] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: if the compilation time is greater than or equal to a preset time threshold, performing a second-level compilation on the target application, the second-level compilation including a verify-level compilation.

[0018] In cases where compilation time is excessively long, electronic devices can perform a second-level compilation of the application, even if the compilation is not yet complete. This second-level compilation can refer to a verifying level compilation, which typically involves compiling only the application's source code into executable code for verification. Understandably, the compilation time required for the second level is less than that required for the first level.

[0019] In conjunction with the first aspect, in some embodiments of the first aspect, the target application is one of the N most frequently used applications in an electronic device.

[0020] It's understandable that compiling applications takes time, and electronic devices typically have a large number of applications installed. Compiling all applications upon restarting would significantly extend the restart time and negatively impact user experience. Therefore, a better approach is to select a subset of applications—the top N most frequently used applications—from the entire electronic device and compile these target applications when restarting the device after the second operating system installation is complete.

[0021] In conjunction with the first aspect, in some embodiments of the first aspect, the target application includes a third-party application.

[0022] It is understandable that system-provided applications can usually be compiled along with the new system version when a new system version is generated. Therefore, the application compilation method provided in this application embodiment only compiles third-party applications, which can avoid the situation of recompiling already compiled applications.

[0023] In conjunction with the first aspect, in some embodiments of the first aspect, the electronic device includes a system service module, a first compilation module, and a compilation execution module. When the installation of the second operating system is completed and the electronic device is restarted, the compilation of the target application includes: when the installation of the second operating system is completed and the electronic device is restarted, the system service module sends a first compilation instruction to the first compilation module in response to the restart operation of the electronic device; the first compilation module sends a second compilation instruction to the compilation execution module in response to the first compilation instruction; and the compilation execution module compiles the target application in response to the second compilation instruction.

[0024] The first compiler instruction is equivalent to Figure 6The first and second instructions in the illustrated embodiment, the second compilation instruction can be equivalent to Figure 6 The compilation parameters in S305 and the compilation file in S307 in the illustrated embodiment.

[0025] In conjunction with the first aspect, in some embodiments of the first aspect, the electronic device further includes a second compilation module. The first compilation module, in response to a first compilation instruction, sends a second compilation instruction to the compilation execution module, including: the first compilation module, in response to the first compilation instruction, sending an acquisition instruction to the second compilation module; the second compilation module acquiring compilation parameters of the target application based on the acquisition instruction; the second compilation module sending the compilation parameters to the first compilation module; and the first compilation module generating a second compilation instruction based on the compilation parameters and sending the second compilation instruction to the compilation execution module.

[0026] Among them, the acquisition instruction is equivalent to Figure 6 The third instruction in the illustrated embodiment.

[0027] In conjunction with the first aspect, in some embodiments of the first aspect, the first compilation module is further configured to determine the target application based on the first compilation instructions.

[0028] For details on the process of determining the target application, please refer to methods 1, 2 and 3 shown in S102.

[0029] In a second aspect, an application compilation apparatus is provided, including a unit for executing any of the methods in the first aspect. This apparatus may be a server, a terminal device, or a chip within a terminal device. The apparatus may include an input unit and a processing unit.

[0030] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory for storing computer program code, which, when the processor executes the computer program code stored in the memory, causes the terminal device to perform any of the methods in the first aspect.

[0031] When the device is a chip within a terminal device, the processing unit can be an internal processing unit of the chip, and the input unit can be an output interface, pin, or circuit, etc.; the chip may also include a memory, which can be an internal memory of the chip (e.g., a register, cache, etc.) or an external memory (e.g., a read-only memory, random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip performs any of the methods in the first aspect.

[0032] In one possible implementation, the memory is used to store computer program code; the processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor performs the following: downloading and installing a second operating system in a running first operating system; compiling the target application when the installation of the second operating system is completed and the electronic device is restarted; and running the second operating system.

[0033] Thirdly, a computer-readable storage medium is provided that stores computer program code, which, when run by a compiler of an application, causes the compiler to perform any of the compilation methods of the application in the first aspect.

[0034] Fourthly, a computer program product is provided, the computer program product comprising: computer program code, which, when run by a compiler of an application, causes the compiler of the application to perform any of the apparatus methods in the first aspect.

[0035] The application compilation method and electronic device provided in this application embodiment download and install a second operating system in a running first operating system. After the installation of the second operating system is completed and the electronic device is restarted, the target application is compiled and then the second operating system is run. That is to say, when the electronic device switches versions, the target application can be compiled in advance during the restart stage of configuring the system version. This can avoid the situation where the target application is compiled after the second operating system starts running, thereby improving the startup speed of the target application and improving the user experience. Attached Figure Description

[0036] Figure 1 A timing diagram illustrating a system version upgrade for an electronic device;

[0037] Figure 2 This is a schematic diagram of a hardware system for an electronic device applicable to this application;

[0038] Figure 3 This is a schematic diagram of a software system applicable to an electronic device of this application;

[0039] Figure 4 This is a flowchart illustrating a method for compiling an application provided in an embodiment of this application;

[0040] Figure 5 This is a flowchart illustrating a method for compiling an application provided in an embodiment of this application;

[0041] Figure 6This is a flowchart illustrating a method for compiling an application provided in an embodiment of this application;

[0042] Figure 7 This is a schematic diagram of a compilation device for an application provided in this application;

[0043] Figure 8 This is a schematic diagram of an electronic device that compiles an application provided in this application. Detailed Implementation

[0044] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0045] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.

[0046] For ease of understanding, the examples provided are for reference only and are related to the concepts in the embodiments of this application.

[0047] 1. Compiling the application.

[0048] Application compilation refers to the compilation technology that transforms the application's source code into executable code for an electronic device. For example, if the application's source code is in Java format and the executable code for the electronic device is in assembly language, then application compilation can refer to converting the Java code into assembly language code.

[0049] Typically, application compilation can be divided into verify-level compilation and speed-profile-level compilation. Verify-level compilation simply verifies the application's source code into executable code for electronic devices, while speed-profile-level compilation not only verifies the application's source code into executable code for electronic devices but also performs optimizations.

[0050] 2. Compile before runtime (Ahead-Of-Time, AOT).

[0051] AOT (Ahead-of-Time) compilation is a compilation technique that compiles an application's source code into executable code for an electronic device before the program runs. Because AOT compilation completes the code compilation before the application runs, it can significantly reduce the compilation overhead at program startup and improve startup speed.

[0052] 3. Just-in-time (JIT) compilation.

[0053] Just-in-time (JIT) compilation is a compilation technique that compiles an application's source code into executable code for an electronic device. However, JIT compilation typically occurs during application runtime. An interpreter usually performs the JIT compilation of the application's source code. Therefore, JIT compilation often slows down application startup.

[0054] The differences between AOT and JIT include at least the following three points:

[0055] (1) Compilation timing: AOT compilation is performed before the program runs, while JIT compilation is performed during program execution.

[0056] (2) Performance optimization: AOT compilation can optimize the code more, but it has less flexibility; JIT compilation can optimize according to the actual running of the program, but the compilation overhead is large.

[0057] (3) Startup speed: AOT compilation can significantly improve the startup speed of the program, while JIT compilation needs to be compiled during program runtime, so the startup speed is relatively slow.

[0058] For example, virtual machine testing shows that compiling the same application using an interpreter takes 493084978 ns, while compiling using AOT takes 3125745412 ns; that is, the time required to compile using an interpreter is 6 times that required to compile using AOT.

[0059] 4. Interpreter.

[0060] An interpreter is a computer program whose main function is to interpret source code line by line into executable instructions, and then execute those instructions immediately. Just-in-time (JIT) compilation typically uses an interpreter for execution.

[0061] 5. Over-the-Air Technology (OTA).

[0062] Over-the-air (OTA) download technology is a technique for remotely managing SIM card data and applications via the air interface of mobile communication. OTA upgrade is a standard software upgrade method provided by the Android system, primarily involving automatically downloading OTA upgrade packages over the network and performing the upgrade automatically. It also supports manually downloading OTA upgrade packages to a specified storage location for upgrades.

[0063] 6. ODEX.

[0064] ODEX is an abbreviation for Optimized Dalvik Executable, which can be translated into Chinese as "optimized Dalvik executable file", and is usually abbreviated as "Odex file".

[0065] ODEX is a file format used in the Android operating system to store optimized Dalvik bytecode. Dalvik is the virtual machine on the Android platform used to execute compiled Android applications (the .dex files within APK files). ODEX files are generated by further optimizing .dex files to improve the application's performance on Android devices. Because ODEX files are optimized, they are typically smaller than the original .dex files, which helps reduce the memory footprint of the application at runtime. By pre-optimizing the application's bytecode, ODEX files can speed up application startup because the device does not need to perform further optimization at runtime.

[0066] ODEX files are typically generated by the Android system during application installation or updates. The system uses the built-in dexopt tool to optimize the .dex files in the APK file and generate the corresponding ODEX files. These ODEX files are then stored in a specific directory on the device for use by the Android virtual machine at runtime.

[0067] 7. Prereboot.

[0068] Prereboot refers to a series of preparatory steps that the user or system automatically performs before an electronic device restarts. These steps are designed to ensure the stability, security, and functionality of the system, enabling it to continue operating normally or acquire new functions after the restart.

[0069] Common prereboot methods include:

[0070] Data backup: Before restarting, users or the system may automatically back up important data to prevent data loss or corruption during the restart process. This typically includes saving files to external storage devices, cloud storage, or a backup partition of the system.

[0071] System Updates: Sometimes, a system needs updated patches, drivers, or software to function properly or have new features. In such cases, the prereboot process might involve downloading and installing these updates, and then applying them after a reboot.

[0072] Configuration Changes: Users or administrators may change system settings or configurations before a reboot to adjust system performance, security, or user experience. These changes may include adjusting network settings, changing user permissions, updating security policies, etc.

[0073] Hardware checks: In some cases, the prereboot process may include checking the hardware status to ensure that the hardware will function properly after the reboot. This may involve checking the health of hardware components such as memory, hard drive, and processor.

[0074] Unlike reboot, which typically refers to the process of restarting a computer system, usually involving shutting down the system, clearing data from memory, and restarting the operating system, prereboot refers to a series of preparatory steps performed before rebooting to ensure that the system can function properly or has the necessary new features after rebooting.

[0075] System version updates for electronic devices can be like Figure 1 The three stages shown include:

[0076] The OTA version creation stage, the OTA download and installation stage, and the post-upgrade usage stage.

[0077] During the OTA (Over-The-Air) version development phase, electronic devices perform ODEX on the code of the system's built-in applications. This eliminates the need for the electronic device to optimize the application code at runtime, helping to reduce the memory space occupied by the applications and speeding up application startup.

[0078] During the OTA download and installation phase, the electronic device downloads and installs the new system version file. The OTA download and installation phase can be divided into three sub-phases: the first sub-phase downloads the installation file for the new system version, the second sub-phase installs the new system version, and the third sub-phase restarts the electronic device to make the new system version effective. In the second sub-phase of installing the new system version, the electronic device typically performs a pre-boot to compile applications (e.g., third-party applications) to avoid compiling these applications only during the usage phase, which could slow down application startup. Understandably, electronic devices usually have a large number of applications installed; pre-booting can only compile a portion of the third-party applications, not all of them.

[0079] Understandably, after installing a new system version, the electronic device will restart to run the new system version. That is to say, before the electronic device restarts, it runs the old system version; only after the restart does it run the new system version.

[0080] During the post-upgrade usage phase, electronic devices can compile uncompiled third-party applications in two ways: one is to perform normal idle compilation when the electronic device is in an idle state, and the other is to perform FastIdle compilation when the electronic device is in a non-idle state.

[0081] In this context, "idle state" can refer to the state of an electronic device while it is charging, and "non-idle state" can refer to the state of an electronic device when it is not charging. In some cases, "idle state" can also refer to the state of an electronic device when its screen is locked, or the state when the electronic device has not been operated for a long time; this embodiment of the application does not impose such limitations. "Idle state compilation" can refer to compiling and optimizing the application; for example, idle state compilation is speed profile-level compilation of the application code, including application compilation and optimization. "FastIdle compilation" can refer to compiling the application; for example, FastIdle compilation is verify-level compilation of the application code. In some cases, FastIdle compilation can also refer to speed profile-level compilation of the application code.

[0082] It's important to note that application compilation requires compiling files from the system version. In some cases, when an electronic device undergoes a system version upgrade, the system version may have undergone significant changes. As described above, during the prereboot phase of the OTA download and installation, some third-party applications are compiled, and this compilation occurs before the electronic device restarts. In other words, after the electronic device has installed a new system version but before restarting, it is still running the old system version. Therefore, during prereboot, third-party applications cannot be compiled to accommodate the new system version.

[0083] For example, an electronic device is upgraded from version X to version Y. Several software development kits (SDKs) on version Y, such as framework-NFC, are updated to version Y1. During the pre-boot phase of the OTA download and installation, since the electronic device has not yet restarted, version X of the system is still running. In this case, before the device restarts, it is typically divided into two areas, storing version X and version Y respectively. For example, the electronic device is divided into area A and area B, where area B can be a mirror area of ​​area A. Version X runs in area A, and version Y is stored in its mirror area B. Version X running in area A is perceptible to the user, while version Y stored in area B is not yet active and is not yet perceptible to the user. Third-party applications running in area A cannot access the version Y system stored in area B. If a third-party application is compiled during pre-boot, it can only obtain the SDK from version X and compile based on that SDK. However, the SDK version in version X is X1, which is different from the SDK version Y1 in version Y. Therefore, third-party applications cannot be compiled during prereboot. They can only be compiled after rebooting and after version Y is officially running, during the upgrade and usage phase.

[0084] It is understandable that compiling an application consumes system resources and takes time. Therefore, compiling the application during the post-upgrade usage phase will increase the memory space occupied by the application at runtime, reduce the application's startup speed, and affect the user experience.

[0085] In view of this, the present application provides a method for compiling an application. A second operating system is downloaded and installed in a running first operating system. After the installation of the second operating system is completed and the electronic device is restarted, the target application is compiled and then the second operating system is run. That is to say, when the electronic device switches versions, the target application can be compiled in advance during the restart phase when configuring the system version. This avoids the situation where the target application is compiled after the second operating system starts running, thereby improving the startup speed of the target application and improving the user experience.

[0086] The application compilation method provided in this application can be applied to electronic devices. Optionally, electronic devices include terminal devices, which can also be called terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablets, computers with wireless transceiver capabilities, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of this application do not limit the specific technology or specific device form used in the terminal devices.

[0087] For example, Figure 2A schematic diagram of the structure of electronic device 100 is shown. Electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0088] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0089] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0090] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0091] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0092] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0093] It should be noted that any electronic device mentioned in the embodiments of this application may include more or fewer modules in electronic device 100.

[0094] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.

[0095] Figure 3 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.

[0096] The layered architecture of the electronic device 100 divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0097] The application layer can include a series of application packages.

[0098] like Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0099] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0100] like Figure 2 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0101] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0102] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0103] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0104] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0105] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, Wi-Fi drivers, etc.

[0106] It should be noted that the electronic device mentioned in the embodiments of this application may include more or fewer modules of the aforementioned electronic device. For example, the electronic device may also include a memory, a timer, etc.

[0107] The application scenarios provided by the embodiments of this application are described below with reference to the accompanying drawings.

[0108] During the system version upgrade process of an electronic device, for example, when the system version of the electronic device is upgraded from version X to version Y, the SDK in the system version file is upgraded from version X1 to version Y1. In this case, the second sub-stage of installing the system version is performed during the download and installation phase, such as... Figure 1 As shown, the application cannot be compiled in the second sub-stage because the Y version of the system is inaccessible. However, the electronic device can access the Y version of the system and compile the application in the third sub-stage, which is the stage for configuring the Y version of the system, during the download and installation phase, thus avoiding the problem of compiling the application only when it is used.

[0109] It should be understood that the above are illustrative examples of application scenarios and do not limit the application scenarios of this application in any way.

[0110] The following is combined with Figures 4 to 6 The compilation method of the application provided in the embodiments of this application will be described in detail.

[0111] Figure 4 A flowchart illustrating an application compilation method provided in this application embodiment is shown below. Figure 4 As shown, this method is applied in an electronic device and includes:

[0112] S101. Download and install the second operating system on the running first operating system.

[0113] The first operating system is the operating system currently running on the electronic device; for example, the first operating system is version X. The second operating system is the operating system that is not yet running on the electronic device; for example, the second operating system is version Y.

[0114] The system version of the first operating system can be lower or higher than that of the second operating system; this application does not impose any restrictions on this. Typically, the SDK version in the first operating system differs from the SDK version in the second operating system. For example, the SDK version in the first operating system might be 34, while the SDK version in the second operating system might be 35.

[0115] Electronic devices can download a second operating system via OTA (Over-The-Air). After the second operating system is downloaded, it can be installed automatically or in response to user input; this application does not impose any limitations on this.

[0116] S102. When the second operating system is installed and the electronic device is restarted, compile the target application.

[0117] Understandably, after installing a second operating system, the electronic device typically needs to reboot. During the reboot process, the newly installed second operating system is configured accordingly, and only after rebooting the device can the second operating system run. In other words, the electronic device runs the first operating system before rebooting, and the second operating system can only run on the device after rebooting.

[0118] After the second operating system is installed and the electronic device is restarted, the electronic device can compile the target application so that the target application has been compiled after the electronic device restarts, thus reducing the startup time of the target application.

[0119] Optionally, when the electronic device is restarted, the compilation of the target application can be a first-level compilation.

[0120] Level 1 compilation can refer to converting the target application's source code into executable code for electronic devices, and then verifying and optimizing the converted executable code. For example, Level 1 compilation could be speed-profile level compilation.

[0121] Unlike the second-level compilation of applications after an electronic device runs a second operating system, which involves verification and optimization of the executable code in the first-level compilation, the second-level compilation only converts the application's source code into executable code for the electronic device, and then verifies the executable code. For example, the second-level compilation could be a verify-level compilation.

[0122] Understandably, compiling applications takes time, and electronic devices typically have a large number of applications installed. Compiling all applications upon restarting would significantly extend the restart time and negatively impact user experience. Therefore, a subset of applications can be selected as target applications from the entire electronic device, and these target applications can be compiled upon restarting the device after the second operating system installation is complete.

[0123] Optionally, the target application can be an application used more frequently than a preset threshold on an electronic device.

[0124] If the target application is an application used more frequently than a preset threshold on the electronic device, then when the electronic device is restarted after the installation of the second operating system is completed, these frequently used target applications can be compiled. Since frequently used target applications are usually applications that users are more likely to open after restarting the electronic device, the startup time of the target application after restarting is shorter, which can improve the user experience.

[0125] The target application can be determined using the following methods.

[0126] Method 1.

[0127] The target algorithm is used to determine the target application.

[0128] The target algorithm can refer to an iaware habit algorithm. An iaware habit algorithm is an artificial intelligence algorithm that analyzes the system logs of an electronic device to identify applications whose usage frequency exceeds a preset threshold as target applications. The preset threshold can be a user-defined value or a value determined by the electronic device based on historical data; this application does not impose any limitations on this. In one possible scenario, the iaware habit algorithm can also identify the top N most frequently used applications on the electronic device, and the usage frequency of the Nth most frequently used application can be used as the preset threshold.

[0129] The frequency of application use can refer to the number of times an application is opened within a unit of time, or it can refer to the ratio of the number of times an application is opened to the total number of times all applications are opened. This application does not limit this.

[0130] For example, the frequency of use of application A can refer to the number of times application A is opened within 24 hours.

[0131] For example, the frequency of use of application A can also refer to the ratio between the number of times application A is opened (X) recorded in the system log and the total number of times all applications on the electronic device are opened (Y) recorded in the system log.

[0132] In some cases, application usage frequency can also refer to the length of time the application is in the foreground.

[0133] For example, when an electronic device is powered on, the frequency of use of application A refers to the ratio of the first duration of application A in the foreground to the total duration of the device being powered on.

[0134] Method 2.

[0135] The top N1 applications launched within a unit of time are selected as the target applications.

[0136] The target application can refer to the top N1 applications with the highest average number of launches per unit of time, the top N1 applications with the highest number of launches per unit of time before the current time, or the top N1 applications with the highest number of launches per unit of time before the first time (the time before the current time). This application embodiment does not limit this.

[0137] For example, an electronic device can obtain the number of times all applications are launched every 24 hours, sort the applications in descending order of the number of launches, so that each application has multiple corresponding serial numbers; then, for each application, calculate the average of the multiple serial numbers to obtain the sorting result of the application; and then, based on the sorting results of each application, determine the top N1 applications as target applications.

[0138] For example, an electronic device can target the top 5 most frequently launched applications in the 24 hours prior to the current moment.

[0139] For example, an electronic device can select a time before the current time as the first time. For instance, if the current time is 8:00 AM, the electronic device can select 0:00 AM as the first time and the 24 hours preceding 0:00, that is, from 0:01 AM of the previous day to 0:00 AM of the current day, as the unit of time, and select the top 5 applications launched most frequently during these 24 hours as the target applications.

[0140] Method 3.

[0141] Select the N2 applications with the longest duration in the foreground within a unit of time as the target applications.

[0142] The target application can refer to the top N2 applications in terms of average time spent in the foreground over multiple units of time, or the top N2 applications in terms of time spent in the foreground over a unit of time before the current time, or the top N2 applications in terms of time spent in the foreground over a unit of time before the current time. This application embodiment does not limit this.

[0143] For example, an electronic device can obtain the foreground duration of all applications every 24 hours, and obtain multiple foreground durations for each application; then, for each application, calculate the average of its multiple foreground durations; and then, based on the average foreground duration of each application, determine the top N2 applications as target applications.

[0144] For example, an electronic device can target the N2 applications that have been in the foreground for the most time in the 24 hours preceding the current moment.

[0145] For example, an electronic device can select a time before the current time as the first time. For instance, if the current time is 8:00 AM, the electronic device can select 0:00 AM as the first time and the 24 hours preceding 0:00, that is, from 0:01 AM of the previous day to 0:00 AM of the current day, as the unit of time. The top N2 applications with the longest time in the foreground during these 24 hours are selected as the target applications.

[0146] In some cases, the target application may be determined based on the user's selection.

[0147] In some cases, the target application may also be an application identified by the electronic device based on historical data.

[0148] S103, Run the second operating system.

[0149] The application compilation method provided in this application embodiment is applied to electronic devices. A second operating system is downloaded and installed in a running first operating system. When the second operating system is installed and the electronic device is restarted, the target application is compiled and then the second operating system is run. That is to say, when the electronic device switches versions, the target application can be compiled during the restart phase when configuring the system version. This avoids the situation where the target application is compiled after the second operating system starts running, which can improve the startup speed of the target application and improve the user experience.

[0150] Figure 5 A flowchart illustrating another application compilation method provided in this application embodiment is shown below. Figure 5 As shown, the method includes:

[0151] S201. Download and install the second operating system on the running first operating system.

[0152] S202, Record the first moment.

[0153] The first moment can refer to the moment when compilation begins.

[0154] S203. Determine whether the application to be processed is one of the applications used the most N times.

[0155] If the application to be processed is one of the top N applications in terms of usage frequency, continue to check whether the compilation time exceeds the preset time threshold, that is, execute S204.

[0156] If the application to be processed is not one of the top N applications in terms of usage frequency, then during the usage phase after the system version upgrade, the application to be processed will undergo a second-level compilation, which is to execute S205.

[0157] S204. Confirm whether the compilation time is less than the preset time threshold based on the first moment.

[0158] The compilation time can refer to the duration between the first moment and the moment when the compilation time is determined and confirmed.

[0159] If the compilation time is less than the preset time threshold, the target application will be compiled at the first level during the electronic device restart phase, which is to execute S206.

[0160] If the compilation time is too long, for example, exceeding a preset time threshold, the electronic device can reduce the time spent compiling the target application.

[0161] Electronic devices can perform a second-level compilation of the target application, or they can stop compiling the target application during the restart phase to reduce the compilation time of the target application.

[0162] Optionally, if the compilation time is greater than or equal to a preset time threshold, then a second level of compilation is performed on the application to be processed, that is, S205 is executed.

[0163] It should be understood that Level 1 compilation includes speed profile level compilation, which typically refers to not only compiling the application's source code into executable code for electronic devices for verification, but also performing optimizations. Level 2 compilation can refer to verify level compilation, which typically only compiles the application's source code into executable code for electronic devices for verification. Therefore, Level 2 compilation requires less compilation time than Level 1 compilation. When compilation time is too long, Level 2 compilation can be performed on the target application to reduce the time spent on compiling the target application.

[0164] In some cases, electronic devices may also halt the compilation of the target application during the reboot phase, and then compile the application that has not yet been completed during the post-upgrade usage phase.

[0165] S205. In the usage phase after the system version upgrade, the application to be processed is compiled at the second level.

[0166] S206. Compile the target application at the first level during the electronic device restart phase.

[0167] The first level of compilation can refer to speed-profile level compilation, which means that not only is the application's source code compiled into executable code for electronic devices verified, but optimization is also performed.

[0168] In some possible cases, an electronic device may include a system service module, a package management service module, a first compilation module, a second compilation module, a third compilation module, a compilation interface module, and a compilation execution module.

[0169] The system service module can determine to send a first instruction to the package management service module to restart the electronic device when the electronic device restarts.

[0170] The package management service module can respond to the first instruction by sending an instruction to the first compilation module to determine the target application.

[0171] The first compiler module can respond to the second instruction by sending a third instruction to the second compiler module to obtain the compilation parameters of the target application.

[0172] The second compilation module can respond to the third instruction to obtain the compilation parameters of each target application, and then send the compilation parameters of each application to the first compilation module.

[0173] The third compilation module can receive the compilation parameters packaged from each application sent by the first compilation module and send them to the compilation execution module through the editing interface module.

[0174] The compiler execution module can compile the target application based on the compilation parameters of each application.

[0175] The following is through Figure 6 The illustrated embodiments will be used to illustrate this in detail. Figure 6 As shown, the method includes:

[0176] S301. In response to the restart operation of the electronic device, the system service module sends the first instruction to the packet management service module.

[0177] The first instruction can be used to instruct the electronic device to restart. This first instruction can be sent to the package management service module via the function startOtherServices(t). Upon restarting, the electronic device can compile the target application.

[0178] The system service module can refer to a module formed by the class SystemServer.java, and the package management module can refer to a module formed by the class PackageManagerService.java.

[0179] S302. In response to the first instruction, the package management service module sends a second instruction to the first compilation module.

[0180] The first compilation module can be a module formed by the class DexOptHelper.java, and the first compilation module can be used to determine the target application. The target application can be as shown in S102 above, and will not be described again here.

[0181] The second instruction can be used to instruct the first compilation module to determine the target application. This second instruction can be carried in the function `updataPackagesIfNeeded()` and sent to the first compilation module.

[0182] S303, the first compilation module responds to the second instruction, obtains the identification information of the target application, and sends a third instruction to the second compilation module.

[0183] Upon receiving the second instruction, the first compilation module can determine whether the electronic device is switching from the first operating system to the second operating system, and if the electronic device switches from the first operating system to the second operating system, it can determine the target application.

[0184] The first compilation module can determine whether an electronic device is switching from the first operating system to the second operating system by reading the system version number.

[0185] Understandably, when the system version of an electronic device is upgraded, the system version before the upgrade (e.g., the first operating system) and the system version after the upgrade (e.g., the second operating system) are stored in two partitions in the electronic device. The first compilation module can read the system version before the upgrade and the system version after the upgrade from the two partitions respectively to determine whether the electronic device is switching from the first operating system to the second operating system.

[0186] Alternatively, switching from the first operating system to the second operating system can refer to a major system version upgrade. For example, switching from the first operating system to the second operating system can refer to upgrading the operating system of an electronic device from version X to version Y.

[0187] When the first compilation module determines that the electronic device is switching from the first operating system to the second operating system, the first compilation module can identify the target application and obtain its identification information. The specific process for identifying the target application can be found in the description of S102 above, and will not be repeated here. The identification information of the target application may refer to the package name of the target application.

[0188] In some possible cases, in order to reduce the restart time of electronic devices, the first compilation module may also stop compiling the application if it detects that the compilation time of the target application exceeds the preset time threshold.

[0189] In some possible cases, in order to reduce the restart time of electronic devices, if the number of target applications exceeds a preset threshold, the first compilation module may also stop compiling the applications when it detects that the number of target applications exceeds the preset threshold.

[0190] The third instruction can carry the identification information of the target application, and can be used to instruct the second compilation module to obtain the compilation parameters of the target application. The electronic device can then compile the target application based on these compilation parameters.

[0191] The third instruction can be sent to the second compilation module in the function performPackageDexOptUpgradeIfNeeded().

[0192] The first compilation module can use the callback interface in the system version to determine the identification information of the target application and send a third instruction to the second compilation module.

[0193] For example, the first compilation module can set a callback function using the `setAdjustCompilerFilterCallback` function to send a third instruction to the second compilation module. Furthermore, upon completion of the compilation of the target application, the sending of the third instruction to the second compilation module is stopped using the `sclearAdjustCompilerFilterCallback` function.

[0194] The second compilation module can be a module formed by the class ArtManagerLocal.java.

[0195] S304. In response to the third instruction, the second compiler module returns the compilation parameters of the target application to the first compiler module.

[0196] The compiler execution module can compile a target application based on the target application's compilation parameters, where the compilation parameters can refer to the `dexoptPackages` parameter. These compilation parameters can be passed into the `dexopt()` function.

[0197] S305, The first compilation module sends the compilation parameters of the target application to the third compilation module.

[0198] After receiving the compilation parameters carried in the function dexopt(), the first compilation module can package the compilation parameters carried in the function dexopt() into a compilation parameter dexoptPackages and send the compilation parameters dexoptPackages to the third compilation module.

[0199] The third compilation module can be a module formed by the class Dexopter.java.

[0200] S306, the third compilation module packages the compilation parameters of the target application to generate a compilation file.

[0201] The third compilation module can package the compilation parameters of dexoptPackages to generate a compiled file called dexoptFile.

[0202] S307. The third compilation module sends the compilation file to the compilation execution module through the compilation interface module.

[0203] The compilation interface module can be a module formed by the class IArtd.java.

[0204] S308, The compilation and execution module compiles the target application based on the compilation file.

[0205] The compiled execution module can be a module formed by the classes artd.cc and dex2oat.cc.

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

[0207] It is understood that, in order to achieve the above functions, the electronic device includes hardware and / or software modules that perform the respective functions. Based on the algorithmic steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is implemented in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0208] This application embodiment can divide an electronic device into functional modules based on the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one module. It should be noted that the module division in this application embodiment is illustrative and represents only one logical functional division; other division methods may be used in actual implementation. It should also be noted that the module names in this application embodiment are illustrative, and the names of the modules are not limited in actual implementation.

[0209] Figure 7 This is a schematic diagram of a structure of a compilation device for an application provided in an embodiment of this application.

[0210] It should be understood that the application's compilation device 600 can execute... Figures 4 to 6 The application compilation method shown; the application compilation device 600 includes: an acquisition unit 610 and a processing unit 620.

[0211] The processing unit 620 is used to download and install a second operating system in the running first operating system; when the installation of the second operating system is completed and the electronic device is restarted, it compiles the target application; and runs the second operating system.

[0212] The application compilation apparatus provided in this embodiment is used to execute the application compilation method of the above embodiment. The technical principle and technical effect are similar, and will not be described again here.

[0213] It should be noted that the compilation device 600 for the aforementioned application is embodied in the form of a functional unit. The term "unit" here can be implemented in software and / or hardware, without specific limitations.

[0214] For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.

[0215] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0216] Figure 8 A schematic diagram of the structure of an electronic device provided in this application is shown. Figure 8 The dashed lines in the diagram indicate that the unit or module is optional. The electronic device 700 can be used to implement the compilation method of the application described in the above method embodiments.

[0217] The electronic device 700 includes one or more processors 701, which support the compilation method of the application program in the method embodiment of the electronic device 700. The processor 701 can be a general-purpose processor or a special-purpose processor. For example, the processor 701 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.

[0218] The processor 701 can be used to control the electronic device 700, execute software programs, and process data from the software programs. The electronic device 700 may also include a communication unit 705 for inputting (receiving) and outputting (transmitting) signals.

[0219] For example, electronic device 700 may be a chip, communication unit 705 may be the input and / or output circuit of the chip, or communication unit 705 may be the communication interface of the chip, and the chip may be a component of terminal device or other electronic device.

[0220] For example, electronic device 700 can be a terminal device, communication unit 705 can be the transceiver of the terminal device, or communication unit 705 can be the transceiver circuit of the terminal device.

[0221] The electronic device 700 may include one or more memories 702, which store a program 704. The program 704 can be executed by the processor 701 to generate instructions 703, causing the processor 701 to execute the impedance matching method described in the above method embodiments according to the instructions 703.

[0222] Optionally, the memory 702 may also store data. Optionally, the processor 701 may also read the data stored in the memory 702, which may be stored at the same memory address as the program 704, or the data may be stored at a different memory address than the program 704.

[0223] The processor 701 and memory 702 can be configured separately or integrated together; for example, integrated on the system on chip (SOC) of the terminal device.

[0224] For example, the memory 702 can be used to store the related program 704 of the application compilation method provided in the embodiments of this application, and the processor 701 can be used to call the related program 704 of the application compilation method stored in the memory 702 when compiling the application, and execute the application compilation method of the embodiments of this application; including: downloading and installing a second operating system in the running first operating system; compiling the target application when the second operating system is installed and the electronic device is restarted; and running the second operating system.

[0225] This application also provides a computer program product that, when executed by processor 701, implements the compilation method of the application program described in any of the method embodiments of this application.

[0226] The computer program product can be stored in memory 702, for example, program 704. Program 704 is finally converted into an executable object file that can be executed by processor 701 after processing such as preprocessing, compilation, assembly and linking.

[0227] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the compilation method of the application program described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.

[0228] The computer-readable storage medium is, for example, memory 702. Memory 702 can be volatile memory or non-volatile memory, or memory 702 can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0229] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0230] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0231] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0232] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

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

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

[0235] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0236] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for compiling an application, characterized in that, The method is applied to electronic devices, including: Download and install the second operating system on the running first operating system; When the second operating system is installed and the electronic device is restarted, the target application is compiled. Run the second operating system.

2. The method according to claim 1, characterized in that, The process of compiling the target application upon restarting the electronic device after the installation of the second operating system is completed includes: Determine if the compilation time is less than the preset time threshold; If the compilation time is less than the preset time threshold, then the application to be processed at the current moment will be compiled as the target application.

3. The method according to claim 2, characterized in that, If the compilation time is less than the preset time threshold, then the application to be processed at the current moment is compiled as the target application, including: If the compilation time is less than the preset time threshold, the application to be processed at the current moment will be used as the target application for first-level compilation, which includes speed profile level compilation.

4. The method according to claim 3, characterized in that, If the compilation time is greater than or equal to the preset time threshold, the target application is compiled at a second level, which includes a verify level compilation.

5. The method according to any one of claims 1 to 4, characterized in that, The target application is the N most frequently used applications in the electronic device.

6. The method according to claim 5, characterized in that, The target application includes third-party applications.

7. The method according to any one of claims 1 to 6, characterized in that, The electronic device includes a system service module, a first compilation module, and a compilation execution module. When the second operating system is installed and the electronic device is restarted, the target application is compiled, including: When the installation of the second operating system is completed and the electronic device is restarted, the system service module responds to the restart operation of the electronic device by sending a first compilation instruction to the first compilation module; In response to the first compilation instruction, the first compilation module sends a second compilation instruction to the compilation execution module; The compilation and execution module responds to the second compilation instruction and compiles the target application.

8. The method according to claim 7, characterized in that, The electronic device further includes a second compilation module, wherein the first compilation module, in response to the first compilation instruction, sends a second compilation instruction to the compilation execution module, including: In response to the first compilation instruction, the first compilation module sends an acquisition instruction to the second compilation module; The second compilation module obtains the compilation parameters of the target application based on the acquisition instruction; The second compilation module sends the compilation parameters to the first compilation module; The first compilation module generates the second compilation instruction based on the compilation parameters and sends the second compilation instruction to the compilation execution module.

9. The method according to claim 7 or 8, characterized in that, The first compilation module is also used to determine the target application based on the first compilation instructions.

10. An electronic device, characterized in that, The electronic device includes a module for performing the method as described in any one of claims 1 to 9.

11. An electronic device, characterized in that, include: One or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored on the memory, and when the computer programs are executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1 to 9.

12. A chip system, characterized in that, The chip system includes a processor for calling and running a computer program from memory, causing an electronic device on which the chip system is installed to perform the method as described in any one of claims 1 to 9.

13. A computer-readable storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1 to 9.