WO2022017244A1 - 安装应用的方法和电子设备 - Google Patents

安装应用的方法和电子设备 Download PDF

Info

Publication number
WO2022017244A1
WO2022017244A1 PCT/CN2021/106377 CN2021106377W WO2022017244A1 WO 2022017244 A1 WO2022017244 A1 WO 2022017244A1 CN 2021106377 W CN2021106377 W CN 2021106377W WO 2022017244 A1 WO2022017244 A1 WO 2022017244A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
time period
electronic device
optimization
dex2oat
Prior art date
Application number
PCT/CN2021/106377
Other languages
English (en)
French (fr)
Inventor
黄德志
祁长乐
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP21845835.4A priority Critical patent/EP4170483A4/en
Priority to US18/017,023 priority patent/US20230289160A1/en
Publication of WO2022017244A1 publication Critical patent/WO2022017244A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • 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/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
    • G06F9/4893Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues taking into account power or heat criteria
    • 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Definitions

  • the present application relates to the field of electronic technology, and in particular, to a method for installing an application and an electronic device.
  • an upper-level installation process and a bottom-level optimization process For example, when an electronic device installs apps in batches or clones and restores multiple apps, the number of apps that need to be installed is large.
  • the upper-level installation process and the bottom-level optimization process of the App are carried out in sequence, and the bottom-level optimization process of the App will take a long time, resulting in the installation process taking a lot of time and reducing the user experience.
  • the present application provides a method for installing an application and an electronic device, which are beneficial to improve the installation speed of installing multiple applications on the electronic device, thereby improving user experience.
  • a method for installing an application is provided, the method is applied to an electronic device, and the method includes: detecting an operation triggered by a user to install a first application and a second application; in response to the operation, copying and scanning the first application an application package, where the first application package is an application package corresponding to the first application; within the first time period after the first application package is copied and scanned, the second application package is copied and scanned, The second application package is an application package corresponding to the second application; within a second time period after the first application package is copied and scanned, the optimization of the first application is performed; wherein the first application package is A period of time and the second period of time overlap at least in part.
  • the upper-layer installation process of the application and the bottom-layer optimization and optimization process are performed in parallel, which is beneficial to improve the installation speed of multiple applications installed on the electronic device, thereby improving user experience.
  • the method further includes: detecting an operation triggered by a user to install the third application program and the fourth application program; In three time periods, copy and scan a third application package, where the third application package is an application package corresponding to the third application; wherein, the duration of the second time period is greater than the first time period and the third time period When the sum of the durations of the segments, the start time of copying and scanning the fourth application package is later than or equal to the start time of performing optimization on the second application.
  • the technical solution when the execution time of the underlying optimization process of an application is long, the technical solution is beneficial to avoid excessive backlog of optimization tasks in the underlying optimization queue.
  • the method further includes: detecting an operation triggered by a user to install a third application; when the second application package is copied and scanned, detecting the The temperature of the central processing unit CPU; it is determined that the temperature is greater than or equal to the preset value; when the optimization of the second application program ends, suspend the first preset time period; after the first preset time period, copy and scan the third application A program package, where the third application package is an application package corresponding to the third application.
  • the temperature of the electronic device is monitored.
  • the underlying optimization task is allowed to rest for a period of time, which is beneficial to reduce the phenomenon that the temperature of the electronic device is too high for a short time. .
  • performing optimization on a fourth application program before performing optimization on the first application program, performing optimization on a fourth application program, and determining that the temperature is greater than or equal to a preset value includes: determining the temperature The temperature is greater than or equal to the preset value and the duration of the fourth period is greater than or equal to the second preset period; wherein, the fourth period and the second period are the same; or, the second period and the fifth period
  • the fourth time segment is the sum of the second time segment and the fifth time segment
  • the fifth time segment is when the electronic device executes the fourth application program. Optimized time period.
  • performing optimization on the first application includes: optimizing the first application The task is added to the first task queue, and the first optimization task is used to optimize the first application; the first thread is started, and the first thread is used to take the first optimization task out of the first task queue; an interface, where the first interface is used to start a second thread, and the second thread is used to execute the first optimization task.
  • the optimization tasks corresponding to the applications can be put into the task queue, and the task queue is managed and scheduled by the first thread, that is, the first thread loads the optimization tasks from the task queue Take it out.
  • the first interface is called to start the second thread to actually perform the optimization task of the application, so that the bottom-level optimization of the application does not affect the upper-level installation of the application, that is, the upper-level installation application and the bottom-level optimization process can be processed in parallel. Accelerates the installation of batch applications and improves the user experience.
  • an electronic device characterized by comprising: one or more processors; one or more memories; the one or more memories stores one or more computer programs, the one or more The computer program includes instructions that, when executed by the one or more processors, cause the electronic device to perform the steps of: detecting that a user triggers an operation to install the first application and the second application; in response to the operation, copying and scan the first application package, the first application package is the application package corresponding to the first application; within the first time period after the copying and scanning of the first application package, copy and scan the second application a program package, where the second application package is an application package corresponding to the second application; within the second time period after the copying and scanning of the first application package, the optimization of the first application is performed; wherein , the first time period and the second time period at least partially overlap.
  • the electronic device when the instruction is executed by the one or more processors, the electronic device is caused to perform the following steps: detecting that the user triggers the installation of the third application and the fourth application Operation of the program; within a third time period after copying and scanning the first application package, copying and scanning a third application package, where the third application package is an application package corresponding to the third application; wherein , when the duration of the second time period is greater than the sum of the duration of the first time period and the third time period, the start time of copying and scanning the fourth application package is later than or equal to the second application package The moment at which optimization is performed.
  • the electronic device when the instruction is executed by the one or more processors, the electronic device is caused to perform the following steps: detecting that the user triggers an operation to install the third application; When the second application package is copied and scanned, the temperature of the CPU of the electronic device is detected; it is determined that the temperature is greater than or equal to the preset value; when the optimization of the second application is completed, the first preset duration is suspended; After the first preset duration, a third application package is copied and scanned, where the third application package is an application package corresponding to the third application.
  • the optimization of the fourth application program before performing the optimization of the first application program, the optimization of the fourth application program is performed, and the electronic device is specifically configured to: determine that the temperature is greater than or equal to a predetermined temperature Set the value and the duration of the fourth time period is greater than or equal to the second preset duration; wherein, the fourth time period and the second time period are the same; or, in the time interval between the second time period and the fifth time period When less than or equal to the third preset time period, the fourth time period is the sum of the second time period and the fifth time period, and the fifth time period is the time period during which the electronic device performs optimization of the fourth application.
  • the electronic device is specifically configured to: add a first optimization task to the first task queue, where the first optimization task is used to optimize the first application; start the first optimization task A thread, the first thread is used to take the first optimization task out of the first task queue; the first interface is called, and the first interface is used to start a second thread, and the second thread is used to execute the first optimization Task.
  • a computer-readable storage medium where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed on an electronic device, the electronic device is made to perform the above-mentioned first aspect and the first aspect A method of installing an application in any possible implementation manner of .
  • a fourth aspect provides a computer program product that, when the computer program product runs on a computer, causes the computer to execute the method for installing an application in any of the above-mentioned first aspect and any possible implementation manner of the first aspect .
  • FIG. 1 is a schematic structural diagram of an electronic device 100 to which the embodiments of the present application may be applied.
  • FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
  • FIG. 3 is a schematic diagram of a group of GUIs provided by an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of installing an application according to an embodiment of the present application.
  • FIG. 5 is a schematic sequence flow diagram of an application installed in a PMS provided by an embodiment of the present application.
  • FIG. 6 is a schematic sequence flow diagram of another application installed in the PMS provided by an embodiment of the present application.
  • FIG. 7 is a flowchart of a method for installing an application provided by an embodiment of the present application.
  • FIG. 8 is a schematic sequence diagram of installing an application according to an embodiment of the present application.
  • FIG. 9 is a schematic sequence diagram of another installation application provided by an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of a method for installing an application provided by an embodiment of the present application.
  • FIG. 11 is a schematic sequence flow diagram of a method for installing a temperature control strategy during application installation provided by an embodiment of the present application.
  • FIG. 12 is a schematic flowchart of counting the working time of a dex2oat work task according to an embodiment of the present application.
  • FIG. 13 is a schematic diagram of an optimized regulation flow of a temperature control strategy provided by an embodiment of the present application.
  • FIG. 14 is a schematic flowchart of a method for installing an application provided by an embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features.
  • a feature defined as “first” or “second” may expressly or implicitly include one or more of that feature.
  • the application installation method provided by the embodiments of the present application can be applied to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, and ultra-mobile personal devices.
  • AR augmented reality
  • VR virtual reality
  • electronic devices such as a computer (ultra-mobile personal computer, UMPC), a netbook, and a personal digital assistant (personal digital assistant, PDA), the embodiments of the present application do not impose any restrictions on the specific type of the electronic device.
  • FIG. 1 shows a schematic structural diagram of an electronic device 100 .
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130.
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator 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 passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify the signal, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing the instructions stored in the internal memory 121 .
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the air pressure sensor 180C is used to measure air pressure.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the electronic device 100 can measure the distance through infrared or laser.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the temperature sensor 180J is used to detect the temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and also can be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiments of the present application take an Android system with a layered architecture as an example to exemplarily describe the software structure of the electronic device 100 .
  • FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
  • the application framework layer provides an application programming interface (API) and a programming framework for the applications of the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a package manager (package manager service, PMS), a window manager, a content provider, a view system, a resource manager, a notification manager, and the like.
  • PMS package manager service
  • window manager a content provider
  • view system a view system
  • resource manager a notification manager
  • PMS is used to manage the installation and uninstallation of various software.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications that appear on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • the Android runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
  • the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: installd, media libraries (media libraries), 3D graphics processing libraries (eg: OpenGL ES), 2D graphics engines (eg: SGL), etc.
  • media libraries media libraries
  • 3D graphics processing libraries eg: OpenGL ES
  • 2D graphics engines eg: SGL
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, storage drivers, sensor drivers, etc.
  • Android application package It is an application package file format used by the Android operating system to distribute and install mobile applications and middleware. If the code of an Android application wants to run on an Android device, it must be compiled first, and then packaged into a file recognized by the Android system before it can be run. This file format can be recognized and run by the Android system. It is "APK”.
  • APK is composed of xml, resource files, and dex (binary bytecode) files.
  • Blocking call Before the call result returns, the current thread will be suspended.
  • dexopt thread used to execute the dexopt task, dexopt is the process of verifying and optimizing the dex file, and generating an executable odex file. This process can improve application startup and component loading performance.
  • dex2oat thread used to perform dex2oat work tasks, dex2oat is the process of optimizing APK files and generating oat files.
  • the oat file is an Android private elf file format, which not only contains the local machine instructions translated from the dex file, but also contains the original dex file content.
  • dex2oat work task queue management thread used to manage the dex2oat work task queue, and used to take the dex2oat work task out of the dex2oat work task queue.
  • FIG. 3 is a schematic diagram of a group of graphical user interfaces (graphical user interface, GUI) provided by an embodiment of the present application.
  • the embodiment of the present application takes the installation of multiple applications on a user's mobile phone as an example. Among them, (a) to (d) in FIG. 3 show the process of a user installing multiple applications at one time.
  • the GUI is the desktop 200 of the mobile phone.
  • the GUI as shown in (b) in FIG. 3 can be displayed. .
  • the GUI shows the interface of the application market, and the user can download various applications in the application market. For example, the user downloads multiple applications at a time, and when the mobile phone detects that the user clicks to download
  • the controls 220, 230, and 240 are controlled, the download of the application is started, and the GUI shown in (c) of FIG. 3 can be displayed.
  • the mobile phone can display the progress of the currently downloaded multiple applications on the interface.
  • the icons of the multiple applications may be displayed on the desktop 220 of the mobile phone.
  • FIG. 4 is a schematic flowchart of installing an application according to an embodiment of the present application. Taking an electronic device based on an Android system as an example, the electronic device installs an application through a package installer interface. As shown in FIG. 4 , this step includes steps 101 to 107 .
  • Step 101 the application layer creates a task.
  • the application installer creates a task by means of a package installer session (PIS).
  • PIS package installer session
  • step 102 the task is submitted to the PMS in the application framework layer, and the application is installed by the PMS.
  • Step 103 the PMS installs the application.
  • the PMS when the PMS installs the application, it will copy the APK file of the application from the download directory of the application to the system directory, scan the APK file, and parse the APK file through the scanning process to obtain the components, configuration files and other information of the application. .
  • Step 104 the PMS invokes the installd interface of the system layer to execute dexopt to optimize the APK file.
  • Step 105 installd calls the dex2oat thread.
  • dexopt when installd executes dexopt, it performs binary optimization on the APK file by calling the dex2oat thread internally to improve the application startup speed and component loading performance.
  • Step 106 installd sends a message that the execution of the dex2oat thread is completed to the PMS.
  • Step 107 the PMS determines that the execution of dexopt is completed, and sends a message that the App installation is complete to the application installer.
  • the installation process needs to block and wait for the dex2oat optimization process, and the dex2oat optimization process generally takes a long time.
  • the dex2oat optimization process generally takes a long time.
  • the debug version The installation time of dex2oat takes about 14s in total, of which the dex2oat optimization process takes about 7s, and the time-consuming ratio is about half of the entire application installation time.
  • FIG. 5 is a schematic sequence flow diagram of an application installed in a PMS provided by an embodiment of the present application. As shown in FIG. 5 , the process may include steps 201 to 206 .
  • the PMS when the PMS starts to install App1, it holds an mInstallLock lock, which is an installation lock protection file.
  • the installation lock protection file prevents other applications from being installed.
  • the PMS submits the dexopt1 task.
  • the PMS submits the dexopt1 task to the software package dex optimizer to optimize the APK file of App1.
  • the package dex optimizer sends the dexopt1 task to installd.
  • the process holds the mInstallLock lock again, and when the current dexopt task is not completed, the installation lock protection file prevents other dexopt tasks from proceeding.
  • installd After the execution of the dex2oat work task is completed, installd sends a message that the installation of App1 is completed to the PMS.
  • the PMS After receiving the message that the installation of App1 is completed, the PMS sends the message to the application installer.
  • the mInstallLock locks will be returned and released in turn. During this period, the installation application blocks and waits, and installation requests for other applications cannot be executed.
  • the present application provides a method for installing an application.
  • the execution process of the dex2oat task that is, the bottom-level optimization process of the App is disassembled from the entire installation process, so as to achieve the top-level installation of the App and the bottom-level optimization of the App.
  • Parallel processing which speeds up the installation of multiple apps and improves the user experience.
  • FIG. 6 is a schematic sequence flow diagram of another application installed in a PMS provided by an embodiment of the present application. As shown in FIG. 6, the process may include steps 201a to 206a.
  • the PMS submits the dex2oat work task of App1 to the optimizer.
  • the PMS submits the dex2oat work task to the dex2oat work task queue, and the dex2oat work task queue management thread manages the queue.
  • the PMS sends a message that the installation of App1 is complete to the application installer.
  • steps 202a and 203a may be performed simultaneously.
  • the optimizer calls the installd interface.
  • the dex2oat work task queue management thread is used to take the dex2oat work task out of the queue.
  • the installd interface after taking out the dex2oat work task corresponding to the App1, the installd interface internally calls the dex2oat thread to execute the dex2oat work task.
  • step 204b and step 205b are performed in parallel with step 204a, and the execution of step 204b and step 205b will not affect the execution of step 204a.
  • the PMS submits the dex2oat work task of App2 to the optimizer.
  • the PMS sends a message that the installation of App2 is complete to the application installer.
  • step 205b after the execution of step 205b is completed, the dex2oat work task management thread will take out the dex2oat work task corresponding to App2 from the queue, and call the installd interface.
  • the installd interface internally calls the dex2oat thread to execute the dex2oat work task corresponding to the App2.
  • the upper-layer application installation of the PMS is performed in parallel with the bottom-layer optimization process of the application.
  • the technical solution can improve the installation speed when installing applications in batches and improve the user experience.
  • FIG. 7 is a flowchart of a method for installing an application provided by an embodiment of the present application. As shown in FIG. 7 , the method may include steps 301 to 305 .
  • the user installs the application.
  • a user downloads and installs multiple apps in the app market, or restores multiple apps from a cloned backup.
  • the application installer copies the APK file for subsequent installation.
  • the PMS scans the APK file for parsing the APK file to obtain information such as application components and configuration files.
  • PMS calls the installd interface to perform dexopt optimization, and installd internally calls the dex2oat thread to perform the dex2oat optimization process to optimize the APK file.
  • each application corresponds to one dex2oat task.
  • the electronic device can group the dex2oat work tasks corresponding to the applications into a queue according to the order of installing the applications. For example, if the electronic device installs App1, App2, and App3 in sequence, and the corresponding dex2oat work tasks are dex2oat1, dex2oat2, and dex2oat3, then the dex2oat work The task queue is dex2oat1, dex2oat2, dex2oat3.
  • the dex2oat work tasks are taken out from the task queue in turn through the background dex2oat work task queue management thread, and the dex2oat thread is called internally by installd to perform the dex2oat optimization process, so as not to hinder the execution of the installation process, this process will dex2oat work
  • the process of task execution is disassembled from the entire application installation process, and the application installation and dex2oat execution processes are processed in parallel, so that batch applications can be quickly installed.
  • this step 304 may include steps 3041 to 3046 .
  • the dex2oat work task queue management thread is used to manage the dex2oat work task queue, and the dex2oat work tasks are sequentially taken out from the dex2oat work task queue.
  • the dex2oat work tasks are dex2oat1, dex2oat2, and dex2oat3.
  • the dex2oat work task queue management thread is terminated.
  • the idling timeout can be understood as no task execution time in the dex2oat work task queue is greater than the preset value, that is, it can be considered that all the dex2oat work tasks in the dex2oat work task queue have been executed, and the system stops the work task queue management thread at this time , which is beneficial to reduce the power consumption of electronic equipment.
  • installd executes the dex2oat work task by calling the dex2oat thread to perform binary optimization on the application's APK file.
  • the execution of the dex2oat work task of the application ends.
  • the above process is the execution process of the dex2oat work task of an application. After the dex2oat work task of the application is executed, the execution process of the dex2oat work task of the next application is the same as the above steps 3042 to 3046, and will not be repeated.
  • the order of installing the applications may be the order in which the electronic device downloads the applications, or may be in the order of preset priorities, which is not specifically limited in this embodiment of the present application.
  • step 305 once the dex2oat work task corresponding to the application is submitted in step 304, it can be considered that the application installation is completed, and the next application can be installed, and the corresponding dex2oat work task is transferred to background execution. At this time, the PMS will send a broadcast message that the application installation is complete to the application installer.
  • step 304 it can be considered that the installation of App1 is completed and App2 can be installed, and dex2oat1 is executed in the background while App2 is being installed.
  • the dex2oat task corresponding to the application can be disassembled from the installation process, so that the upper-layer installation application and the underlying dex2oat optimization process can be processed in parallel, thereby speeding up the installation of batch applications speed and improve user experience.
  • FIG. 8 is a schematic sequence diagram of installing an application according to an embodiment of the present application.
  • FIG. 8 in the original technical solution, when applications are installed in batches on electronic devices, multiple applications are installed in series in sequence. For example, before installing App2, you must wait for the dex2oat task of App1 to complete. Similarly, before installing App3, you must wait for the dex2oat task of App2 to complete. Therefore, batch application installation is slow, affecting user experience.
  • the APK1 corresponding to the first application program (ie, the upper-layer installation App1) is copied and scanned.
  • the first application program ie, the upper-layer installation App1
  • the first application program that is, the upper layer installs App2
  • the second time period t2 after copying and scanning the APK1 corresponding to the first application program, execute the first application program.
  • the optimization ie the execution of dex2oat1 during time t2, wherein the first time period t1 and the second time period t2 at least partially overlap.
  • the first time period t1 and the second time period t2 start at the same time.
  • the upper-layer installation of dex2oat1 and App2 are performed in parallel, which can improve the installation speed of the application and improve the user experience.
  • start times of t1 and t2 may also be different.
  • start time of t2 is earlier than the start time of t1, but the time periods of t1 and t2 overlap at least partially.
  • the upper-level installation and the bottom-level optimization of App1 are carried out in parallel, which can improve the installation speed of multiple applications.
  • the first optimization task corresponding to App1 can be added to the first task queue; the first optimization task is taken out from the first task queue by the first thread; and the first optimization task is called. an interface, the first interface starts a second thread to perform the first optimization task.
  • the first task queue is a dex2oat task queue
  • the first thread is a dex2oat task queue management thread
  • the first interface is an installd interface
  • the second thread is a dex2oat thread.
  • the time duration that can be optimized is the sum of the time spent executing dex2oat1 and executing dex2oat2.
  • FIG. 9 is a schematic sequence diagram of installing an application according to an embodiment of the present application.
  • the situation that may occur is that the execution process of dex2oat1 corresponding to App1 takes a long time.
  • the upper-layer App1 is installed, and App2 starts to be installed.
  • the bottom layer starts to execute dex2oat1 on App1; the upper layer of App2 is installed, and dex2oat2 is added to the dex2oat work task queue.
  • dex2oat2 can only wait for execution in the queue; at this time, the upper layer starts to install App3, and after the upper layer of App3 is installed , dex2oat3 joins the dex2oat work task queue to wait for execution; the upper layer starts to install App4, after the upper layer of App4 is installed, dex2oat4 joins the dex2oat work task queue to wait for execution, at this time, dex2oat1 is still not completed. Therefore, the result is a backlog of tasks in the dex2oat work task queue, and these tasks are not actually executed. If the electronic device is abnormal at this time (such as shutdown or restart, etc.), there may be some apps that do not If the corresponding dex2oat is executed, then when the user enables the application, it will start in normal mode.
  • dex2oat optimization of the App can improve the startup speed and component loading performance of the App.
  • the App In the normal mode, the App is not optimized, and the startup speed of the App may be slow.
  • an embodiment of the present application provides a method, which can control the number of backlogged tasks in the dex2oat work task queue. As shown in (b) in Figure 9, the method may include the following steps:
  • the start time of the first time period t1 and the second time period t2 are the same, that is, when App2 is installed on the upper layer, the bottom layer starts to execute dex2oat1 on App1.
  • the installation of the upper layer of App2 is completed, but the execution of dex2oat1 has not been completed.
  • the dex2oat2 corresponding to App2 is added to the waiting queue, and the upper layer starts to install App3.
  • the dex2oat2 corresponding to App2 is added to the waiting queue and executed within the fourth time period t4.
  • the dex2oat work task queue management thread (ie the first thread) takes the dex2oat2 out of the queue, the PMS calls the installd interface to execute, and installd internally starts the dex2oat thread (ie the third thread) to execute the dex2oat2.
  • the upper layer installs App4, wherein the duration of the second time period t2 is greater than the duration of the first time period t1 and the third time period t3
  • the start time of copying and scanning the fourth application package ie, the start time of t5
  • the start time of performing optimization on the second application program ie, the time of t4 .
  • the bottom layer dex2oat when the duration of the second time period t2 is greater than the sum of the duration of the first time period t1 and the third time period t3, it means that the bottom layer optimization task of App1 takes a long time. If it is not controlled, the bottom layer dex2oat There may be a backlog of multiple dex2oat work tasks in the work task queue. At this time, the PMS does not send a broadcast of the App3 installation completion to the application installer, but waits for the completion of the execution of the underlying dex2oat1. When the execution of the underlying dex2oat1 is completed, the execution of dex2oat2 begins.
  • the dex2oat3 corresponding to App3 is added to the dex2oat waiting queue, and the dex2oat3 is waiting to be executed in the dex2oat work task queue. Then the upper layer continues to install App4. At this time, the starting moment of optimizing App2 is equal to the starting moment of copying and scanning App4, that is, the installation of App4 on the upper layer and the execution of dex2oat2 on the bottom layer are carried out at the same time.
  • this solution can avoid the backlog of excessive dex2oat work tasks in the dex2oat work task queue.
  • FIG. 10 is a schematic flowchart of a method for installing an application provided by an embodiment of the present application.
  • the method may include steps 401 to 408 .
  • the user installs the application.
  • PMS calls the installd interface to perform dexopt optimization, and installd internally calls the dex2oat thread to perform the dex2oat optimization process.
  • the upper-layer installation App and the lower-layer execution dex2oat work task are parallelized, so as to speed up the application installation speed.
  • dex2oat work task waiting queue represents a queue waiting to execute dex2oat work tasks in addition to the currently executing dex2oat work tasks.
  • the application installer is notified that the application installation is complete.
  • App3 is installed on the upper layer.
  • PMS submits dex2oat3
  • the current dex2oat1 has not been executed yet.
  • the PMS does not send a message to the application installer.
  • App3 installation completed message, but blocked waiting for the dex2oat1 execution to complete.
  • the execution of dex2oat2 starts, and the waiting queue is empty at this time.
  • the dex2oat work task queue is empty, it means that the dex2oat work task waiting to be executed in the dex2oat work task queue is empty, then the dex2oat work task of the application can be submitted to the dex2oat work task queue at this time, that is, the dex2oat work task corresponding to the application The task is added to the dex2oat worker task waiting queue.
  • step 406 the dex2oat work task waiting queue is not empty, and after the PMS blocking waiting queue is emptied, the PMS submits the dex2oat work task of the application to the task queue.
  • the dex2oat waiting queue is empty, and the PMS sends a broadcast of the installation completion of App3 to the application installer.
  • the dex2oat3 corresponding to App3 joins the dex2oat waiting queue. waiting for execution.
  • App3 is installed on the upper layer, and dex2oat2 is being executed on the bottom layer. At this time, there is no dex2oat work task waiting to be executed in the dex2oat work queue, then the dex2oat3 is added to the dex2oat work task queue for execution.
  • the PMS After submitting the dex2oat work task of the currently installed app to the dex2oat work task queue, the PMS sends a broadcast of the app installation completion to the app installer.
  • this solution can avoid the backlog of too many dex2oat work tasks in the dex2oat work task queue.
  • the dex2oat work task of the application is executed in the local system of the electronic device. Since the dex2oat execution process is a process with a high amount of calculation, there will be more power consumption, resulting in a short period of time for the electronic device. A temperature rise occurs that may affect the stability of electronic equipment. Therefore, the embodiments of the present application provide a temperature control strategy method to improve the above problems.
  • FIG. 11 is a schematic sequence flow diagram of a method for installing a temperature control strategy during application installation provided by an embodiment of the present application.
  • App1 is installed on the upper layer of the electronic device
  • the bottom layer starts to execute dex2oat1
  • the upper layer starts to install App2.
  • dex2oat2 that is, at time T1
  • monitor the temperature of the electronic device which can be the temperature of the entire electronic device. , or the temperature of the central processing unit (CPU) of the electronic device.
  • CPU central processing unit
  • a threshold range of the temperature can be preset. When the temperature is greater than the first threshold, it is considered that the temperature of the electronic device is abnormal, and when the temperature is less than or equal to the first threshold, the temperature of the electronic device is considered to be normal, for example , the first threshold can be any value between 35 degrees and 40 degrees.
  • the first execution duration (ie, the fourth time period) is determined.
  • the first execution duration is used to indicate the duration of the electronic device's continuous execution of the dex2oat work task.
  • the first execution duration It can be used to judge whether the dex2oat work task has been executed for a long time.
  • the PMS will not send the App2 installation completion broadcast to the application installer, and trigger the stop of the dex2oat work task, that is, suspend the dex2oat work task queue management thread , so that it rests for the first preset duration, that is, suspends the scheduling of the dex2oat work task within the first preset duration, that is, after the first preset duration, copy and scan App3 again.
  • the dex2oat work task can be triggered to stop, even if the dex2oat work task queue management thread is suspended for the first preset time period, similarly, the stop is triggered after the execution of dex2oat2 of App2 is completed. dex2oat job task.
  • the temperature monitoring in the embodiments of the present application may be implemented by a temperature sensor, or may be implemented by other sensors having a temperature monitoring function, which are not specifically limited in the embodiments of the present application.
  • the rest interval can be a preset time period, such as 5s or 10s or other values.
  • the dex2oat work task has been suspended for a period of time t, and the PMS sends a broadcast of the end of the installation of App2 to the application installer, and starts to install App3.
  • the rest time of the dex2oat work task is T2 to T4, which can effectively reduce the occurrence of electronic devices in a short time during the batch installation and application process. fever problem.
  • the following describes a method for counting the execution duration of a dex2oat work task in this embodiment of the present application with reference to FIG. 12 .
  • FIG. 12 is a schematic flowchart of counting the working time of a dex2oat work task according to an embodiment of the present application. As shown in FIG. 12 , the method may include steps 501 to 509 .
  • Step 501 the user installs the application.
  • Step 502 submit the dex2oat work task.
  • Step 503 the dex2oat work task starts to be executed, and the time T1 is recorded.
  • Step 504 the execution of the dex2oat work task is completed, and the time T2 is recorded.
  • AT represents the time interval between this dex2oat work task and the last dex2oat work task
  • LT2 represents the time when the last dex2oat work task was executed.
  • Step 507 if AT ⁇ MIN_INTER, the working time WT of the dex2oat is the sum of the working time of the current dex2oat and the working time of the last dex2oat.
  • WT represents the working time of dex2oat
  • MIN_INTER represents the minimum time interval. It should be understood that the minimum time interval may be a preset value, for example, the minimum time interval may be 20s or 30s or other values.
  • the accumulated dex2oat work time If the time interval AT between this dex2oat work task and the last dex2oat work task is less than or equal to the set minimum time interval MIN_INTER of dex2oat, the accumulated dex2oat work time.
  • the bottom layer optimization dex2oat0 of the fourth application App0 is performed, and at time T1, the fifth time period when dex2oat0 is executed is performed.
  • the interval between the time period t5 and the second time period for executing dex2oat1 is less than or equal to the minimum time interval (ie, the third preset time period), then the working time WT of dex2oat (ie, the fourth time period) is the fifth time period t5 and the second time period.
  • the execution time dT of this dex2oat is taken as the work time of dex2oat.
  • the working time WT (fourth time period) of dex2oat is dex2oat1.
  • the execution time of is the first time period t1.
  • the following describes a method for optimizing and regulating the temperature control strategy according to the embodiment of the present application with reference to FIG. 13 .
  • FIG. 13 is a schematic diagram of an optimized regulation flow of a temperature control strategy provided by an embodiment of the present application. As shown in FIG. 13 , the method may include steps 601 to 606 .
  • step 601 the upper layer has installed App1, and in this step, the upper layer installs App2 and the lower layer executes the dex2oat work task in parallel.
  • Step 602 submit the dex2oat work task.
  • Step 603 the system reads the temperature information Temp according to the temperature monitoring result.
  • the system can monitor the temperature of the electronic device according to the temperature sensor, and the temperature can be the temperature of the whole electronic device or the temperature of the CPU.
  • Step 604 according to the temperature monitoring result in step 603, if the temperature of the electronic device is Temp>MIN_TEMP at this time, and the dex2oat working time WT>MAX_WT, the dex2oat work task is triggered to be suspended.
  • MIN_TEMP represents the threshold temperature
  • the threshold temperature is used to judge whether the temperature is abnormal when the electronic equipment is installed and applied
  • MAX_WT is used to represent the longest working time.
  • the value of MIN_TEMP and the value of MAX_WT can be implemented by system presets. As mentioned above, the MIN_TEMP can be any value between 35 degrees and 40 degrees, and the MAX_WT can be any value between 20s and 30s.
  • the WT in this embodiment of the present application can be obtained by the method of counting the working time of the dex2oat work task in FIG. 10 .
  • the dex2oat work task is triggered to stop in this step 604, in order to avoid the stability problem during the application installation process, the currently executing dex2oat work task is not stopped immediately, as mentioned above, but the dex2oat2 of App2 The dex2oat work task stops only after the execution is completed.
  • Step 605 the execution of dex2oat2 is completed.
  • dex2oat2 After the execution of dex2oat2 is completed, the work task of dex2oat will stop for a period of time to avoid the problem of insufficient stability of electronic equipment due to excessive temperature.
  • Step 606 WT clear processing.
  • the work time WT of dex2oat is set to zero, so as to facilitate the statistics of the work time of dex2oat in the next cycle.
  • the optimization method of the temperature control strategy in the embodiment of the present application can avoid the stability of the electronic device due to excessive temperature. Sexual insufficiency.
  • FIG. 14 is an exemplary flowchart of a method for installing an application provided by an embodiment of the present application. As shown in FIG. 14 , the method may include steps 710 to 740 .
  • the electronic device detects an operation triggered by the user to install the application.
  • the user downloads and installs multiple applications in the application market at one time, or the user clones and restores multiple applications using an electronic device, clones multiple applications from one device to another device, and so on.
  • the electronic device copies and scans the first application package in response to the user's operation, that is, the first application is installed on the upper layer of the electronic device.
  • the first time period may start immediately after the electronic device scans and copies the first application package, or may start at an interval after the electronic device scans and copies the first application package.
  • start time of the first time period and the second time period are the same, that is, the upper layer installation of the second application and the bottom layer optimization of the first application are performed simultaneously.
  • the start time of the first time period and the second time period are different.
  • the start time of the first time period is later than the start time of the second time period.
  • the upper layer of the electronic device installs the first time period.
  • the application program and the second application program will be separated for a period of time, which is beneficial to reduce the heating phenomenon of the electronic device.
  • the upper-layer installation process of the application and the bottom-layer optimization process are performed in parallel, which is beneficial to speed up the installation speed when multiple applications are installed on the electronic device, thereby improving the user experience.
  • the electronic device includes corresponding hardware and/or software modules for executing each function.
  • the present application can be implemented in hardware or in the form of a combination of hardware and computer software in conjunction with the algorithm steps of each example described in conjunction with the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functionality for each particular application in conjunction with the embodiments, but such implementations should not be considered beyond the scope of this application.
  • the electronic device can be divided into functional modules according to the above method examples.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that, the division of modules in this embodiment is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
  • This embodiment also provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed on the electronic device, the electronic device executes the above-mentioned related method steps to realize the above-mentioned embodiments. How to install the app.
  • This embodiment also provides a computer program product, which, when the computer program product runs on the computer, causes the computer to execute the above-mentioned relevant steps, so as to realize the method for installing an application in the above-mentioned embodiment.
  • the embodiments of the present application also provide an apparatus, which may specifically be a chip, a component or a module, and the apparatus may include a connected processor and a memory; wherein, the memory is used for storing computer execution instructions, and when the apparatus is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the method for installing an application in the foregoing method embodiments.
  • the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above. Therefore, for the beneficial effects that can be achieved, reference may be made to the above-provided method. The beneficial effects in the corresponding method will not be repeated here.
  • the disclosed apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of modules or units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or May be integrated into another device, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • Units described as separate components may or may not be physically separated, and components shown as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium.
  • a readable storage medium including several instructions to make a device (which may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

Landscapes

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

Abstract

一种安装应用的方法和电子设备,该方法应用于电子设备,该方法包括:检测到用户触发安装第一应用程序和第二应用程序的操作;响应于该操作,拷贝并扫描第一应用程序包,该第一应用程序包为该第一应用程序对应的应用程序包(720);在该拷贝并扫描第一应用程序包后的第一时间段内,拷贝并扫描第二应用程序包,该第二应用程序包为该第二应用程序对应的应用程序包(730);在该拷贝并扫描第一应用程序包后的第二时间段内,执行对该第一应用程序的优化;其中,该第一时间段和该第二时间段至少部分重叠(740)。加快了安装多个应用时的安装速度,提升了用户体验。

Description

安装应用的方法和电子设备
本申请要求于2020年07月23日提交中国专利局、申请号为202010713889.3、申请名称为“安装应用的方法和电子设备”中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子技术领域,尤其涉及一种安装应用的方法和电子设备。
背景技术
电子设备安装应用(application,App)时,一般会有上层安装过程和底层优化过程,例如,在电子设备批量安装App或克隆备份恢复多个App时,需要安装的App数量多,由于多个App的上层安装过程和底层优化过程是依次进行的,而App的底层优化过程会占用较长时间,导致安装过程耗费大量时间,降低了用户体验。
因此,如何快速高效的批量安装App,成为需要解决的技术问题。
发明内容
本申请提供一种安装应用的方法和电子设备,有利于提升电子设备安装多个应用的安装速度,从而提升用户体验。
第一方面,提供了一种安装应用的方法,该方法应用于电子设备,该方法包括:检测到用户触发安装第一应用程序和第二应用程序的操作;响应于该操作,拷贝并扫描第一应用程序包,该第一应用程序包为该第一应用程序对应的应用程序包;在该拷贝并扫描第一应用程序包后的第一时间段内,拷贝并扫描第二应用程序包,该第二应用程序包为该第二应用程序对应的应用程序包;在该拷贝并扫描第一应用程序包后的第二时间段内,执行对该第一应用程序的优化;其中,该第一时间段和该第二时间段至少部分重叠。
基于该技术方案,在电子设备安装应用时,通过将应用的上层安装过程与底层优化优化过程并行进行,有利于提升电子设备安装多个应用的安装速度,从而提升用户体验。
结合第一方面,在第一方面的一些实现方式中,该方法还包括:检测到用户触发安装第三应用程序和第四应用程序的操作;在拷贝并扫描该第一应用程序包后的第三时间段内,拷贝并扫描第三应用程序包,该第三应用程序包为该第三应用程序对应的应用程序包;其中,在第二时间段的时长大于第一时间段和第三时间段的时长之和时,拷贝并扫描第四应用程序包的起始时刻晚于或等于对该第二应用程序执行优化的起始时刻。
基于该技术方案,当某个应用的底层优化过程执行时间较长时,该技术方案有利于避免底层优化队列中积压过多的优化任务。
结合第一方面,在第一方面的一些实现方式中,该方法还包括:检测到用户触发安装第三应用程序的操作;在该第二应用程序包拷贝并扫描完成时,检测该电子设备的中央处理器CPU的温度;确定该温度大于或等于预设值;在该第二应用程序的优化结束时,暂 停第一预设时长;在该第一预设时长之后,拷贝并扫描第三应用程序包,该第三应用程序包为第三应用程序对应的应用程序包。
基于该技术方案,在多个应用安装过程中,对电子设备的温度进行监控,当电子设备温度过高时,使底层优化任务休息一段时间,有利于降低电子设备出现短时间温度过高的现象。
基于该技术方案,当电子设备的温度出现异常时,并不是马上停止当前正在执行的优化任务,而是等待该优化任务执行完成才去停止一段时间,有利于避免电子设备出现应用稳定性不足的问题。
结合第一方面,在第一方面的一些实现方式中,在执行对该第一应用程序的优化之前,执行对第四应用程序的优化,确定该温度大于或等于预设值,包括:确定该温度大于或等于预设值且第四时间段的时长大于或等于第二预设时长;其中,该第四时间段和第二时间段相同;或者,在该第二时间段与该第五时间段的时间间隔小于或等于第三预设时长时,该第四时间段为该第二时间段和第五时间段之和,该第五时间段为该电子设备执行对该第四应用程序的优化的时间段。
基于该技术方案,在电子设备温度异常时,判断底层优化任务是否已经长时间执行,该方案有利于判断电子设备出现温度异常是否是由底层优化应用导致的。
结合第一方面,在第一方面的一些实现方式中,该在该拷贝并扫描第一应用程序包后的第二时间段内,执行对该第一应用程序的优化,包括:将第一优化任务加入第一任务队列中,该第一优化任务用于优化该第一应用程序;启动第一线程,该第一线程用于将该第一优化任务从该第一任务队列中取出;调用第一接口,该第一接口用于启动第二线程,该第二线程用于执行该第一优化任务。
该技术方案中,在电子设备上批量安装应用时,可以将应用对应的优化任务放入任务队列中,由该第一线程管理调度该任务队列,即第一线程从该任务队列中将优化任务取出,此时调用第一接口启动第二线程来真正执行应用的优化任务,从而可以做到应用的底层优化不影响应用的上层安装,即可以实现上层安装应用和底层优化过程并行处理,从而可以加快批量应用的安装速度,提升用户体验。
第二方面,提供了一种电子设备,其特征在于,包括:一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被该一个或多个处理器执行时,使得该电子设备执行以下步骤:检测到用户触发安装第一应用程序和第二应用程序的操作;响应于该操作,拷贝并扫描第一应用程序包,该第一应用程序包为该第一应用程序对应的应用程序包;在该拷贝并扫描第一应用程序包后的第一时间段内,拷贝并扫描第二应用程序包,该第二应用程序包为该第二应用程序对应的应用程序包;在该拷贝并扫描第一应用程序包后的第二时间段内,执行对该第一应用程序的优化;其中,该第一时间段和该第二时间段至少部分重叠。
结合第二方面,在第二方面的一些实现方式中,当该指令被该一个或多个处理器执行时,使得该电子设备执行以下步骤:检测到用户触发安装第三应用程序和第四应用程序的操作;在拷贝并扫描该第一应用程序包后的第三时间段内,拷贝并扫描第三应用程序包,该第三应用程序包为该第三应用程序对应的应用程序包;其中,在该第二时间段的时长大于该第一时间段和该第三时间段的时长之和时,拷贝并扫描该第四应用程序包的起始时刻晚于或等于对该第二应用程序执行优化的起始时刻。
结合第二方面,在第二方面的一些实现方式中,当该指令被该一个或多个处理器执行时,使得该电子设备执行以下步骤:检测到用户触发安装第三应用程序的操作;在该第二应用程序包拷贝并扫描完成时,检测该电子设备的CPU的温度;确定该温度大于或等于预设值;在该第二应用程序的优化结束时,暂停第一预设时长;在该第一预设时长之后,拷贝并扫描第三应用程序包,该第三应用程序包为第三应用程序对应的应用程序包。
结合第二方面,在第二方面的一些实现方式中,在执行对该第一应用程序的优化之前,执行对第四应用程序的优化,该电子设备具体用于:确定该温度大于或等于预设值且第四时间段的时长大于或等于第二预设时长;其中,该第四时间段和该第二时间段相同;或者,在该第二时间段与该第五时间段的时间间隔小于或等于第三预设时长时,该第四时间段为该第二时间段和第五时间段之和,该第五时间段为电子设备执行对该第四应用程序的优化的时间段。
结合第二方面,在第二方面的一些实现方式中,该电子设备具体用于:将第一优化任务加入第一任务队列中,该第一优化任务用于优化第一应用程序;启动第一线程,该第一线程用于将该第一优化任务从该第一任务队列中取出;调用第一接口,该第一接口用于启动第二线程,该第二线程用于执行该第一优化任务。
第三方面,提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机指令,当该计算机指令在电子设备上运行时,使得该电子设备执行如上述第一方面及第一方面的任一项可能的实现方式中的安装应用的方法。
第四方面,提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得该计算机执行如上述第一方面及第一方面的任一项可能的实现方式中的安装应用的方法。
附图说明
图1是本申请实施例可以适用的电子设备100的结构示意图。
图2是本申请实施例的电子设备100的软件结构框图。
图3是本申请实施例提供的一组GUI的示意图。
图4是本申请实施例提供的一种安装应用的流程示意图。
图5是本申请实施例提供的一种PMS内部安装应用的时序流程示意图。
图6是本申请实施例提供的另一种PMS内部安装应用的时序流程示意图。
图7是本申请实施例提供的一种安装应用的方法流程图。
图8是本申请实施例提供的一种安装应用的时序示意图。
图9是本申请实施例提供的另一种安装应用的时序示意图。
图10是本申请实施例提供的一种安装应用的方法的流程示意图。
图11是本申请实施例提供的一种安装应用时温控策略的方法的时序流程示意图。
图12是本申请实施例提供的一种统计dex2oat工作任务工作时间的流程示意图。
图13是本申请实施例提供的一种温控策略的优化调控流程示意图。
图14是本申请实施例提供的一种安装应用方法的示意性流程图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中, 在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。
本申请实施例提供的安装应用的方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等电子设备上,本申请实施例对电子设备的具体类型不作任何限制。
示例性的,图1示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal  asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口 130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications, GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本 理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。气压传感器180C用于测量气压。磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子 设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。
指纹传感器180H用于采集指纹。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。
骨传导传感器180M可以获取振动信号。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图2是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括软件包管理器(package manager service,PMS),窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。
PMS用于管理各种软件的安装和卸载。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于 构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:installd,媒体库(media libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,存储驱动,传感器驱动等。
为了便于理解,本申请以下实施例将以具有图1和图2所示结构的电子设备为例,结合附图和应用场景,对本申请实施例提供的安装应用的方法进行具体阐述。
在描述本申请实施例的安装应用的方法之前,首先对本申请实施例中的术语做简单的介绍。
1、Android应用程序包(android application package,APK):是Android操作系统使用的一种应用程序包文件格式,用于分发和安装移动应用及中间件。一个Android应用程序的代码想要在Android设备上运行,必须先进行编译,然后被打包成为一个被Android系统所能识别的文件才可以被运行,而这种能被Android系统识别并运行的文件格式便是“APK”。APK由xml、资源文件、dex(二进制字节码)文件组合而成。
2、阻塞调用:调用结果返回之前,当前线程会被挂起。
3、dexopt线程:用于执行dexopt任务,dexopt是对dex文件进行验证和优化的过程,生成可执行的odex文件。该过程可以提升应用启动和组件加载性能。
4、dex2oat线程:用于执行dex2oat工作任务,dex2oat是对APK文件进行优化,生成oat文件的过程。oat文件是一种Android私有elf文件格式,它不仅包含有从dex文件翻译而来的本地机器指令,还包含有原来的dex文件内容。对于APK来说,oat文件实际上是对odex文件的包装,即oat=odex。
5、dex2oat工作任务队列管理线程:用于管理dex2oat工作任务队列,用于将dex2oat工作任务从dex2oat工作任务队列中取出。
图3是本申请实施例提供的一组图形用户界面(graphical user interface,GUI)的示意图。本申请实施例以在用户使用手机安装多个应用为例。其中,从图3中的(a)至(d)示出了用户一次性安装多个应用的过程。
参见图3中的(a),该GUI为手机的桌面200,当手机检测到用户点击桌面200上的应用市场的图标210的操作后,可以显示如图3中的(b)所示的GUI。
参见图3中的(b),该GUI显示的是应用市场的界面,用户可以在该应用市场中下载需要的各种应用,例如,用户一次下载多个应用,当手机检测到用户依次点击下载控件220、230、240时,即开始下载应用,可以显示如图3中的(c)所示的GUI。
参见图3中的(c),手机可以在该界面上显示当前下载的多个应用的进度。
参见图3中的(d),当该多个应用下载安装完成时,可以在手机的桌面220上显示该多个应用的图标。
图4是本申请实施例提供的一种安装应用的流程示意图。以基于安卓(Android)系统的电子装置为例,电子装置通过软件包安装(package installer)接口来安装应用。如图4所示,该步骤包括步骤101至步骤107。
步骤101,应用程序层创建任务。
其中,应用安装方通过软件包安装任务(package installer session,PIS)的方式创建任务。
步骤102,将任务提交到应用框架层中的PMS中,由PMS进行应用的安装。
步骤103,PMS安装应用。
其中,PMS安装应用时会从应用的下载目录中将应用的APK文件拷贝到系统目录中,并扫描该APK文件,通过扫描过程对该APK文件进行解析,以获取应用的组件、配置文件等信息。
步骤104,PMS调用系统层的installd接口执行dexopt,以对APK文件进行优化。
这个过程PMS阻塞调用installd接口。
步骤105,installd调用dex2oat线程。
其中,installd在执行dexopt时,通过内部调用dex2oat线程对APK文件进行二进制优化,以提升应用启动速度和组件加载性能。
步骤106,installd向PMS发送dex2oat线程执行结束的消息。
步骤107,PMS判断dexopt执行完成,则向应用安装方发送App安装完成的消息。
上述应用安装过程中,对于单个的应用安装,安装过程需要阻塞等待dex2oat优化过程,而dex2oat优化过程一般耗费时间较长,例如,在电子设备上安装典型应用微信(大小约为120MB),调试版本的安装时间总共需要14s,其中dex2oat优化过程耗时约为7s,耗时占比约为整个应用安装耗时的一半。
图5是本申请实施例提供的一种PMS内部安装应用的时序流程示意图。如图5所示,该流程可以包括步骤201至步骤206。
201,PMS开始安装App1。
其中,PMS在开始安装App1时,持有mInstallLock锁,该mInstallLock锁为一种安装锁定保护文件,在当前应用安装未完成时,该安装锁定保护文件阻止其他应用安装。
202,PMS提交dexopt1任务。
其中,PMS向软件包dex优化器提交dexopt1任务,对App1的APK文件进行优化。
203,软件包dex优化器向installd发送dexopt1任务。
其中,该过程再次持有mInstallLock锁,在当前dexopt任务未完成时,该安装锁定保护文件阻止其他dexopt任务进行。
204,installd内部调用dex2oat线程执行dex2oat工作任务,对APK文件进行二进制优化。
205,dex2oat工作任务执行完成之后,installd向PMS发送App1安装完成的消息。
206,PMS在接收到App1安装完成的消息之后,向应用安装方发送该消息。
207,PMS开始进行App2的安装。
应理解,dex2oat工作任务执行结束后,mInstallLock锁会依次返回释放,在此期间,该安装应用阻塞等待,对于其他应用的安装请求无法执行。
因此,批量应用安装过程中,由于mInstallLock锁的存在,多个应用的安装和dex2oat工作任务是依次串行进行的,导致的结果是多个应用安装过程缓慢,用户体验感较差。因此,需要一种快速安装应用的方法,以提升用户体验。
应理解,本申请实施例中PMS拷贝和扫描APK文件的过程可以称为“上层”或“上层安装”,而dexopt或dex2oat的优化过程可以称为“底层”或“底层优化”。
如前文所述,电子设备在批量安装App时,多个App的上层安装过程和底层优化过程是依次串行进行的,导致多个App安装过程缓慢,用户体验感较差。
本申请提供一种安装应用的方法,在电子设备批量安装App时,将dex2oat工作任务的执行过程即App的底层优化过程从整个安装过程中拆解开来,做到App上层安装与App底层优化并行处理,从而加快了安装多个App时的安装速度,提升用户体验。
图6是本申请实施例提供的另一种PMS内部安装应用的时序流程示意图。如图6所示,该流程可以包括步骤201a至步骤206a。
201a,PMS开始安装App1。
202a,PMS将App1的dex2oat工作任务提交给优化器。
具体地,PMS将dex2oat工作任务提交到dex2oat工作任务队列中,由dex2oat工作任务队列管理线程管理该队列。
203a,PMS向应用安装方发送App1安装完成的消息。
应理解,该步骤202a与203a可以是同时进行的。
204a,PMS开始安装App2。
204b,优化器调用installd接口。
具体地,dex2oat工作任务队列管理线程用于将dex2oat工作任务从队列中取出。
205b,将该App1对应的dex2oat工作任务取出后,installd接口内部调用dex2oat线程执行该dex2oat工作任务。
应理解,步骤204b和步骤205b与步骤204a是并行进行的,步骤204b和步骤205b的执行并不会影响步骤204a的进行。
205a,PMS将App2的dex2oat工作任务提交给优化器。
206a,PMS向应用安装方发送App2安装完成的消息。
206b,在步骤205b执行结束之后,dex2oat工作任务管理线程会将App2对应的dex2oat工作任务从队列中取出,并调用installd接口。
207b,installd接口内部调用dex2oat线程执行该App2对应的dex2oat工作任务。
同样的,该步骤207b和步骤208b并不会影响下一个应用的安装。
本申请实施例中,PMS上层安装应用与应用的底层优化过程并行进行,相比于现有的串行安装过程,该技术方案可以提升批量安装应用时的安装速度,提升了用户体验。
图7是本申请实施例提供的一种安装应用的方法流程图。如图7所示,该方法可以包括步骤301至步骤305。
301,用户安装应用。
例如,用户在应用市场下载安装多个应用,或者使用克隆备份恢复多个应用。
302,拷贝APK文件。
应用安装方拷贝APK文件,以便于后续安装。
303,扫描APK文件。
其中,PMS扫描APK文件用于对APK文件进行解析,以获取应用的组件、配置文件等信息。
304,提交dex2oat工作任务。
其中,PMS调用installd接口执行dexopt优化,而installd内部调用dex2oat线程执行dex2oat优化过程,以对APK文件进行优化。
应理解,在电子设备批量安装应用的过程中,每个应用对应一个dex2oat工作任务。电子设备可以按照安装应用的顺序将应用对应的dex2oat工作任务组成一个队列,例如,电子设备依次安装App1,App2,App3,其各自对应的dex2oat工作任务分别为dex2oat1,dex2oat2,dex2oat3,则该dex2oat工作任务队列为dex2oat1,dex2oat2,dex2oat3。应用安装过程中,通过后台dex2oat工作任务队列管理线程,将该dex2oat工作任务从任务队列中依次取出,installd内部调用dex2oat线程执行dex2oat优化过程,不让其阻碍安装流程的执行,该过程将dex2oat工作任务执行的过程从整个应用安装的过程中拆解出来,将应用安装和dex2oat执行过程做并行处理,从而可以快速安装批量应用。
具体地,该步骤304可以包括步骤3041至步骤3046。
3041,启动后台dex2oat工作任务队列管理线程。
其中,该dex2oat工作任务队列管理线程用于管理dex2oat工作任务队列,将dex2oat工作任务依次从dex2oat工作任务队列中取出。
3042,等待dex2oat工作任务队列。
例如,电子设备依次安装App1,App2,App3,则该dex2oat工作任务为dex2oat1、dex2oat2、dex2oat3。
3043,若dex2oat工作任务空转超时,则结束该dex2oat工作任务队列管理线程。
其中,空转超时可以理解为dex2oat工作任务队列中没有任务执行的时间大于预设值,即可以认为该dex2oat工作任务队列中的dex2oat工作任务已全部执行结束,此时系统停止该工作任务队列管理线程,有利于降低电子设备的功耗。
3044,若dex2oat非空转,则获取dex2oat工作任务。
3045,执行dex2oat工作任务。
installd通过调用dex2oat线程执行dex2oat工作任务,以对应用的APK文件进行二进制优化。
3046,dex2oat工作任务执行结束。
其中,该dex2oat线程将dex文件编译成oat文件格式后,即该应用的dex2oat工作任务执行结束。
应理解,上述过程是一个应用的dex2oat工作任务的执行过程,该应用的dex2oat工作任务执行完成后,下一个应用的dex2oat工作任务的执行过程和上述步骤3042至3046 相同,不再赘述。
还应理解,该安装应用的顺序可以是电子设备下载应用完成的顺序,也可以是按照预设的优先级的顺序,本申请实施例对此不做具体限定。
305,安装应用完成。
应理解,在步骤305中,一旦步骤304提交了该应用对应的dex2oat工作任务,则可以认为该应用安装完成,即可以进行下一个应用的安装,而其对应的dex2oat工作任务转为后台执行。此时,PMS会向应用安装方发送该应用安装完成的广播消息。
例如,当前正在安装的应用为App1,在步骤304中提交了App1对应的dex2oat1后,则可以认为该App1安装完成,可以进行App2的安装,而在安装App2的同时,后台执行dex2oat1。
基于上述技术方案,在电子设备上批量安装应用时,可以将应用对应的dex2oat工作任务从安装过程中拆解出来,做到上层安装应用和底层dex2oat优化过程并行处理,从而可以加快批量应用的安装速度,提升用户体验。
图8是本申请实施例提供的一种安装应用的时序示意图。如图8所示,原技术方案中,电子设备批量安装应用时,多个应用是依次串行安装。例如,在安装App2之前,必须等待App1的dex2oat工作任务执行完毕,同样的,在安装App3之前,必须等待App2的dex2oat工作任务执行完毕。因此,导致批量应用安装缓慢,影响用户体验。
在本申请实施例中,如图8所示,响应于用户触发的安装应用程序的操作,拷贝和扫描第一应用程序对应的APK1(即上层安装App1),在拷贝并扫描APK1之后的第一时间段t1内,拷贝和扫描第二应用程序对应的APK2(即上层安装App2),在拷贝和扫描第一应用程序对应的APK1之后的第二时间段内t2内,执行对第一应用程序的优化,即在时间t2内执行dex2oat1,其中,该第一时间段t1和第二时间段t2至少部分重叠。
如图8所示,第一时间段t1和第二时间段t2的起始时间相同,此时dex2oat1和App2上层安装并行进行,从而可以提升应用的安装速度,提升用户体验。
在另一个示例中,该t1和t2的起始时间也可以不同,例如,t2的起始时间早于t1的起始时间,但t1和t2的时间段至少有部分重叠,也可以实现App2的上层安装和App1的底层优化的并行进行,从而可以提升多个应用的安装速度。
在一种可能的实现方式中,可以将该App1对应的第一优化任务即dex2oat任务加入第一任务队列中;由第一线程将该第一优化任务从第一任务队列中取出;并调用第一接口,该第一接口启动第二线程,以执行该第一优化任务。
例如,该第一任务队列为dex2oat任务队列,该第一线程为dex2oat任务队列管理线程,该第一接口为installd接口,该第二线程为dex2oat线程。
基于本申请实施例提供的安装应用的方法,在安装App1和App2时,相比于原安装应用方法,可以优化的时长为执行dex2oat1与执行dex2oat2所耗费时间的总和。
图9是本申请实施例提供的一种安装应用的时序示意图。本申请实施例中,批量安装应用时可能会出现的情况是:App1对应的dex2oat1的执行过程耗费时间较长,如图9中的(a)所示,上层App1安装完成,开始安装App2,同时底层开始对App1执行dex2oat1;App2上层安装完成,dex2oat2加入dex2oat工作任务队列,由于此时dex2oat1尚未执行完成,因此dex2oat2只能在队列中等待执行;此时,上层开始安装App3,App3上层安装完成后,dex2oat3加入dex2oat工作任务队列等待执行;上层开始安装App4,App4上层安 装完成后,dex2oat4加入dex2oat工作任务队列等待执行,此时dex2oat1依然尚未执行完成。因此,造成的结果是dex2oat工作任务队列中积压了较多的任务,而这些任务并未真正执行,如果此时电子设备出现异常情况(如,关机或重启等),那么可能会出现有些App没有执行其对应的dex2oat的情况,那么当用户启用该应用时,将会以普通模式启动。
应理解,对App进行dex2oat优化,可以提升App的启动速度和组件加载性能,普通模式即不对App进行优化,可能出现的情况是该App的启动速度较慢。
针对可能出现的上述情形,本申请实施例提供一种方法,可以控制dex2oat工作任务队列中积压的任务数量。如图9中的(b)所示,该方法可以包括如下步骤:
(1)App1上层安装完成,在App1上层安装完成之后的第一时间段t1内上层安装App2,在App1上层安装完成之后的第二时间段t2内,执行对App1的优化。
例如,该第一时间段t1和第二时间段t2的起始时间相同,即在上层安装App2的同时底层开始对App1执行dex2oat1。
(2)在App1上层安装完成之后的第三时间段t3内,上层安装App3。
例如,App2上层安装完成,dex2oat1尚未执行完成,此时,将App2对应的dex2oat2加入等待队列中,同时上层开始安装App3。
(3)在App1上层安装完成之后的第四时间段t4内,执行对App2的优化。
例如,将App2对应的dex2oat2加入等待队列中,在第四时间段t4内执行。
具体地,由dex2oat工作任务队列管理线程(即第一线程)将该dex2oat2从队列中取出,PMS调用installd接口执行,而installd内部启动dex2oat线程(即第三线程)执行该dex2oat2。
(4)在App1上层安装完成之后的第五时间段t5内,上层安装App4,其中,在该第二时间段t2的时长大于所述第一时间段t1和所述第三时间段t3的时长之和时,拷贝并扫描第四应用程序包的起始时刻(即t5的起始时刻)晚于或等于对该第二应用程序执行优化的起始时刻(即t4的时刻)。
其中,当该第二时间段t2的时长大于第一时间段t1和第三时间段t3的时长之和时,意味着App1的底层优化任务耗费的时间较长,如果不加控制,底层的dex2oat工作任务队列中可能会积压多个dex2oat工作任务,此时PMS不向应用安装方发送该App3安装完成的广播,而是等待底层dex2oat1执行完成。在底层dex2oat1执行完成的同时,开始执行dex2oat2,此时App3对应的dex2oat3加入dex2oat等待队列,则dex2oat工作任务队列中等待执行的是dex2oat3,此时PMS向应用安装方发送该App3安装完成的消息,则上层开始继续安装App4,此时,该对App2执行优化的起始时刻等于对App4进行拷贝和扫描的起始时刻,即上层安装App4和底层执行dex2oat2是同时进行的。
应理解,后续更多应用的安装可以参考上述安装过程,不再赘述。
应理解,上述过程以dex2oat工作任务队列中积压一个dex2oat工作任务为例进行说明,但本申请实施例不局限于此,本申请实施例中dex2oat工作任务队列中积压的dex2oat工作任务数量也可以是两个、三个或更多个。
基于上述技术方案,在批量安装应用时,当某个应用的dex2oat执行过程耗费时间较长时,该方案可以避免dex2oat工作任务队列中积压过多的dex2oat工作任务。
图10是本申请实施例提供的一种安装应用的方法流程示意图。该方法可以包括步骤401至步骤408。
401,用户安装应用。
402,拷贝APK文件。
403,扫描APK文件。
应理解,上述步骤401至403可以参考前文所述,为了简洁,不再赘述。
404,提交dex2oat工作任务。
其中,PMS调用installd接口执行dexopt优化,而installd内部调用dex2oat线程来执行dex2oat优化过程。
405,并行化dex2oat工作任务。
如前文所述,应用本申请实施例中的安装应用的方法,上层安装App与底层执行dex2oat工作任务并行化处理,以加快应用的安装速度。
406,若dex2oat工作任务等待队列不为空,则阻塞等待队列清空。
应理解,该dex2oat工作任务等待队列表示除当前正在执行的dex2oat工作任务之外,等待执行dex2oat工作任务的队列。
在安装应用过程中,上层安装App与底层dex2oat工作任务并行处理时,若当前dex2oat工作任务等待队列不为空,则意味着当前dex2oat工作任务尚未执行完成,则此时,PMS阻塞等待该dex2oat工作任务执行完成后,再通知应用安装方该应用安装完成。
例如,参考图9中的(b),上层安装App3,在PMS提交dex2oat3时,当前dex2oat1尚未执行完成,此时,dex2oat工作任务队列中还有dex2oat2等待执行,那么,PMS不向应用安装方发送App3安装完成的消息,而是阻塞等待该dex2oat1执行完成。dex2oat1执行完成之后,开始执行dex2oat2,则此时等待队列为空。
407,若dex2oat工作任务等待队列为空,则提交dex2oat工作任务。
若dex2oat工作任务队列为空,则意味着该dex2oat工作任务队列中等待执行的dex2oat工作任务为空,则此时可以向dex2oat工作任务队列提交该应用的dex2oat工作任务,即将该应用对应的dex2oat工作任务加入dex2oat工作任务等待队列中。
在一个示例中,步骤406中dex2oat工作任务等待队列不为空,PMS阻塞等待队列清空之后,PMS提交该应用的dex2oat工作任务到任务队列中。例如,参考图9中的(b),dex2oat1执行完成之后,开始执行dex2oat2,此时dex2oat等待队列为空,则PMS向应用安装方发送App3安装完成的广播,同时App3对应的dex2oat3加入dex2oat等待队列中等待执行。
在另一个示例中,上层安装App3,底层正在执行dex2oat2,此时,dex2oat工作队列中并未有等待执行的dex2oat工作任务,则此时将该dex2oat3加入该dex2oat工作任务队列中等待执行。
408,安装应用完成。
将当前安装App的dex2oat工作任务提交到dex2oat工作任务队列中后,PMS向应用安装方发送该App安装完成的广播。
应理解,此时,尽管PMS向应用安装方发送了该App安装完成的广播,但该App对应的dex2oat工作任务仍在后台执行或等待执行。
基于上述技术方案,在批量安装应用时,该方案可以避免dex2oat工作任务队列中积压过多的dex2oat工作任务。
在批量应用安装过程中,应用的dex2oat工作任务是在电子设备的本地系统中执行, 由于该dex2oat执行过程是一个高计算量的过程,因此会有较多的功耗,导致电子设备短时间内出现温度上升,从而可能会影响电子设备的稳定性。因此,本申请实施例提供一种温度控制策略方法来改善上述问题。
图11是本申请实施例提供的一种安装应用时温控策略的方法的时序流程示意图。如图11所示,电子设备上层安装完App1,底层开始执行dex2oat1,同时上层开始安装App2,在准备提交dex2oat2时,即T1时刻,监测电子设备的温度,该温度可以是电子设备的整机温度,也可以是电子设备的中央处理器(center processing unit,CPU)的温度。
例如,可以预先设置该温度的阈值范围,当该温度大于第一阈值时,即认为该电子设备的温度异常,当该温度小于或等于第一阈值时,即认为该电子设备的温度正常,例如,该第一阈值可以是35度至40度之间的任意值。
若T1时刻监测到该电子设备的温度异常,再确定第一执行时长(即第四时间段),该第一执行时长用于表示该电子设备连续执行dex2oat工作任务的时长,该第一执行时长可以用于判断dex2oat工作任务是否已经长时间执行,若dex2oat工作任务已经长时间执行,则PMS不向应用安装方发送App2安装完成的广播,并触发停止dex2oat工作任务即暂停dex2oat工作任务队列管理线程,使其休息第一预设时长,即在第一预设时长内暂停dex2oat工作任务的调度,也就是说,在该第一预设时长之后,再拷贝并扫描App3。值得注意的是,并不是马上停止当前dex2oat工作任务的执行过程,而是让App2的dex2oat2执行完成才触发停止dex2oat工作任务,如图11中的T2时刻,因为App的扫描和dex2oat优化过程是一个安装过程,所以尽量使其不分离,避免出现稳定性不足的问题。
可选地,当T1时刻检测到电子设备的温度异常时,就可以触发停止dex2oat工作任务,即使dex2oat工作任务队列管理线程暂停第一预设时长,同样的,等待App2的dex2oat2执行完成才触发停止dex2oat工作任务。
应理解,本申请实施例中的温度监控可以通过温度传感器来实现,也可以通过其他具有温度监控功能的传感器来实现,本申请实施例对此不做具体限定。
应理解,本申请实施例中可以通过统计当前dex2oat优化过程的执行时间来判断其是否已经长时间执行,例如,当前dex2oat优化过程的执行时间大于预设的值,可以认为其已经长时间执行,下文将结合具体实施例描述判断当前dex2oat优化过程是否已经长时间执行的过程,此处暂不详述。
T2时刻,触发停止dex2oat工作任务队列管理线程,使其休息一段时间至T3时刻,该休息的时间间隔可以是预先设定的时长,例如5s或10s或其他值。
T3时刻,dex2oat工作任务已经暂停了一段时间t,PMS向应用安装方发送App2安装结束的广播,并开始安装App3。
T4时刻,上层安装App3结束,底层开始执行dex2oat3。
可以看出,从T2时刻触发停止dex2oat工作任务开始,到T4时刻开始执行dex2oat3,实际上dex2oat工作任务的休息时长为T2至T4,从而可以有效降低电子设备在批量安装应用过程中短时间内出现的发热问题。
应理解,后续更多应用的安装可以参照上述T1至T4时刻,为了简洁,不再赘述。
下面结合图12介绍本申请实施例中统计dex2oat工作任务执行时长的方法。
图12是本申请实施例提供的一种统计dex2oat工作任务工作时间的流程示意图。如图12所示,该方法可以包括步骤501至步骤509。
步骤501,用户安装应用。
步骤502,提交dex2oat工作任务。
步骤503,dex2oat工作任务开始执行,记录时间T1。
步骤504,dex2oat工作任务执行完成,记录时间T2。
步骤505,记录本次dex2oat执行时间:dT=T2-T1。
步骤506,计算本次dex2oat工作任务与上次dex2oat工作任务的时间间隔:AT=T1-LT2。
其中,AT表示本次dex2oat工作任务与上次dex2oat工作任务的时间间隔,LT2表示上次dex2oat工作任务执行完成的时间。
步骤507,若AT≤MIN_INTER,则dex2oat的工作时间WT为本次dex2oat的工作时长与上次dex2oat的工作时长之和。
其中,WT表示dex2oat的工作时间,MIN_INTER表示最小时间间隔。应理解,该最小时间间隔可以是预先设置的值,例如,该最小时间间隔可以为20s或30s或其他值。
若本次dex2oat工作任务与上次dex2oat工作任务的时间间隔AT小于或等于设定的dex2oat的最小时间间隔MIN_INTER,则累计dex2oat工作时间。
示例性地,如图11所示,在拷贝并扫描第一应用程序App1之前的第五时间段t5内,执行对第四应用程序App0的底层优化dex2oat0,若T1时刻,在执行dex2oat0的第五时间段t5与执行dex2oat1的第二时间段的间隔小于或等于最小时间间隔(即第三预设时长),则dex2oat的工作时间WT(即第四时间段)为第五时间段t5与第二时间段t2的时长之和。
步骤508,若AT>MIN_INTER,则dex2oat的工作时间:WT=dT。
若本次dex2oat工作任务与上次dex2oat工作任务的时间间隔AT大于设定的dex2oat的最小时间间隔MIN_INTER,则将本次dex2oat的执行时间dT作为dex2oat的工作时间。
示例性地,如图11所示的T1时刻,若第五时间段t5与第二时间段t2之间的间隔大于第三预设时长,则dex2oat的工作时间WT(第四时间段)为dex2oat1的执行时间即第一时间段t1。
步骤509,LT2=T2。
在下一个dex2oat工作任务开始时,将该当前dex2oat工作任务执行完成的时间作为LT2。
应理解,下一个或多个dex2oat工作任务的工作时间的统计可以参考上述步骤,为了简洁,不再赘述。
下面结合图13介绍本申请实施例的温控策略的优化调控的方法。
图13是本申请实施例提供的一种温控策略的优化调控流程示意图。如图13所示,该方法可以包括步骤601至步骤606。
步骤601,安装App2。
应理解,在该步骤601之前,上层已经安装完App1,该步骤中上层安装App2和底层执行dex2oat工作任务是并行进行的。
步骤602,提交dex2oat工作任务。
步骤603,系统根据温度监测结果,读取温度信息Temp。
其中,系统可以根据温度传感器来监测电子设备的温度,该温度可以是电子设备的整机温度,也可以是CPU的温度。
步骤604,根据步骤603中温度的监测结果,若此时电子设备的温度Temp>MIN_TEMP,且dex2oat工作时间WT>MAX_WT,则触发dex2oat工作任务暂停。
其中,MIN_TEMP表示门限温度,该门限温度用于判断电子设备安装应用时温度是否异常的临界温度,MAX_WT用于表示最长工作时间。该MIN_TEMP的值和MAX_WT的值可以通过系统预设来实现,如前文所述,该MIN_TEMP可以为35度至40度之间的任意值,该MAX_WT可以为20s至30s之间的任意值。
应理解,本申请实施例中的WT可以通过图10中的统计dex2oat工作任务的工作时间的方法获取。
其中,该步骤604中虽然触发了dex2oat工作任务停止,但是为了避免应用安装过程中出现的稳定性问题,并不是马上停止当前正在执行的dex2oat工作任务,如前文所述,而是让App2的dex2oat2执行完成才让dex2oat工作任务停止。
步骤605,dex2oat2执行完成。
其中,dex2oat2执行完成后,dex2oat工作任务会停止一段时间,以避免电子设备由于温度过高,而带来稳定性不足的问题。
步骤606,WT清零处理。
其中,触发dex2oat工作任务停止时,将dex2oat的工作时间WT置零,以便于下一个周期中dex2oat的工作时间的统计。
基于上述技术方法,当批量安装应用时,由于dex2oat工作任务执行过程中会有较多的功耗,本申请实施例中的温控策略的优化方法可以避免电子设备由于温度过高而带来稳定性不足的问题。
图14是本申请实施例提供的一种安装应用的方法的示例性流程图。如图14所示,该方法可以包括步骤710至步骤740。
710,电子设备检测到用户触发安装应用程序的操作。
示例性的,用户在应用市场中一次性下载安装多个应用,或者用户使用电子设备克隆恢复多个应用,从一个设备克隆多个应用到另一个设备等。
720,响应于该操作,拷贝并扫描第一应用程序包,该第一应用程序包为该第一应用程序对应的应用程序包。
其中,电子设备响应于用户的操作,拷贝并扫描第一应用程序包,即电子设备上层安装第一应用。
730,在该拷贝并扫描第一应用程序包后的第一时间段内,拷贝并扫描第二应用程序包,该第二应用程序包为第二应用程序对应的应用程序包;
其中,该第一时间段可以在电子设备扫描并拷贝第一应用程序包之后立即开始,也可以在电子设备扫描并拷贝第一应用程序包之后间隔一段时间开始。
740,在该拷贝并扫描第一应用程序包后的第二时间段内,执行对该第一应用程序的优化;其中,该第一时间段和该第二时间段至少部分重叠。
可选地,该第一时间段和第二时间段的起始时间相同,即第二应用的上层安装和第一应用的底层优化是同时进行的。
可选地,该第一时间段和第二时间的起始时间不相同,例如,第一时间段的起始时间晚于第二时间段的起始时间,此时,电子设备上层安装第一应用程序和第二应用程序会间隔一段时间,有利于减轻电子设备出现的发热现象。
上述实施例中以电子设备安装两个应用程序为例进行说明,但这不应对本申请造成任何限定,应理解,更多个应用的安装过程可以参考上述过程。
基于本申请实施例的安装应用的方法,将应用的上层安装过程与底层优化过程并行进行,有利于加快电子设备安装多个应用时的安装速度,从而提升了用户体验。
可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块可以采用硬件的形式实现。需要说明的是,本实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
本实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的安装应用的方法。
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的安装应用的方法。
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的安装应用的方法。
其中,本实施例提供的电子设备、计算机可读存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各 个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (12)

  1. 一种安装应用的方法,其特征在于,所述方法应用于电子设备,所述方法包括:
    检测到用户触发安装第一应用程序和第二应用程序的操作;
    响应于所述操作,拷贝并扫描第一应用程序包,所述第一应用程序包为所述第一应用程序对应的应用程序包;
    在所述拷贝并扫描第一应用程序包后的第一时间段内,拷贝并扫描第二应用程序包,所述第二应用程序包为所述第二应用程序对应的应用程序包;
    在所述拷贝并扫描第一应用程序包后的第二时间段内,执行对所述第一应用程序的优化;
    其中,所述第一时间段和所述第二时间段至少部分重叠。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    检测到用户触发安装第三应用程序和第四应用程序的操作;
    在所述拷贝并扫描所述第一应用程序包后的第三时间段内,拷贝并扫描第三应用程序包,所述第三应用程序包为所述第三应用程序对应的应用程序包;其中,
    在所述第二时间段的时长大于所述第一时间段和所述第三时间段的时长之和时,拷贝并扫描所述第四应用程序包的起始时刻晚于或等于对所述第二应用程序执行优化的起始时刻。
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    检测到用户触发安装第三应用程序的操作;
    在所述第二应用程序包拷贝并扫描完成时,检测所述电子设备的中央处理器CPU的温度;
    确定所述温度大于或等于预设值;
    在所述第二应用程序的优化结束时,暂停第一预设时长;
    在所述第一预设时长之后,拷贝并扫描第三应用程序包,所述第三应用程序包为所述第三应用程序对应的应用程序包。
  4. 根据权利要求3所述的方法,其特征在于,在所述执行对所述第一应用程序的优化之前,执行对第四应用程序的优化,所述确定所述温度大于或等于预设值,包括:
    确定所述温度大于或等于预设值且第四时间段的时长大于或等于第二预设时长;
    其中,所述第四时间段和所述第二时间段相同;或者,
    在所述第二时间段与所述第五时间段的时间间隔小于或等于第三预设时长时,所述第四时间段为所述第二时间段和第五时间段之和,所述第五时间段为所述电子设备执行对所述第四应用程序的优化的时间段。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述执行对所述第一应用程序的优化,包括:
    将第一优化任务加入第一任务队列中,所述第一优化任务用于优化所述第一应用程序;
    启动第一线程,所述第一线程用于将所述第一优化任务从所述第一任务队列中取出;
    调用第一接口,所述第一接口用于启动第二线程,所述第二线程用于执行所述第一优 化任务。
  6. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    一个或多个存储器;
    所述一个或多个存储器存储有一个或多个计算机程序,所述一个或多个计算机程序包括指令,当所述指令被所述一个或多个处理器执行时,使得所述电子设备执行以下步骤:
    检测到用户触发安装第一应用程序和第二应用程序的操作;
    响应于所述操作,拷贝并扫描第一应用程序包,所述第一应用程序包为所述第一应用程序对应的应用程序包;
    在所述拷贝并扫描第一应用程序包后的第一时间段内,拷贝并扫描第二应用程序包,所述第二应用程序包为所述第二应用程序对应的应用程序包;
    在所述拷贝并扫描第一应用程序包后的第二时间段内,执行对所述第一应用程序的优化;
    其中,所述第一时间段和所述第二时间段至少部分重叠。
  7. 根据权利要求6所述的电子设备,其特征在于,当所述指令被所述一个或多个处理器执行时,使得所述电子设备执行以下步骤:
    检测到用户触发安装第三应用程序和第四应用程序的操作;
    在所述拷贝并扫描所述第一应用程序包后的第三时间段内,拷贝并扫描第三应用程序包,所述第三应用程序包为所述第三应用程序对应的应用程序包;其中,
    在所述第二时间段的时长大于所述第一时间段和所述第三时间段的时长之和时,拷贝并扫描所述第四应用程序包的起始时刻晚于或等于对所述第二应用程序执行优化的起始时刻。
  8. 根据权利要求6所述的电子设备,其特征在于,当所述指令被所述一个或多个处理器执行时,使得所述电子设备执行以下步骤:
    检测到用户触发安装第三应用程序的操作;
    在所述第二应用程序包拷贝并扫描完成时,检测所述电子设备的CPU的温度;
    确定所述温度大于或等于预设值;
    在所述第二应用程序的优化结束时,暂停第一预设时长;
    在所述第一预设时长之后,拷贝并扫描第三应用程序包,所述第三应用程序包为所述第三应用程序对应的应用程序包。
  9. 根据权利要求8所述的电子设备,其特征在于,在所述执行对所述第一应用程序的优化之前,执行对第四应用程序的优化,所述电子设备具体用于:
    确定所述温度大于或等于预设值且第四时间段的时长大于或等于第二预设时长;
    其中,所述第四时间段和所述第二时间段相同;或者,
    在所述第二时间段与所述第五时间段的时间间隔小于或等于第三预设时长时,所述第四时间段为所述第二时间段和第五时间段之和,所述第五时间段为所述电子设备执行对所述第四应用程序的优化的时间段。
  10. 根据权利要求6-9中任一项所述的电子设备,其特征在于,所述电子设备具体用于:
    将第一优化任务加入第一任务队列中,所述第一优化任务用于优化所述第一应用程 序;
    启动第一线程,所述第一线程用于将所述第一优化任务从所述第一任务队列中取出;
    调用第一接口,所述第一接口用于启动第二线程,所述第二线程用于执行所述第一优化任务。
  11. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1至5中任一项所述的安装应用的方法。
  12. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1至5中任一项所述的安装应用的方法。
PCT/CN2021/106377 2020-07-23 2021-07-15 安装应用的方法和电子设备 WO2022017244A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21845835.4A EP4170483A4 (en) 2020-07-23 2021-07-15 APPLICATION INSTALLATION METHOD AND ELECTRONIC DEVICE
US18/017,023 US20230289160A1 (en) 2020-07-23 2021-07-15 Application installation method and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010713889.3 2020-07-23
CN202010713889.3A CN113971034A (zh) 2020-07-23 2020-07-23 安装应用的方法和电子设备

Publications (1)

Publication Number Publication Date
WO2022017244A1 true WO2022017244A1 (zh) 2022-01-27

Family

ID=79585046

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/106377 WO2022017244A1 (zh) 2020-07-23 2021-07-15 安装应用的方法和电子设备

Country Status (4)

Country Link
US (1) US20230289160A1 (zh)
EP (1) EP4170483A4 (zh)
CN (1) CN113971034A (zh)
WO (1) WO2022017244A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785221A (zh) * 2022-09-28 2024-03-29 华为技术有限公司 一种应用程序安装方法及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104516754A (zh) * 2013-09-30 2015-04-15 腾讯科技(深圳)有限公司 一种应用程序的批量安装方法和装置
US20170220335A1 (en) * 2016-02-02 2017-08-03 ZeroTurnaround AS System and Method for Fast Initial and Incremental Deployment of Apps
CN111309341A (zh) * 2020-02-17 2020-06-19 中南大学 基于耗时预测的安卓应用安装流程优化方法
CN111435318A (zh) * 2019-01-15 2020-07-21 青岛海信移动通信技术股份有限公司 应用程序的dex优化方法及终端

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106250180B (zh) * 2016-07-27 2019-10-11 宇龙计算机通信科技(深圳)有限公司 一种odex优化控制方法及移动终端
CN107861730B (zh) * 2017-10-27 2020-10-30 维沃移动通信有限公司 一种应用程序的处理方法及移动终端

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104516754A (zh) * 2013-09-30 2015-04-15 腾讯科技(深圳)有限公司 一种应用程序的批量安装方法和装置
US20170220335A1 (en) * 2016-02-02 2017-08-03 ZeroTurnaround AS System and Method for Fast Initial and Incremental Deployment of Apps
CN111435318A (zh) * 2019-01-15 2020-07-21 青岛海信移动通信技术股份有限公司 应用程序的dex优化方法及终端
CN111309341A (zh) * 2020-02-17 2020-06-19 中南大学 基于耗时预测的安卓应用安装流程优化方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4170483A4

Also Published As

Publication number Publication date
CN113971034A (zh) 2022-01-25
US20230289160A1 (en) 2023-09-14
EP4170483A4 (en) 2023-11-22
EP4170483A1 (en) 2023-04-26

Similar Documents

Publication Publication Date Title
WO2020103764A1 (zh) 一种语音控制方法及电子设备
WO2020108356A1 (zh) 一种应用显示方法及电子设备
WO2020119492A1 (zh) 消息处理方法及相关装置
WO2021052415A1 (zh) 资源调度方法及电子设备
WO2021043046A1 (zh) 一种资源管控方法及设备
WO2021159746A1 (zh) 文件共享方法、系统及相关设备
WO2022199509A1 (zh) 应用执行绘制操作的方法及电子设备
WO2022111665A1 (zh) 应用的管理方法、装置、设备及存储介质
WO2020073288A1 (zh) 一种触发电子设备执行功能的方法及电子设备
CN113805797B (zh) 网络资源的处理方法、电子设备及计算机可读存储介质
WO2021218429A1 (zh) 应用窗口的管理方法、终端设备及计算机可读存储介质
WO2023056795A1 (zh) 快速拍照方法、电子设备及计算机可读存储介质
WO2021073337A1 (zh) 安装插件的方法、装置和存储介质
WO2022078105A1 (zh) 内存管理方法、电子设备以及计算机可读存储介质
WO2022143180A1 (zh) 协同显示方法、终端设备及计算机可读存储介质
WO2021057472A1 (zh) 一种显示控制方法与电子设备
WO2021104122A1 (zh) 呼叫需求响应方法、装置及电子设备
CN113568634A (zh) 应用优化的处理方法及处理装置
CN114498028B (zh) 数据传输方法、装置、设备及存储介质
WO2022170856A1 (zh) 建立连接的方法与电子设备
WO2022017244A1 (zh) 安装应用的方法和电子设备
CN113485709B (zh) 应用优化方法、装置以及电子设备
WO2021238376A1 (zh) 功能包的加载方法、装置、服务器和电子设备
WO2021129453A1 (zh) 一种截屏方法及相关设备
CN112783418B (zh) 一种存储应用程序数据的方法及移动终端

Legal Events

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

Ref document number: 21845835

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021845835

Country of ref document: EP

Effective date: 20230118

NENP Non-entry into the national phase

Ref country code: DE