CN115185652B - Application optimization method and device and electronic equipment - Google Patents

Application optimization method and device and electronic equipment Download PDF

Info

Publication number
CN115185652B
CN115185652B CN202210667655.9A CN202210667655A CN115185652B CN 115185652 B CN115185652 B CN 115185652B CN 202210667655 A CN202210667655 A CN 202210667655A CN 115185652 B CN115185652 B CN 115185652B
Authority
CN
China
Prior art keywords
application
compiling
optimized
target application
parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210667655.9A
Other languages
Chinese (zh)
Other versions
CN115185652A (en
Inventor
朱金鹏
种洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210667655.9A priority Critical patent/CN115185652B/en
Publication of CN115185652A publication Critical patent/CN115185652A/en
Application granted granted Critical
Publication of CN115185652B publication Critical patent/CN115185652B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application optimization method and device and electronic equipment relate to the technical field of terminals and aim at guaranteeing that the problem of hot blocking does not occur in an updated scene and simultaneously giving consideration to performance experience when a user uses an application. The specific scheme is as follows: canceling or delaying an optimized compiling operation required to be executed for at least part of non-optimized applications under an updated scene; the non-optimized application is an application needing to perform optimized compiling operation under an updated scene; detecting whether an unoptimized application cold start exists; if the fact that the non-optimized application is cold-started is detected, triggering and executing the optimized compiling operation corresponding to the target application; the target application is a detected cold-start non-optimized application.

Description

Application optimization method and device and electronic equipment
The application is filed by the China patent office, the application number is 202110661937.3, the invention name is application optimizing method and device and electronic equipment in the year of 2021, 6 and 15, and the application is a divisional application of the China patent application.
Technical Field
The application relates to the technical field of terminals, in particular to an application optimization method and device and electronic equipment.
Background
In the prior art, in the context of updating a mobile phone device, many applications generally need to be optimized. Specifically, by triggering the optimizing and compiling thread of each application program, compiling each application program into the oat format file, obtaining the optimizing file of each application program, and completing the performance optimization of each application.
However, because the application programs needed to be optimized in the updated scene are too many, the load of the central processing unit (centra l process ing un it, CPU) is too large, the phenomenon of hot sticking can occur after the mobile phone is started, and bad user experience is brought to the user.
Disclosure of Invention
The application optimization method, the application optimization device and the electronic equipment are used for guaranteeing that the problem of hot blocking does not occur in an updated scene and simultaneously giving consideration to performance experience when a user uses an application.
In order to achieve the above object, the present application provides the following technical solutions:
in a first aspect, the present application provides an application optimization method, including: and canceling or delaying the optimized compiling operation required to be executed by at least part of non-optimized applications in the updating scene, wherein the non-optimized applications are applications which need to be executed in the updating scene. And then detecting whether the non-optimized application cold start exists, and if so, triggering and executing the optimized compiling operation corresponding to the target application, wherein the target application is the non-optimized application of the detected cold start.
According to the application optimization method, partial optimization compiling operation which is required to be executed for the non-optimized application in the updated scene is delayed, so that the phenomenon of overlarge load of a CPU (Central processing Unit) does not occur, and the mode of triggering the execution of the optimization compiling operation corresponding to the target application when the existence of the cold start of the non-optimized application is detected is adopted, so that under the condition of reducing the load of the CPU, the application can have optimized performance when a user uses the application.
In one possible implementation, the detecting whether there is an un-optimized application cold start includes: if the existence of the application cold start is detected, judging whether the application is an unoptimized application or not. If the application is judged to be the non-optimized application, the existence of the non-optimized application cold start is determined, and if the application is judged not to be the non-optimized application, the existence of the non-optimized application cold start is determined.
In another possible implementation manner, if it is detected that there is a cold start of the application, determining whether the cold started application is an un-optimized application includes:
if the existence of the application cold start is detected, determining whether an optimized file corresponding to the cold start application is invalid due to the update scene. If the optimized file corresponding to the cold-started application is invalid due to the updated scene, determining that the cold-started application is an un-optimized application, and if the optimized file corresponding to the cold-started application is not invalid due to the updated scene, determining that the cold-started application is not the un-optimized application.
In another possible implementation manner, after delaying the partial optimization compiling operation that needs to be performed on the non-optimized application in the updated scenario, the method further includes:
when the service scheduler meets the condition of being in the idle state of the equipment, the execution delay optimizing compiling operation is triggered.
In the application optimizing method provided by the application optimizing method, the optimizing compiling operation corresponding to the target application can be triggered to be executed when the existence of the non-optimized application cold start is detected, and the optimizing compiling operation with delayed execution can be triggered when the condition in the equipment idle state is met, so that the application can be further ensured to have the optimized performance under the condition of reducing the CPU load.
In another possible implementation manner, the condition that the device is in the idle state is that the screen is turned off, the electric quantity is larger than a preset electric quantity value, and the device is in a charging state.
In another possible implementation manner, after detecting that there is an un-optimized application cold start, the method further includes:
firstly, creating an optimized compiling thread, and then setting compiling requirement parameters in the optimized compiling thread to obtain compiling requirement parameters of a target application, wherein the compiling requirement parameters of the target application comprise: the target application identification, and parameters that the target application adapts during the optimization compilation process. Further, through the compiling requirement parameters of the target application, the compiling operation parameters of the target application can be configured according to the requirement of the target application in optimizing the compiling process, so as to obtain the compiling operation parameters of the configured target application, wherein the compiling operation parameters of the target application are used for explaining the operation mode of executing the optimizing compiling operation corresponding to the target application. The triggering execution of the optimized compiling operation corresponding to the target application comprises the following steps: and triggering and executing the optimized compiling operation corresponding to the target application by using the compiling operation parameters of the configured target application.
In another possible implementation manner, the compiling operation parameters of the configured target application include: at least one parameter of a processor core used when executing the optimized compiling operation corresponding to the target application, the thread number, the compiling level and the termination preset duration when executing the optimized compiling operation, wherein the termination preset duration is the maximum duration when executing the optimized compiling operation corresponding to the target application.
In another possible implementation manner, before the configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application, the method further includes: and adding the compiling requirement parameters of the target application into an unoptimized management and control queue, arranging the compiling requirement parameters in the unoptimized management and control queue according to the time sequence of detecting the cold start of the unoptimized application, detecting whether the current equipment is in a busy state, if so, delaying the operation of the unoptimized management and control queue, and after delaying a first preset time length, returning to execute the step of detecting whether the current equipment is in the busy state. The configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application to obtain the compiling operation parameters of the configured target application includes: if the fact that the current equipment is not in the busy state and the current unoptimized management and control queue runs to the compiling requirement parameters of the target application is detected, configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application.
In another possible implementation manner, before the configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application, the method further includes: and transmitting the compiling requirement parameters of the target application into a service scheduler. The configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application to obtain the compiling operation parameters of the configured target application includes: triggering the compiling requirement parameters of the target application to configure the compiling operation parameters of the target application when the service scheduler meets the condition that the device is not in a busy state, and obtaining the configured compiling operation parameters of the target application.
In another possible implementation manner, before the configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application, the method further includes: firstly acquiring equipment state parameters, then configuring the compiling operation parameters of the target application when executing the compiling requirement parameters of the target application to obtain the compiling operation parameters of the configured target application, and configuring the compiling operation parameters of the target application through the compiling requirement parameters of the target application and the equipment state parameters to obtain the compiling operation parameters of the configured target application.
In another possible implementation manner, after the triggering execution of the optimized compiling operation corresponding to the target application by using the configured compiling operation parameter of the target application, the method further includes: and receiving an execution result of the optimizing compiling operation corresponding to the target application, and ending the optimizing compiling thread.
In another possible implementation manner, the performing the optimized compiling operation corresponding to the target application includes:
and executing the optimized compiling operation corresponding to the target application by calling dex2 oat.
In another possible implementation manner, the performing, by invoking the dex2oat, the optimized compiling operation corresponding to the target application includes: and compiling the dex format file corresponding to the target application into an oat format file by calling dex2 oat.
In a second aspect, the present application provides another application optimization method applied to an electronic device, where an application is installed on the electronic device, and the electronic device includes: the method comprises the following steps of:
the byte code compiling module cancels or delays the optimizing compiling operation required to be executed for at least part of non-optimizing applications in an updating scene, the non-optimizing applications are applications required to be executed for optimizing compiling operation in the updating scene, when the application managing and controlling module receives a cold starting message sent by the application, the application managing and controlling module responds to the cold starting message to determine whether the application is the non-optimizing application, the cold starting message carries an application identifier and a cold starting identifier, and if the application is determined to be the non-optimizing application, the application managing and controlling module triggers the run time to execute the optimizing compiling operation for the application.
According to the application optimization method, the byte code compiling module delays partial optimization compiling operation required to be executed on the un-optimized application under the updated scene, so that the phenomenon of overlarge load of a CPU does not occur, when the application is determined to be the un-optimized application through the application management and control module responding to the cold start message, the run time is triggered to execute the optimization compiling operation on the application, and the application can have optimized performance under the condition of reducing the load of the CPU.
In one possible implementation, the determining, by the application management module, whether the application is an un-optimized application includes:
the application management and control module requests the byte code compiling module to acquire the optimized file state information of the application, the request carries the application identifier, then the run time sends the optimized file state information of the application to the application management and control module, the optimized file state information of the application is used for indicating whether an optimized file of the application is invalid due to system upgrading, if the optimized file state information of the application indicates that the optimized file of the application is invalid due to system upgrading, the application management and control module determines that the application is not an optimized application, and if the optimized file state information of the application indicates that the optimized file of the application is not invalid due to system upgrading, the application management and control module determines that the application is not the un-optimized application.
In another possible implementation manner, the application management and control module triggers the run time to perform an optimized compiling operation on the application, including: the application management and control module creates an optimized compiling thread, the application management and control module sets compiling requirement parameters in the optimized compiling thread to obtain compiling requirement parameters of a target application, and the compiling requirement parameters of the target application comprise: the method comprises the steps that a target application identifier and parameters adapted in the optimizing and compiling process of the target application are identified, the application management and control module sends a starting and compiling message to the byte code compiling module, the starting and compiling message carries compiling requirement parameters of the target application, then the byte code compiling module responds to the starting and compiling message, based on the compiling requirement parameters of the target application, compiling operation parameters of the target application are configured to obtain the configured compiling operation parameters of the target application, the compiling operation parameters of the target application are used for representing an operation mode when the optimizing and compiling operation corresponding to the target application is executed, and the byte code compiling module triggers the Runt time to execute the optimizing and compiling operation of the application by using the configured compiling operation parameters of the target application.
In another possible implementation manner, the compiling operation parameters of the configured target application include: at least one parameter of a processor core used when executing the optimized compiling operation corresponding to the target application, the number of threads, the compiling level and the termination preset duration when executing the optimized compiling operation; and the termination preset time is the maximum time for executing the optimized compiling operation corresponding to the target application.
In another possible implementation manner, the byte code compiling module configures a compiling operation parameter of the target application based on a compiling requirement parameter of the target application, and before obtaining the configured compiling operation parameter of the target application, the method further includes: the byte code compiling module adds the compiling requirement parameters of the target application into an unoptimized management and control queue, the compiling requirement parameters in the unoptimized management and control queue are arranged according to the time sequence of detecting the cold start of the unoptimized application, the byte code compiling module detects whether the target application is currently in a device busy state, if the target application is detected to be in the device busy state, the byte code compiling module delays running the unoptimized management and control queue, and after delaying a first preset time length, returns to execute the step of detecting whether the target application is currently in the device busy state, the byte code compiling module configures the compiling operation parameters of the target application based on the compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application, and the method comprises the following steps: and if the byte code compiling module detects that the current equipment is not in a busy state and the current unoptimized management and control queue runs to the compiling requirement parameter of the target application, configuring the compiling operation parameter of the target application based on the compiling requirement parameter of the target application to obtain the configured compiling operation parameter of the target application.
In another possible implementation manner, the byte code compiling module configures a compiling operation parameter of the target application based on a compiling requirement parameter of the target application, and before obtaining the configured compiling operation parameter of the target application, the method further includes:
the byte code compiling module transmits the compiling requirement parameters of the target application into a service scheduler, and then configures the compiling operation parameters of the target application based on the compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application, wherein the compiling operation parameters of the target application comprise: and triggering and executing the compiling requirement parameters based on the target application to configure the compiling operation parameters of the target application when the service scheduler meets the condition that the device is not in a busy state, and obtaining the configured compiling operation parameters of the target application.
In another possible implementation manner, the byte code compiling module configures a compiling operation parameter of the target application based on a compiling requirement parameter of the target application, and before obtaining the configured compiling operation parameter of the target application, the method further includes: the byte code compiling module obtains the equipment state parameter, the byte code compiling module configures the compiling operation parameter of the target application based on the compiling requirement parameter of the target application, and obtains the compiling operation parameter of the configured target application, and the method comprises the following steps: and the byte code compiling module configures compiling operation parameters of the target application based on the compiling requirement parameters and the equipment state parameters of the target application to obtain the configured compiling operation parameters of the target application.
In another possible implementation manner, after the byte code compiling module triggers the run time to execute the optimized compiling operation for the application by using the configured compiling operation parameter of the target application, the method further includes: and the run time sends an execution result of the optimized compiling operation corresponding to the target application to the application management and control module, and responds to the execution result of the optimized compiling operation corresponding to the target application to finish the optimized compiling thread.
In another possible implementation manner, after the byte code compiling module delays the optimization compiling operation to be executed on at least a part of the non-optimized application in the update scenario, the method further includes: the byte code compiling module triggers the execution delay optimizing compiling operation when the condition in the idle state of the equipment is met through the service scheduler.
In a third aspect, the present application provides an electronic device, including: one or more processors, memory, display screen, wireless communication module, and mobile communication module;
the memory, the display screen, the wireless communication module, and the mobile communication module are coupled with the one or more processors, the memory for storing computer program code comprising computer instructions that, when executed by the one or more processors, the electronic device performs the application optimization method of any of the first aspects described above.
In a fourth aspect, the present application provides an application optimizing apparatus, including: the device comprises a processing unit, a storage unit, a display unit and a transceiver unit, wherein the storage unit is used for storing one or more programs; the processing unit is configured to execute the one or more programs; the one or more programs include instructions for performing the method of the first aspect or any of the possible implementations of the first aspect.
In a fifth aspect, the present application provides a computer storage medium, which may comprise computer instructions, which when run on an electronic device, cause the electronic device to perform the method as described in the first aspect or any of the possible implementations of the first aspect.
In a sixth aspect, the present application provides a computer program product which, when run on a computer, causes the computer to perform the method as described in any one of the above first aspect or possible implementations of the first aspect.
It should be appreciated that the description of technical features, aspects, benefits or similar language in this application does not imply that all of the features and advantages may be realized with any single embodiment. Conversely, it should be understood that the description of features or advantages is intended to include, in at least one embodiment, the particular features, aspects, or advantages. Therefore, the description of technical features, technical solutions or advantageous effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and advantageous effects described in the present embodiment may also be combined in any appropriate manner. Those of skill in the art will appreciate that an embodiment may be implemented without one or more particular features, aspects, or benefits of a particular embodiment. In other embodiments, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments.
Drawings
FIG. 1 is a diagram showing an example of CPU frequency change during an upgrade process of a mobile phone system;
FIG. 2 is a diagram showing an example of the variation of CPU frequency and temperature during the upgrading process of the mobile phone system;
FIG. 3 is a schematic diagram of an electronic device according to the present application;
fig. 4 is a diagram illustrating a software structure of an electronic device provided in the present application;
FIG. 5 is a schematic flow chart of an application optimization method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a second flowchart of an application optimization method according to an embodiment of the present application;
fig. 7 is a diagram showing a composition example of an electronic device provided in the present application;
fig. 8 is a diagram illustrating an example of the composition of an application optimizing apparatus provided in the present application.
Detailed Description
The terms first, second, third and the like in the description and in the claims and drawings are used for distinguishing between different objects and not for limiting the specified sequence.
In the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
For clarity and conciseness in the description of the embodiments below, a brief description of an implementation scheme of an application optimization process is first given:
in the updated scene, the mobile phone equipment often has the phenomena of mobile phone blocking, hair scalding and the like because of optimizing a plurality of application programs. For example, as shown in fig. 1, fig. 1 is a diagram illustrating a CPU frequency change during an upgrade process of a mobile phone system. When the mobile phone system is upgraded in this updated scenario, the dex2oat operation needs to be executed for about 4 minutes approximately 131 times in the process of starting up, and after the mobile phone system is turned on for one minute, the dex2oat operation needs to be executed 161 times for about 8 minutes, because the dex2oat needs to be executed too much, as can be seen from fig. 1, in the process of starting up, even after the completion of starting up, the time for executing the dex2oat is too long, the CPU frequency is relatively high, which easily causes equipment to be stuck and scalded, and the experience of the user using the mobile phone is affected.
Fig. 2 is a diagram showing an example of the change of the CPU frequency and temperature during the upgrading process of the mobile phone system. As shown in fig. 2, in the starting-up process, since the dex2oat processed by the CPU is too much and the frequency of the CPU is not limited, the temperature of the mobile phone is continuously increased, the mobile phone is scalded, after the starting-up is completed, in order to protect the mobile phone from normal operation, the mobile phone equipment limits the CPU frequency when detecting that the temperature of the mobile phone is too high, so that the CPU frequency is limited to a lower frequency after the starting-up, the time required for the CPU to process the dex2oat after the starting-up is longer, the operation rate of the mobile phone is lower, and bad use experience is brought to the user.
The dex2oat is a function for compiling and generating an optimized file, and the dex format file of the application can be compiled into the oat file to realize the optimization of the application. In the process of upgrading the system, many applications need to perform corresponding optimization operations in order to adapt to the upgraded system, so that better performance can be provided for users. However, the optimization process is often executed for a long time, and the mobile phone is scalded and blocked, so that the phenomenon of the mobile phone that is scalded and blocked is reduced in the process of performing application optimization in an updated scene, which is a problem to be solved in the prior art.
Based on the problems in the technical scheme, the application optimization method is provided to solve the problem that the mobile phone is scalded and blocked in an updated scene. The application optimization method can be applied to electronic devices such as mobile phones, tablet computers, desktop computers, laptops, notebook computers, ultra mobile personal computers (U-mobi le Persona l Computer, UMPC), handheld computers, netbooks, personal digital assistants (Persona l Digita l Ass i stant, PDA), wearable electronic devices, intelligent watches and the like. The structure of the electronic device to which the application optimization method is applied may be as shown in fig. 3.
As shown in fig. 3, fig. 3 is an illustration of an example of the composition of an electronic device provided herein, which may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (un iversa l ser ia l bus, USB) interface 330, a charge management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an earphone interface 370D, a sensor module 380, keys 390, a motor 391, an indicator 392, a camera 393, a display screen 394, and a subscriber identity module (subscr iber ident ificat ion modu le, SIM) card interface 395. The sensor module 380 may include a pressure sensor 380A, a gyroscope sensor 380B, an air pressure sensor 380C, a magnetic sensor 380D, an acceleration sensor 380E, a distance sensor 380F, a proximity sensor 380G, a fingerprint sensor 380H, a temperature sensor 380J, a touch sensor 380K, an ambient light sensor 380L, a bone conduction sensor 380M, and the like.
It is to be understood that the structure illustrated in the present embodiment does not constitute a specific limitation on the electronic apparatus. In other embodiments, the electronic device may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 310 may include one or more processing units, such as: the processor 310 may include an application processor (app l icat ion processor, AP), a modem processor, a graphics processor (graph ics process ing un it, GPU), an image signal processor (image s igna l processor, ISP), a controller, a video codec, a digital signal processor (d igita l s igna l processor, DSP), a baseband processor, and/or a neural network processor (neuro l-network process ing un it, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors. For example, in the present application, the processor 310 may schedule a scene according to the state information of the smart home device, that is, generate a control rule, where the control rule is used to control the smart home device. After the electronic equipment receives a second operation of starting the intelligent home scene, the electronic equipment responds to the second operation and controls the intelligent home equipment to enter a state corresponding to the state information according to the control rule. The smart home device is a smart home device associated with a user account to which the electronic device is logged in. Further, the smart home device may be a smart home device operated by a user in a smart home device associated with a user account to which the electronic device is logged in.
The controller may be a neural hub and a command center of the electronic device 302, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 310 for storing instructions and data. In some embodiments, the memory in the processor 310 is a cache memory. The memory may hold instructions or data that the processor 310 has just used or recycled. If the processor 310 needs to reuse the instruction or data, it may be called directly from the memory. Repeated accesses are avoided and the latency of the processor 310 is reduced, thereby improving the efficiency of the system.
In some embodiments, processor 310 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated ci rcu it, I2C) interface, an integrated circuit built-in audio (inter-integrated ci rcu it sound, I2S) interface, a pulse code modulation (pu l se code modu l at ion, PCM) interface, a universal asynchronous receiver transmitter (un iversa l asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobi le industry processor interface, MI PI), a general purpose input/output (GPIO) interface, a subscriber identity module (subscr iber ident ity modu le, SIM) interface, and/or a universal serial bus (un iversa l ser ia l bus, USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (ser ia l data l ine, SDA) and a serial clock line (derai l C lock l ine, SCL). In some embodiments, the processor 310 may contain multiple sets of I2C buses. The processor 310 may be coupled to the touch sensor 380K, charger, flash, camera 393, etc., respectively, via different I2C bus interfaces. For example: the processor 310 may couple the touch sensor 380K through an I2C interface, causing the processor 310 to communicate with the touch sensor 380K through an I2C bus interface, implementing the touch functionality of the electronic device 302.
The I2S interface may be used for audio communication. In some embodiments, the processor 310 may contain multiple sets of I2S buses. The processor 310 may be coupled to the audio module 370 via an I2S bus to enable communication between the processor 310 and the audio module 370. In some embodiments, the audio module 370 may communicate audio signals to the wireless communication module 360 via the I2S interface to enable answering calls via the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 370 and the wireless communication module 360 may be coupled by a PCM bus interface. In some embodiments, the audio module 370 may also transmit audio signals to the wireless communication module 360 via the PCM interface to enable phone answering via the bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 310 with the wireless communication module 360. For example: the processor 310 communicates with a bluetooth module in the wireless communication module 360 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 370 may transmit audio signals to the wireless communication module 360 through a UART interface to implement a function of playing music through a bluetooth headset.
The MI PI interface may be used to connect the processor 310 with peripheral devices such as the display screen 394, the camera 393, and the like. The MI PI interface includes camera serial interface (camera ser ia l interface, CSI), display screen serial interface (d i sp l ay ser ia linterface, DSI), etc. In some embodiments, processor 310 and camera 393 communicate through the CSI interface, implementing the photographing function of electronic device 302. The processor 310 and the display screen 194 communicate via a DSI interface to implement the display functionality of the electronic device 302.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or as a data signal. In some embodiments, a GPIO interface may be used to connect processor 310 with camera 393, display 394, wireless communication module 360, audio module 370, sensor module 380, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, an MI PI interface, etc.
The USB interface 330 is an interface conforming to the USB standard specification, and may specifically be a mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 330 may be used to connect a charger to charge the electronic device 302, or may be used to transfer data between the electronic device 302 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in this embodiment is only illustrative, and is not meant to limit the structure of the electronic device 302. In other embodiments of the present application, the electronic device 302 may also use different interfacing manners, or a combination of multiple interfacing manners, as in the above embodiments.
The charge management module 340 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 340 may receive a charging input of a wired charger through the USB interface 330. In some wireless charging embodiments, the charge management module 340 may receive wireless charging input through a wireless charging coil of the electronic device 302. The battery 342 is charged by the charge management module 340, and the electronic device may be powered by the power management module 341.
The power management module 341 is configured to connect the battery 342, the charge management module 340 and the processor 310. The power management module 341 receives input from the battery 342 and/or the charge management module 340 to power the processor 310, the internal memory 321, the display screen 394, the camera 393, the wireless communication module 360, and the like. The power management module 341 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance), and other parameters. In other embodiments, the power management module 341 may also be disposed in the processor 310. In other embodiments, the power management module 341 and the charging management module 340 may also be disposed in the same device.
The wireless communication function of the electronic device may be implemented by the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 350 may provide a solution for wireless communication including 2G/3G/4G/5G, etc. applied on an electronic device. The mobile communication module 350 may include at least one filter, switch, power amplifier, low noise amplifier (low noi se amp l ifier, LNA), etc. The mobile communication module 350 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 350 may amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate the electromagnetic waves. In some embodiments, at least some of the functional modules of the mobile communication module 350 may be disposed in the processor 310. In some embodiments, at least some of the functional modules of the mobile communication module 350 may be provided in the same device as at least some of the modules of the processor 310.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 370A, receiver 370B, etc.), or displays images or video through display screen 394. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 350 or other functional module, independent of the processor 310.
The wireless communication module 360 may provide solutions for wireless communication including wireless local area network (Wi re less loca larea networks, WLAN) (e.g., wireless fidelity (Wi re less fide l ity, wi-Fi) network), bluetooth (BT), global navigation satellite system (globa l navigat ion sate l l ite system, GNSS), frequency modulation (frequency modu l at ion, FM), near field wireless communication technology (near fie ld commun icat ion, NFC), infrared technology (I R), etc. for application on an electronic device. The wireless communication module 360 may be one or more devices that integrate at least one communication processing module. The wireless communication module 360 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 310. The wireless communication module 360 may also receive a signal to be transmitted from the processor 310, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 and mobile communication module 350 of the electronic device are coupled, and antenna 2 and wireless communication module 360 are coupled, such that electronic device 302 may communicate with a network and other devices through wireless communication techniques. The wireless communication techniques may include global system for mobile communications (globa l system for mobi le commun icat ions, GSM), general packet radio service (genera l packet rad io service, GPRS), code division multiple access (code d ivi s ion mu lt ip le access, CDMA), wideband code division multiple access (wideband code d ivi s ion mu lt ip le access, WCDMA), time division code division multiple access (t ime-d ivi s ion code d ivi s ion mu lt ip le access, TD-SCDMA), long term evolution (long term evo l ut ion, LTE), BT, GNSS, WLAN, NFC, FM, and/or I R techniques, among others. The GNSS may include a global satellite positioning system (globa l pos it ion ing system, GPS), a global navigation satellite system (globa l navigat ion sate l l ite system, GLONASS), a beidou satellite navigation system (beidou navigat ion sate l l ite system, BDS), a quasi zenith satellite system (quas i-zen ith sate l l ite system, QZSS) and/or a satellite based augmentation system (sate l l ite based augmentat ion systems, SBAS).
The electronic device implements display functions through the GPU, display screen 394, and application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 310 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 394 is used for displaying images, videos, and the like. The display screen 394 includes a display panel. The display panel may employ a liquid crystal display (l iqu id crysta l d i sp l ay, LCD), an Organic Light Emitting Diode (OLED), an active-matrix organic light emitting diode (AMOLED) or an active-matrix organic light emitting diode (matr ix organ ic l ight emitt ing d iode), a Flexible Light Emitting Diode (FLED), a mini led, a Micro-o led, a quantum dot light emitting diode (quantum dot l ight emitt ing d iodes, QLED), or the like. In some embodiments, the electronic device may include 1 or N displays 394, N being a positive integer greater than 1.
A series of graphical user interfaces (graph ica l user interface, GUIs) may be displayed on the display screen 394 of the electronic device, all of which are home screens of the electronic device. Generally, the size of the display 394 of an electronic device is fixed and only limited controls can be displayed in the display 394 of the electronic device. A control is a GUI element that is a software component contained within an application program that controls all data processed by the application program and interactive operations on that data, and a user can interact with the control by direct manipulation (d i rect man ipu l at ion) to read or edit information about the application program. In general, controls may include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and the like. For example, in an embodiment of the present application, the display 194 may display virtual keys (one-key arrangement, start arrangement, scene arrangement).
The electronic device may implement shooting functions through the ISP, the camera 393, the video codec, the GPU, the display screen 394, the application processor, and the like.
The ISP is used to process the data fed back by camera 393. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 393.
Camera 393 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coup led device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, the electronic device may include 1 or N cameras 393, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, and so on.
Video codecs are used to compress or decompress digital video. The electronic device may support one or more video codecs. In this way, the electronic device may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a Neural Network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent cognition of electronic devices can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The external memory interface 320 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device. The external memory card communicates with the processor 310 through an external memory interface 320 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 321 may be used to store computer executable program code comprising instructions. The processor 310 executes various functional applications of the electronic device 302 and data processing by executing instructions stored in the internal memory 321. For example, in the present embodiment, the processor 310 may perform scene orchestration by executing instructions stored in the internal memory 321. The internal memory 321 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device (e.g., audio data, phonebook, etc.), and so forth. In addition, the internal memory 321 may include a high-speed random access memory, and may also include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (un iversa l f l ash storage, UFS), and the like. The processor 310 performs various functional applications of the electronic device and data processing by executing instructions stored in the internal memory 321, and/or instructions stored in a memory provided in the processor.
The electronic device may implement audio functionality through an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an ear-headphone interface 370D, and an application processor, among others. Such as music playing, recording, etc.
The audio module 370 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 370 may also be used to encode and decode audio signals. In some embodiments, the audio module 370 may be disposed in the processor 310, or some of the functional modules of the audio module 370 may be disposed in the processor 310.
Speaker 370A, also known as a "horn," is used to convert audio electrical signals into sound signals. The electronic device may listen to music, or to hands-free conversations, through speaker 370A.
A receiver 370B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When the electronic device picks up a phone call or voice message, the voice can be picked up by placing the receiver 370B close to the human ear.
Microphone 370C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 370C through the mouth, inputting a sound signal to the microphone 370C. The electronic device may be provided with at least one microphone 370C. In other embodiments, the electronic device may be provided with two microphones 370C, which may also perform a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device may also be provided with three, four, or more microphones 370C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 370D is for connecting a wired earphone. The headset interface 170D may be a USB interface 330 or a 3.5mm open mobile electronic device platform (open mobi le termina l p l atform, OMTP) standard interface, a american cellular telecommunications industry association (ce l l u l ar te lecommun icat ions industry associat ion of the USA, CTIA) standard interface.
The pressure sensor 380A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 380A may be disposed on the display screen 394. The pressure sensor 380A is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. When a force is applied to the pressure sensor 380A, the capacitance between the electrodes changes. The electronics determine the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 394, the electronic device detects the touch operation intensity from the pressure sensor 380A. The electronic device may also calculate the location of the touch based on the detection signal of the pressure sensor 380A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 380B may be used to determine the motion pose of the electronic device. In some embodiments, the angular velocity of the electronic device about three axes (i.e., x, y, and z axes) may be determined by gyroscope sensor 380B. The gyro sensor 380B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 380B detects the shake angle of the electronic device, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device through the reverse motion, thereby realizing anti-shake. The gyro sensor 380B may also be used for navigating, somatosensory game scenes.
The air pressure sensor 380C is used to measure air pressure. In some embodiments, the electronics calculate altitude from barometric pressure values measured by barometric pressure sensor 380C, aiding in positioning and navigation.
The magnetic sensor 380D includes a hall sensor. The electronic device may detect the opening and closing of the flip holster using the magnetic sensor 380D. In some embodiments, when the electronic device is a flip machine, the electronic device may detect the opening and closing of the flip according to the magnetic sensor 380D. And then according to the detected opening and closing state of the leather sheath or the opening and closing state of the flip, the characteristics of automatic unlocking of the flip and the like are set.
The acceleration sensor 380E may detect the magnitude of acceleration of the electronic device in various directions (typically three axes). The magnitude and direction of gravity can be detected when the electronic device is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 380F for measuring distance. The electronic device may measure the distance by infrared or laser. In some embodiments, the scene is photographed and the electronic device can range using the distance sensor 380F to achieve quick focus.
The proximity light sensor 380G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device emits infrared light outwards through the light emitting diode. The electronic device uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it may be determined that an object is in the vicinity of the electronic device. When insufficient reflected light is detected, the electronic device may determine that there is no object in the vicinity of the electronic device. The electronic device can use the proximity light sensor 380G to detect that the user holds the electronic device close to the ear for communication, so as to automatically extinguish the screen to achieve the purpose of saving electricity. The proximity light sensor 380G may also be used in holster mode, pocket mode to automatically unlock and lock the screen.
The ambient light sensor 380L is used to sense ambient light level. The electronic device can adaptively adjust the brightness of the display screen 394 based on the perceived ambient light level. The ambient light sensor 380L may also be used to automatically adjust white balance during photographing. The ambient light sensor 380L may also cooperate with the proximity light sensor 380G to detect if the electronic device is in a pocket to prevent false touches.
The fingerprint sensor 380H is used to collect a fingerprint. The electronic equipment can utilize the collected fingerprint characteristics to realize fingerprint unlocking, access the application lock, fingerprint photographing, fingerprint incoming call answering and the like.
The temperature sensor 380J is used to detect temperature. In some embodiments, the electronic device performs a temperature processing strategy using the temperature detected by temperature sensor 380J. For example, when the temperature reported by temperature sensor 380J exceeds a threshold, the electronic device performs a reduction in performance of a processor located in the vicinity of temperature sensor 380J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device heats the battery 342 to avoid the low temperature causing the electronic device to shut down abnormally. In other embodiments, the electronic device performs boosting of the output voltage of the battery 342 when the temperature is below a further threshold to avoid abnormal shutdown caused by low temperatures.
Touch sensor 380K, also known as a "touch device". The touch sensor 380K may be disposed on the display screen 394, and the touch sensor 380K and the display screen 394 form a touch screen, which is also referred to as a "touch screen". The touch sensor 380K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display screen 394. In other embodiments, touch sensor 380K may also be located on a surface of the electronic device other than where display 394 is located.
The bone conduction sensor 380M may acquire a vibration signal. In some embodiments, bone conduction sensor 380M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 380M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 380M may also be provided in the headset, in combination with an osteoinductive headset. The audio module 370 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 380M, so as to implement a voice function. The application processor can analyze heart rate information based on the blood pressure beat signals acquired by the bone conduction sensor 380M, so as to realize a heart rate detection function.
The keys 390 include a power on key, a volume key, etc. Key 390 may be a mechanical key. Or may be a touch key. The electronic device may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device.
The motor 391 may generate a vibration alert. The motor 391 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 391 may also correspond to different vibration feedback effects by touch operations applied to different areas of the display screen 394. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 392 may be an indicator light, which may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 395 is for interfacing with a SIM card. The SIM card may be inserted into the SIM card interface 395 or removed from the SIM card interface 395 to enable contact and separation with the electronic device. The electronic device may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 395 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 395 can be used to insert multiple cards simultaneously. The types of the plurality of cards may be the same or different. The SIM card interface 395 may also be compatible with different types of SIM cards. The SIM card interface 395 may also be compatible with external memory cards. The electronic equipment interacts with the network through the SIM card, so that the functions of communication, data communication and the like are realized. In some embodiments, the electronic device employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
In addition, an operating system is run on the components. Such as the hong Monte System, the iOS operating system, the Android open source operating system, the Windows operating system, and the like. An operating application may be installed on the operating system.
Fig. 4 is a software configuration block diagram of an electronic device according to an embodiment of the present application.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun row (Android run time) and system libraries, and a kernel layer, respectively.
The application layer may include a series of application packages. As shown in fig. 4, the application package may include applications for cameras, gallery, calendar, phone calls, maps, navigation, WLAN, bluetooth, music, video, short messages, etc. In the embodiment of the application, a plurality of application programs belonging to non-optimized applications exist in the application program layer. The non-optimized application is an application requiring optimized compiling operation in an updated scene. In the application layer, the state parameters of the optimization file corresponding to each application program can indicate whether the application program is an un-optimized application.
The application framework layer provides an application programming interface (app l icat ion programming interface, API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions. As shown in fig. 4, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like. For example, in some embodiments of the present application, the application framework layer may also include a bytecode compilation module and an application management module. In a system upgrade scene, the byte code compiling module cancels or delays the optimizing compiling operation required to be executed for at least part of non-optimizing applications in the system upgrade scene in advance. When an application in an application layer is cold started, a cold start message of the application is sent to a start message interface of an application management and control module, then the application management and control module acquires a detection result of whether an optimization file of the application is outdated due to system upgrading or not by calling an optimization file state interface on an Android run time, if the detection result is that the optimization file of the application is outdated due to system upgrading, an optimization compiling thread is created, compiling requirement parameters in the optimization compiling thread are set, compiling requirement parameters of the target application are obtained, and then a start compiling message carrying the compiling requirement parameters of the target application is sent to a byte code compiling module. The target application is a cold-start non-optimized application detected by the application management and control module. After the byte code compiling module receives the starting compiling message, the compiling operation parameters of the target application are configured through the compiling requirement parameters of the target application carried in the starting compiling message, and the compiling operation parameters of the configured target application are obtained. And then the byte code compiling module uses the configured compiling operation parameters of the target application to call dex2oat, compiles the dex file of the target application into oat file, and completes the optimization of the target application.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is for providing communication functions of the electronic device. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
Android run time includes a core library and virtual machines. Android run time is responsible for scheduling and management of the Android system. In some embodiments of the present application, the application cold start may run in an Android run time, and the Android run time obtains an optimized file state parameter of the application from the running time, and further the Android run time may determine whether the optimized file is outdated due to system upgrade through the optimized file state parameter, and return a determination result to the application management and control module.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: a surface manager (surface manager), a media library (Med ia Librar ies), a three-dimensional graphics processing library (e.g., openGL ES), a 2D graphics engine (e.g., SGL), etc.
The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
Although the Android system is taken as an example for explanation, the basic principle of the embodiment of the present application is equally applicable to electronic devices based on operating systems such as hong and Monte, iOS, windows, and the like.
The workflow of the electronic device software and hardware is illustrated below in connection with a system upgrade scenario.
In a system upgrade scene, the byte code compiling module cancels or delays the optimizing compiling operation required to be executed for at least part of non-optimizing applications in the system upgrade scene in advance. When touch sensor 380K receives a touch operation, it is reported to processor 310, causing the processor to launch the application in response to the touch operation and display the user interface of the application on display 394. If the application is started, a cold start message of the application is sent to a start message interface of the application management and control module, the application management and control module obtains a detection result of whether an optimization file of the application is outdated due to system upgrade from an Android run time of a system library through an optimization state interface, if the detection result is that the optimization file of the application is outdated due to system upgrade, an optimization compiling thread is created, compiling requirement parameters in the optimization compiling thread are set, compiling requirement parameters of the target application are obtained, and then a start compiling message carrying the compiling requirement parameters of the target application is sent to a byte code compiling module to trigger the byte code compiling module to execute optimization compiling operation on the target application. The target application is a cold-start non-optimized application detected by the application management and control module. After the byte code compiling module receives the starting compiling message, the compiling operation parameters of the target application are configured through the compiling requirement parameters of the target application carried in the starting compiling message, and the compiling operation parameters of the configured target application are obtained. And then the byte code compiling module uses the configured compiling operation parameters of the target application to call dex2oat, compiles the dex file of the target application into oat file, and completes the optimization of the target application. Because the byte code compiling module in the application cancels or delays the optimizing compiling operation required to be executed for at least part of the non-optimizing application in the system upgrading scene in advance, the optimizing compiling operation for the application is triggered only when the application management and control module detects that the optimizing file of the cold-started application is overtime caused by the system upgrading, the CPU load is reduced in a mode of canceling or delaying the optimizing compiling operation, the problem that the electronic equipment is stuck and scalded is solved, and meanwhile, the optimizing compiling operation for the application is preferentially triggered and executed under the condition that the optimizing file of the cold-started application is outdated due to the system upgrading, so that the application used by a user can be preferentially optimized in performance, and the better performance experience of the user when the application is used is ensured.
Embodiments of the present application will be described in detail below with reference to fig. 5 to 6. For convenience of description, the following will take an example in which the electronic device is a mobile phone.
Fig. 5 is a schematic flow chart of an application optimization method according to an embodiment of the present application. As shown in fig. 5, the application optimization method may include:
s501, the byte code compiling module cancels the optimizing compiling operation required to be executed for at least part of non-optimizing applications in the system upgrading scene in advance, or triggers the execution when the condition of the equipment in the idle state is met.
The non-optimized application is an application that needs to perform an optimized compiling operation in a system upgrade scenario (e.g., HOTA scenario, OTA scenario). With the upgrade of the system, many applications need to be correspondingly optimized (such as some function libraries related to the upgraded application) in order to adapt to the upgraded system, otherwise, the situation that the individual performance of the application cannot be applied to the upgraded system may occur, and the applications that need to be optimally compiled due to the upgrade of the system are collectively referred to as non-optimized applications in the embodiment of the present application.
In some embodiments, the optimized compiling operation required to be executed for at least part of the non-optimized applications in the system upgrade scenario where the bytecode compiling module is cancelled or delayed to be executed may be the optimized compiling operation required to be executed after the mobile phone is started for one minute. Because the CPU frequency of the mobile phone is limited by the burn-in process and usually occurs after the mobile phone is started for one minute, the optimized compiling operation which is originally required to be executed after the mobile phone is started for one minute can be directly deleted or is delayed until the condition that the mobile phone is in an idle state is met, and the optimized compiling operation which is required to be executed in the starting process of the mobile phone is normally triggered and executed, so that the mobile phone is ensured not to cause frequency limitation due to the burn-in process of the mobile phone. In other embodiments, all the optimizing and compiling operations needed to be executed in all the system upgrading scenes can be cancelled or delayed, and part of optimizing and compiling operations which affect the operation efficiency of the mobile phone most can be cancelled or delayed according to experience selection. The optimized compiling operation cancelled or delayed by the byte code compiling module can be selected according to specific situations. In the case that the bytecode compiling module selects to cancel or delay the optimizing compiling operation executed by at least part of the non-optimizing application in the system upgrading scene, the cancelled or delayed optimizing compiling operation can pass through the steps after the step S501, so that when the non-optimizing application is cold-started, the optimizing compiling operation of the non-optimizing application which executes the cold start is triggered, and the following description of the steps after the step S501 can be particularly referred to.
In some embodiments, in the system upgrade scenario, the optimized compiling operation that needs to be performed on the non-optimized application is written into the service scheduler in the bytecode compiling module, and in the step S501, by deleting the optimized compiling operation in the service scheduler that needs to be performed on at least a portion of the non-optimized application in the system upgrade scenario, the optimized compiling operation that needs to be performed on at least a portion of the non-optimized application in the system upgrade scenario may be canceled. And the condition in the equipment idle state is used as a trigger condition for executing the optimized compiling operation of at least part of the non-optimized application, and the trigger condition is written into the service scheduler, so that the delay of the optimized compiling operation required to be executed for at least part of the non-optimized application in the system upgrading scene can be realized, and the execution is triggered until the condition in the equipment idle state is met. For example, because the optimized compiling operation executed by the mobile phone after one minute of startup easily causes the mobile phone to get hot and stuck, the optimized compiling operation which is originally required to be triggered and executed by the service scheduler after one minute of startup can be selectively deleted, so that the optimized compiling operation which is originally required to be executed after one minute of startup is canceled. Or, a trigger condition is added to the service scheduler for the optimized compiling operation which needs to be executed after the service scheduler is started for one minute, and the trigger condition can be a condition in an equipment idle state, so that when the condition in the equipment idle state is met, the optimized compiling operation which needs to be executed after the service scheduler is started for one minute is triggered to be executed. It should be noted that, if there is a cold start of the application, and it is determined that the application is an un-optimized application through steps S502 to S517 shown in fig. 5, and the optimized compiling operation of the application is triggered and executed, then when the triggering condition in the idle state of the device is satisfied, the optimized compiling operation of the application is not triggered any more. I.e., the delayed optimization compilation operation of the non-optimized application is performed, if the execution is triggered by the manner of step S502 to step S517, then the optimization compilation operation is not performed any more when the trigger condition is satisfied. Similarly, if an optimizing compilation operation of a delayed application is performed when the triggering condition is met, when the application is cold started, the steps S502 to S505 shown in fig. 5 are triggered to be performed, and when the execution proceeds to step S505, the application management and control module determines that the application is not an un-optimized application (because the application has performed the optimizing compilation operation when the triggering condition is met), so that the process is ended, that is, the optimizing compilation operation of the application is not triggered to be performed any more.
In some embodiments, the condition that is satisfied in the device idle state is that the screen is off, the amount of power is greater than a preset power value, and in the charged state. For example, the method includes writing a state of charge meeting the condition that the mobile phone is turned off and the mobile phone electric quantity is greater than 95% into the service scheduler as a trigger condition of an optimized compiling operation to be executed after one minute of startup, so that the service scheduler receives a trigger signal when the mobile phone meets the condition that the mobile phone is turned off and the mobile phone electric quantity is greater than 95% and is in the state of charge, and triggers the execution of the optimized compiling operation to be executed after one minute of startup.
In some embodiments, the optimizing compiling operation refers to an operation of compiling an optimizing file of an application, for example, compiling a dex file of the application into an oat file by a dex2oat function.
In the prior art, in a system upgrading scene, in a starting-up process and after one minute of starting-up is completed, an optimized compiling operation is executed on a large number of non-optimized applications through a byte code compiling module, so that a mobile phone CPU (central processing unit) is overloaded, a phenomenon of clamping and scalding occurs in the mobile phone, and in the process, a user needs to use the mobile phone generally, so that the use experience of the user is influenced.
In the application, in order to solve the problems of mobile phone blocking and scalding, the byte code compiling module selects and does not trigger the execution of the optimized compiling operation which is needed to be executed on at least part of the un-optimized applications in the system upgrading scene, namely, the execution of the optimized compiling operation which is needed to be executed on at least part of the un-optimized applications in the system upgrading scene is canceled, or directly delays the execution of the optimized compiling operation which is needed to be executed on at least part of the un-optimized applications in the system upgrading scene in the original byte code compiling module until the execution is triggered when the condition in the idle state of equipment is satisfied. The method comprises the steps that an optimized compiling operation which is originally required to be executed on at least partial un-optimized application in a system upgrading scene is directly delayed to be executed in a byte code compiling module, and the optimized compiling operation is triggered to be executed until a condition in an idle state of equipment is met.
It should be noted that, in the embodiment of the present application, only a system upgrade scenario is taken as an example, and other mobile phone update scenarios, such as application installation, application update, etc., also need to execute an optimizing and compiling operation on a plurality of non-optimized applications, so that the non-optimized applications in the embodiment of the present application may also refer to applications that need to execute the optimizing and compiling operation in other update scenarios. While step S501 may not be performed at the time of application installation and application update scenario. In the system upgrade scenario, step S501 is not required to be repeatedly executed each time the embodiment shown in fig. 5 is executed, and step S501 is a pre-operation, and after being executed once in advance, the steps after step S502 and step S502 are triggered to be executed only when there is a cold start of the application, and step S501 is not required to be executed each time the optimizing compiling operation is executed.
In the embodiment of the present application, when the bytecode compiling module delays the optimizing compiling operation that needs to be executed on at least a part of the non-optimizing applications in the system upgrade scenario, the device may be selected to be in an idle state as a trigger condition, other conditions may be selected as trigger conditions after the delay, and one or more trigger conditions may be provided. In addition to the above-mentioned triggering condition triggering the execution of the delayed optimal compilation operation, the subsequent detection of a cold start of an un-optimized application mentioned after step S501 may also trigger the execution of the delayed optimal compilation operation, see in particular the following description of the steps after step S501.
S502, application cold start, and sending an application cold start message to an application management and control module.
Cold start refers to when an application is started, the background has no process of the application, and the system will recreate a new process assigned to the application, this starting mode is cold start. In some embodiments, the application cold start may be triggered by a user. The user triggers the cold start of the application by clicking the way the application is opened. In other embodiments, the application cold start may also be triggered automatically by the handset. For example, some user settings automatically launch some applications after power-on, and then the applications automatically trigger a cold start. Or when the user clicks one application, other applications are started in a correlated way, and the other applications automatically trigger cold start.
In the application cold start process, the application can judge whether the application has an effective optimization file, if the application does not have the effective optimization file, the dex file of the application is loaded, and if the application does not have the effective optimization file, the optimization file of the application is loaded. In the system upgrade scenario, if an application that needs to perform an optimal compiling operation in the system upgrade scenario is certain, because step S501 delays or cancels the optimal compiling operation of the application in advance, when the application is first cold-started in the system upgrade scenario, the application will determine that the application does not have an effective optimizing file at this time, and then loads the dex file. Meanwhile, the application is started for the first time, and steps S502 to S505 are triggered to be executed, and when the execution is executed to step S505, it is determined that the application is an unoptimized application. The application determines whether the application has a valid optimization file, and the order of the triggering steps 502 may be simultaneous, sequential, or unlimited.
The application cold start message carries an application identifier, which may be a packet name of the application, path information of the application in the mobile phone, and other unique information of the application, or the identifier may be path information of the application in the mobile phone. In some embodiments, the application's cold start message also carries a cold start identification.
In some embodiments, the application cold start message may be actively sent to the application management and control module after cold start, or may be a start state message of the application management and control module actively polled by the application, and then the application replies to the application management and control module with the application cold start message after cold start.
In some embodiments, the application management and control module may receive, through the added startup message interface, a startup status message sent by the application, and after receiving a cold startup message of the application, the application management and control module may detect that the application is cold started, and may further continue to execute the subsequent step S503. For example, after the application is cold started, the application transmits a cold start message to a newly added start message interface of the application module through an android binder communication mechanism.
In some embodiments, any start-up status message generated by the application, such as a cold start, a hot start, etc., may be sent to the application management and control module, but in embodiments of the present application, the application management and control module only performs subsequent processing when receiving the cold start message. In other embodiments, the application may only send to the application management and control module when a cold start message is generated, and the remaining start status messages are not sent to the application management and control module. In the embodiment of the application, if the application is an un-optimized application, when the application is cold started for the first time, the application is triggered to perform the optimized compiling operation, and when the application is cold started again, the application is not un-optimized any more, so that the application management and control module does not need to send a cold starting message, and the application management and control module decides whether to trigger the execution of the optimized compiling operation on the application. The first cold start refers to the cold start generated by the first application in the system upgrade scene.
S503, the application management and control module requests the run time to acquire the optimized file state information of the application.
After receiving the cold start message sent by the application, the application management and control module responds to the cold start message to request the run time for obtaining the optimized file state information of the application. The purpose of the application management and control module to request the run time to acquire the state information of the optimized file of the application is to know whether the optimized file of the application is invalid due to system upgrade. The optimized file state information of the application may indicate whether the optimized file of the application is invalid due to a system upgrade. The application management and control module needs to carry the application identifier in the request sent when executing step S503, which may specifically be the packet name of the application or the path information of the application.
When the application is started in a cold mode, the run time is run in the run time of the mobile phone, and therefore all information of the application is obtained by the run time, and the run time also comprises optimized file state information for explaining whether an optimized file of the application is invalid due to system upgrading. The optimization file invalidation specifically comprises the conditions that the optimization file is out of date, the optimization file does not exist, and the like.
In some embodiments, the application management and control module may call an optimized file state interface added with a run time, and transfer the application identification parameter to the optimized file state interface, so as to implement a method of asking the run time for whether the optimized file of the application is outdated due to system upgrade, and the run time may output the optimized file state information of the application carrying the query result from the optimized file state interface to the application management and control module, where the application management and control module may know whether the optimized file of the application is invalid due to system upgrade through the query result in the optimized file state information.
For example, the optimized file status interface on the run time may be defined as a function named "i sOatBoot ImageOutOfDate", and when the application management and control module requests to obtain the optimized file status information of the application from the run time, the application management and control module calls the function named "i sOatBoot ImageOutOfDate", and transmits the path information of the application to the function named "i sOatBoot ImageOutOfDate", where the transmitted path information may be a string type parameter.
In other embodiments, the mode of the application management and control module obtaining the optimized file state information of the application from the run time may be that by calling the optimized file state interface of the run time, the run time is requested to obtain all the optimized file state information of the application, and the optimized file state information returned by the run time to the application management module includes whether the optimized file of the application is invalid, and what causes the invalid if the optimized file of the application is invalid. The application management and control module can further determine whether the optimized file of the application is invalid due to system upgrade from the optimized file state information of the application.
S504, the run time sends the optimized file state information of the application to the application management and control module.
The optimized file status information of the application may indicate whether the optimized file of the application is invalid due to system upgrade.
In some embodiments, the optimized file state information of the application sent by the run time is output to the application management and control module through an optimized file state interface on the run time.
In some embodiments, the manner in which the run time outputs optimized file state information is: the application management and control module transmits path information of an application to an optimized file state interface added to the run time, then the run time finds an optimized file of the application according to the path information, compares the check code in the state information of the optimized file with the check code in the system information, if the comparison result is inconsistent, the optimized file is invalid, whether the optimized file is invalid due to a system upgrading scene or not needs to be checked through the state information of the optimized file, if the optimized file is invalid due to the system upgrading scene, it is determined that the current optimized file is not matched with the system due to the system upgrading (namely, the optimized file is invalid), and therefore the optimized file state information of the application output by the run time indicates that the optimized file of the application is invalid due to the system upgrading.
In some embodiments, the optimized file state information output by the run time may be a state bit. For example, a state of 1 indicates that the optimized file of the application is invalid due to a system upgrade, and a state of 0 indicates that the optimized file of the application is not invalid due to a system upgrade.
S505, the application management and control module judges whether the application is an unoptimized application according to the optimized file state information of the application.
And the application management and control module determines whether the application is an unoptimized application according to the optimized file state information of the application. If the state information of the optimized file of the application indicates that the optimized file of the application is invalid due to system upgrade, the optimized file of the application needs to be subjected to optimized compiling operation again, namely the application is an un-optimized application. If the optimized file state information of the application indicates that the optimized file of the application is not outdated due to system upgrade, the optimized file of the application is not invalid due to system upgrade, and the optimized file is not an un-optimized application in a system upgrade scene, so that optimized compiling operation is not needed.
If the application is not an optimized application, the application management and control module executes step S506, and if the application is not an optimized application, the flow is ended. When the application is an un-optimized application, since the application is currently cold-started, which means that the application has a high priority for the user to use, and belongs to an application that is frequently needed by the user, the optimization of the application needs to be completed preferentially compared with other un-optimized applications without cold start (other un-optimized applications without cold start are likely to be applications that the user will not use at all), that is, the execution of the optimizing and compiling operation on the application needs to be triggered, and thus step S506 needs to be executed. If the application is not an un-optimized application, the application does not need to be optimized in the system upgrading scene, or the optimization is already completed, so that the process can be directly ended.
It should be noted that, the final purpose of executing the processes from step S502 to step S505 is to detect whether there is a cold start of an un-optimized application, and specifically detect whether there is a cold start of an un-optimized application, which may be the case in step S502 to step S504, where the application management and control module determines whether the cold start application is an un-optimized application, and in other embodiments, may record all the identifiers of the applications (i.e., un-optimized applications) that need to perform an optimized compiling operation in a system upgrade scenario (i.e., determine which un-optimized applications are first) in advance, then match the application identifier with the pre-recorded un-optimized application identifier when the application is cold started, and if so, determine that the cold start application is an un-optimized application. There are many ways in which the application management and control module detects whether there is an un-optimized application cold start, including but not limited to the ways set forth in the embodiments of the present application.
It should be further noted that, in the embodiment of the present application, only the system upgrade scenario is taken as an example, and other mobile phone update scenarios, such as application installation, application update, etc., are similar to the principle and process of executing steps S502 to S505. Specifically, if the optimized file state information in other updated scenes is also required to be obtained, other application file state interfaces can be added to the application management and control module to receive the optimized file state information of the application in other updated scenes, so that whether the application is invalid in the optimized file due to the other updated scenes or not can be determined through the optimized file state information, and further whether the application is an un-optimized application in the other updated scenes or not can be determined.
S506, the application management and control module creates an optimized compiling thread.
The optimizing compiling thread is mainly used for triggering and executing the current cold start judged by the application management and control module and is an application of the non-optimized application. For convenience of description, the application management and control module refers to the non-optimized application of the cold start determined by the steps as the target application.
After the application management and control module creates the optimized compiling thread, the whole process of triggering and executing the optimized compiling operation corresponding to the target application is executed in the created optimized compiling thread, so that other tasks of the mobile phone main thread are not affected.
S507, setting the compiling requirement parameters in the optimizing compiling thread by the application management and control module to obtain the compiling requirement parameters of the target application.
The compiling requirement parameters of the target application comprise: target application identification, and parameters that the target application adapts during the optimization compilation process. The parameters adapted by the target application in the optimizing and compiling process refer to the requirements of the target application in the optimizing and compiling operation process corresponding to the target application. For example, the parameters that the target application adapts during the optimization compilation process may include at least one parameter of a number of processor cores required to perform an optimization compilation operation corresponding to the target application, a number of threads required to perform the optimization compilation operation, a required compilation level (e.g., speed level, verify-opt level, etc.), and a required termination preset duration. The termination preset time length is the maximum time length of the optimized compiling operation corresponding to the execution target application. For example, when the preset time length is 55 seconds, the execution of the optimized compiling operation corresponding to the target application is stopped if the execution time length exceeds 55 seconds.
Parameters adapted in the optimizing and compiling process of different applications may be different, for example, the estimated time of optimizing and compiling operations required to be executed by some applications is longer, more threads are needed, more processor cores are needed to process the operations more appropriately, the optimizing and compiling operations executed by some applications are simpler, the estimated time is shorter, and only a single thread is needed to execute the operations. The parameters adapted by the target application in the optimizing and compiling process may be the parameters optimally adapted by the target application in the optimizing and compiling process, or may be parameters of an adapting range of the target application in the optimizing and compiling process, for example, the number of processor cores required for executing the optimizing and compiling operation corresponding to the target application is 2 cores to 3 cores, the number of threads is 2 threads to 3 threads, and the like.
In some embodiments, the application management and control module checks the compiling requirement information of the target application in the optimizing and compiling process by calling a file library corresponding to the target application, and then sets the compiling requirement parameters in the optimizing and compiling thread by the compiling requirement information to obtain the compiling requirement parameters of the target application.
In some embodiments, the compiling requirement parameters of the target application may further include: system upgrade scenario parameters, which are used to illustrate that there is currently an application (i.e., an un-optimized application) cold start with an out-of-date optimized file due to system upgrade.
S508, the application management and control module sends a starting compiling message to the byte code compiling module.
The compiling requirement parameters of the target application obtained in step S507 are carried in the starting compiling message. The starting compiling information sent by the application management and control module is used for triggering the byte code compiling module to execute the optimizing compiling operation on the target application.
S509, the byte code compiling module adds compiling requirement parameters of the target application into the unoptimized management and control queue.
The byte code compiling module responds to the starting compiling message and adds compiling requirement parameters of the target application into the unoptimized management and control queue. The compiling requirement parameters in the non-optimized control queue are arranged according to the time sequence of detecting the cold start of the non-optimized application, namely when a plurality of target applications exist, the non-optimized control queue is arranged according to the time sequence of the cold start of the target application. The order of the optimized compiling operation can be executed without optimizing the order of the control queue, namely, the earlier the target application is at the cold start time, the more preferentially the optimized compiling operation of the target application is executed.
In some embodiments, the bytecode compiling module packages the compiling requirement parameters of the target application, marks the packaged parameters with the target application identifier, and then adds the parameters to the unoptimized management and control queue. In other embodiments, the compiling requirement parameters of the target application may not be packaged, and may be directly added to the non-optimized management and control queue.
In some embodiments, if the target application is a cold-started non-optimized application detected by the application management module, before executing step S509, there may be no non-optimized management queue in the bytecode compiling module, so that it is also necessary to create a non-optimized management queue first, and then add the compiling requirement parameters of the target application to the non-optimized management queue. When the byte code compiling module receives the compiling requirement parameters of other target applications, the unoptimized managing and controlling queue is not required to be created, and the compiling requirement parameters of other target applications are only required to be added into the unoptimized managing and controlling queue according to the cold starting time sequence.
S510, detecting whether the device is busy currently by the byte code compiling module.
The device busy state refers to a state in which the device busy degree exceeds a preset standard. And the preset standard may be empirically set. For example, the mobile phone is not in the off-screen state, or the electric quantity of the mobile phone is less than 50% of the electric quantity of the mobile phone is set as a preset standard, when the mobile phone is not in the off-screen state, or the electric quantity of the mobile phone is less than 50%, the mobile phone is considered to be in the equipment busy state, and when the electric quantity of the mobile phone is greater than or equal to 50%, the mobile phone is considered to be not in the equipment busy state. It should be noted that the mobile phone is not in the busy state of the device, and is not necessarily identical to the mobile phone in the idle state of the device. The criteria for judging the idle state of the device may not be consistent with the criteria for judging the busy state of the device.
In some embodiments, all the current system status information of the mobile phone may be read by the application management and control module, so when executing step S501, the bytecode compiling module may read the current system status information by the application management and control module to determine whether the device is currently in a busy state.
If the device is currently busy, step S511 is executed, and if the device is not currently busy, step S512 is executed.
It should be noted that, in some embodiments, it is also possible to directly enter step S512 after step S509 is performed without detecting whether the device is currently busy.
S511, the byte code compiling module delays running the unoptimized management and control queue, and returns to execute the step S510 after delaying for a first preset time period.
When the device is in the busy state, if the execution of various optimized compiling operations is continuously triggered, the mobile phone may be blocked to send out sugar, so that the operation of the un-optimized managing and controlling queue needs to be delayed, and whether the device is in the busy state is detected again after the first preset time period is delayed, namely, the operation of the un-optimized managing and controlling queue is guaranteed only when the device is not in the busy state. In some embodiments, the first preset time period may be empirically set.
Running the unoptimized management and control queue refers to executing the following step S512 on the application by application in accordance with the arrangement order of the compiling requirement parameters of each application. Specifically, in step S512, a specific operation process will be described by taking a target application as an example.
S512, when the byte code compiling module does not optimize the compiling requirement parameters of the control queue to the target application currently, acquiring the equipment state parameters.
The device status parameter may reflect the current busyness of the device. The device status parameters may include one or more information that indicates which processor cores are currently the most busy, which processor cores are idle, which threads are currently taskless, which threads are currently taskmore, whether the threads are currently in an off-screen state, and the like.
In some embodiments, the bytecode compilation module receives device state parameters broadcast by the system through a broadcast receiver created by itself.
S513, the byte code compiling module configures compiling operation parameters of the target application through compiling requirement parameters and equipment state parameters of the target application to obtain the configured compiling operation parameters of the target application.
The compiling operation parameters of the target application are used for explaining the operation mode when the optimizing compiling operation corresponding to the target application is executed. That is, when the optimized compiling operation is executed on the target application, the optimized compiling operation is executed according to the operation mode described by the compiling operation parameters of the configured target application.
The compiling operation parameters of the target application after configuration are the compiling operation parameters of the current optimal target application determined according to the compiling requirement parameters and the equipment state parameters of the target application, namely the compiling operation parameters of the target application after configuration are the compiling operation parameters of the current optimal target application determined by the requirement of the target application and the current state of the mobile phone, so that adverse effects on the mobile phone when the optimal compiling operation is executed on the target application can be minimized.
In some embodiments, the compiled operating parameters of the configured target application may include: at least one parameter of a processor core used when executing the optimized compiling operation corresponding to the target application, the thread number when executing the optimized compiling operation, the compiling level and the termination preset time length. For example, the process of executing step S513 may be that the compiling requirement parameter of the target application obtained by the bytecode compiling module indicates that the compiling level of the target application is a ver-opt level (for indicating whether a part or all of functions of the target application need to be verified are legal), the number of processor cores required for executing the optimized compiling operation corresponding to the target application is 2 cores, the number of threads is 2, the preset termination time is 55 seconds, the device state parameter indicates that the current first processor core is busy, and the second processor core and the third processor core are idle, so that when the compiling operation parameter of the target application is configured, the processor cores used for executing the optimized compiling operation corresponding to the target application are the second processor core and the third processor core, the number of threads for executing the optimized compiling operation is 2, the compiling level is Speed, and the preset termination time is 55 seconds.
It should be noted that, the compiling operation parameters of the target application are configured by the bytecode compiling module through the compiling requirement parameters and the device state parameters of the target application, so that the compiling operation parameters of the configured target application are obtained, and only one of the modes of obtaining the compiling operation parameters of the configured target application is obtained.
S514, the byte code compiling module uses the compiling operation parameters of the configured target application to call the dex2oat function in the run time.
Specifically, the byte code compiling module transmits the compiling operation parameters of the configured target application to the called dex2oat, so that the run time can be executed according to the operation mode described by the compiling operation parameters of the configured target application when the dex2oat is executed.
The byte code compiling module also needs to use the target application identifier to call the dex2oat function when the dex2oat in the run time is called, so that the run time can clearly execute the optimized compiling operation on which application when the dex2oat is executed. In some embodiments, when the dex2oat function in the run time is called, the compiling operation parameters of the configured target application are not necessarily required, for example, if all operation modes are standardized, or if the compiling operation parameters of all applications are preconfigured and stored in the run time, the byte code compiling module does not need to use the compiling operation parameters of the configured target application when the dex2oat is called, and only the target application identifier is required to be transmitted to the dex2oat function.
In some embodiments, after the bytecode compiling module compiles the configured compiling operation parameters of the target application obtained in step S513, the configured compiling operation parameters of the target application and the target application identifier are first compiled, and an instal led module in the bytecode compiling module is called to parse the configured compiling operation parameters and the target application identifier so as to parse the configured compiling operation parameters and the target application identifier into a format capable of running in a run time. For example, the manner in which the instal led module is called for resolution may be: and calling functions such as RunDex2Oat in the instal led module to analyze the compiling operation parameters and the target application identification of the configured target application. And then, calling a dex2oat function in the run time by using the analyzed compiling operation parameters of the configured target application and the target application identifier, namely transmitting the compiling operation parameters of the compiled configured target application to the dex2oat function, and triggering the run time to execute the dex2oat on the target application.
It should be noted that, triggering the execution of the optimized compiling operation corresponding to the target application by calling the dex2oat function in the run time is only one embodiment, and may also be performed by other methods.
It should be noted that, steps S506 to S514 are merely one implementation manner of triggering and executing the optimized compiling operation corresponding to the target application, and in some embodiments, after step S505 determines that the application is not an optimized application, the package name of the target application may be directly used to trigger and execute the optimized compiling operation corresponding to the target application, without performing configuration of the compiling operation parameters of the target application through the operations of steps S506 to S514, and then triggering and executing the optimized compiling operation corresponding to the target application by using the configured compiling operation parameters of the target application. I.e. configuring compiled operating parameters of the target application is only an optional operation and not a necessary operation. While the process of implementing the compiling operation parameters of the configuration target application in the steps S506 to S514 by means of not optimizing the control queue is also optional, there are other ways to implement the compiling operation parameters of the configuration target application, and not necessarily by means of not optimizing the control queue.
S515, runt time compiles the dex format file corresponding to the target application into an oat format file.
After the run time is called the dex2oat function, compiling the dex format file corresponding to the target application into the oat format file according to the operation mode described by the compiling operation parameters of the configured target application, implementing the optimizing compiling operation on the target application, if no error occurs in the executing process, finally generating a new optimizing file of the target application, storing the generated new optimizing file of the target application into the installation path of the target application, updating or replacing the optimizing file originally under the installation path of the target application, completing the updating of the optimizing file of the target application, and finally obtaining the optimizing file of the target application through the operation of step S515 is not invalid due to the system upgrading scene.
In the subsequent cold start process of the target application, the target application firstly judges whether the optimized file of the target application is effective when judging whether the optimized file of the target application is effective, then loads the optimized file of the target application (i.e. the file in the oat format of the target application), at this time, the starting speed, the running performance, the executing speed and other performances of the target application are optimized, i.e. when a user uses the target application, the performance of the target application is the optimized performance. In the embodiment of the present application, when the application is cold started, the steps S502 to S505 are triggered and executed, and the step S505 is executed again, that is, when whether the target application is an un-optimized application is judged again, a judgment result that the target application is not an un-optimized application is obtained, and then the flow shown in fig. 5 is ended. And (3) the target application after cold start again can adapt to the updated system because the optimization file is updated, and the optimization compiling operation is not needed. In some embodiments, if the application management and control module records when the run time successfully completes the optimization compiling operation, that is, successfully updates the optimization file of the target application, then it may be determined that step S505 is not performed any more by looking at the record when the cold start message of the target application is received next time.
S516, the run time sends an execution result of the optimized compiling operation corresponding to the target application to the application management and control module.
The execution result of the optimization compiling operation corresponding to the target application is used for explaining whether the optimization compiling operation corresponding to the target application is successfully generated, namely whether the optimization file corresponding to the target application is successfully generated.
The run time may cause execution failure of the optimized compiling operation due to excessively long execution time, execution error, etc. in the process of executing step S515, for example, if the preset termination time period in the configured compiling operation parameters of the target application is 55 seconds, and the time period spent by the run time in executing step S515 exceeds 55 seconds, the run time is terminated to continue executing step S515 according to the instruction of terminating the preset time period in the configured compiling operation parameters of the target application, so as to avoid that excessive time is consumed in executing the optimized compiling operation corresponding to the target application, affecting other tasks, and at this time, the optimized compiling operation corresponding to the target application fails due to exceeding the preset termination time period. Therefore, in some embodiments, the execution result of the optimal compiling operation corresponding to the target application is used for explaining whether to successfully generate the optimal compiling operation corresponding to the target application, and also explaining the reason why the optimal compiling operation fails when the optimal compiling operation corresponding to the target application is not successfully generated, and when maintenance is performed subsequently, the corresponding maintenance can be performed by looking up the reason why the optimal compiling operation fails.
S517, the application management and control module ends the optimizing compiling thread.
The application management and control module may consider that the optimization compiling operation corresponding to the target application has ended when receiving the execution result of the optimization compiling operation corresponding to the target application, so that the optimization compiling thread may be ended.
In some embodiments, the whole execution process of the application management and control module optimizing and compiling thread can be recorded in an optimizing and compiling log, and whether a bug exists in the optimizing and compiling process or not can be checked through the optimizing and compiling log later so as to repair and maintain.
It should be noted that, step S516 and step S517 are also unnecessary operations in the embodiments of the present application, in other embodiments, the run time may not send the execution result of the optimized compiling operation corresponding to the target application to the application management and control module, and the application management and control module may also automatically end the optimized compiling thread after sending the start compiling message to the byte code compiling module, or automatically end the optimized compiling thread after creating the second preset time period after the optimized compiling thread.
It should be further noted that, in the system upgrade scenario shown in the embodiment of the present application, the non-optimized application cold start is taken as a trigger condition, and in some other embodiments, the trigger condition that triggers the execution of the optimized compiling operation of the application may be not just the non-optimized application cold start. For example, in other update scenarios such as application installation and application update, the application management and control module may be used as a trigger condition for triggering the execution of the optimized compiling operation on the installed application when the application management and control module detects the application installation and the application update.
As can be seen from the embodiment shown in fig. 5, the optimized compiling operation that needs to be performed on at least a part of the non-optimized applications in the system update scenario that is cancelled or delayed in step S501 is that when the application management module detects that the non-optimized application is cold-started, the optimized compiling operation of the execution target application (i.e., the detected cold-started non-optimized application) is triggered again. The un-optimized application which is started by cold can be described as the application which is frequently required to be used by the user, so that the un-optimized application is started by cold as a triggering condition of the optimized compiling operation, the optimized compiling operation which is required to be executed on at least part of the un-optimized application under the cancelled or delayed system updating scene can be solved, and the performance experience of the user when the application is used is considered.
Fig. 6 is a second flowchart of an application optimization method according to an embodiment of the present application. As shown in fig. 6, the application optimization method may include:
s601, a byte code compiling module cancels the optimized compiling operation required to be executed for at least part of non-optimized applications in a system upgrading scene in advance, or triggers the execution when the condition of the equipment in an idle state is met.
The principle and execution of step S601 are the same as those of step S501, and will not be described here.
S602, application cold start, and sending an application cold start message to an application management and control module.
The principle and execution of step S602 are the same as those of step S502, and will not be described here.
S603, the application management and control module requests the run time to acquire the optimized file state information of the application.
The principle and execution of step S603 are the same as those of step S503, and will not be described here.
S604, the run time sends the optimized file state information of the application to the application management and control module.
The principle and execution of step S604 are the same as those of step S504, and will not be described here.
S605, the application management and control module judges whether the application is an unoptimized application according to the optimized file state information of the application.
The principle and execution of step S605 are the same as those of step S505, and will not be described here.
S606, the application management and control module creates an optimized compiling thread.
The principle and execution of step S606 are the same as those of step S506, and will not be described here.
S607, the application management and control module sets the compiling requirement parameters in the optimizing compiling thread to obtain the compiling requirement parameters of the target application.
The principle and execution of step S607 are the same as those of step S507, and will not be described here.
S608, the application management and control module sends a starting compiling message to the byte code compiling module.
The principle and execution of step S608 are the same as those of step S508, and will not be described here.
S609, the byte code compiling module transmits compiling requirement parameters of the target application into the service scheduler.
In some embodiments, after receiving the startup compiling message, the service scheduler is created specifically for the target application, that is, only the compiling requirement parameters of the target application are transmitted into the service scheduler, if the startup compiling message of other applications is sent to the byte code compiling module, the byte code compiling module re-creates a service scheduler for the other applications, and then transmits the compiling requirement parameters of the other applications.
In other embodiments, the service scheduler is only created when the startup compilation message is first received, and is no longer created when the startup compilation message is subsequently received. Therefore, the compiling requirement parameters which are input into the service scheduler may not belong to the target application only, and if the starting compiling information of other applications is received, the compiling requirement parameters of other applications are input into the service scheduler.
And S610, triggering the compiling requirement parameters of the target application through the service dispatcher when the condition that the device is not in a busy state is met, and configuring the compiling operation parameters of the target application to obtain the configured compiling operation parameters of the target application.
In some embodiments, the byte code compiling module uses the device busy state not as the triggering condition of the service scheduler mentioned in step S609, so that the service scheduler triggers the compiling requirement parameter of the target application to configure the compiling operation parameter of the target application only when the device busy state not being satisfied, and obtains the configured compiling operation parameter of the target application.
In some embodiments, if the bytecode compiling module creates service schedulers for different applications, when the trigger conditions set by all service schedulers are consistent, step S610 is performed according to the order of creating the service schedulers. If the bytecode compiling module is to transmit the compiling requirement parameters of the plurality of applications to the same service scheduler, step S610 is executed according to the sequence of the transmitted parameters (i.e. the sequence in which the bytecode compiling module receives the startup compiling message).
The busy state of the device in step S610 is consistent with that in fig. 5, and the compiling operation parameters of the target application are configured according to the compiling requirement parameters of the target application, so that the principle and the executing process of the compiling operation parameters of the configured target application are also consistent with those in fig. 5, and are not repeated herein.
S611, the byte code compiling module uses the compiling operation parameters of the configured target application to call the dex2oat function in the run time.
In some embodiments, step S611 may be implemented by the above-mentioned service scheduler, i.e. the program related to step S611 is written into the above-mentioned service scheduler to run.
The execution and principle of step S611 are the same as those of step S514, and will not be described here.
S612, runt time compiles the dex format file corresponding to the target application into an oat format file.
The execution and principle of step S612 are the same as those of step S515, and will not be described here.
S613, the run time sends the execution result of the optimized compiling operation corresponding to the target application to the application management and control module.
The execution and principle of step S613 are the same as those of step S516, and will not be described here.
S614, the application management and control module ends the optimizing compiling thread.
The execution and principle of step S614 are the same as those of step S517, and will not be described here.
Some embodiments of the present application also provide an electronic device, as shown in fig. 7, which may include: a touch screen 701, wherein the touch screen 701 may include a touch sensitive surface 706 and a display screen 707; one or more processors 702; a memory 703; and one or more computer programs 704, the devices described above may be connected by one or more communication buses 705. Wherein the one or more computer programs 704 are stored in the memory 703 and configured to be executed by the one or more processors 702, the one or more computer programs 704 include instructions that can be used to perform the various steps performed by the cell phone in the corresponding embodiments of fig. 5 and 6. Of course, the electronic device shown in fig. 7 may further include other devices, such as a sensor module, an audio module, and a SIM card interface, which is not limited in any way by the embodiments of the present application. When the electronic device shown in fig. 7 further includes other devices such as a sensor module, an audio module, and a SIM card interface, it may be the electronic device shown in fig. 3.
The embodiment of the application may divide the functional modules of the electronic device according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Fig. 8 shows a schematic diagram of a possible composition of an application optimization device that can execute the steps executed by the electronic device in any of the method embodiments of the present application, in the case of dividing the respective functional modules with the respective functions. As shown in fig. 8, the application optimizing apparatus is an electronic device or a communication apparatus supporting the electronic device to implement the method provided in the embodiment, and for example, the communication apparatus may be a chip system. The application optimizing apparatus may include: processing section 801, display section 802, transmitting/receiving section 803, and storage section 804.
The processing unit 801 is configured to support the application optimization device to execute the method described in the embodiment of the present application. For example, the processing unit 801 is configured to execute or support the application optimizing apparatus to execute the application optimizing method shown in fig. 5, and the application optimizing method shown in fig. 6.
It should be noted that, all relevant contents of each step related to the above method embodiment may be cited to the functional description of the corresponding functional module, which is not described herein.
The application optimizing device provided by the embodiment of the application is used for executing the method of any embodiment, so that the same effect as that of the method of the embodiment can be achieved.
The present embodiment also provides a computer readable storage medium comprising instructions which, when executed on an electronic device, cause the electronic device to perform the relevant method steps of fig. 5 and 6 to implement the method of the above embodiment.
The present embodiment also provides a computer program product comprising instructions which, when run on an electronic device, cause the electronic device to perform the relevant method steps as in fig. 5 and 6 to implement the method of the above embodiments.
The present embodiment also provides a control device comprising a processor and a memory for storing computer program code comprising computer instructions which, when executed by the processor, perform the relevant method steps as in fig. 5 and 6 to implement the method in the above embodiments. The control device may be an integrated circuit IC or a system on chip SOC. The integrated circuit can be a general-purpose integrated circuit, a field programmable gate array FPGA, or an application specific integrated circuit ASI C.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of functional modules is illustrated, and in practical application, the above-described functional allocation may be implemented by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above. The specific working processes of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which are not described herein.
In the several embodiments provided in this embodiment, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present embodiment may be integrated in one processing unit, each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present embodiment may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in the respective embodiments. And the aforementioned storage medium includes: flash memory, removable hard disk, read-only memory, random access memory, magnetic or optical disk, and the like.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (18)

1. An application optimization method, comprising:
canceling or delaying an optimized compiling operation required to be executed for at least part of non-optimized applications under an updated scene; the non-optimized application is an application needing to perform optimized compiling operation under an updated scene;
detecting whether an unoptimized application cold start exists;
if the existence of the non-optimized application cold start is detected, an optimized compiling thread is created;
setting the compiling requirement parameters in the optimizing compiling thread to obtain the compiling requirement parameters of the target application; the compiling requirement parameters of the target application comprise: the target application identification and parameters adapted by the target application in the optimizing and compiling process;
adding the compiling requirement parameters of the target application into an unoptimized management and control queue; compiling demand parameters in the non-optimized management and control queue are arranged according to the time sequence of detecting the non-optimized application cold start;
Detecting whether the device is currently in a busy state;
if the current busy state of the equipment is detected, delaying running the unoptimized management and control queue, and after delaying for a first preset time length, returning to execute the step of detecting whether the current busy state of the equipment is detected;
if the fact that the current equipment is not in a busy state and the current unoptimized management and control queue runs to the compiling requirement parameter of the target application is detected, configuring the compiling operation parameter of the target application based on the compiling requirement parameter of the target application to obtain the configured compiling operation parameter of the target application; the compiling operation parameters of the target application are used for representing an operation mode when the optimizing compiling operation corresponding to the target application is executed;
and triggering and executing the optimized compiling operation corresponding to the target application by using the compiling operation parameters of the configured target application.
2. The application optimization method of claim 1 wherein said detecting whether there is an un-optimized application cold start comprises:
if the application cold start is detected, judging whether the application is an unoptimized application or not;
if the application is judged to be the non-optimized application, determining that the non-optimized application is cold started;
And if the application is judged not to be the non-optimized application, determining that the non-optimized application cold start exists.
3. The application optimization method of claim 2, wherein the determining whether the application is an un-optimized application if a cold start of the application is detected comprises:
if the application cold start is detected, determining whether an optimized file corresponding to the cold start application is invalid due to updating a scene;
if the optimized file corresponding to the cold-started application is invalid due to scene updating, determining that the cold-started application is an un-optimized application;
and if the optimized file corresponding to the cold-started application is not invalid due to the updated scene, determining that the cold-started application is not an un-optimized application.
4. The application optimization method of claim 1, wherein compiling the operating parameters of the configured target application comprises: at least one parameter of a processor core used when executing the optimized compiling operation corresponding to the target application, the number of threads, the compiling level and the termination preset duration when executing the optimized compiling operation; and the termination preset time is the maximum time for executing the optimized compiling operation corresponding to the target application.
5. The application optimization method according to claim 1, wherein the configuring the compiling operation parameters of the target application based on the compiling requirement parameters of the target application, before obtaining the configured compiling operation parameters of the target application, further comprises:
acquiring equipment state parameters;
the configuring the compiling operation parameters of the target application based on the compiling requirement parameters of the target application to obtain the compiling operation parameters of the configured target application includes:
and configuring the compiling operation parameters of the target application based on the compiling requirement parameters of the target application and the equipment state parameters to obtain the configured compiling operation parameters of the target application.
6. The application optimization method according to claim 1, wherein after triggering execution of the optimized compiling operation corresponding to the target application using the configured compiling operation parameter of the target application, the method further comprises:
and receiving an execution result of the optimizing compiling operation corresponding to the target application, and ending the optimizing compiling thread.
7. The application optimization method according to any one of claims 1 to 3, wherein the triggering execution of the optimization compiling operation corresponding to the target application includes:
Triggering and executing the optimized compiling operation corresponding to the target application by calling dex2 oat.
8. The application optimization method as set forth in claim 7, wherein said performing an optimized compilation operation corresponding to the target application by invoking dex2oat includes:
and compiling the dex format file corresponding to the target application into an oat format file by calling dex2 oat.
9. An application optimization method according to any one of claims 1 to 3, wherein after canceling or delaying the optimized compiling operation to be performed on at least a part of the non-optimized application in the updated scenario, the method further comprises:
when the service scheduler meets the condition of being in the idle state of the equipment, the execution delay optimizing compiling operation is triggered.
10. The application optimization method of claim 9, wherein the condition that the device is in an idle state is off-screen, an electric quantity is greater than a preset electric quantity value, and the device is in a charging state.
11. An application optimization method, characterized by being applied to an electronic device, the electronic device being provided with an application, the electronic device comprising: the method comprises the following steps of applying a management and control module, a byte code compiling module and a run time:
The byte code compiling module cancels or delays the optimizing compiling operation required to be executed for at least part of non-optimizing applications under the updating scene; the non-optimized application is an application needing to perform optimized compiling operation under an updated scene;
the application management and control module receives a cold start message sent by the application, wherein the cold start message carries an application identifier and a cold start identifier;
in response to the cold start message, the application management and control module determines whether the application is an un-optimized application;
if it is determined that the application is an un-optimized application,
the application management and control module creates an optimized compiling thread;
the application management and control module sets the compiling requirement parameters in the optimizing compiling thread to obtain the compiling requirement parameters of the target application; the compiling requirement parameters of the target application comprise: the target application identification and parameters adapted by the target application in the optimizing and compiling process;
the application management and control module sends a start compiling message to the byte code compiling module; the compiling starting message carries compiling requirement parameters of the target application;
the byte code compiling module adds compiling requirement parameters of the target application into an unoptimized management and control queue; compiling demand parameters in the non-optimized management and control queue are arranged according to the time sequence of detecting the non-optimized application cold start;
The byte code compiling module detects whether the device is in a busy state currently;
if the current busy state of the equipment is detected, the byte code compiling module delays running the unoptimized management and control queue, and after delaying for a first preset time length, returns to execute the step of detecting whether the current busy state of the equipment is detected;
responding to the starting compiling message, if the byte code compiling module detects that the device is not in a busy state currently and the unoptimized management and control queue runs to the compiling requirement parameter of the target application currently, configuring the compiling operation parameter of the target application based on the compiling requirement parameter of the target application to obtain the configured compiling operation parameter of the target application; the compiling operation parameters of the target application are used for representing an operation mode when the optimizing compiling operation corresponding to the target application is executed;
and the byte code compiling module triggers the run time to execute the optimized compiling operation of the application by using the compiling operation parameters of the configured target application.
12. The method of claim 11, wherein the application management module determining whether the application is an un-optimized application comprises:
The application management and control module requests the byte code compiling module to acquire the optimized file state information of the application; the request carries the application identifier;
the run time sends the optimized file state information of the application to the application management and control module; the optimized file state information of the application is used for indicating whether the optimized file of the application is invalid due to system upgrade;
if the optimized file state information of the application indicates that the optimized file of the application is invalid due to system upgrading, the application management and control module determines that the application is not an optimized application;
if the optimized file state information of the application indicates that the optimized file of the application is not invalid due to system upgrade, the application management and control module determines that the application is not an un-optimized application.
13. The method of claim 11, wherein compiling operational parameters of the configured target application comprises: at least one parameter of a processor core used when executing the optimized compiling operation corresponding to the target application, the number of threads, the compiling level and the termination preset duration when executing the optimized compiling operation; and the termination preset time is the maximum time for executing the optimized compiling operation corresponding to the target application.
14. The method of claim 11, wherein the byte code compilation module configures the compilation operation parameters of the target application based on the compilation requirement parameters of the target application, and further comprising, prior to obtaining the configured compilation operation parameters of the target application:
the byte code compiling module acquires equipment state parameters;
the byte code compiling module configures compiling operation parameters of the target application based on compiling requirement parameters of the target application to obtain the configured compiling operation parameters of the target application, and the method comprises the following steps:
and the byte code compiling module configures compiling operation parameters of the target application based on the compiling requirement parameters and the equipment state parameters of the target application to obtain the configured compiling operation parameters of the target application.
15. The method of claim 11, wherein the byte code compilation module, using the configured compilation operation parameters of the target application, after triggering the run time to perform an optimized compilation operation of the application, further comprises:
the run time sends an execution result of the optimized compiling operation corresponding to the target application to the application management and control module;
And responding to an execution result of the optimized compiling operation corresponding to the target application, and ending the optimized compiling thread.
16. The method of claim 11 or 12, wherein after the bytecode compilation module delays an optimized compilation operation that needs to be performed on at least a portion of an un-optimized application in an update scenario, further comprising:
the byte code compiling module triggers the execution delay optimizing compiling operation when the condition in the idle state of the equipment is met through the service scheduler.
17. An electronic device, comprising: one or more processors, memory, display screen, wireless communication module, and mobile communication module;
the memory, the display screen, the wireless communication module, and the mobile communication module are coupled with the one or more processors, the memory for storing computer program code comprising computer instructions that, when executed by the one or more processors, the electronic device performs the application optimization method of any of claims 1-10, or the application optimization method of any of claims 11-16.
18. An application optimizing apparatus, characterized in that the application optimizing apparatus comprises: the device comprises a processing unit, a storage unit, a display unit and a transceiver unit, wherein the storage unit is used for storing one or more programs; the processing unit is configured to execute the one or more programs; the one or more programs include instructions for performing the application optimization method of any one of claims 1 to 10, or the application optimization method of any one of claims 11 to 16.
CN202210667655.9A 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment Active CN115185652B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210667655.9A CN115185652B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110661937.3A CN113485709B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment
CN202210667655.9A CN115185652B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202110661937.3A Division CN113485709B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN115185652A CN115185652A (en) 2022-10-14
CN115185652B true CN115185652B (en) 2023-07-21

Family

ID=77934820

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202210667655.9A Active CN115185652B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment
CN202110661937.3A Active CN113485709B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202110661937.3A Active CN113485709B (en) 2021-06-15 2021-06-15 Application optimization method and device and electronic equipment

Country Status (1)

Country Link
CN (2) CN115185652B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117152320A (en) * 2023-02-15 2023-12-01 荣耀终端有限公司 Image processing method and electronic device

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9189252B2 (en) * 2011-12-30 2015-11-17 Microsoft Technology Licensing, Llc Context-based device action prediction
CN102567062B (en) * 2011-12-31 2015-02-25 成都主导软件技术有限公司 System for upgrading software based on monitoring vehicle
US9603049B2 (en) * 2013-07-22 2017-03-21 Seven Networks, Llc Extending delay tolerance of mobile applications for optimizing mobile traffic management
CN107820605B (en) * 2017-03-27 2021-06-01 香港应用科技研究院有限公司 System and method for dynamic low-latency optimization
JP6881028B2 (en) * 2017-05-24 2021-06-02 株式会社リコー Image forming device, system and control method
CN107015816A (en) * 2017-05-25 2017-08-04 微鲸科技有限公司 Operating system update method, device and a kind of intelligent terminal
CN108037934B (en) * 2017-11-13 2021-02-09 维沃移动通信有限公司 Method and device for updating application program
CN108536488B (en) * 2018-04-17 2021-12-07 Oppo广东移动通信有限公司 Application starting optimization method and device, storage medium and terminal equipment
CN111475220B (en) * 2019-01-23 2023-04-25 阿里巴巴集团控股有限公司 Cold start method and device, electronic equipment and computer storage medium
CN110750284B (en) * 2019-10-15 2023-03-28 Oppo(重庆)智能科技有限公司 Application quick starting method, terminal and computer readable storage medium
CN110941424B (en) * 2019-11-28 2023-06-13 Oppo广东移动通信有限公司 Compiling parameter optimization method and device and electronic equipment
CN111552480B (en) * 2020-05-07 2021-06-25 深圳百斯特控制技术有限公司 Cross-platform compiling method, device, equipment and readable storage medium
CN112596773A (en) * 2020-12-31 2021-04-02 深圳市大富网络技术有限公司 Application program updating method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113485709A (en) 2021-10-08
CN113485709B (en) 2022-10-14
CN115185652A (en) 2022-10-14

Similar Documents

Publication Publication Date Title
US11947974B2 (en) Application start method and electronic device
CN113704205B (en) Log storage method, chip, electronic device and readable storage medium
CN113821767A (en) Application program authority management method and device and electronic equipment
WO2021073337A1 (en) Method and apparatus for installing plug-in, and storage medium
CN114741720B (en) Authority management method and terminal equipment
CN115333941B (en) Method for acquiring application running condition and related equipment
CN115185652B (en) Application optimization method and device and electronic equipment
CN113703894A (en) Display method and display device of notification message
CN113656089B (en) Class verification method and device in application program
CN116483734B (en) Pile inserting method and system based on compiler and related electronic equipment
CN115017498B (en) Method for operating applet and electronic device
CN113590346B (en) Method and electronic equipment for processing service request
CN114828098B (en) Data transmission method and electronic equipment
CN113467821A (en) Application program repairing method, device, equipment and readable storage medium
CN116321106A (en) Method and device for updating system data of user identity recognition module card
CN116048629B (en) System service switching method, control device, electronic equipment and storage medium
CN114996078B (en) Method and device for compiling control of dex file
CN116048594B (en) Software upgrading method and related device
CN114996162B (en) Test method and related device
CN116089057B (en) Resource scheduling method, device, storage medium and program product
CN115952564B (en) Data writing method and terminal equipment
CN114006969B (en) Window starting method and electronic equipment
CN117707562A (en) Parameter updating method and terminal equipment
CN114490006A (en) Task determination method, device, equipment and storage medium
CN117785548A (en) File updating method and electronic equipment

Legal Events

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