WO2021043046A1 - Resource management and control method and device - Google Patents

Resource management and control method and device Download PDF

Info

Publication number
WO2021043046A1
WO2021043046A1 PCT/CN2020/111494 CN2020111494W WO2021043046A1 WO 2021043046 A1 WO2021043046 A1 WO 2021043046A1 CN 2020111494 W CN2020111494 W CN 2020111494W WO 2021043046 A1 WO2021043046 A1 WO 2021043046A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
application
management
critical
resources
Prior art date
Application number
PCT/CN2020/111494
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Publication of WO2021043046A1 publication Critical patent/WO2021043046A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72454User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the embodiments of the present application relate to the field of electronic technology, and in particular to a method and equipment for resource management and control.
  • an instant messaging application can receive messages in the background
  • a navigation application can continue to navigate in the background
  • a music application can play songs in the background.
  • Background applications need to use resources while they are running.
  • the resources involved in the application program are managed and controlled according to the package name of the application program package (package) or the user identity (UID) of the application program.
  • This control method includes allowing the use of resources or restricting the use of resources.
  • the prior art allows the background application program to use resources normally.
  • the embodiments of the present application provide a resource management and control method and device, which can perform fine-grained management and control of resource usage according to processes in a background application, and can perform different levels of resource management and control for different processes, thereby reducing the burden of background applications.
  • Resource consumption reduce the power consumption of electronic equipment.
  • an embodiment of the present application provides a resource management and control method, including: an electronic device displays an interface of a first application program.
  • the electronic device switches from running the first application program in the foreground to running the first application program in the background, and stops displaying the interface of the first application program.
  • the electronic device determines the critical process and the non-critical process in the first application program.
  • the electronic equipment adopts the first management and control method and the second management and control method respectively to process the resources of the critical process and the non-critical process.
  • the second management and control method has a greater degree of resource management and control than the first management and control method.
  • the mobile phone can perform fine-grained management and control of resource usage according to the process of the background application, and can perform different levels of resource management and control for the key and non-critical processes of the background application.
  • the resource consumption of each application program in the background can be reduced, and the power consumption of the electronic device can be reduced.
  • the electronic device determines the critical process and the non-critical process in the first application program, including: if the first process in the first application program is in the process whitelist, the electronic device determines that the first process is The key process. If the first process in the first application is in the process blacklist, the electronic device determines that the first process is a non-critical process.
  • the electronic device can determine the critical process and the non-critical process according to the preset whitelist and blacklist.
  • the electronic device can determine the critical process and the non-critical process according to the priority of the process in the first application.
  • determining the critical process and non-critical process in the first application by the electronic device includes: if the ADJ value of the first process in the first application is less than or equal to FORREGROUND_APP_ADJ, the electronic device determines that the first process is a critical process. If the ADJ value of the first process in the first application is greater than FORREGROUND_APP_ADJ, the electronic device determines that the first process is a non-critical process.
  • the electronic device can determine the critical process and the non-critical process through information that characterizes the priority of the process, such as the ADJ value.
  • the electronic device determines the critical process and the non-critical process in the first application, including: if the first process in the first application is located in the SCHED_GROUP_BACKGROUND group, the electronic device determines that the first process is The key process. If the first process in the first application is located in another group, the electronic device determines that the first process is a non-critical process.
  • the electronic device can determine the critical process and the non-critical process through the grouping of the process.
  • the electronic device determines the critical process and the non-critical process in the first application program, including: if the first process in the first application program uses the foreground service, the electronic device determines that the first process is The key process. If the first process in the first application does not use the foreground service, the electronic device determines that the first process is a non-critical process.
  • the electronic device can determine whether it is a critical process according to whether the process in the background application uses the foreground service.
  • the electronic device determines the critical process and the non-critical process in the first application program, including: if the first process in the first application program meets the target characteristics, the electronic device determines that the first process is critical Process; where the target feature is a preset feature, or a feature obtained through training of an electronic device. If the first process in the first application program does not meet the target characteristics, the electronic device determines that the first process is a non-critical process.
  • the electronic device can determine whether it is a critical process according to the characteristics of the process in the background application.
  • the electronic device adopts the first management and control method and the second management and control method to process the resources of the key process and the non-critical process, including: the electronic device switches to the background operation in the first application program and experiences After the preset time period T, the electronic device adopts the first management and control mode and the second management and control mode respectively to process the resources of the critical process and the non-critical process.
  • the electronic device may temporarily not perform resource management and control on the background first application program.
  • the probability of the user using the first application program in the foreground again is small, and the electronic device can perform resource management and control on the background first application program.
  • the method further includes: the electronic device is the first application program Process to apply for resources.
  • the electronic device stores resource application information, and the resource application information includes the corresponding relationship between the process and the requested resource.
  • Electronic equipment adopts the first management and control method and the second management and control method to process the resources of the key process and the non-critical process, including: the electronic equipment adopts the first and second management methods according to the resource application information, respectively, and controls the key process and the second control method.
  • Non-critical processes handle resource processing.
  • the electronic device can record the corresponding relationship between the process and the resource when the process applies for the resource, so as to subsequently perform resource management and control on the process according to the corresponding relationship.
  • the first control method includes unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources.
  • the second control method includes restricting the use of resources by non-critical processes.
  • the key processes include the first level, the second level, and the third level.
  • the first management and control method corresponding to the first-level key process includes allowing the key process to use resources.
  • the first management and control method corresponding to the second-level key processes includes the first cycle of unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources.
  • the first management and control method corresponding to the third-level key processes includes unifying the key processes in the second cycle based on the heartbeat packet of the timing alarm Alarm, allowing the key processes to use other resources, and the second cycle is greater than the first cycle.
  • non-critical processes include the first level and the second level.
  • the second management and control method corresponding to the non-critical processes of the first level includes periodically restricting the use of resources by the non-critical processes.
  • the second control method corresponding to the second-level non-critical processes includes restricting the use of resources by non-critical processes.
  • the first control method includes allowing the use of critical resources and restricting the use of non-critical resources.
  • the resources include: navigation satellite system resources, network resources, Bluetooth resources, transmission control protocol (transmission control protocol, TCP) connection resources, audio resources, modem resources, timer alarm resources, wake-up Lock one or more of Wakelock resources, broadcast resources, delayed processing Job resources, or service resources.
  • transmission control protocol transmission control protocol, TCP
  • an embodiment of the present application provides an electronic device, including: a screen for displaying an interface; one or more processors; and a memory in which codes are stored.
  • the electronic device When the code is executed by the electronic device, the electronic device is caused to perform the following steps: display the interface of the first application; switch from running the first application in the foreground to running the first application in the background, and stop displaying the interface of the first application; OK The critical and non-critical processes in the first application; the first and second control methods are used to process the resources of the critical and non-critical processes; the second control method has a greater degree of control over resources than the first control method The degree of control over resources.
  • determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program is in the process whitelist, determining the first process as the critical process. If the first process in the first application is in the process blacklist, it is determined that the first process is a non-critical process.
  • determining the critical process and the non-critical process in the first application program includes: if the ADJ value of the first process in the first application program is less than or equal to FORegROUND_APP_ADJ, then determining that the first process is critical process. If the ADJ value of the first process in the first application is greater than FORREGROUND_APP_ADJ, it is determined that the first process is a non-critical process.
  • determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program is located in the SCHED_GROUP_BACKGROUND group, determining the first process as the critical process. If the first process in the first application is located in another group, it is determined that the first process is a non-critical process.
  • determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program uses the foreground service, determining the first process as the critical process. If the first process in the first application does not use the foreground service, it is determined that the first process is a non-critical process.
  • determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program meets the target characteristics, determining the first process as the critical process.
  • the target feature is a preset feature, or a feature obtained by training of an electronic device. If the first process in the first application program does not meet the target characteristics, the first process is determined to be a non-critical process.
  • the first management and control method and the second management and control method are used to process the resources of key processes and non-critical processes, including: switching the first application to run in the background and experiencing a preset duration of T After that, the first management and control method and the second management and control method are respectively adopted to process the resources of the critical process and the non-critical process.
  • the electronic device when the code is executed by the electronic device, the electronic device is also made to perform the following steps: before the first and second control methods are used to process the resources of the critical process and the non-critical process, Apply for resources for the process in the first application. Save the resource application information.
  • the resource application information includes the corresponding relationship between the process and the requested resource.
  • the first and second control methods are used to process the resources of key and non-critical processes, including: according to the resource application information, the first and second control methods are used to process key and non-critical processes. Resource processing.
  • the first control method includes unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources.
  • the second control method includes restricting the use of resources by non-critical processes.
  • the key processes include the first level, the second level, and the third level.
  • the first management and control method corresponding to the first-level key process includes allowing the key process to use resources.
  • the first management and control method corresponding to the second-level key processes includes the first cycle of unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources.
  • the first management and control method corresponding to the third-level key processes includes unifying the key processes in the second cycle based on the heartbeat packet of the timing alarm Alarm, allowing the key processes to use other resources, and the second cycle is greater than the first cycle.
  • non-critical processes include the first level and the second level.
  • the second management and control method corresponding to the non-critical processes of the first level includes periodically restricting the use of resources by the non-critical processes.
  • the second control method corresponding to the second-level non-critical processes includes restricting the use of resources by non-critical processes.
  • the resources include: navigation satellite system resources, network resources, Bluetooth resources, transmission control protocol TCP connection resources, audio resources, modem resources, timing alarm resources, wakelock resources, broadcast resources , Delay processing of one or more of Job resources or Service resources.
  • an embodiment of the present application provides a resource management and control device, which is included in an electronic device.
  • the device has the function of realizing the behavior of the electronic device in any of the above aspects and possible design methods.
  • This function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes at least one module or unit corresponding to the above-mentioned functions. For example, detecting modules/units, creating modules/units, saving modules/units, displaying modules/units, switching modules/units, determining modules/units, and controlling modules/units, etc.
  • an embodiment of the present application provides a computer storage medium, including computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the resource management and control method in any one of the possible designs in the foregoing aspects.
  • embodiments of the present application provide a computer program product, which when the computer program product runs on a computer, enables the computer to execute the resource management and control method in any one of the possible designs in the foregoing aspects.
  • Figure 1A is a schematic diagram of an application resource provided by the prior art
  • FIG. 1B is a schematic diagram of management of resource application information provided by the prior art
  • FIG. 2 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of the software structure of an electronic device provided by an embodiment of the application.
  • FIG. 4 is a flowchart of a resource management and control method provided by an embodiment of the application.
  • 5A-5B are schematic diagrams of a set of interfaces provided by an embodiment of the application.
  • FIG. 6A is a schematic diagram of management of resource application information provided by an embodiment of this application.
  • FIG. 6B is a schematic diagram of an application resource provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of determining critical processes and non-critical processes according to process characteristics according to an embodiment of the application.
  • FIG. 8 is a schematic diagram of a weak management and control method provided by an embodiment of the application.
  • FIG. 9 is a schematic diagram of a heartbeat mechanism provided by an embodiment of this application.
  • FIG. 10 is a schematic diagram of a strong management and control method provided by an embodiment of the application.
  • first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the present embodiment, unless otherwise specified, "plurality" means two or more.
  • the application can be identified by the package name of the application or the UID of the application user identity. Among them, each UID can correspond to one or more applications.
  • the application can create multiple processes during the running process, and each process can apply for the use of resources according to its own business needs.
  • the resources applied for by the process of the application program may include hardware resources and software resources.
  • the hardware resources may include global navigation satellite system (GNSS) resources, network resources, bluetooth (BT) resources, transmission control protocol TCP connection resources, audio resources or modem resources, etc.
  • GNSS resources can include global positioning system (GPS) resources, global navigation satellite system (GLONASS) resources, Beidou navigation satellite system (BDS) resources, and quasi-zenith Satellite system (quasi-zenith satellite system, QZSS) resources and/or satellite-based augmentation systems (satellite-based augmentation systems, SBAS) resources, etc.
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith Satellite system
  • SBAS satellite-based augmentation systems
  • Network resources refer to resources that can be used for surfing the Internet, such as operators' mobile data service (2G/3G/4G/5G) resources or wireless fidelity (Wi-Fi) resources.
  • the TCP connection can exchange information through the socket Socket link.
  • Audio resources are used to implement audio playback, such as speaker resources or audio codec resources.
  • the software resources may include timing alarm resources, wakelock resources, broadcast resources, delayed processing job resources or service service resources, etc.
  • the Alarm resource can be used for system-level prompts according to the set time or cycle.
  • Wakelock resources can be used to prevent the processor from sleeping.
  • Broadcast resources can be used to transfer information between different applications or different components.
  • Job resource is a resource in a library that can be processed in a delayed manner in the background.
  • Service resource is an application component that can perform long-running operations in the background without a user interface.
  • the resource manager in the electronic device running the application program may save the resource application information.
  • the resource application information includes the package name and UID of the application requesting the resource, and the resource requesting the application.
  • the resource application information may also include relevant information such as the application time and application duration of the resource. In other words, the prior art counts the resource application information of the process according to the package name and UID.
  • the electronic device performs resource management and control according to the package name or UID of the application program.
  • the electronic device allows the application program to enter the background to be able to use various resources normally.
  • the package name of background application 1 is package name 1, and the corresponding UID is UID1.
  • the electronic device allows the requested resource corresponding to package name 1 to be used normally; in another prior art, the electronic device allows the requested resource corresponding to UID1 to be used normally, so that the application Program 1 can run in the background.
  • the existing technology allows each process in the background application program to use resources normally, but in fact the resources of some processes do not necessarily need to be used, so the existing technology adopts the solution As a result, the resource consumption and power consumption of the electronic device are relatively high.
  • the embodiment of the present application provides a resource management and control method, which can be applied to electronic devices.
  • Electronic devices can perform fine-grained management and control of resource usage based on processes in background applications.
  • the electronic device can perform different levels of resource management and control.
  • the electronic device can control the resources of some processes in the background application regardless of control or weak control, that is, the degree and intensity of control is small; and the resources of other processes can be strongly controlled, that is, the degree and intensity of control is greater. Therefore, compared with the prior art allowing each process in the background application program to use various resources normally, the resource management and control method provided by the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
  • the electronic device may be a mobile phone, a tablet computer, a folding screen device, a netbook, a personal digital assistant (personal digital assistant, PDA), a wearable device, or augmented reality (AR)/virtual reality (VR) Devices, etc.
  • PDA personal digital assistant
  • AR augmented reality
  • VR virtual reality
  • FIG. 2 shows a schematic structural diagram of the 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 charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone 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, etc.
  • 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 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 structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and 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.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that the processor 110 has just used or used cyclically. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • 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, and a 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 (USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous transmitter receiver/transmitter
  • 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, which includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may include multiple sets of I2C buses.
  • the processor 110 may couple the touch sensor 180K, the charger, the flash, the camera 193, etc., respectively through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement the touch function of the electronic device 100.
  • the I2S interface can be used for audio communication.
  • the processor 110 may include 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 may transmit audio signals to the wireless communication module 160 through an I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communication to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 may 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 I2S interface and PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • the UART interface is generally used to connect the processor 110 and the wireless communication module 160.
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to realize the Bluetooth function.
  • the audio module 170 may transmit audio signals to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with the display screen 194, the camera 193 and other peripheral devices.
  • the MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and so on.
  • the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device 100.
  • the processor 110 and the display screen 194 communicate through a DSI interface to realize the display function of the electronic device 100.
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can 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 so on.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect earphones and play audio through earphones. This interface can also be used to connect to other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the electronic device 100.
  • the electronic device 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive the wireless charging input through the 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 to connect 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 charge 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, and 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 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic wave radiation via 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 and at least part of the modules of the processor 110 may be provided in the same device.
  • 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. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor.
  • the application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194.
  • the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and 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), and global navigation satellites.
  • WLAN wireless local area networks
  • BT wireless fidelity
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication technology
  • infrared technology infrared, IR
  • 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 may also receive the signal to be sent from the processor 110, perform frequency modulation, amplify it, and convert it into electromagnetic waves to radiate 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.
  • Wireless communication technologies can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), and broadband code division. Multiple access (wideband 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.
  • GSM global system for mobile communications
  • GPRS general packet radio service
  • CDMA code division multiple access
  • CDMA broadband code division. Multiple access
  • WCDMA wideband code division multiple access
  • TD-SCDMA time-division code division multiple access
  • LTE long term evolution
  • BT GNSS
  • WLAN Wireless Fidelity
  • NFC NFC
  • FM And/or IR technology
  • GNSS may
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor, which is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • AMOLED flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the electronic device 100 may include one or N display screens 194, and N is a positive integer greater than one.
  • the electronic device 100 can realize a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal. The photosensitive element of the camera transmits the electrical signal to the ISP for processing and transforms it into an image visible to the naked eye. ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object generates an optical image through the lens and is projected to 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 transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they 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 energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, and so on.
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, and so on.
  • the external memory interface 120 may 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, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, and the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by running 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, at least one application program (such as a sound playback function, an image playback function, etc.) required by at least one function.
  • the data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device 100.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
  • the speaker 170A also called “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 called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through the 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 noise reduction functions in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, and a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA, CTIA
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the capacitive pressure sensor may include at least two parallel plates with conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example, when a touch operation whose intensity of the touch operation is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the movement posture of the electronic device 100.
  • the angular velocity of the electronic device 100 around three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip holster.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and apply to applications such as horizontal and vertical screen switching, pedometers and so on.
  • the electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • the electronic device 100 uses a photodiode 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 can determine that there is no object in the vicinity of 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.
  • the proximity light sensor 180G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
  • the ambient light sensor 180L is used to sense the brightness of the ambient light.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
  • the temperature sensor 180J is used to detect 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, so as to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can obtain the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the human pulse and receive the blood pressure pulse signal.
  • the bone conduction sensor 180M may also be provided in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can parse the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180M, and realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, and realize the heart rate detection function.
  • the button 190 includes a power-on button, a volume button, and so on.
  • the button 190 may be a mechanical button. It can also be a touch button.
  • the electronic device 100 may receive key input, and generate key signal input related to user settings and function control of the electronic device 100.
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback.
  • touch operations that act on different applications can correspond to different vibration feedback effects.
  • Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminding, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device 100.
  • the electronic device 100 may support one or N SIM card interfaces, and N is a positive integer greater than one.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
  • the same SIM card interface 195 can insert multiple cards at the same time. The types of multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 may also be compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication.
  • the electronic device 100 adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
  • the processor 110 may run instructions stored in the internal memory 121 to perform fine-grained control of resource usage according to processes in the background application.
  • the electronic device can perform different levels of resource management and control. Among them, the electronic device can control the resources of some processes in the background application regardless of control or weak control, and control the resources of other processes strongly. Therefore, compared with the prior art allowing each process in the background application program to use various resources normally, the resource management and control method provided by the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
  • 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 embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 by way of example.
  • FIG. 3 is a software structure block diagram of the electronic device 100 according to an 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. Communication between layers through software interface.
  • the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer can include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and so on.
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display, determine whether there is a status bar, lock the screen, take a screenshot, etc.
  • the content provider is used to store and retrieve data and make these data accessible to applications.
  • Data can include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, and so on.
  • the view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
  • the phone manager is used to provide the communication function of the electronic device 100. For example, the management of the call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc., and can also be used to fine-grain and control the resources of the background application according to the process.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can disappear automatically after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, and so on.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
  • Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the application layer and the application framework layer run in a virtual machine.
  • 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 life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to realize 3D graphics drawing, image rendering, synthesis, and layer processing.
  • the 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the kernel layer can also include some network protocols for controlling TCP connections and network resources.
  • the resource manager in the application framework layer can perform fine-grained management and control of resource usage for the processes in the background application. Moreover, for different processes in the background application, the resource manager can perform resource management and control of different degrees and strengths. Therefore, compared with allowing each process in the background application program to use various resources normally, the resource management and control method provided in the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
  • background applications may include critical processes and non-critical processes.
  • the key process is an important process, or a process perceivable by the user.
  • Electronic equipment can perform lesser and lesser resource management and control for key processes, and greater and more powerful resource management and control for non-critical processes.
  • the electronic device as a mobile phone with the structure shown in FIG. 2 and FIG. 3 as an example to illustrate the resource management and control method provided in the embodiment of the present application.
  • the method may include:
  • the mobile phone After the mobile phone detects the first operation instructed by the user to open the first application, it runs the first application in the foreground.
  • the first application program may be a system application program or a third-party application program, which is not limited in the embodiment of the present application.
  • the user can instruct the mobile phone to open the first application by clicking on the icon of the first application program, voice commands, or gestures in the air, etc. in various ways.
  • the first application is an instant messaging application, such as QQ, WeChat, facetime, or skype.
  • the first application is QQ as an example for description.
  • the mobile phone detects the first operation of the user clicking the QQ icon 501; in response to the first operation, the mobile phone starts the QQ application in the foreground.
  • the mobile phone creates a process of the first application, and the process in the first application applies for resources.
  • the process of the first application can be created.
  • the mobile phone can create one or more of the QQ main process, the QQ tool process, the QQ space process, the QQ message receiving/sending process, and the download service process.
  • the package name and the application program have a one-to-one correspondence and are fixed; each UID can correspond to one or more applications, and the UID corresponding to the application program may change after the application program is uninstalled and reinstalled.
  • the mobile phone can create one or more of the WeChat main interface process, the WeChat message receiving/sending process, and the WeChat tool process.
  • each process in the first application program may apply for resources, and the resources may include the above-mentioned software resources and/or hardware resources to support the normal operation of various functional services of the first application program.
  • the mobile phone saves resource application information, where the resource application information includes the corresponding relationship between the process in the first application program and the requested resource.
  • the resource application information can be saved through the resource manager.
  • the resource application information includes the corresponding relationship between the process in the first application program and the requested resource.
  • the resource application information includes the process identity document (PID) and/or process name in the first application, and the corresponding relationship between the requested resource.
  • the corresponding relationship may also include the package name and/or UID of the application.
  • the corresponding relationship may also include related information such as application time and application duration of the resource applied for by the process.
  • the package name of the first application program is package name 1, and the UID corresponding to the first application program is UID1.
  • UID1 the UID corresponding to the first application program
  • the resource manager may include an application-level resource management module and a process-level resource management control module.
  • the corresponding process of step 402 and step 403 can be seen in Fig. 6B.
  • the mobile phone displays the interface of the first application program.
  • the interface of the first application program can be displayed on the screen.
  • a schematic diagram of the mobile phone displaying the QQ interface in the foreground can be seen in Fig. 5B.
  • the first application may first apply for resources and then display the interface, or may display the interface before applying for resources, which is not limited in the embodiment of this application.
  • the mobile phone switches from running the first application program in the foreground to running the first application program in the background, and stops displaying the interface of the first application program.
  • the mobile phone can run the first application program from the foreground and switch to the background operation of the first application program.
  • the mobile phone when the first application is running in the foreground of the mobile phone, if the mobile phone detects the user's instruction to open another application, the mobile phone switches from running the first application in the foreground to running the first application in the background.
  • the mobile phone when the first application is running in the foreground of the mobile phone, if the mobile phone detects an operation instructing to open the desktop by the user, the mobile phone switches from running the first application in the foreground to running the first application in the background.
  • the mobile phone when the first application program is running in the foreground of the mobile phone, if the mobile phone detects the operation of the user instructing the screen to rest, the mobile phone switches from running the first application program in the foreground to running the first application program in the background.
  • the mobile phone when the first application is running in the foreground of the mobile phone, if the mobile phone detects that the user has not used the mobile phone for a long time and automatically turns off the screen, the mobile phone switches from running the first application in the foreground to running the first application in the background.
  • each process in the first application may also apply for resources, and the mobile phone may save the resource application information in the manner described in step 403.
  • the mobile phone determines the critical process and the non-critical process in the first application.
  • the mobile phone can determine the critical process and non-critical process in the first application, so that the mobile phone can use different control methods for resource management and control for the critical process and the non-critical process.
  • the key process is an important process, or a process perceivable by the user. There are many ways for a mobile phone to determine critical processes and non-critical processes.
  • the mobile phone saves a list of critical processes and a list of non-critical processes.
  • the mobile phone may determine the key process in the first application program according to the key process list, and determine the non-critical process in the first application program according to the non-critical process list.
  • a process white list and a process black list are saved on the mobile phone.
  • the process whitelist includes multiple critical processes of multiple applications
  • the process blacklist includes multiple non-critical processes of multiple applications. If the first process in the first application is in the process whitelist, the mobile phone determines that the first process is a key process. If the first application program determines that the first process is in the process blacklist, the mobile phone determines that the first process is a non-critical process.
  • the QQ message receiving/sending process in the QQ process is in the white list, and the QQ message receiving/sending process is the key process.
  • the QQ tool process in the QQ process is in the blacklist, so it is a non-critical process.
  • the QQ message receiving/sending process in the QQ process is in the whitelist, and the QQ message receiving/sending process is the key process.
  • the main QQ process, the QQ tool process, and the QQ space process in the QQ process are in the blacklist, so they are non-critical processes.
  • the process in the application program has a priority
  • the mobile phone can determine whether the process in the first application program is a critical process or a non-critical process according to the priority of the process.
  • the priority of a process can be represented by the ADJ value corresponding to the process.
  • a process with an ADJ value less than or equal to the value of FORREGROUND_APP_ADJ is a critical process; a process with an ADJ value greater than the value of FORREGROUND_APP_ADJ is a non-critical process.
  • the mobile phone may determine whether the process in the first background application is a critical process or a non-critical process according to the group to which the process belongs. For example, in the Android operating system, processes in the SCHED_GROUP_BACKGROUND group are non-critical processes, and processes in other groups (for example, the SCHED_GROUP_FOREGROUND group) are key processes.
  • the mobile phone may determine whether the process in the first background application is a critical process or a non-critical process according to the service type used by the process. For example, in the Android operating system, the process that uses the foreground service in the first application program is a critical process, and the process that does not use the foreground service is a non-critical process.
  • the mobile phone may determine the critical process and the non-critical process according to the function or type of the first application program. For example, if the first application is an instant messaging application, the message receiving/sending process is a key process. For another example, if the first application is a navigation application, the navigation process is a key process.
  • the mobile phone can learn and recognize whether the process is a critical process or a non-critical process according to the characteristics of the process.
  • the cloud server can learn and identify whether the process is a critical process or a non-critical process according to the characteristics of the process, and the mobile phone can obtain the identification result of the process from the cloud server.
  • the key process can usually be a background process that is perceivable by the user. If the background processes meet the target characteristics shown in Table 3, which are usually associated with the user’s perception, the mobile phone can determine that these processes are user-perceivable message receiving/sending processes, alarm clock processes, uploading/downloading processes, and audio playback Key processes such as class process or navigation class process.
  • the mobile phone can collect heartbeats and network data packets according to the process, record notifications, vibrations, or collect other related information about the process.
  • the mobile phone recognizes whether the process characteristics shown in Table 3 are satisfied according to the relevant information; if it is satisfied, the mobile phone determines that the process is a critical process; if not, the mobile phone determines that the process is a non-critical process.
  • having network authority means that the process has the authority to use network resources and can use network resources normally.
  • the mobile phone can collect heartbeats and network data packets according to the process, record notifications, vibrations, or collect other related information of the process, and upload it to the cloud server.
  • the cloud server recognizes whether the process characteristics shown in Table 3 are satisfied according to the relevant information of the process; if it is satisfied, the cloud server determines that the process is a critical process; if it is not satisfied, the cloud server determines that the process is a non-critical process.
  • the cloud server returns the identification result of the process to the mobile phone.
  • the process of a mobile phone background application has the following characteristics: continuous sound playback, network, resident notification bar (that is, it often resides in the notification bar), and I/O operations.
  • the mobile phone can determine that the process is a key process of the audio playback process.
  • the mobile phone or cloud service determines whether the process is a critical process or a non-critical process according to the process characteristics. This can be done every time the first application enters the background; it can also be learned and trained in advance, and the process recognition training can be saved result. For example, key processes obtained by pre-learning and training can be stored in the aforementioned process whitelist, and non-key processes obtained by pre-learning and training can be stored in the aforementioned process blacklist.
  • the mobile phone After determining the critical process and non-critical process in the first background application, the mobile phone executes step 407 and step 408 for the critical process and the non-critical process, respectively.
  • the mobile phone adopts the first management and control method for resource management and control for key processes.
  • the mobile phone uses the second management and control method for resource management and control for non-critical processes, and the second management and control method has a greater degree of resource management and control than the first management and control method for resources.
  • the mobile phone can perform fine-grained management and control of the resource usage of the background application from the perspective of the process, and can perform different levels of resource management and control for the key and non-critical processes of the background application. Therefore, compared with the prior art allowing the normal resources of each process in the background application program, the resource management and control method provided in the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
  • the mobile phone uses resource management to process the first application in the background to protect the process of the first application without killing the process of the first application, so that the first application can continue to run in the background and in the background.
  • the first application is switched from the background to the foreground again, there is no need to load the process again, which can increase the speed at which the first application is started in the foreground, so that the interface of the first application is quickly displayed in the foreground.
  • the mobile phone After the first application has just switched to the background, there is a high probability that the user wants to use the first application in the foreground again in a short time. For example, when the user uses WeChat, the mobile phone receives a short message; when the user views the short message, WeChat switches to the background; when the user uses WeChat again after viewing the short message, WeChat switches to the foreground again. Therefore, in some embodiments, after the first application is switched to the background, the mobile phone may not immediately perform steps 407-408, so that when the mobile phone switches the first application from the background to the foreground again in a short time, it can be guaranteed The first application in the foreground can run normally.
  • the mobile phone can perform step 407-step 408 to update the first application in the background.
  • the preset duration T when the first application is switched from the foreground to the background when the mobile phone is on, the user is more likely to want to use the first application in the foreground again in a short period of time, and the preset duration T may be T1, T1 can be longer, for example, T1 can be 1 min. In the case that the first application is switched from the foreground to the background by the screen of the mobile phone, the probability that the user wants to use the first application in the foreground again in a short period of time is relatively small.
  • the preset duration T can be T2, and T2 can be shorter. For example, T2 can be 6s.
  • the phone When the phone is on, the first application is switched from the foreground to the background, and then the phone is off, if T1 ends before T2, the phone executes step 407-step 408 when T1 ends; if T2 ends before T1, Then the mobile phone executes step 407-step 408 at the end of T2.
  • T1 is 1min
  • T2 is 6s
  • the first application is switched to the background at time t1; after 20s (less than T1) after t1, that is, at time t2, the phone screen is off; after the screen is off, 6s( That is, at time t3 after the preset time period T2), the mobile phone executes step 407 to step 408.
  • the time interval between time t3 and time t1 is less than 1 min.
  • the mobile phone may not immediately perform step 406; after the first application is switched to the background and the preset time period T has elapsed, the user may not want to be in the foreground again in a short time.
  • the first application program is used, so the mobile phone can perform step 406 to step 408 to perform resource management and control on the key processes and non-critical processes in the background first application program.
  • the first management and control method is that the mobile phone allows the key processes of the first application in the background to use various resources normally, including the normal use of the resources that have been applied for, and the normal application of various resources, so that the first application The key process can run normally in the background. That is to say, the mobile phone does not limit the resource usage of the key process of the first application, and the first management and control method may be a control-independent method. Among them, the mobile phone can determine the corresponding relationship between the key process and the requested resource according to the resource application information.
  • the first management and control mode is a weak management and control mode. That is, the mobile phone controls the key processes of the first application program in the background to a lesser degree and with less intensity, so as to make the key processes of the first application program continue to run in the background as far as possible. Specifically, the mobile phone can perform weak control over the key process according to the process identifier or process name of the key process.
  • the mobile phone's weak management and control methods for key processes can include: unify Alarm heartbeat according to the process; keep the TCP connection alive according to the process, and the TCP connection is continuously connected; does not limit the network permissions of the process; Use of resources such as job/broadcasting. In other words, weakly control the Alarm resources of key processes, allowing key processes to use other resources normally.
  • Alarm heartbeat is a heartbeat mechanism based on Alarm resources.
  • Unifying the Alarm heartbeat by process means that the heartbeat packets based on Alarm resources are unified by process, that is, the heartbeat packets in the current key process are sent according to the preset cycle T3.
  • the heartbeat packet refers to a custom command word between the client and the server to notify the other party of their own status at regular intervals, which is similar to the heartbeat, so it is called the heartbeat packet.
  • Keep-alive TCP connection by process means that the TCP connection of the current key process is kept alive, and the Socket link used to realize the TCP connection is not broken.
  • the application (that is, the client (Client)) sends a keepalive data packet, that is, a heartbeat packet, to the server (Server).
  • a keepalive data packet that is, a heartbeat packet
  • the server sends a keepalive data packet to the server (Server).
  • the client periodically wakes up the operating system through the Alarm. After the operating system is woken up, the client sends a heartbeat packet to the server, handshake with the server; and receives an acknowledgement (ACK) packet returned by the server.
  • ACK acknowledgement
  • the mobile phone running the client will remind the user, including multiple reminders such as notification bar message reminders, ring reminders or vibration reminders.
  • the heartbeat packets of different key processes in the same application in the background can be sent in the same preset period T3 (for example, 5 min), which can reduce the number of times the operating system is awakened and reduce the power consumption of the mobile phone. .
  • the heartbeat packets of different key processes in different applications in the background of the mobile phone can be sent in the same preset period T3, which can reduce the number of times the operating system is awakened and reduce the power consumption of the mobile phone.
  • the second control method is a strong control method, that is, the mobile phone controls the non-critical processes of the first application program in the background to a greater degree and with greater intensity.
  • the second control method is to restrict non-critical processes from using resources, including releasing resources requested by non-critical processes, that is, restrict non-critical processes from using resources that have been applied for, and restrict non-critical processes from applying for resources.
  • resources including releasing resources requested by non-critical processes, that is, restrict non-critical processes from using resources that have been applied for, and restrict non-critical processes from applying for resources.
  • the mobile phone can determine the correspondence between the non-critical process and the requested resource according to the resource application information.
  • the strong control methods can include: pause Alarm heartbeat according to process; disconnect TCP connection according to process; limit network permissions according to process; buffer or discard broadcast according to process; pause GNSS/Wakelock/Job/ according to process Use of resources such as broadcasting.
  • suspending the Alarm heartbeat by process means stopping the current non-critical process based on the Alarm heartbeat packet.
  • the TCP connection is through the Socket link for information exchange, and the TCP connection is disconnected according to the process, that is, the Socket link corresponding to the TCP connection of the current non-critical process is disconnected.
  • Restricting network permissions by process refers to restricting the use of network resources by current non-critical processes.
  • Suspending resources such as GNSS/Wakelock/Job/broadcast by process means that the current non-critical processes are prohibited from using resources such as GNSS/Wakelock/Job/broadcast.
  • suspending broadcast resources by process includes caching or discarding broadcast content of current non-critical processes.
  • a process may include multiple Socket links.
  • the Socket link is disconnected, a four-way handshake interaction is required between the mobile phone and the server, and multiple data packets need to be sent.
  • the disconnection time of different Socket links in the process is different. For example, after the Socket link has no message interaction time greater than or equal to the preset duration T4 (for example, it can be 8 minutes), the four-way handshake can be disconnected.
  • T4 for example, it can be 8 minutes
  • the Socket links in the same non-critical process can be disconnected uniformly at the same time. For example, after determining that the current process is a critical process, and the first application program enters the background for T duration, the mobile phone may uniformly disconnect the Socket links in the non-critical process. When the unified link is disconnected, the mobile phone can send a reset message (or RST packet) to the server.
  • the reset message includes the source and destination IP addresses and port numbers of the Socket links in the non-critical process to notify The server uniformly disconnects the Socket link in the process. Therefore, the disconnection process does not require multiple message interactions, consumes less resources, and consumes less power.
  • each QQ process creates multiple Socket links for TCP connections. For example, each QQ process creates 28 Socket links for TCP connections, of which 27 Socket links are created by the tool process application, and the other Socket link is created by the message receiving/sending process. If the method in the prior art is adopted, after QQ enters the background, the mobile phone allows each process of QQ to use resources normally according to the package name or UID, that is, all 28 Socket links are reserved.
  • the key process of QQ includes the message receiving/sending process
  • the non-critical process includes the tool process.
  • the mobile phone can allow the key process message receiving/sending process to normally use the 1 Socket link created, and disconnect the 27 Socket links created by the non-critical process tool process.
  • the resource consumption of the background QQ can be reduced, and the power consumption of the mobile phone can be reduced.
  • the Socket links in the non-critical processes in the same application can be disconnected at the same time.
  • resource consumption can be reduced more, and the power consumption of the mobile phone can be reduced.
  • the second management and control method is to restrict non-critical processes from using one or more resources.
  • mobile phones can restrict non-critical processes from using Socket links and network resources, but allow non-critical processes to use Alarm resources normally.
  • the mobile phone can further reduce resource consumption and power consumption. For example, if only the network permissions of non-critical processes are restricted and the TCP connection of non-critical processes is not disconnected, the mobile phone will still try to receive/send messages through the TCP connection. These messages are blocked at the network firewall of the mobile phone, but the mobile phone is still consumed. More resources and power consumption. If only the TCP connection of the non-critical process is disconnected, and the network permissions of the non-critical process are not restricted, the non-critical process may try to re-establish the TCP connection after disconnecting the TCP connection, which will consume more resources and power consumption of the mobile phone. .
  • the key process may include multiple levels, the higher the level, the more important the key process, or the higher the level, the easier the function service of the key process is to be perceived by the user.
  • Different levels of key processes can correspond to different first management and control methods.
  • the higher the level of the key process the smaller the control intensity of the corresponding first control method. This can minimize the resource consumption of other processes and reduce the power consumption of the mobile phone on the basis of ensuring the normal operation of the key process with a high level.
  • the key process includes the first level, the second level, and the third level in descending order.
  • Alarm heartbeat as an example.
  • the mobile phone In the first control mode corresponding to the first level, the mobile phone does not control the Alarm heartbeat cycle in this critical process, that is, it does not control the use of Alarm resources; in the second level, the first control mode corresponds to In the key process, the alarm heartbeat cycle is 5min; in the first control mode corresponding to the third level, the alarm heartbeat cycle in the key process is 10min.
  • the non-critical process may include multiple levels, and the lower the level of the non-critical process is, the less important it is, or the higher the level of the key process, the less likely it is to be perceived by the user.
  • Different levels of non-critical processes can correspond to different second management and control methods.
  • the lower the level of non-critical processes the greater the control intensity of the corresponding second control method, which can minimize the resource consumption of unimportant non-critical processes and reduce the power consumption of mobile phones.
  • non-critical processes include first and second levels ranked from high to low.
  • the mobile phone periodically restricts the use of resources by non-critical processes, that is, periodically allows and restricts the use of resources by non-critical processes.
  • the mobile phone in the second management and control mode corresponding to the first level, the mobile phone periodically restricts the network permissions of non-critical processes, that is, periodically allows and restricts the use of network resources by non-critical processes.
  • the mobile phone restricts the use of resources (such as network resources, etc.) by non-critical processes.
  • different key processes of the background application program may correspond to different key resources, and the key resources are used to support the main functions of the key process.
  • the mobile phone can not control the key resources of the key process, and weakly or strongly control other resources, so as to reduce the resource and power consumption of the mobile phone by minimizing the use of resources.
  • the message receiving/sending process is usually a key process, and the key resources corresponding to the message receiving/sending process include the TCP connection resources used to support the message receiving/sending function. , Network resources and Alarm resources.
  • the mobile phone can allow the message receiving/sending process in the instant messaging application to use TCP connection resources, network resources, and Alarm resources normally; and weakly or strongly control other resources (such as GPS resources, broadcast resources, etc.) requested by the message receiving/sending process. Management and control (such as restricting or periodically restricting the use of other resources requested by the message receiving/sending process).
  • the navigation process is usually a key process
  • the key resources corresponding to the navigation process include GNSS resources and network resources for supporting navigation functions.
  • the mobile phone can allow the navigation process in the navigation application program to use GNSS resources normally, and weakly or strongly control other resource processes applied for by the navigation process.
  • the navigation application program 1 may include a navigation application main process, a navigation process, a push message process, and the like.
  • the navigation process is a key process
  • the key resources in the navigation process include GNSS resources and network resources.
  • the navigation application 2 may include a navigation application main process, a map navigation process, a patch update process, and so on.
  • the map navigation process is a key process, and the key resources of the navigation process include GNSS resources and network resources.
  • the playback process is usually a key process
  • the key resources corresponding to the playback process include audio resources for supporting the audio playback function.
  • the key resource may also include network resources.
  • the mobile phone can allow the playback process in the audio playback application to use audio resources normally, and weakly or strongly control other resource processes requested by the playback process.
  • the audio playback application program 1 and the audio playback application program 2 may include an application main process and a playback process.
  • the playback process is the key process
  • the audio resources in the playback process are the key resources.
  • the mobile phone may not perform resource management and control, or the mobile phone may use a preset resource management method (for example, the resource management method in the prior art) to control it. Carry out resource management and control.
  • the QQ message receiving/sending process in QQ is a critical process
  • the QQ tool process is a non-critical process
  • other processes such as the QQ main process and the QQ space process are critical processes and other processes other than non-critical processes.
  • the mobile phone may not perform resource management and control on other processes such as the QQ main process and the QQ space process, or the mobile phone may use the resource management method in the prior art to perform resource management and control on other processes such as the QQ main process and the QQ space process.
  • the method may further include:
  • the mobile phone switches from running the first application program in the background to running the first application program in the foreground.
  • each process in the first application program can use various resources normally to realize various functions and services of the first application program.
  • the mobile phone switches from running the first application program in the foreground to running the first application program in the background again.
  • the mobile phone can use the resource management and control method described in the above embodiment to perform resource management and control on key processes and non-critical processes.
  • the mobile phone can execute the direct step 407 and step 408, so as to check the information in the background first application. Resource management and control for critical and non-critical processes.
  • the mobile phone can perform step 406-step 408 to determine the critical process and non-critical process of the first background application program, and compare the critical process and non-critical process of the first background application program. Carry out resource management and control.
  • the above description is mainly based on an example in which the electronic device is a mobile phone.
  • the resource management and control method provided in the embodiment of the present application can also be applied to other electronic devices such as tablets, and will not be repeated here.
  • an embodiment of the present application also provides an electronic device, including a detection unit, a creation unit, a storage unit, a display unit, a switching unit, a determination unit, and a management and control unit.
  • Each unit can cooperate with each other to make the electronic device perform the above-mentioned embodiments.
  • Each step of the implementation of the above-mentioned resource management and control method is also provided.
  • the embodiments of the present application also provide an electronic device, including one or more processors; a memory; and one or more computer programs.
  • One or more computer programs are stored in the memory, and the one or more computer programs include instructions.
  • the electronic device is caused to execute each step in the foregoing embodiment, so as to implement the foregoing resource management and control method.
  • the embodiment of the present application also provides a computer storage medium, the computer storage medium stores computer instructions, when the computer instructions run on the electronic device, the electronic device executes the above-mentioned related method steps to realize the resource management and control in the above-mentioned embodiment method.
  • the embodiments of the present application also provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute the above-mentioned related steps, so as to realize the resource management and control method executed by the electronic device in the above-mentioned embodiment.
  • the embodiments of the present application also provide a device.
  • the device may specifically be a chip, component or module.
  • the device may include a processor and a memory connected to each other.
  • the memory is used to store computer execution instructions.
  • the processor can execute the computer-executable instructions stored in the memory, so that the chip executes the resource management and control methods executed by the electronic device in the foregoing method embodiments.
  • the electronic devices, computer storage media, computer program products, or chips provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the corresponding methods provided above. The beneficial effects of the method are not repeated here.
  • the disclosed device and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another device, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate parts may or may not be physically separate.
  • the parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium. It includes several instructions to make a device (may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read only memory (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)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Environmental & Geological Engineering (AREA)
  • Telephone Function (AREA)

Abstract

Provided are a resource management and control method and device, wherein same relate to the technical field of electronics. The fine granularity can be managed and controlled for resource use according to a process in a background application program, thereby reducing the resource consumption of the background application program, and reducing the power consumption of an electronic device. The specific solution is: an electronic device displaying an interface of a first application program; the electronic device being switched from a state where a foreground operates the first application program to a state where a background operates the first application program, and stopping displaying the interface of the first application program; the electronic device determining a key process and a non-key process in the first application program; and the electronic device respectively using a first management and control mode and a second management and control mode to perform resource processing on the key process and the non-key process, wherein the degree of management and control of the second management and control mode for resources is greater than that of the first management and control mode. The embodiments of the present application are used for resource management and control.

Description

一种资源管控方法及设备Resource management and control method and equipment
本申请要求于2019年9月5日提交国家知识产权局、申请号为201910834397.7、申请名称为“一种进程管理方法”,以及于2019年9月17日提交国家知识产权局、申请号为201910877656.4、申请名称为“一种资源管控方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application is required to be submitted to the State Intellectual Property Office on September 5, 2019, with the application number of 201910834397.7, the application name being "a process management method", and the State Intellectual Property Office on September 17, 2019, with the application number being 201910877656.4 1. The priority of the Chinese patent application titled "A method and equipment for resource management and control", the entire content of which is incorporated into this application by reference.
技术领域Technical field
本申请实施例涉及电子技术领域,尤其涉及一种资源管控方法及设备。The embodiments of the present application relate to the field of electronic technology, and in particular to a method and equipment for resource management and control.
背景技术Background technique
目前,手机或平板电脑等电子设备通常支持后台多任务,应用程序从前台切换到后台后也能够继续运行。例如,即时消息应用程序在后台可以收消息,导航应用程序在后台可以继续导航,音乐应用程序在后台可以播放歌曲等。后台应用程序在运行时需要使用资源。At present, electronic devices such as mobile phones or tablet computers usually support background multitasking, and applications can continue to run after switching from the foreground to the background. For example, an instant messaging application can receive messages in the background, a navigation application can continue to navigate in the background, and a music application can play songs in the background. Background applications need to use resources while they are running.
现有技术按照应用程序包(package)的包名或应用程序用户身份标识(user identity,UID),对应用程序涉及的资源进行管控。该管控方式包括允许使用资源或限制使用资源。为了使得应用程序在后台能够继续运行,现有技术允许后台应用程序正常使用资源。In the prior art, the resources involved in the application program are managed and controlled according to the package name of the application program package (package) or the user identity (UID) of the application program. This control method includes allowing the use of resources or restricting the use of resources. In order to enable the application program to continue to run in the background, the prior art allows the background application program to use resources normally.
在该方案中,当应用程序在后台运行时,尤其在后台运行有多个应用程序时,后台应用程序将使得电子设备的资源消耗和功耗较大。In this solution, when the application program is running in the background, especially when there are multiple application programs running in the background, the background application program will cause the resource consumption and power consumption of the electronic device to be relatively large.
发明内容Summary of the invention
本申请实施例提供一种资源管控方法及设备,能够根据后台应用程序中的进程对资源使用进行细粒度的管控,且针对不同的进程可以进行不同程度的资源管控,从而能够减少后台应用程序的资源消耗,降低电子设备的功耗。The embodiments of the present application provide a resource management and control method and device, which can perform fine-grained management and control of resource usage according to processes in a background application, and can perform different levels of resource management and control for different processes, thereby reducing the burden of background applications. Resource consumption, reduce the power consumption of electronic equipment.
为达到上述目的,本申请实施例采用如下技术方案:To achieve the foregoing objectives, the following technical solutions are adopted in the embodiments of the present application:
一方面,本申请实施例提供了一种资源管控方法,包括:电子设备显示第一应用程序的界面。电子设备由前台运行第一应用程序切换到后台运行第一应用程序,并停止显示第一应用程序的界面。电子设备确定第一应用程序中的关键进程和非关键进程。电子设备分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理。其中,第二管控方式对资源的管控程度大于第一管控方式对资源的管控程度。On the one hand, an embodiment of the present application provides a resource management and control method, including: an electronic device displays an interface of a first application program. The electronic device switches from running the first application program in the foreground to running the first application program in the background, and stops displaying the interface of the first application program. The electronic device determines the critical process and the non-critical process in the first application program. The electronic equipment adopts the first management and control method and the second management and control method respectively to process the resources of the critical process and the non-critical process. Among them, the second management and control method has a greater degree of resource management and control than the first management and control method.
在该方案中,手机可以根据后台应用程序的进程对资源使用进行细粒度的管控,并且可以针对后台应用程序的关键进程和非关键进程进行不同程度的资源管控。从而,可以减少后台每个应用程序的资源消耗,降低电子设备的功耗。In this solution, the mobile phone can perform fine-grained management and control of resource usage according to the process of the background application, and can perform different levels of resource management and control for the key and non-critical processes of the background application. Thus, the resource consumption of each application program in the background can be reduced, and the power consumption of the electronic device can be reduced.
在一种可能的设计中,电子设备确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程在进程白名单中,则电子设备确定第一进程为关键进程。若第一应用程序中的第一进程在进程黑名单中,则电子设备确定第一进程为非关键进程。In a possible design, the electronic device determines the critical process and the non-critical process in the first application program, including: if the first process in the first application program is in the process whitelist, the electronic device determines that the first process is The key process. If the first process in the first application is in the process blacklist, the electronic device determines that the first process is a non-critical process.
也就是说,电子设备可以根据预设的白名单和黑名单,确定关键进程和非关键进程。In other words, the electronic device can determine the critical process and the non-critical process according to the preset whitelist and blacklist.
在另一种可能的设计中,电子设备可以根据第一应用程序中进程的优先级,确定关键进程和非关键进程。In another possible design, the electronic device can determine the critical process and the non-critical process according to the priority of the process in the first application.
例如,电子设备确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程的ADJ值小于或者等于FOREGROUND_APP_ADJ,则电子设备确定第一进程为关键进程。若第一应用程序中的第一进程的ADJ值大于FOREGROUND_APP_ADJ,则电子设备确定第一进程为非关键进程。For example, determining the critical process and non-critical process in the first application by the electronic device includes: if the ADJ value of the first process in the first application is less than or equal to FORREGROUND_APP_ADJ, the electronic device determines that the first process is a critical process. If the ADJ value of the first process in the first application is greater than FORREGROUND_APP_ADJ, the electronic device determines that the first process is a non-critical process.
也就是说,电子设备可以通过ADJ值等表征进程优先级的信息,确定关键进程和非关键进程。That is to say, the electronic device can determine the critical process and the non-critical process through information that characterizes the priority of the process, such as the ADJ value.
在另一种可能的设计中,电子设备确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程位于SCHED_GROUP_BACKGROUND分组中,则电子设备确定第一进程为关键进程。若第一应用程序中的第一进程位于其他分组中,则电子设备确定第一进程为非关键进程。In another possible design, the electronic device determines the critical process and the non-critical process in the first application, including: if the first process in the first application is located in the SCHED_GROUP_BACKGROUND group, the electronic device determines that the first process is The key process. If the first process in the first application is located in another group, the electronic device determines that the first process is a non-critical process.
也就是说,电子设备可以通过进程所处的分组,确定关键进程和非关键进程。In other words, the electronic device can determine the critical process and the non-critical process through the grouping of the process.
在另一种可能的设计中,电子设备确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程使用了前台服务,则电子设备确定第一进程为关键进程。若第一应用程序中的第一进程未使用前台服务,则电子设备确定第一进程为非关键进程。In another possible design, the electronic device determines the critical process and the non-critical process in the first application program, including: if the first process in the first application program uses the foreground service, the electronic device determines that the first process is The key process. If the first process in the first application does not use the foreground service, the electronic device determines that the first process is a non-critical process.
这样,电子设备可以根据后台应用程序中的进程是否使用了前台服务,来确定是否为关键进程。In this way, the electronic device can determine whether it is a critical process according to whether the process in the background application uses the foreground service.
在另一种可能的设计中,电子设备确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程满足目标特征,则电子设备确定第一进程为关键进程;其中,目标特征为预设的特征,或者为电子设备训练获得的特征。若第一应用程序中的第一进程不满足目标特征,则电子设备确定第一进程为非关键进程。In another possible design, the electronic device determines the critical process and the non-critical process in the first application program, including: if the first process in the first application program meets the target characteristics, the electronic device determines that the first process is critical Process; where the target feature is a preset feature, or a feature obtained through training of an electronic device. If the first process in the first application program does not meet the target characteristics, the electronic device determines that the first process is a non-critical process.
在该方案中,电子设备可以根据后台应用程序中进程的特征,确定是否为关键进程。In this solution, the electronic device can determine whether it is a critical process according to the characteristics of the process in the background application.
在另一种可能的设计中,电子设备分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理,包括:电子设备在第一应用程序切换到后台运行,且经历预设时长T后,电子设备分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理。In another possible design, the electronic device adopts the first management and control method and the second management and control method to process the resources of the key process and the non-critical process, including: the electronic device switches to the background operation in the first application program and experiences After the preset time period T, the electronic device adopts the first management and control mode and the second management and control mode respectively to process the resources of the critical process and the non-critical process.
可以理解的是,第一应用程序刚切换到后台时,用户再次前台使用第一应用程序的概率较大,因而电子设备可以暂不对后台第一应用程序进行资源管控。在第一应用程序切换到后台运行,且经历预设时长T后,用户再次前台使用第一应用程序的概率较小,电子设备可以对后台第一应用程序进行资源管控。It is understandable that when the first application program is just switched to the background, the user is more likely to use the first application program in the foreground again, so the electronic device may temporarily not perform resource management and control on the background first application program. After the first application program is switched to run in the background and the preset time period T has elapsed, the probability of the user using the first application program in the foreground again is small, and the electronic device can perform resource management and control on the background first application program.
在另一种可能的设计中,在电子设备分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理之前,该方法还包括:电子设备为第一应用程序中的进程申请资源。电子设备保存资源申请信息,资源申请信息包括进程与所申请的资源之间的对应关系。电子设备分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理,包括:电子设备根据资源申请信息,分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理。In another possible design, before the electronic device adopts the first management and control mode and the second management and control mode to process the resources of the critical process and the non-critical process, the method further includes: the electronic device is the first application program Process to apply for resources. The electronic device stores resource application information, and the resource application information includes the corresponding relationship between the process and the requested resource. Electronic equipment adopts the first management and control method and the second management and control method to process the resources of the key process and the non-critical process, including: the electronic equipment adopts the first and second management methods according to the resource application information, respectively, and controls the key process and the second control method. Non-critical processes handle resource processing.
也就是说,电子设备在进程申请资源时可以记录进程与资源的对应关系,以便后续根据该对应关系对进程进行资源管控。That is to say, the electronic device can record the corresponding relationship between the process and the resource when the process applies for the resource, so as to subsequently perform resource management and control on the process according to the corresponding relationship.
在另一种可能的设计中,第一管控方式包括,统一关键进程基于定时告警Alarm的心跳包,允许关键进程使用其他资源。In another possible design, the first control method includes unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources.
这样,可以保证关键进程能够正常运行,并降低心跳包消耗的资源和功耗。In this way, the normal operation of key processes can be guaranteed, and the resources and power consumption consumed by the heartbeat packet can be reduced.
在另一种可能的设计中,第二管控方式包括,限制非关键进程使用资源。In another possible design, the second control method includes restricting the use of resources by non-critical processes.
这样,可以更多地节省后台第一应用程序的资源消耗和功耗。In this way, the resource consumption and power consumption of the first application in the background can be more saved.
在另一种可能的设计中,关键进程包括第一等级、第二等级和第三等级。其中,第一等级的关键进程对应的第一管控方式包括,允许关键进程使用资源。第二等级的关键进程对应的第一管控方式包括,以第一周期统一关键进程基于定时告警Alarm的心跳包,允许关键进程使用其他资源。第三等级的关键进程对应的第一管控方式包括,以第二周期统一关键进程基于定时告警Alarm的心跳包,允许关键进程使用其他资源,且第二周期大于第一周期。In another possible design, the key processes include the first level, the second level, and the third level. Among them, the first management and control method corresponding to the first-level key process includes allowing the key process to use resources. The first management and control method corresponding to the second-level key processes includes the first cycle of unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources. The first management and control method corresponding to the third-level key processes includes unifying the key processes in the second cycle based on the heartbeat packet of the timing alarm Alarm, allowing the key processes to use other resources, and the second cycle is greater than the first cycle.
这样,不同等级的关键进行的资源管控程度不同,资源消耗和功耗也不同。In this way, the degree of resource management performed by different levels of key is different, and the resource consumption and power consumption are also different.
在另一种可能的设计中,非关键进程包括第一等级和第二等级。其中,第一等级的非关键进程对应的第二管控方式包括,周期性地限制非关键进程使用资源。第二等级的非关键进程对应的第二管控方式包括,限制非关键进程使用资源。In another possible design, non-critical processes include the first level and the second level. Among them, the second management and control method corresponding to the non-critical processes of the first level includes periodically restricting the use of resources by the non-critical processes. The second control method corresponding to the second-level non-critical processes includes restricting the use of resources by non-critical processes.
这样,不同等级的非关键进行的资源管控程度不同,资源消耗和功耗也不同。In this way, different levels of non-critical resource management and control have different degrees, and resource consumption and power consumption are also different.
在另一种可能的设计中,第一管控方式包括,允许使用关键资源,且限制使用非关键资源。In another possible design, the first control method includes allowing the use of critical resources and restricting the use of non-critical resources.
这样,通过正常使用关键资源,可以在尽量减小资源消耗和功耗的基础上,尽量使得关键进程的功能和服务能够正常运行。In this way, through the normal use of key resources, it is possible to make the functions and services of key processes run normally while minimizing resource consumption and power consumption.
在另一种可能的设计中,该资源包括:导航卫星系统资源,网络资源,蓝牙资源,传输控制协议(transmission control protocol,TCP)连接资源,音频资源,调制解调器Modem资源,定时告警Alarm资源,唤醒锁Wakelock资源,广播资源,延时处理Job资源,或服务Service资源中的一项或多项。In another possible design, the resources include: navigation satellite system resources, network resources, Bluetooth resources, transmission control protocol (transmission control protocol, TCP) connection resources, audio resources, modem resources, timer alarm resources, wake-up Lock one or more of Wakelock resources, broadcast resources, delayed processing Job resources, or service resources.
另一方面,本申请实施例提供了一种电子设备,包括:屏幕,用于显示界面;一个或多个处理器;以及存储器,存储器中存储有代码。当代码被电子设备执行时,使得电子设备执行如下步骤:显示第一应用程序的界面;由前台运行第一应用程序切换到后台运行第一应用程序,并停止显示第一应用程序的界面;确定第一应用程序中的关键进程和非关键进程;分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理;第二管控方式对资源的管控程度大于第一管控方式对资源的管控程度。On the other hand, an embodiment of the present application provides an electronic device, including: a screen for displaying an interface; one or more processors; and a memory in which codes are stored. When the code is executed by the electronic device, the electronic device is caused to perform the following steps: display the interface of the first application; switch from running the first application in the foreground to running the first application in the background, and stop displaying the interface of the first application; OK The critical and non-critical processes in the first application; the first and second control methods are used to process the resources of the critical and non-critical processes; the second control method has a greater degree of control over resources than the first control method The degree of control over resources.
在一种可能的设计中,确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程在进程白名单中,则确定第一进程为关键进程。若第一应用程序中的第一进程在进程黑名单中,则确定第一进程为非关键进程。In a possible design, determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program is in the process whitelist, determining the first process as the critical process. If the first process in the first application is in the process blacklist, it is determined that the first process is a non-critical process.
在另一种可能的设计中,确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程的ADJ值小于或者等于FOREGROUND_APP_ADJ,则确定第一进程为关键进程。若第一应用程序中的第一进程的ADJ值大于FOREGROUND_APP_ADJ,则确定第一进程为非关键进程。In another possible design, determining the critical process and the non-critical process in the first application program includes: if the ADJ value of the first process in the first application program is less than or equal to FORegROUND_APP_ADJ, then determining that the first process is critical process. If the ADJ value of the first process in the first application is greater than FORREGROUND_APP_ADJ, it is determined that the first process is a non-critical process.
在另一种可能的设计中,确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程位于SCHED_GROUP_BACKGROUND分组中,则确定第一进程为关键进程。若第一应用程序中的第一进程位于其他分组中,则确定第一进程为非关键进程。In another possible design, determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program is located in the SCHED_GROUP_BACKGROUND group, determining the first process as the critical process. If the first process in the first application is located in another group, it is determined that the first process is a non-critical process.
在另一种可能的设计中,确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程使用了前台服务,则确定第一进程为关键进程。若第一应用程序中的第一进程未使用前台服务,则确定第一进程为非关键进程。In another possible design, determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program uses the foreground service, determining the first process as the critical process. If the first process in the first application does not use the foreground service, it is determined that the first process is a non-critical process.
在另一种可能的设计中,确定第一应用程序中的关键进程和非关键进程,包括:若第一应用程序中的第一进程满足目标特征,则确定第一进程为关键进程。其中,目标特征为预设的特征,或者为电子设备训练获得的特征。若第一应用程序中的第一进程不满足目标特征,则确定第一进程为非关键进程。In another possible design, determining the critical process and the non-critical process in the first application program includes: if the first process in the first application program meets the target characteristics, determining the first process as the critical process. Wherein, the target feature is a preset feature, or a feature obtained by training of an electronic device. If the first process in the first application program does not meet the target characteristics, the first process is determined to be a non-critical process.
在另一种可能的设计中,分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理,包括:在第一应用程序切换到后台运行,且经历预设时长T后,分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理。In another possible design, the first management and control method and the second management and control method are used to process the resources of key processes and non-critical processes, including: switching the first application to run in the background and experiencing a preset duration of T After that, the first management and control method and the second management and control method are respectively adopted to process the resources of the critical process and the non-critical process.
在另一种可能的设计中,当代码被电子设备执行时,还使得电子设备执行如下步骤:在分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理之前,为第一应用程序中的进程申请资源。保存资源申请信息,资源申请信息包括进程与所申请的资源之间的对应关系。分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理,包括:根据资源申请信息,分别采用第一管控方式和第二管控方式,对关键进程和非关键进程进行资源处理。In another possible design, when the code is executed by the electronic device, the electronic device is also made to perform the following steps: before the first and second control methods are used to process the resources of the critical process and the non-critical process, Apply for resources for the process in the first application. Save the resource application information. The resource application information includes the corresponding relationship between the process and the requested resource. The first and second control methods are used to process the resources of key and non-critical processes, including: according to the resource application information, the first and second control methods are used to process key and non-critical processes. Resource processing.
在另一种可能的设计中,第一管控方式包括,统一关键进程基于定时告警Alarm的心跳包,允许关键进程使用其他资源。第二管控方式包括,限制非关键进程使用资源。In another possible design, the first control method includes unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources. The second control method includes restricting the use of resources by non-critical processes.
在另一种可能的设计中,关键进程包括第一等级、第二等级和第三等级。其中,第一等级的关键进程对应的第一管控方式包括,允许关键进程使用资源。第二等级的关键进程对应的第一管控方式包括,以第一周期统一关键进程基于定时告警Alarm的心跳包,允许关键进程使用其他资源。第三等级的关键进程对应的第一管控方式包括,以第二周期统一关键进程基于定时告警Alarm的心跳包,允许关键进程使用其他资源,且第二周期大于第一周期。In another possible design, the key processes include the first level, the second level, and the third level. Among them, the first management and control method corresponding to the first-level key process includes allowing the key process to use resources. The first management and control method corresponding to the second-level key processes includes the first cycle of unifying key processes based on the heartbeat packet of the timing alarm Alarm, allowing key processes to use other resources. The first management and control method corresponding to the third-level key processes includes unifying the key processes in the second cycle based on the heartbeat packet of the timing alarm Alarm, allowing the key processes to use other resources, and the second cycle is greater than the first cycle.
在另一种可能的设计中,非关键进程包括第一等级和第二等级。其中,第一等级的非关键进程对应的第二管控方式包括,周期性地限制非关键进程使用资源。第二等级的非关键进程对应的第二管控方式包括,限制非关键进程使用资源。In another possible design, non-critical processes include the first level and the second level. Among them, the second management and control method corresponding to the non-critical processes of the first level includes periodically restricting the use of resources by the non-critical processes. The second control method corresponding to the second-level non-critical processes includes restricting the use of resources by non-critical processes.
在另一种可能的设计中,该资源包括:导航卫星系统资源,网络资源,蓝牙资源,传输控制协议TCP连接资源,音频资源,调制解调器Modem资源,定时告警Alarm资源,唤醒锁Wakelock资源,广播资源,延时处理Job资源,或服务Service资源中的一项或多项。In another possible design, the resources include: navigation satellite system resources, network resources, Bluetooth resources, transmission control protocol TCP connection resources, audio resources, modem resources, timing alarm resources, wakelock resources, broadcast resources , Delay processing of one or more of Job resources or Service resources.
另一方面,本申请实施例提供了一种资源管控装置,该装置包含在电子设备中。该装置具有实现上述方面及可能的设计中任一方法中电子设备行为的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括至少一个与上述功能相对应的模块或单元。例如,检测模块/单元,创建模块/单元,保存模块/单元,显示模块/单元,切换模块/单元,确定模块/单元,以及管控模块/单元等。On the other hand, an embodiment of the present application provides a resource management and control device, which is included in an electronic device. The device has the function of realizing the behavior of the electronic device in any of the above aspects and possible design methods. This function can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above-mentioned functions. For example, detecting modules/units, creating modules/units, saving modules/units, displaying modules/units, switching modules/units, determining modules/units, and controlling modules/units, etc.
另一方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行上述方面任一项可能的设计中的资源管控方法。On the other hand, an embodiment of the present application provides a computer storage medium, including computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the resource management and control method in any one of the possible designs in the foregoing aspects.
又一方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上 运行时,使得计算机执行上述方面任一项可能的设计中的资源管控方法。In another aspect, embodiments of the present application provide a computer program product, which when the computer program product runs on a computer, enables the computer to execute the resource management and control method in any one of the possible designs in the foregoing aspects.
上述其他方面对应的有益效果,可以参见关于方法方面的有益效果的描述,此处不予赘述。For the corresponding beneficial effects of the other aspects mentioned above, please refer to the description of the beneficial effects of the method, which will not be repeated here.
附图说明Description of the drawings
图1A为现有技术提供的一种申请资源的示意图;Figure 1A is a schematic diagram of an application resource provided by the prior art;
图1B为现有技术提供的一种资源申请信息的管理示意图;FIG. 1B is a schematic diagram of management of resource application information provided by the prior art;
图2为本申请实施例提供的一种电子设备的硬件结构示意图;2 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the application;
图3为本申请实施例提供的一种电子设备的软件结构示意图;3 is a schematic diagram of the software structure of an electronic device provided by an embodiment of the application;
图4为本申请实施例提供的一种资源管控方法流程图;FIG. 4 is a flowchart of a resource management and control method provided by an embodiment of the application;
图5A-图5B为本申请实施例提供的一组界面示意图;5A-5B are schematic diagrams of a set of interfaces provided by an embodiment of the application;
图6A为本申请实施例提供的一种资源申请信息的管理示意图;FIG. 6A is a schematic diagram of management of resource application information provided by an embodiment of this application;
图6B为本申请实施例提供的一种申请资源的示意图;FIG. 6B is a schematic diagram of an application resource provided by an embodiment of the application;
图7为本申请实施例提供的一种根据进程特征确定关键进程和非关键进程的示意图;FIG. 7 is a schematic diagram of determining critical processes and non-critical processes according to process characteristics according to an embodiment of the application;
图8为本申请实施例提供的一种弱管控方式的示意图;FIG. 8 is a schematic diagram of a weak management and control method provided by an embodiment of the application;
图9为本申请实施例提供的一种心跳机制示意图;FIG. 9 is a schematic diagram of a heartbeat mechanism provided by an embodiment of this application;
图10为本申请实施例提供的一种强管控方式的示意图。FIG. 10 is a schematic diagram of a strong management and control method provided by an embodiment of the application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this document is only a description of related objects The association relationship of indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: A alone exists, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" refers to two or more than two.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms “first” and “second” are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" may explicitly or implicitly include one or more of these features. In the description of the present embodiment, unless otherwise specified, "plurality" means two or more.
应用程序可以通过应用程序的包名或应用程序用户身份标识UID进行标识。其中,每个UID可以对应一个或多个应用程序。应用程序在运行过程中可以创建多个进程,每个进程可以根据自身的业务需求申请使用资源。The application can be identified by the package name of the application or the UID of the application user identity. Among them, each UID can correspond to one or more applications. The application can create multiple processes during the running process, and each process can apply for the use of resources according to its own business needs.
例如,在一种资源划分方式中,应用程序的进程申请使用的资源可以包括硬件资源和软件资源。比如,该硬件资源可以包括全球导航卫星系统(global navigation satellite system,GNSS)资源,网络资源,蓝牙(bluetooth,BT)资源,传输控制协议TCP连接资源,音频资源或调制解调器Modem资源等。其中,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)资源等。网络资源指可以用于上网的资源,例如运营商移动数据业务(2G/3G/4G/5G)资源或无线保真(wireless fidelity,Wi-Fi)资源等。TCP连接可以通过套接字Socket链路进行信息交互。音频资源用于实现音频的播放,例如包括扬声器资 源或音频编/解码器资源等。For example, in a resource division method, the resources applied for by the process of the application program may include hardware resources and software resources. For example, the hardware resources may include global navigation satellite system (GNSS) resources, network resources, bluetooth (BT) resources, transmission control protocol TCP connection resources, audio resources or modem resources, etc. Among them, GNSS resources can include global positioning system (GPS) resources, global navigation satellite system (GLONASS) resources, Beidou navigation satellite system (BDS) resources, and quasi-zenith Satellite system (quasi-zenith satellite system, QZSS) resources and/or satellite-based augmentation systems (satellite-based augmentation systems, SBAS) resources, etc. Network resources refer to resources that can be used for surfing the Internet, such as operators' mobile data service (2G/3G/4G/5G) resources or wireless fidelity (Wi-Fi) resources. The TCP connection can exchange information through the socket Socket link. Audio resources are used to implement audio playback, such as speaker resources or audio codec resources.
以安卓(Android)操作系统为例,该软件资源可以包括定时告警Alarm资源,唤醒锁Wakelock资源,广播资源,延时处理Job资源或服务Service资源等。其中,Alarm资源可以用于根据设定的时间或周期进行系统级的提示。Wakelock资源可以用于阻止处理器休眠。广播资源可以用于在不同应用程序或不同组件之间进行信息传输。Job资源是一个可以在后台进行延时处理的库中的资源。服务Service资源是一种可以在后台执行长时间运行操作而没有用户界面的应用组件。Taking the Android operating system as an example, the software resources may include timing alarm resources, wakelock resources, broadcast resources, delayed processing job resources or service service resources, etc. Among them, the Alarm resource can be used for system-level prompts according to the set time or cycle. Wakelock resources can be used to prevent the processor from sleeping. Broadcast resources can be used to transfer information between different applications or different components. Job resource is a resource in a library that can be processed in a delayed manner in the background. Service resource is an application component that can perform long-running operations in the background without a user interface.
示例性的,应用程序中的进程申请资源的示意图可以参见图1A。在应用程序中的进程申请资源的过程中,运行该应用程序的电子设备中的资源管理器可以保存资源申请信息。例如,在现有技术中,参见图1B,该资源申请信息包括请求申请资源的应用程序的包名、UID以及请求申请的资源。此外,该资源申请信息还可以包括资源的申请时间和申请时长等相关信息。也就是说,现有技术按照包名和UID统计进程的资源申请信息。Exemplarily, a schematic diagram of a process in an application program applying for resources can be seen in FIG. 1A. During the process of applying for resources in the application program, the resource manager in the electronic device running the application program may save the resource application information. For example, in the prior art, referring to FIG. 1B, the resource application information includes the package name and UID of the application requesting the resource, and the resource requesting the application. In addition, the resource application information may also include relevant information such as the application time and application duration of the resource. In other words, the prior art counts the resource application information of the process according to the package name and UID.
在现有技术中,电子设备按照应用程序的包名或UID进行资源管控。为了使得应用程序能够在后台运行,电子设备允许应用程序进入后台能够正常使用各项资源。In the prior art, the electronic device performs resource management and control according to the package name or UID of the application program. In order to enable the application program to run in the background, the electronic device allows the application program to enter the background to be able to use various resources normally.
例如,后台应用程序1的包名为包名1,对应的UID为UID1。在一种现有技术中,电子设备允许包名1对应的所申请的资源能够正常使用;在另一种现有技术中,电子设备允许UID1对应的所申请的资源能够正常使用,以使得应用程序1能够在后台运行。For example, the package name of background application 1 is package name 1, and the corresponding UID is UID1. In a prior art, the electronic device allows the requested resource corresponding to package name 1 to be used normally; in another prior art, the electronic device allows the requested resource corresponding to UID1 to be used normally, so that the application Program 1 can run in the background.
由于后台应用程序可以包括多个进程,现有技术允许后台应用程序中的每个进程都能正常使用资源,而实际上有些进程的资源并不是必须需要使用的,因而现有技术采用的方案将导致电子设备的资源消耗和功耗较大。Since the background application program can include multiple processes, the existing technology allows each process in the background application program to use resources normally, but in fact the resources of some processes do not necessarily need to be used, so the existing technology adopts the solution As a result, the resource consumption and power consumption of the electronic device are relatively high.
本申请实施例提供了一种资源管控方法,可以应用于电子设备。电子设备可以根据后台应用程序中的进程对资源使用进行细粒度的管控。并且,对于后台应用程序内的不同进程,电子设备可以进行不同程度的资源管控。其中,电子设备可以对后台应用程序内的一些进程的资源进行不管控或弱管控,即管控程度和力度较小;对另一些进程的资源进行强管控,即管控程度和力度较大。因而,与现有技术中允许后台应用程序内的各进程正常使用各项资源相比,本申请实施例提供的资源管控方法可以减少后台每个应用程序的资源消耗,降低电子设备的功耗。The embodiment of the present application provides a resource management and control method, which can be applied to electronic devices. Electronic devices can perform fine-grained management and control of resource usage based on processes in background applications. In addition, for different processes in the background application, the electronic device can perform different levels of resource management and control. Among them, the electronic device can control the resources of some processes in the background application regardless of control or weak control, that is, the degree and intensity of control is small; and the resources of other processes can be strongly controlled, that is, the degree and intensity of control is greater. Therefore, compared with the prior art allowing each process in the background application program to use various resources normally, the resource management and control method provided by the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
例如,该电子设备可以是手机、平板电脑、折叠屏设备、上网本、个人数字助理(personal digital assistant,PDA)、可穿戴设备或增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备等,本申请实施例对电子设备的具体类型不作任何限制。For example, the electronic device may be a mobile phone, a tablet computer, a folding screen device, a netbook, a personal digital assistant (personal digital assistant, PDA), a wearable device, or augmented reality (AR)/virtual reality (VR) Devices, etc., the embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
示例性的,图2示出了电子设备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等。Exemplarily, FIG. 2 shows a schematic structural diagram of the 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 charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2. , Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone 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, etc. 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 sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light Sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and 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. Among them, the different processing units may be independent devices or integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 to store instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that the processor 110 has just used or used cyclically. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
在一些实施例中,处理器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)接口等。In some embodiments, 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, and a 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 (USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, which includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple sets of I2C buses. The processor 110 may couple the touch sensor 180K, the charger, the flash, the camera 193, etc., respectively through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement the touch function of the electronic device 100.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include 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. In some embodiments, the audio module 170 may transmit audio signals to the wireless communication module 160 through an I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。I2S接口和PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 may 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 I2S interface and PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信 模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to realize the Bluetooth function. In some embodiments, the audio module 170 may transmit audio signals to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with the display screen 194, the camera 193 and other peripheral devices. The MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and so on. In some embodiments, the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through a DSI interface to realize the display function of the electronic device 100.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can 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 so on. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect earphones and play audio through earphones. This interface can also be used to connect to other electronic devices, such as AR devices.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive the charging input of the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through the 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.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect 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 charge 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, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施 例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic wave radiation via the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, 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. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
无线通信模块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转为电磁波辐射出去。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), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. 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 may also receive the signal to be sent from the processor 110, perform frequency modulation, amplify it, and convert it into electromagnetic waves to radiate through the antenna 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可以包括全球卫星定位系统GPS,全球导航卫星系统GLONASS,北斗卫星导航系统BDS,准天顶卫星系统QZSS和/或星基增强系统SBAS。In some embodiments, 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. Wireless communication technologies can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), and broadband code division. Multiple access (wideband 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. GNSS may include Global Positioning System GPS, Global Navigation Satellite System GLONASS, Beidou Satellite Navigation System BDS, Quasi-Zenith Satellite System QZSS and/or Satellite-Based Augmentation System SBAS.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is an image processing microprocessor, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
显示屏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的正整数。The display screen 194 is used to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode). AMOLED, flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, and N is a positive integer greater than one.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传 递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal. The photosensitive element of the camera transmits the electrical signal to the ISP for processing and transforms it into an image visible to the naked eye. ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and is projected to the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal. ISP outputs digital image signals to DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In some embodiments, the electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they 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 energy of the frequency point.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, for example, the transfer mode between human brain neurons, it can quickly process input information, and it can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, and so on.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 may 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, save music, video and other files in an external memory card.
内部存储器121可以用于存储计算机可执行程序代码,可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。The internal memory 121 may be used to store computer executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. Among them, the storage program area can store an operating system, at least one application program (such as a sound playback function, an image playback function, etc.) required by at least one function. The data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device 100.
此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。The speaker 170A, also called "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.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone", "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C through the 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 noise reduction functions in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone interface 170D is used to connect wired earphones. The earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, and a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be provided on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors and so on. The capacitive pressure sensor may include at least two parallel plates with conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example, when a touch operation whose intensity of the touch operation is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the movement posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip holster. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Furthermore, according to the detected opening and closing state of the holster or the opening and closing state of the flip cover, features such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and apply to applications such as horizontal and vertical screen switching, pedometers and so on.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F, used to measure distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子 设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄息屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light to the outside through the light emitting diode. The electronic device 100 uses a photodiode 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 can determine that there is no object in the vicinity of 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. The proximity light sensor 180G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect temperature. In some embodiments, 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, so as to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. The visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can obtain the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the human pulse and receive the blood pressure pulse signal.
在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。In some embodiments, the bone conduction sensor 180M may also be provided in the earphone, combined with the bone conduction earphone. The audio module 170 can parse the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180M, and realize the voice function. The application processor can analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, and realize the heart rate detection function.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The button 190 includes a power-on button, a volume button, and so on. The button 190 may be a mechanical button. It can also be a touch button. The electronic device 100 may receive key input, and generate key signal input related to user settings and function control of the electronic device 100.
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback. For example, touch operations that act on different applications (such as photographing, audio playback, etc.) can correspond to different vibration feedback effects. Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminding, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个 SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect to the SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device 100. The electronic device 100 may support one or N SIM card interfaces, and N is a positive integer greater than one. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. The same SIM card interface 195 can insert multiple cards at the same time. The types of multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication. In some embodiments, the electronic device 100 adopts an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
在本申请的实施例中,处理器110可以运行存储在内部存储器121的指令,根据后台应用程序中的进程对资源使用进行细粒度的管控。并且,对于后台应用程序内的不同进程,电子设备可以进行不同程度的资源管控。其中,电子设备可以对后台应用程序内的一些进程的资源进行不管控或弱管控,对另一些进程的资源进行强管控。因而,与现有技术中允许后台应用程序内的各进程正常使用各项资源相比,本申请实施例提供的资源管控方法可以减少后台每个应用程序的资源消耗,降低电子设备的功耗。In the embodiment of the present application, the processor 110 may run instructions stored in the internal memory 121 to perform fine-grained control of resource usage according to processes in the background application. In addition, for different processes in the background application, the electronic device can perform different levels of resource management and control. Among them, the electronic device can control the resources of some processes in the background application regardless of control or weak control, and control the resources of other processes strongly. Therefore, compared with the prior art allowing each process in the background application program to use various resources normally, the resource management and control method provided by the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。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 embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 by way of example.
图3是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。FIG. 3 is a software structure block diagram of the electronic device 100 according to an 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. Communication between layers through software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer. The application layer can include a series of application packages.
如图3所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 3, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图3所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in Figure 3, the application framework layer can include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and so on.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。The window manager is used to manage window programs. The window manager can obtain the size of the display, determine whether there is a status bar, lock the screen, take a screenshot, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。The content provider is used to store and retrieve data and make these data accessible to applications. Data can include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls that display text, controls that display pictures, and so on. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication function of the electronic device 100. For example, the management of the call status (including connecting, hanging up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等,还可以用于根据进程对后台应用程序的资源进行细粒度的、不同程度的管控。The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc., and can also be used to fine-grain and control the resources of the background application according to the process.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例 如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, and so on. The notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in a virtual machine. 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 life cycle management, stack management, thread management, security and exception management, and garbage collection.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to realize 3D graphics drawing, image rendering, synthesis, and layer processing.
2D图形引擎是2D绘图的绘图引擎。The 2D graphics engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。内核层还可以包括一些网络协议,用于进行TCP连接和网络资源的控制。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver. The kernel layer can also include some network protocols for controlling TCP connections and network resources.
在本申请的实施例中,应用程序框架层中的资源管理器可以针对后台应用程序内的进程,对资源使用进行细粒度的管控。并且,对于后台应用程序内的不同进程,资源管理器可以进行不同程度、不同力度的资源管控。因而,与允许后台应用程序内的各进程正常使用各项资源相比,本申请实施例提供的资源管控方法可以减少后台每个应用程序的资源消耗,降低电子设备的功耗。In the embodiment of the present application, the resource manager in the application framework layer can perform fine-grained management and control of resource usage for the processes in the background application. Moreover, for different processes in the background application, the resource manager can perform resource management and control of different degrees and strengths. Therefore, compared with allowing each process in the background application program to use various resources normally, the resource management and control method provided in the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
在一些实施例中,后台应用程序可以包括关键进程和非关键进程。其中,关键进程是重要进程,或者用户可感知的进程。电子设备可以针对关键进程进行较小程度和较小力度的资源管控,针对非关键进程进行较大程度和较大力度的资源管控。In some embodiments, background applications may include critical processes and non-critical processes. Among them, the key process is an important process, or a process perceivable by the user. Electronic equipment can perform lesser and lesser resource management and control for key processes, and greater and more powerful resource management and control for non-critical processes.
以下将以电子设备为具有图2和图3所示结构的手机为例,对本申请实施例提供的资源管控方法进行阐述。参见图4,该方法可以包括:The following will take the electronic device as a mobile phone with the structure shown in FIG. 2 and FIG. 3 as an example to illustrate the resource management and control method provided in the embodiment of the present application. Referring to Figure 4, the method may include:
401、手机检测到用户指示打开第一应用程序的第一操作后,在前台运行第一应用程序。401. After the mobile phone detects the first operation instructed by the user to open the first application, it runs the first application in the foreground.
其中,该第一应用程序可以是系统应用程序,也可以是第三方应用程序,本申请实施例不予限定。用户可以通过点击第一应用程序的图标、语音指令或隔空手势等多种方式的操作,指示手机打开第一应用程序。Wherein, the first application program may be a system application program or a third-party application program, which is not limited in the embodiment of the present application. The user can instruct the mobile phone to open the first application by clicking on the icon of the first application program, voice commands, or gestures in the air, etc. in various ways.
例如,该第一应用程序为即时消息类应用程序,比如为QQ、微信、facetime或skype等。此处以第一应用程序为QQ为例进行说明。示例性的,参见图5A,手机检测到用户点击QQ图标501的第一操作;响应于该第一操作,手机在前台启动QQ应用。For example, the first application is an instant messaging application, such as QQ, WeChat, facetime, or skype. Here, the first application is QQ as an example for description. Exemplarily, referring to FIG. 5A, the mobile phone detects the first operation of the user clicking the QQ icon 501; in response to the first operation, the mobile phone starts the QQ application in the foreground.
402、手机创建第一应用程序的进程,第一应用程序中的进程申请资源。402. The mobile phone creates a process of the first application, and the process in the first application applies for resources.
手机在启动第一应用程序后,可以创建第一应用程序的进程。例如,当第一应用程序为QQ时,参见表1,手机可以创建QQ主进程,QQ工具进程,QQ空间进程,QQ消息 收/发进程,以及下载服务进程等进程中的一个或多个。其中,包名与应用程序是一一对应且固定不变的;每个UID可以对应一个或多个应用程序,且在应用程序卸载并重装后应用程序对应的UID可能会发生变化。After the mobile phone starts the first application, the process of the first application can be created. For example, when the first application is QQ, referring to Table 1, the mobile phone can create one or more of the QQ main process, the QQ tool process, the QQ space process, the QQ message receiving/sending process, and the download service process. Among them, the package name and the application program have a one-to-one correspondence and are fixed; each UID can correspond to one or more applications, and the UID corresponding to the application program may change after the application program is uninstalled and reinstalled.
表1Table 1
Figure PCTCN2020111494-appb-000001
Figure PCTCN2020111494-appb-000001
再例如,当第一应用程序为微信时,参见表2,手机可以创建微信主界面进程,微信消息收/发进程,以及微信工具进程等进程中的一个或多个。For another example, when the first application is WeChat, referring to Table 2, the mobile phone can create one or more of the WeChat main interface process, the WeChat message receiving/sending process, and the WeChat tool process.
表2Table 2
Figure PCTCN2020111494-appb-000002
Figure PCTCN2020111494-appb-000002
其中,第一应用程序中的各进程可以申请资源,该资源可以包括上述软件资源和/或硬件资源,以支持第一应用程序的各项功能服务能够正常运行。Wherein, each process in the first application program may apply for resources, and the resources may include the above-mentioned software resources and/or hardware resources to support the normal operation of various functional services of the first application program.
403、手机保存资源申请信息,该资源申请信息包括第一应用程序中的进程与申请的资源之间的对应关系。403. The mobile phone saves resource application information, where the resource application information includes the corresponding relationship between the process in the first application program and the requested resource.
手机在第一应用程序的进程申请资源时,可以通过资源管理器保存资源申请信息。该资源申请信息包括第一应用程序中的进程与申请的资源之间的对应关系。例如,资源申请信息包括第一应用程序中的进程标识(process identity document,PID)和/或进程名,与申请的资源之间的对应关系。此外,该对应关系还可以包括应用程序的包名和/或UID。When the mobile phone applies for resources in the process of the first application program, the resource application information can be saved through the resource manager. The resource application information includes the corresponding relationship between the process in the first application program and the requested resource. For example, the resource application information includes the process identity document (PID) and/or process name in the first application, and the corresponding relationship between the requested resource. In addition, the corresponding relationship may also include the package name and/or UID of the application.
在一些实施例中,该对应关系还可以包括进程所申请的资源的申请时间和申请时长等相关信息。In some embodiments, the corresponding relationship may also include related information such as application time and application duration of the resource applied for by the process.
示例性的,第一应用程序的包名为包名1,第一应用程序对应的UID为UID1,手机保存的资源申请信息的示意图可以参见图6A。Exemplarily, the package name of the first application program is package name 1, and the UID corresponding to the first application program is UID1. For a schematic diagram of the resource application information stored in the mobile phone, refer to FIG. 6A.
在一些实施例中,资源管理器可以包括应用级别的资源管理模块和进程级别的资源管 控模块,步骤402和步骤403对应的过程可以参见图6B。In some embodiments, the resource manager may include an application-level resource management module and a process-level resource management control module. The corresponding process of step 402 and step 403 can be seen in Fig. 6B.
404、手机显示第一应用程序的界面。404. The mobile phone displays the interface of the first application program.
手机在前台启动第一应用程序的界面后,可以在屏幕上显示第一应用程序的界面。示例性的,手机在前台显示QQ界面的示意图可以参见图5B。After the mobile phone starts the interface of the first application program in the foreground, the interface of the first application program can be displayed on the screen. Exemplarily, a schematic diagram of the mobile phone displaying the QQ interface in the foreground can be seen in Fig. 5B.
需要说明的是,步骤403和步骤404没有明确的先后关系,第一应用程序可以先申请资源再显示界面,也可以先显示界面再申请资源,本申请实施例不予限定。It should be noted that there is no clear sequence relationship between step 403 and step 404. The first application may first apply for resources and then display the interface, or may display the interface before applying for resources, which is not limited in the embodiment of this application.
405、手机由前台运行第一应用程序切换为后台运行第一应用程序,并停止显示第一应用程序的界面。405. The mobile phone switches from running the first application program in the foreground to running the first application program in the background, and stops displaying the interface of the first application program.
手机在多种情况下可以由前台运行第一应用程序,切换为后台运行第一应用程序。In many cases, the mobile phone can run the first application program from the foreground and switch to the background operation of the first application program.
例如,在手机前台运行第一应用程序的情况下,若手机检测到用户指示打开另一应用程序的操作,则手机由前台运行第一应用程序切换为后台运行第一应用程序。For example, when the first application is running in the foreground of the mobile phone, if the mobile phone detects the user's instruction to open another application, the mobile phone switches from running the first application in the foreground to running the first application in the background.
再例如,在手机前台运行第一应用程序的情况下,若手机检测到用户指示打开桌面的操作,则手机由前台运行第一应用程序切换为后台运行第一应用程序。For another example, when the first application is running in the foreground of the mobile phone, if the mobile phone detects an operation instructing to open the desktop by the user, the mobile phone switches from running the first application in the foreground to running the first application in the background.
又例如,在手机前台运行第一应用程序的情况下,若手机检测到用户指示息屏的操作,则手机由前台运行第一应用程序切换为后台运行第一应用程序。For another example, when the first application program is running in the foreground of the mobile phone, if the mobile phone detects the operation of the user instructing the screen to rest, the mobile phone switches from running the first application program in the foreground to running the first application program in the background.
再例如,在手机前台运行第一应用程序的情况下,若手机检测到用户长时间未使用手机从而自动息屏,则手机由前台运行第一应用程序切换为后台运行第一应用程序。For another example, when the first application is running in the foreground of the mobile phone, if the mobile phone detects that the user has not used the mobile phone for a long time and automatically turns off the screen, the mobile phone switches from running the first application in the foreground to running the first application in the background.
可以理解的是,在第一应用程序由前台切换为后台以后,第一应用程序中的各进程也可能会申请资源,手机可以按照步骤403中描述的方式保存资源申请信息。It is understandable that after the first application is switched from the foreground to the background, each process in the first application may also apply for resources, and the mobile phone may save the resource application information in the manner described in step 403.
406、手机确定第一应用程序中的关键进程和非关键进程。406. The mobile phone determines the critical process and the non-critical process in the first application.
在第一应用程序切换到后台后,手机可以确定第一应用程序中的关键进程和非关键进程,以便手机可以分别针对关键进程和非关键进程采用不同的管控方式进行资源管控。其中,关键进程是重要进程,或者是用户可感知的进程。手机确定关键进程和非关键进程的方式可以有多种。After the first application is switched to the background, the mobile phone can determine the critical process and non-critical process in the first application, so that the mobile phone can use different control methods for resource management and control for the critical process and the non-critical process. Among them, the key process is an important process, or a process perceivable by the user. There are many ways for a mobile phone to determine critical processes and non-critical processes.
在一些实施例中,手机保存有关键进程列表和非关键进程列表。手机可以根据关键进程列表确定第一应用程序中的关键进程,并根据非关键进程列表确定第一应用程序中的非关键进程。In some embodiments, the mobile phone saves a list of critical processes and a list of non-critical processes. The mobile phone may determine the key process in the first application program according to the key process list, and determine the non-critical process in the first application program according to the non-critical process list.
例如,手机上保存有进程白名单和进程黑名单。进程白名单包括多个应用程序的多个关键进程,进程黑名单包括多个应用程序的多个非关键进程。若第一应用程序中的第一进程在进程白名单中,则手机确定第一进程为关键进程。若第一应用程序确定第一进程在进程黑名单中,则手机确定第一进程为非关键进程。For example, a process white list and a process black list are saved on the mobile phone. The process whitelist includes multiple critical processes of multiple applications, and the process blacklist includes multiple non-critical processes of multiple applications. If the first process in the first application is in the process whitelist, the mobile phone determines that the first process is a key process. If the first application program determines that the first process is in the process blacklist, the mobile phone determines that the first process is a non-critical process.
示例性的,当第一应用程序为QQ时,QQ进程中的QQ消息收/发进程在白名单列表中,QQ消息收/发进程为关键进程。QQ进程中的QQ工具进程在黑名单列表中,因而属于非关键进程。Exemplarily, when the first application is QQ, the QQ message receiving/sending process in the QQ process is in the white list, and the QQ message receiving/sending process is the key process. The QQ tool process in the QQ process is in the blacklist, so it is a non-critical process.
再示例性的,当第一应用程序为QQ时,QQ进程中的QQ消息收/发进程在白名单列表中,QQ消息收/发进程为关键进程。QQ进程中的QQ主进程、QQ工具进程和QQ空间进程在黑名单列表中,因而属于非关键进程。Illustratively again, when the first application is QQ, the QQ message receiving/sending process in the QQ process is in the whitelist, and the QQ message receiving/sending process is the key process. The main QQ process, the QQ tool process, and the QQ space process in the QQ process are in the blacklist, so they are non-critical processes.
在另一些实施例中,应用程序中的进程具有优先级,手机可以根据进程的优先级确定第一应用程序中的进程为关键进程还是非关键进程。In other embodiments, the process in the application program has a priority, and the mobile phone can determine whether the process in the first application program is a critical process or a non-critical process according to the priority of the process.
例如,在安卓操作系统中,进程的优先级可以通过进程对应的ADJ值来表示。ADJ值越小,进程的优先级越高;ADJ值越大,进程的优先级越低。比如,ADJ值小于或者等于FOREGROUND_APP_ADJ值的进程为关键进程;ADJ值大于FOREGROUND_APP_ADJ值的进程为非关键进程。For example, in the Android operating system, the priority of a process can be represented by the ADJ value corresponding to the process. The smaller the ADJ value, the higher the priority of the process; the larger the ADJ value, the lower the priority of the process. For example, a process with an ADJ value less than or equal to the value of FORREGROUND_APP_ADJ is a critical process; a process with an ADJ value greater than the value of FORREGROUND_APP_ADJ is a non-critical process.
在另一些实施例中,手机可以根据进程所属的分组,确定后台第一应用程序中的进程为关键进程或非关键进程。例如,在安卓操作系统中,位于SCHED_GROUP_BACKGROUND分组中的进程为非关键进程,其它分组(例如SCHED_GROUP_FOREGROUND分组)中的进程为关键进程。In other embodiments, the mobile phone may determine whether the process in the first background application is a critical process or a non-critical process according to the group to which the process belongs. For example, in the Android operating system, processes in the SCHED_GROUP_BACKGROUND group are non-critical processes, and processes in other groups (for example, the SCHED_GROUP_FOREGROUND group) are key processes.
在另一些实施例中,手机可以根据进程使用的服务类型,确定后台第一应用程序中的进程为关键进程或非关键进程。例如,在安卓操作系统中,第一应用程序中使用前台服务的进程为关键进程,未使用前台服务的进程为非关键进程。In other embodiments, the mobile phone may determine whether the process in the first background application is a critical process or a non-critical process according to the service type used by the process. For example, in the Android operating system, the process that uses the foreground service in the first application program is a critical process, and the process that does not use the foreground service is a non-critical process.
在另一些实施例中,手机可以根据第一应用程序的功能或类型确定关键进程和非关键进程。例如,若第一应用程序为即时消息类应用程序,则消息收/发进程为关键进程。再例如,若第一应用程序为导航类的应用程序,则导航进程为关键进程。In other embodiments, the mobile phone may determine the critical process and the non-critical process according to the function or type of the first application program. For example, if the first application is an instant messaging application, the message receiving/sending process is a key process. For another example, if the first application is a navigation application, the navigation process is a key process.
在另一些实施例中,手机可以根据进程的特征,学习和识别进程是否为关键进程或非关键进程。或者,云端服务器可以根据进程的特征,学习和识别进程是否为关键进程或非关键进程,手机可以从云端服务器获取进程的识别结果。In other embodiments, the mobile phone can learn and recognize whether the process is a critical process or a non-critical process according to the characteristics of the process. Alternatively, the cloud server can learn and identify whether the process is a critical process or a non-critical process according to the characteristics of the process, and the mobile phone can obtain the identification result of the process from the cloud server.
例如,关键进程通常可以为用户可感知的后台进程。若后台进程满足表3所示的通常与用户的感知相关联的目标特征,则手机可以确定这些进程为用户可感知的消息收/发类进程、闹钟类进程、上传/下载类进程、音频播放类进程或导航类进程等关键进程。For example, the key process can usually be a background process that is perceivable by the user. If the background processes meet the target characteristics shown in Table 3, which are usually associated with the user’s perception, the mobile phone can determine that these processes are user-perceivable message receiving/sending processes, alarm clock processes, uploading/downloading processes, and audio playback Key processes such as class process or navigation class process.
表3table 3
Figure PCTCN2020111494-appb-000003
Figure PCTCN2020111494-appb-000003
具体的,参见图7,手机可以按进程采集心跳、网络数据包,记录通知、振动,或收集进程的其他相关信息。手机根据该相关信息识别是否满足表3所示的进程特征;若满足,则手机确定该进程为关键进程;若不满足,则手机确定该进程为非关键进程。其中,有网 络权限是指,该进程有使用网络资源的权限,可以正常使用网络资源。Specifically, referring to Figure 7, the mobile phone can collect heartbeats and network data packets according to the process, record notifications, vibrations, or collect other related information about the process. The mobile phone recognizes whether the process characteristics shown in Table 3 are satisfied according to the relevant information; if it is satisfied, the mobile phone determines that the process is a critical process; if not, the mobile phone determines that the process is a non-critical process. Among them, having network authority means that the process has the authority to use network resources and can use network resources normally.
或者,手机可以按进程采集心跳、网络数据包,记录通知、振动,或收集进程的其他相关信息,并上传给云端服务器。云端服务器根据进程的相关信息识别是否满足表3所示的进程特征;若满足,则云端服务器确定该进程为关键进程;若不满足,则云端服务器确定该进程为非关键进程。云端服务器将进程的识别结果返回给手机。Alternatively, the mobile phone can collect heartbeats and network data packets according to the process, record notifications, vibrations, or collect other related information of the process, and upload it to the cloud server. The cloud server recognizes whether the process characteristics shown in Table 3 are satisfied according to the relevant information of the process; if it is satisfied, the cloud server determines that the process is a critical process; if it is not satisfied, the cloud server determines that the process is a non-critical process. The cloud server returns the identification result of the process to the mobile phone.
举例来说,若手机某一后台应用程序的进程具有如下特征:有连续性的声音播放、有网络、常驻通知栏(即经常驻留在通知栏)、有I/O操作这些特征,则手机可以确定该进程为音频播放进程类的关键进程。For example, if the process of a mobile phone background application has the following characteristics: continuous sound playback, network, resident notification bar (that is, it often resides in the notification bar), and I/O operations. The mobile phone can determine that the process is a key process of the audio playback process.
需要说明的是,手机或云端服务根据进程特征确定进程是否为关键进程或非关键进程,可以在第一应用程序每次进入后台后进行;也可以预先进行学习和训练,并保存进程识别的训练结果。例如,预先学习和训练获得的关键进程可以保存在上述进程白名单中,预先学习和训练获得的非关键进程可以保存在上述进程黑名单中。It should be noted that the mobile phone or cloud service determines whether the process is a critical process or a non-critical process according to the process characteristics. This can be done every time the first application enters the background; it can also be learned and trained in advance, and the process recognition training can be saved result. For example, key processes obtained by pre-learning and training can be stored in the aforementioned process whitelist, and non-key processes obtained by pre-learning and training can be stored in the aforementioned process blacklist.
手机在确定后台第一应用程序中的关键进程和非关键进程后,分别针对关键进程和非关键进程执行步骤407和步骤408。After determining the critical process and non-critical process in the first background application, the mobile phone executes step 407 and step 408 for the critical process and the non-critical process, respectively.
407、手机针对关键进程采用第一管控方式进行资源管控。407. The mobile phone adopts the first management and control method for resource management and control for key processes.
408、手机针对非关键进程采用第二管控方式进行资源管控,且第二管控方式对资源的管控程度大于第一管控方式对资源的管控程度。408. The mobile phone uses the second management and control method for resource management and control for non-critical processes, and the second management and control method has a greater degree of resource management and control than the first management and control method for resources.
在步骤407-步骤408中,手机可以从进程的角度对后台应用程序的资源使用进行细粒度的管控,并且可以针对后台应用程序的关键进程和非关键进程进行不同程度的资源管控。从而,与现有技术中允许后台应用程序内的各进程正常各项资源相比,本申请实施例提供的资源管控方法可以减少后台每个应用程序的资源消耗,降低电子设备的功耗。In step 407-step 408, the mobile phone can perform fine-grained management and control of the resource usage of the background application from the perspective of the process, and can perform different levels of resource management and control for the key and non-critical processes of the background application. Therefore, compared with the prior art allowing the normal resources of each process in the background application program, the resource management and control method provided in the embodiment of the present application can reduce the resource consumption of each background application program and reduce the power consumption of the electronic device.
并且,手机采用资源管控的方式处理后台第一应用程序,保护第一应用程序的进程,而并不杀掉第一应用程序的进程,从而可以使得第一应用程序能够在后台继续运行,并且在第一应用程序从后台再次切换到前台时不需要再次加载进程,可以提高前台启动第一应用程序的速度,从而在前台快速显示第一应用程序的界面。In addition, the mobile phone uses resource management to process the first application in the background to protect the process of the first application without killing the process of the first application, so that the first application can continue to run in the background and in the background. When the first application is switched from the background to the foreground again, there is no need to load the process again, which can increase the speed at which the first application is started in the foreground, so that the interface of the first application is quickly displayed in the foreground.
在第一应用程序刚切换到后台后,用户短时间内想要再次在前台使用第一应用程序的概率较大。例如,在用户使用微信时,手机收到一条短信;在用户查看短信时,微信切换到后台;在用户查看短信后再次使用微信时,微信再次切换到前台。因而,在一些实施例中,在第一应用程序切换到后台后,手机可以不立即执行步骤407-步骤408,以在手机短时间内再次将第一应用程序从后台切换到前台时,可以保证前台第一应用程序能够正常运行。在第一应用程序切换到后台且经历预设时长T后,用户可能短时间内不想在前台再次使用第一应用程序了,因而手机可以执行步骤407-步骤408,以对后台第一应用程序中的进程进行资源管控。After the first application has just switched to the background, there is a high probability that the user wants to use the first application in the foreground again in a short time. For example, when the user uses WeChat, the mobile phone receives a short message; when the user views the short message, WeChat switches to the background; when the user uses WeChat again after viewing the short message, WeChat switches to the foreground again. Therefore, in some embodiments, after the first application is switched to the background, the mobile phone may not immediately perform steps 407-408, so that when the mobile phone switches the first application from the background to the foreground again in a short time, it can be guaranteed The first application in the foreground can run normally. After the first application is switched to the background and the preset time period T has elapsed, the user may not want to use the first application again in the foreground in a short period of time. Therefore, the mobile phone can perform step 407-step 408 to update the first application in the background. The process of resource management and control.
在一些实施例中,在手机亮屏时第一应用程序从前台切换到后台的情况下,用户短时间内想要再次在前台使用第一应用程序的概率较大,该预设时长T可以为T1,T1可以较长,例如T1可以为1min。在手机息屏使得第一应用程序从前台切换到后台的情况下,用户短时间内想要再次在前台使用第一应用程序的概率较小,该预设时长T可以为T2,T2可以较短,例如T2可以为6s。In some embodiments, when the first application is switched from the foreground to the background when the mobile phone is on, the user is more likely to want to use the first application in the foreground again in a short period of time, and the preset duration T may be T1, T1 can be longer, for example, T1 can be 1 min. In the case that the first application is switched from the foreground to the background by the screen of the mobile phone, the probability that the user wants to use the first application in the foreground again in a short period of time is relatively small. The preset duration T can be T2, and T2 can be shorter. For example, T2 can be 6s.
在手机亮屏时第一应用程序从前台切换到后台,而后手机息屏的情况下,若T1比T2 先结束,则手机在T1结束时执行步骤407-步骤408;若T2比T1先结束,则手机在T2结束时执行步骤407-步骤408。举例来说,T1为1min,T2为6s;第一应用程序在时刻t1切换到后台;在t1之后的20s(小于T1)后,即在t2时刻,手机息屏;在息屏后经过6s(即预设时长T2)后的t3时刻,手机执行步骤407-步骤408。其中,t3时刻与t1时刻之间的时间间隔小于1min。When the phone is on, the first application is switched from the foreground to the background, and then the phone is off, if T1 ends before T2, the phone executes step 407-step 408 when T1 ends; if T2 ends before T1, Then the mobile phone executes step 407-step 408 at the end of T2. For example, T1 is 1min, T2 is 6s; the first application is switched to the background at time t1; after 20s (less than T1) after t1, that is, at time t2, the phone screen is off; after the screen is off, 6s( That is, at time t3 after the preset time period T2), the mobile phone executes step 407 to step 408. Among them, the time interval between time t3 and time t1 is less than 1 min.
在其他一些实施例中,在第一应用程序切换到后台后,手机可以不立即执行步骤406;在第一应用程序切换到后台且经过预设时长T后,用户可能短时间内不想在前台再次使用第一应用程序了,因而手机可以执行步骤406-步骤408,以对后台第一应用程序中的关键进程和非关键进程进行资源管控。In some other embodiments, after the first application is switched to the background, the mobile phone may not immediately perform step 406; after the first application is switched to the background and the preset time period T has elapsed, the user may not want to be in the foreground again in a short time. The first application program is used, so the mobile phone can perform step 406 to step 408 to perform resource management and control on the key processes and non-critical processes in the background first application program.
在一些实施例中,该第一管控方式为手机允许后台第一应用程序的关键进程正常使用各项资源,包括正常使用已申请的各项资源以及正常申请各项资源,以使得第一应用程序的关键进程可以在后台正常运行。也就是说,手机不对第一应用程序的关键进程的资源使用进行限制,该第一管控方式可以为不管控的方式。其中,手机可以根据资源申请信息确定关键进程与所申请的资源之间的对应关系。In some embodiments, the first management and control method is that the mobile phone allows the key processes of the first application in the background to use various resources normally, including the normal use of the resources that have been applied for, and the normal application of various resources, so that the first application The key process can run normally in the background. That is to say, the mobile phone does not limit the resource usage of the key process of the first application, and the first management and control method may be a control-independent method. Among them, the mobile phone can determine the corresponding relationship between the key process and the requested resource according to the resource application information.
在另一些实施例中,该第一管控方式为弱管控方式。即,手机对后台第一应用程序的关键进程进行较小程度和较小力度的管控,以尽量使得第一应用程序的关键进程可以在后台继续运行。具体的,手机可以根据关键进程的进程标识或进程名,对关键进程进行弱管控。In other embodiments, the first management and control mode is a weak management and control mode. That is, the mobile phone controls the key processes of the first application program in the background to a lesser degree and with less intensity, so as to make the key processes of the first application program continue to run in the background as far as possible. Specifically, the mobile phone can perform weak control over the key process according to the process identifier or process name of the key process.
例如,参见图8,手机针对关键进程的弱管控方式可以包括:按进程统一Alarm心跳;按进程保活TCP连接,TCP连接不断连;不限制进程的网络权限;不限制进程对GNSS/Wakelock/Job/广播等资源的使用。也就是说,对关键进程的Alarm资源进行弱管控,允许关键进程正常使用其他资源。For example, referring to Figure 8, the mobile phone's weak management and control methods for key processes can include: unify Alarm heartbeat according to the process; keep the TCP connection alive according to the process, and the TCP connection is continuously connected; does not limit the network permissions of the process; Use of resources such as job/broadcasting. In other words, weakly control the Alarm resources of key processes, allowing key processes to use other resources normally.
其中,Alarm心跳为基于Alarm资源的心跳机制。按进程统一Alarm心跳是指,按进程统一基于Alarm资源的心跳包,即当前关键进程中的心跳包按照预设的周期T3进行发送。心跳包是指在客户端和服务器之间定时通知对方自己状态的一个自定义的命令字,按照一定的时间间隔发送,类似于心跳,所以叫做心跳包。按进程保活TCP连接是指,保活当前关键进程的TCP连接,用于实现TCP连接的Socket链路不进行断链。Among them, Alarm heartbeat is a heartbeat mechanism based on Alarm resources. Unifying the Alarm heartbeat by process means that the heartbeat packets based on Alarm resources are unified by process, that is, the heartbeat packets in the current key process are sent according to the preset cycle T3. The heartbeat packet refers to a custom command word between the client and the server to notify the other party of their own status at regular intervals, which is similar to the heartbeat, so it is called the heartbeat packet. Keep-alive TCP connection by process means that the TCP connection of the current key process is kept alive, and the Socket link used to realize the TCP connection is not broken.
以消息收/发业务为例,应用程序为了保证消息的及时性,需要在后台创建TCP连接,并与其服务器保持长时间的TCP连接。由于网络协议要求,在后台保持的长连接需要定时的进行数据包交互。应用程序(即客户端(Client))会向服务器(Server)发送保活(keep alive)数据包,也就是心跳包。参见图9,客户端会通过Alarm周期性地定时唤醒操作系统,在操作系统被唤醒后,客户端向服务器发送心跳包,与服务器进行握手;并接收服务端返回的确认(ACK)包。若有消息或订单到达客户端,则运行该客户端的手机会提醒用户,包括通知栏消息提醒,响铃提醒或振动提醒等多种提醒方式。Take the message receiving/sending service as an example. In order to ensure the timeliness of the message, the application needs to create a TCP connection in the background and maintain a long-term TCP connection with its server. Due to the requirements of the network protocol, the long connection maintained in the background requires regular data packet interaction. The application program (that is, the client (Client)) sends a keepalive data packet, that is, a heartbeat packet, to the server (Server). Referring to Figure 9, the client periodically wakes up the operating system through the Alarm. After the operating system is woken up, the client sends a heartbeat packet to the server, handshake with the server; and receives an acknowledgement (ACK) packet returned by the server. If a message or an order arrives at the client, the mobile phone running the client will remind the user, including multiple reminders such as notification bar message reminders, ring reminders or vibration reminders.
在一些实施例中,后台同一应用程序中的不同关键进程的心跳包可以采用预设的同一周期T3(例如可以为5min)进行发送,这样可以减少操作系统被唤醒的次数,降低手机的功耗。In some embodiments, the heartbeat packets of different key processes in the same application in the background can be sent in the same preset period T3 (for example, 5 min), which can reduce the number of times the operating system is awakened and reduce the power consumption of the mobile phone. .
在另一些实施例中,手机后台不同应用程序中的不同关键进程的心跳包可以采用预设的同一周期T3进行发送,这样可以更多地减少操作系统被唤醒的次数,降低手机的功耗。In other embodiments, the heartbeat packets of different key processes in different applications in the background of the mobile phone can be sent in the same preset period T3, which can reduce the number of times the operating system is awakened and reduce the power consumption of the mobile phone.
其中,第二管控方式为强管控方式,即手机对后台第一应用程序的非关键进程进行较大程度和较大力度的管控。在一些实施例中,第二管控方式为限制非关键进程使用各项资源,包括释放非关键进程申请的各项资源,即限制非关键进程使用已申请的各项资源,并限制非关键进程申请各项资源。其中,手机可以根据资源申请信息确定非关键进程与所申请的资源之间的对应关系。Among them, the second control method is a strong control method, that is, the mobile phone controls the non-critical processes of the first application program in the background to a greater degree and with greater intensity. In some embodiments, the second control method is to restrict non-critical processes from using resources, including releasing resources requested by non-critical processes, that is, restrict non-critical processes from using resources that have been applied for, and restrict non-critical processes from applying for resources. Various resources. Among them, the mobile phone can determine the correspondence between the non-critical process and the requested resource according to the resource application information.
例如,参见图10,强管控方式具体可以包括:按进程暂停Alarm心跳;按进程断开TCP连接;按进程限制网络权限;按进程对广播进行缓存或丢弃;按进程暂停GNSS/Wakelock/Job/广播等资源的使用。For example, referring to Figure 10, the strong control methods can include: pause Alarm heartbeat according to process; disconnect TCP connection according to process; limit network permissions according to process; buffer or discard broadcast according to process; pause GNSS/Wakelock/Job/ according to process Use of resources such as broadcasting.
其中,按进程暂停Alarm心跳是指,停止当前非关键进程基于Alarm的心跳包。TCP连接是通过Socket链路进行信息交互的,按进程断开TCP连接也就是说,断开当前非关键进程的TCP连接对应的Socket链路。按进程限制网络权限是指,限制当前非关键进程使用网络资源。按进程暂停GNSS/Wakelock/Job/广播等资源是指,禁止当前非关键进程使用GNSS/Wakelock/Job/广播等资源。其中,按进程暂停广播资源包括,缓存或丢弃当前非关键进程的广播内容。Among them, suspending the Alarm heartbeat by process means stopping the current non-critical process based on the Alarm heartbeat packet. The TCP connection is through the Socket link for information exchange, and the TCP connection is disconnected according to the process, that is, the Socket link corresponding to the TCP connection of the current non-critical process is disconnected. Restricting network permissions by process refers to restricting the use of network resources by current non-critical processes. Suspending resources such as GNSS/Wakelock/Job/broadcast by process means that the current non-critical processes are prohibited from using resources such as GNSS/Wakelock/Job/broadcast. Among them, suspending broadcast resources by process includes caching or discarding broadcast content of current non-critical processes.
以TCP连接的Socket链路资源为例进行说明。在现有技术中,一个进程中可能包括多个Socket链路。Socket链路断链时,手机和服务器之间需要进行四次握手交互,需要发送多个数据包。并且,进程中不同Socket链路的断链时间不同。例如,Socket链路在未进行消息交互的时间大于或者等于预设时长T4(例如可以为8min)后,可以进行四次握手的断链过程。同一进程中多个Socket链路分别进行断链需要多次消息交互,消耗的资源较多,功耗较大。Take the Socket link resource of the TCP connection as an example. In the prior art, a process may include multiple Socket links. When the Socket link is disconnected, a four-way handshake interaction is required between the mobile phone and the server, and multiple data packets need to be sent. In addition, the disconnection time of different Socket links in the process is different. For example, after the Socket link has no message interaction time greater than or equal to the preset duration T4 (for example, it can be 8 minutes), the four-way handshake can be disconnected. The disconnection of multiple Socket links in the same process requires multiple message interactions, which consumes more resources and consumes more power.
在本申请实施例提供的一种方案中,同一非关键进程中的各Socket链路可以在同一时刻统一断链。例如,手机可以在确定当前进行为关键进程,且第一应用程序进入后台T时长后,对该非关键进程中的各Socket链路统一进行断链。在统一断链时,手机可以向服务器发送重置Reset消息(或称RST包),该重置消息包括该非关键进程中各Socket链路的源端和目的端的IP地址和端口号,以通知服务器统一对该进程中的Socket链路进行断链。因而,该断链过程不需要进行多次消息交互,消耗的资源少,功耗小。In a solution provided by an embodiment of the present application, the Socket links in the same non-critical process can be disconnected uniformly at the same time. For example, after determining that the current process is a critical process, and the first application program enters the background for T duration, the mobile phone may uniformly disconnect the Socket links in the non-critical process. When the unified link is disconnected, the mobile phone can send a reset message (or RST packet) to the server. The reset message includes the source and destination IP addresses and port numbers of the Socket links in the non-critical process to notify The server uniformly disconnects the Socket link in the process. Therefore, the disconnection process does not require multiple message interactions, consumes less resources, and consumes less power.
示例性的,以QQ为例进行说明。在QQ运行后,QQ各进程创建了TCP连接的多个Socket链路。例如,QQ各进程创建了TCP连接的28个Socket链路,其中的27个Socket链路是由tool工具进程申请创建的,另一个Socket链路由消息收/发进程申请创建。若采用现有技术中的方式,在QQ进入后台后,手机根据包名或UID允许QQ各进程正常使用资源,即28个Socket链路均保留。Illustratively, take QQ as an example for description. After QQ runs, each QQ process creates multiple Socket links for TCP connections. For example, each QQ process creates 28 Socket links for TCP connections, of which 27 Socket links are created by the tool process application, and the other Socket link is created by the message receiving/sending process. If the method in the prior art is adopted, after QQ enters the background, the mobile phone allows each process of QQ to use resources normally according to the package name or UID, that is, all 28 Socket links are reserved.
在本申请的实施例中,在QQ进入后台后,QQ关键进程包括消息收/发进程,非关键进程包括tool进程。手机可以允许关键进程消息收/发进程正常使用所创建的1个Socket链路,断开非关键进程tool工具进程所创建的27个Socket链路。从而,可以减少后台QQ的资源消耗,降低手机的功耗。In the embodiment of the present application, after QQ enters the background, the key process of QQ includes the message receiving/sending process, and the non-critical process includes the tool process. The mobile phone can allow the key process message receiving/sending process to normally use the 1 Socket link created, and disconnect the 27 Socket links created by the non-critical process tool process. Thus, the resource consumption of the background QQ can be reduced, and the power consumption of the mobile phone can be reduced.
在本申请实施例提供的另一种方案中,同一应用程序中的非关键进程中的各Socket链路,可以在同一时刻统一断链。从而,可以更多地减少资源消耗,降低手机的功耗。In another solution provided by the embodiment of the present application, the Socket links in the non-critical processes in the same application can be disconnected at the same time. As a result, resource consumption can be reduced more, and the power consumption of the mobile phone can be reduced.
在另一些实施例中,第二管控方式为限制非关键进程使用一种或多种资源。例如,以QQ为例,手机可以限制非关键进程使用Socket链路和网络资源,但允许非关键进程正常 使用Alarm资源。In other embodiments, the second management and control method is to restrict non-critical processes from using one or more resources. For example, taking QQ as an example, mobile phones can restrict non-critical processes from using Socket links and network resources, but allow non-critical processes to use Alarm resources normally.
需要说明的是,在第二管控方式同时包括限制网络权限和断开TCP连接的情况下,手机可以更多地减少资源消耗和功耗。例如,若仅限制非关键进程的网络权限,不断开非关键进程的TCP连接,则手机仍会通过TCP连接尝试收/发消息,这些消息在手机的网络防火墙处被拦截,但仍然消耗了手机较多的资源和功耗。若仅断开非关键进程的TCP连接,不限制非关键进程的网络权限,则非关键进程在断开TCP连接后,或尝试重新建立TCP连接,从而也会消耗手机较多的资源和功耗。It should be noted that in the case that the second management and control method includes both restriction of network permissions and disconnection of TCP connections, the mobile phone can further reduce resource consumption and power consumption. For example, if only the network permissions of non-critical processes are restricted and the TCP connection of non-critical processes is not disconnected, the mobile phone will still try to receive/send messages through the TCP connection. These messages are blocked at the network firewall of the mobile phone, but the mobile phone is still consumed. More resources and power consumption. If only the TCP connection of the non-critical process is disconnected, and the network permissions of the non-critical process are not restricted, the non-critical process may try to re-establish the TCP connection after disconnecting the TCP connection, which will consume more resources and power consumption of the mobile phone. .
在一些实施例中,关键进程可以包括多个等级,等级越高的关键进程越重要,或者等级越高的关键进程的功能服务越容易被用户感知到。不同等级的关键进程可以对应不同的第一管控方式。并且,关键进程的等级越高,对应的第一管控方式的管控力度越小,这样可以在保证等级高的关键进程正常运行的基础上,尽量减少其他进程的资源消耗,降低手机的功耗。In some embodiments, the key process may include multiple levels, the higher the level, the more important the key process, or the higher the level, the easier the function service of the key process is to be perceived by the user. Different levels of key processes can correspond to different first management and control methods. In addition, the higher the level of the key process, the smaller the control intensity of the corresponding first control method. This can minimize the resource consumption of other processes and reduce the power consumption of the mobile phone on the basis of ensuring the normal operation of the key process with a high level.
例如,关键进程包括等级从高到低排列的第一等级、第二等级和第三等级。以Alarm心跳为例,在第一等级对应的第一管控方式中,手机不对该关键进程中的Alarm心跳周期进行管控,即不对Alarm资源的使用进行管控;在第二等级对应的第一管控方式中,该关键进程中的Alarm心跳周期为5min;在第三等级对应的第一管控方式中,该关键进程中的Alarm心跳周期为10min。For example, the key process includes the first level, the second level, and the third level in descending order. Take Alarm heartbeat as an example. In the first control mode corresponding to the first level, the mobile phone does not control the Alarm heartbeat cycle in this critical process, that is, it does not control the use of Alarm resources; in the second level, the first control mode corresponds to In the key process, the alarm heartbeat cycle is 5min; in the first control mode corresponding to the third level, the alarm heartbeat cycle in the key process is 10min.
在另一些实施例中,非关键进程可以包括多个等级,等级越低的非关键进程越不重要,或者等级越高的关键进程的功能服务越不容易被用户感知到。不同等级的非关键进程可以对应不同的第二管控方式。并且,非关键进程的等级越低,对应的第二管控方式的管控力度越大,这样可以在尽量减少不重要的非关键进程的资源消耗,降低手机的功耗。In other embodiments, the non-critical process may include multiple levels, and the lower the level of the non-critical process is, the less important it is, or the higher the level of the key process, the less likely it is to be perceived by the user. Different levels of non-critical processes can correspond to different second management and control methods. Moreover, the lower the level of non-critical processes, the greater the control intensity of the corresponding second control method, which can minimize the resource consumption of unimportant non-critical processes and reduce the power consumption of mobile phones.
例如,非关键进程包括等级从高到低排列的第一等级和第二等级。在第一等级对应的第二管控方式中,手机周期性限制非关键进程使用资源,即周期性地允许和限制非关键进程使用资源。以网络资源为例,在第一等级对应的第二管控方式中,手机周期性限制非关键进程的网络权限,即周期性地允许和限制非关键进程使用网络资源。在第二等级对应的第二管控方式中,手机限制非关键进程使用资源(例如网络资源等)。For example, non-critical processes include first and second levels ranked from high to low. In the second management and control method corresponding to the first level, the mobile phone periodically restricts the use of resources by non-critical processes, that is, periodically allows and restricts the use of resources by non-critical processes. Taking network resources as an example, in the second management and control mode corresponding to the first level, the mobile phone periodically restricts the network permissions of non-critical processes, that is, periodically allows and restricts the use of network resources by non-critical processes. In the second management and control method corresponding to the second level, the mobile phone restricts the use of resources (such as network resources, etc.) by non-critical processes.
在其他一些实施例中,后台应用程序的不同关键进程可以分别对应不同的关键资源,该关键资源用于支持该关键进程的主要功能。手机可以对关键进程的关键资源不进行管控,对其他资源进行弱管控或强管控,以通过尽量减少资源的使用,降低手机的资源和电量消耗。In some other embodiments, different key processes of the background application program may correspond to different key resources, and the key resources are used to support the main functions of the key process. The mobile phone can not control the key resources of the key process, and weakly or strongly control other resources, so as to reduce the resource and power consumption of the mobile phone by minimizing the use of resources.
例如,对于即时消息类应用程序(例如QQ、微信等)来说,消息收/发进程通常为关键进程,消息收/发进程对应的关键资源包括用于支持消息收/发功能的TCP连接资源、网络资源和Alarm资源。手机可以允许及时消息应用中的消息收/发进程正常使用TCP连接资源、网络资源和Alarm资源;并对消息收/发进程申请的其他资源(例如GPS资源、广播资源等)进行弱管控或强管控(例如限制或周期性限制消息收/发进程申请的其他资源的使用)。For example, for instant messaging applications (such as QQ, WeChat, etc.), the message receiving/sending process is usually a key process, and the key resources corresponding to the message receiving/sending process include the TCP connection resources used to support the message receiving/sending function. , Network resources and Alarm resources. The mobile phone can allow the message receiving/sending process in the instant messaging application to use TCP connection resources, network resources, and Alarm resources normally; and weakly or strongly control other resources (such as GPS resources, broadcast resources, etc.) requested by the message receiving/sending process. Management and control (such as restricting or periodically restricting the use of other resources requested by the message receiving/sending process).
再例如,对于导航类应用程序,导航进程通常为关键进程,导航进程对应的关键资源包括用于支持导航功能的GNSS资源和网络资源。手机可以允许导航类应用程序中的导航进程正常使用GNSS资源,并对导航进程申请的其他资源进程弱管控或强管控。For another example, for navigation applications, the navigation process is usually a key process, and the key resources corresponding to the navigation process include GNSS resources and network resources for supporting navigation functions. The mobile phone can allow the navigation process in the navigation application program to use GNSS resources normally, and weakly or strongly control other resource processes applied for by the navigation process.
示例性的,参见表4,导航应用程序1可以包括导航应用主进程、导航进程和推送消息进程等。其中,导航进程为关键进程,导航进程中的关键资源包括GNSS资源和网络资源。Exemplarily, referring to Table 4, the navigation application program 1 may include a navigation application main process, a navigation process, a push message process, and the like. Among them, the navigation process is a key process, and the key resources in the navigation process include GNSS resources and network resources.
再示例性的,参见表5,导航应用程序2可以包括导航应用主进程、地图导航进程和Patch更新进程等。地图导航进程为关键进程,导航进程的关键资源包括GNSS资源和网络资源。For another example, referring to Table 5, the navigation application 2 may include a navigation application main process, a map navigation process, a patch update process, and so on. The map navigation process is a key process, and the key resources of the navigation process include GNSS resources and network resources.
表4Table 4
Figure PCTCN2020111494-appb-000004
Figure PCTCN2020111494-appb-000004
表5table 5
Figure PCTCN2020111494-appb-000005
Figure PCTCN2020111494-appb-000005
再例如,对于音频播放类应用程序,播放进程通常为关键进程,播放进程对应的关键资源包括用于支持音频播放功能的音频资源。在一些实施例中,该关键资源还可以包括网络资源。手机可以允许音频播放类应用程序中的播放进程正常使用音频资源,并对播放进程申请的其他资源进程弱管控或强管控。For another example, for an audio playback application, the playback process is usually a key process, and the key resources corresponding to the playback process include audio resources for supporting the audio playback function. In some embodiments, the key resource may also include network resources. The mobile phone can allow the playback process in the audio playback application to use audio resources normally, and weakly or strongly control other resource processes requested by the playback process.
示例性的,参见表6和表7,音频播放应用程序1和音频播放应用程序2可以包括应用主进程和播放进程等。其中,播放进程为关键进程,播放进程中的音频资源为关键资源。Exemplarily, referring to Table 6 and Table 7, the audio playback application program 1 and the audio playback application program 2 may include an application main process and a playback process. Among them, the playback process is the key process, and the audio resources in the playback process are the key resources.
表6Table 6
Figure PCTCN2020111494-appb-000006
Figure PCTCN2020111494-appb-000006
表7Table 7
Figure PCTCN2020111494-appb-000007
Figure PCTCN2020111494-appb-000007
此外,对于后台第一应用程序中关键进程和非关键进程以外的其他进程,手机可以不对其进行资源管控,或者手机采用预设的资源管控方式(例如现有技术中的资源管控方式) 对其进行资源管控。举例来说,QQ中的QQ消息收/发进程为关键进程,QQ工具进程为非关键进程,QQ主进程和QQ空间进程等其他进程为关键进程和非关键进程以外的其他进程。手机可以不对QQ主进程和QQ空间进程等其他进程进行资源管控,或者手机可以采用现有技术中的资源管控方式对QQ主进程和QQ空间进程等其他进程进行资源管控。In addition, for other processes other than the critical process and non-critical process in the first background application, the mobile phone may not perform resource management and control, or the mobile phone may use a preset resource management method (for example, the resource management method in the prior art) to control it. Carry out resource management and control. For example, the QQ message receiving/sending process in QQ is a critical process, the QQ tool process is a non-critical process, and other processes such as the QQ main process and the QQ space process are critical processes and other processes other than non-critical processes. The mobile phone may not perform resource management and control on other processes such as the QQ main process and the QQ space process, or the mobile phone may use the resource management method in the prior art to perform resource management and control on other processes such as the QQ main process and the QQ space process.
在步骤407和步骤408之后,该方法还可以包括:After step 407 and step 408, the method may further include:
409、手机由后台运行第一应用程序切换到前台运行第一应用程序。409. The mobile phone switches from running the first application program in the background to running the first application program in the foreground.
第一应用程序由后台切换到前台后,第一应用程序中的各进程可以正常使用各种资源,以实现第一应用程序的各项功能和服务。After the first application program is switched from the background to the foreground, each process in the first application program can use various resources normally to realize various functions and services of the first application program.
410、手机由前台运行第一应用程序再次切换到后台运行第一应用程序。410. The mobile phone switches from running the first application program in the foreground to running the first application program in the background again.
在第一应用程序再次由前台切换到后台后,手机可以采用以上实施例描述的资源管控方法对关键进程和非关键进程进行资源管控。After the first application is switched from the foreground to the background again, the mobile phone can use the resource management and control method described in the above embodiment to perform resource management and control on key processes and non-critical processes.
在一些实施例中,在步骤410之后,由于手机之前已经确定了后台第一应用程序的关键进程和非关键进程,因而手机可以执行直接步骤407和步骤408,从而对后台第一应用程序中的关键进程和非关键进程进行资源管控。In some embodiments, after step 410, since the mobile phone has previously determined the key process and non-critical process of the first background application, the mobile phone can execute the direct step 407 and step 408, so as to check the information in the background first application. Resource management and control for critical and non-critical processes.
在另一些实施例中,在步骤410之后,手机可以执行步骤406-步骤408,确定后台第一应用程序的关键进程和非关键进程,并对后台第一应用程序中的关键进程和非关键进程进行资源管控。In other embodiments, after step 410, the mobile phone can perform step 406-step 408 to determine the critical process and non-critical process of the first background application program, and compare the critical process and non-critical process of the first background application program. Carry out resource management and control.
以上主要是以电子设备为手机为例进行说明的,本申请实施例提供的资源管控方法还可以用于平板等其他电子设备,此处不予赘述。The above description is mainly based on an example in which the electronic device is a mobile phone. The resource management and control method provided in the embodiment of the present application can also be applied to other electronic devices such as tablets, and will not be repeated here.
另外,本申请实施例还提供了一种电子设备,包括检测单元,创建单元,保存单元,显示单元,切换单元,确定单元和管控单元,各单元可以相互配合以使得电子设备执行上述实施例中的各个步骤,实现上述资源管控方法。In addition, an embodiment of the present application also provides an electronic device, including a detection unit, a creation unit, a storage unit, a display unit, a switching unit, a determination unit, and a management and control unit. Each unit can cooperate with each other to make the electronic device perform the above-mentioned embodiments. Each step of the implementation of the above-mentioned resource management and control method.
本申请实施例还提供了一种电子设备,包括一个或多个处理器;存储器;以及一个或多个计算机程序。一个或多个计算机程序被存储在存储器中,一个或多个计算机程序包括指令。当指令被一个或多个处理器执行时,使得电子设备执行上述实施例中的各个步骤,以实现上述资源管控方法。The embodiments of the present application also provide an electronic device, including one or more processors; a memory; and one or more computer programs. One or more computer programs are stored in the memory, and the one or more computer programs include instructions. When the instructions are executed by one or more processors, the electronic device is caused to execute each step in the foregoing embodiment, so as to implement the foregoing resource management and control method.
本申请的实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的资源管控方法。The embodiment of the present application also provides a computer storage medium, the computer storage medium stores computer instructions, when the computer instructions run on the electronic device, the electronic device executes the above-mentioned related method steps to realize the resource management and control in the above-mentioned embodiment method.
本申请的实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中电子设备执行的资源管控方法。The embodiments of the present application also provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute the above-mentioned related steps, so as to realize the resource management and control method executed by the electronic device in the above-mentioned embodiment.
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中电子设备执行的资源管控方法。In addition, the embodiments of the present application also provide a device. The device may specifically be a chip, component or module. The device may include a processor and a memory connected to each other. The memory is used to store computer execution instructions. When the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the resource management and control methods executed by the electronic device in the foregoing method embodiments.
其中,本申请实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Among them, the electronic devices, computer storage media, computer program products, or chips provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the corresponding methods provided above. The beneficial effects of the method are not repeated here.
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁, 仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that for the convenience and brevity of the description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functions as required. The function module is completed, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another device, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate parts may or may not be physically separate. The parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium. It includes several instructions to make a device (may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above content is only the specific implementation of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Covered in the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (23)

  1. 一种资源管控方法,其特征在于,包括:A resource management and control method, characterized in that it comprises:
    电子设备显示第一应用程序的界面;The electronic device displays the interface of the first application;
    所述电子设备由前台运行所述第一应用程序切换到后台运行所述第一应用程序,并停止显示所述第一应用程序的界面;The electronic device switches from running the first application program in the foreground to running the first application program in the background, and stops displaying the interface of the first application program;
    所述电子设备确定所述第一应用程序中的关键进程和非关键进程;Determining, by the electronic device, a critical process and a non-critical process in the first application;
    所述电子设备分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理;所述第二管控方式对资源的管控程度大于所述第一管控方式对资源的管控程度。The electronic device adopts a first management and control method and a second management and control method to process resources for the critical process and the non-critical process; the second management and control method has a greater degree of resource management and control than the first management and control method for The degree of resource management.
  2. 根据权利要求1所述的方法,其特征在于,所述电子设备确定所述第一应用程序中的关键进程和非关键进程,包括:The method according to claim 1, wherein the electronic device determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程在进程白名单中,则所述电子设备确定所述第一进程为所述关键进程;If the first process in the first application is in the process whitelist, the electronic device determines that the first process is the key process;
    若所述第一应用程序中的所述第一进程在进程黑名单中,则所述电子设备确定所述第一进程为所述非关键进程。If the first process in the first application is in the process blacklist, the electronic device determines that the first process is the non-critical process.
  3. 根据权利要求1所述的方法,其特征在于,所述电子设备确定所述第一应用程序中的关键进程和非关键进程,包括:The method according to claim 1, wherein the electronic device determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程的ADJ值小于或者等于FOREGROUND_APP_ADJ,则所述电子设备确定所述第一进程为所述关键进程;If the ADJ value of the first process in the first application is less than or equal to FORegROUND_APP_ADJ, the electronic device determines that the first process is the key process;
    若所述第一应用程序中的所述第一进程的ADJ值大于所述FOREGROUND_APP_ADJ,则所述电子设备确定所述第一进程为所述非关键进程。If the ADJ value of the first process in the first application is greater than the FOREGROUND_APP_ADJ, the electronic device determines that the first process is the non-critical process.
  4. 根据权利要求1所述的方法,其特征在于,所述电子设备确定所述第一应用程序中的关键进程和非关键进程,包括:The method according to claim 1, wherein the electronic device determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程位于SCHED_GROUP_BACKGROUND分组中,则所述电子设备确定所述第一进程为所述关键进程;If the first process in the first application is in the SCHED_GROUP_BACKGROUND group, the electronic device determines that the first process is the key process;
    若所述第一应用程序中的所述第一进程位于其他分组中,则所述电子设备确定所述第一进程为所述非关键进程。If the first process in the first application is located in another group, the electronic device determines that the first process is the non-critical process.
  5. 根据权利要求1所述的方法,其特征在于,所述电子设备确定所述第一应用程序中的关键进程和非关键进程,包括:The method according to claim 1, wherein the electronic device determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程使用了前台服务,则所述电子设备确定所述第一进程为所述关键进程;If the first process in the first application uses the foreground service, the electronic device determines that the first process is the key process;
    若所述第一应用程序中的所述第一进程未使用前台服务,则所述电子设备确定所述第一进程为所述非关键进程。If the first process in the first application does not use the foreground service, the electronic device determines that the first process is the non-critical process.
  6. 根据权利要求1所述的方法,其特征在于,所述电子设备确定所述第一应用程序中的关键进程和非关键进程,包括:The method according to claim 1, wherein the electronic device determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程满足目标特征,则所述电子设备确定所述第一进程为所述关键进程;其中,所述目标特征为预设的特征,或者为所述电子设备训练获得的特征;If the first process in the first application program satisfies the target feature, the electronic device determines that the first process is the key process; wherein, the target feature is a preset feature or is the electronic Features obtained by equipment training;
    若所述第一应用程序中的所述第一进程不满足所述目标特征,则所述电子设备确定所 述第一进程为所述非关键进程。If the first process in the first application program does not meet the target feature, the electronic device determines that the first process is the non-critical process.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述电子设备分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理,包括:The method according to any one of claims 1 to 6, wherein the electronic device adopts a first management and control mode and a second management and control mode to perform resource processing on the critical process and the non-critical process, including: :
    所述电子设备在所述第一应用程序切换到后台运行,且经历预设时长T后,T大于0,所述电子设备分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理。The electronic device is switched to run in the background after the first application program is switched to, and after a preset period of time T, T is greater than 0, the electronic device adopts the first control mode and the second control mode, respectively, for the key process and The non-critical process performs resource processing.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,在所述电子设备分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理之前,所述方法还包括:The method according to any one of claims 1-7, characterized in that, before the electronic device adopts the first management and control mode and the second management and control mode, respectively, the critical process and the non-critical process are processed for resources , The method further includes:
    所述电子设备为所述第一应用程序中的进程申请资源;The electronic device applies for resources for the process in the first application;
    所述电子设备保存资源申请信息,所述资源申请信息包括进程与所申请的资源之间的对应关系;The electronic device saves resource application information, and the resource application information includes the corresponding relationship between the process and the requested resource;
    所述电子设备分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理,包括:The electronic device adopts a first management and control mode and a second management and control mode to perform resource processing on the critical process and the non-critical process, including:
    所述电子设备根据所述资源申请信息,分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理。According to the resource application information, the electronic device adopts a first management and control mode and a second management and control mode, respectively, to perform resource processing on the critical process and the non-critical process.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述第一管控方式包括,统一所述关键进程基于定时告警Alarm的心跳包,允许所述关键进程使用其他资源;The method according to any one of claims 1-8, wherein the first management and control method comprises unifying the heartbeat packets of the key process based on the timing alarm Alarm, and allowing the key process to use other resources;
    所述第二管控方式包括,限制所述非关键进程使用资源。The second management and control method includes restricting the use of resources by the non-critical process.
  10. 根据权利要求1-8任一项所述的方法,其特征在于,所述关键进程包括第一等级、第二等级和第三等级;其中,The method according to any one of claims 1-8, wherein the key process includes a first level, a second level, and a third level; wherein,
    所述第一等级的关键进程对应的第一管控方式包括,允许所述关键进程使用资源;The first management and control method corresponding to the first-level key process includes allowing the key process to use resources;
    所述第二等级的关键进程对应的第一管控方式包括,以第一周期统一所述关键进程基于定时告警Alarm的心跳包,允许所述关键进程使用其他资源;The first management and control method corresponding to the second-level key process includes unifying the heartbeat packets of the key process based on the timing alarm in the first cycle, and allowing the key process to use other resources;
    所述第三等级的关键进程对应的第一管控方式包括,以第二周期统一所述关键进程基于定时告警Alarm的心跳包,允许所述关键进程使用其他资源,且所述第二周期大于所述第一周期。The first management and control method corresponding to the third-level key processes includes unifying the heartbeat packets of the key processes based on the timing alarm in a second cycle, allowing the key processes to use other resources, and the second cycle is greater than all The first cycle.
  11. 根据权利要求1-8任一项所述的方法,其特征在于,所述非关键进程包括第一等级和第二等级;其中,The method according to any one of claims 1-8, wherein the non-critical process includes a first level and a second level; wherein,
    所述第一等级的非关键进程对应的第二管控方式包括,周期性地限制所述非关键进程使用资源;The second management and control method corresponding to the non-critical process of the first level includes periodically restricting the use of resources by the non-critical process;
    所述第二等级的非关键进程对应的第二管控方式包括,限制所述非关键进程使用资源。The second management and control method corresponding to the second-level non-critical process includes restricting the use of resources by the non-critical process.
  12. 根据权利要求1-11任一项所述的方法,其特征在于,所述资源包括:导航卫星系统资源,网络资源,蓝牙资源,传输控制协议TCP连接资源,音频资源,调制解调器Modem资源,定时告警Alarm资源,唤醒锁Wakelock资源,广播资源,延时处理Job资源,或服务Service资源中的一项或多项。The method according to any one of claims 1-11, wherein the resources include: navigation satellite system resources, network resources, Bluetooth resources, transmission control protocol TCP connection resources, audio resources, modem resources, and timing alarms One or more of Alarm resources, Wakelock resources, Broadcast resources, Delayed processing Job resources, or Service resources.
  13. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    屏幕,用于显示界面;Screen, used to display the interface;
    一个或多个处理器;One or more processors;
    以及存储器,所述存储器中存储有代码;And a memory, in which code is stored;
    当所述代码被所述电子设备执行时,使得所述电子设备执行如下步骤:When the code is executed by the electronic device, the electronic device is caused to execute the following steps:
    显示第一应用程序的界面;Display the interface of the first application;
    由前台运行所述第一应用程序切换到后台运行所述第一应用程序,并停止显示所述第一应用程序的界面;Switch from running the first application program in the foreground to running the first application program in the background, and stop displaying the interface of the first application program;
    确定所述第一应用程序中的关键进程和非关键进程;Determine the critical process and the non-critical process in the first application;
    分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理;所述第二管控方式对资源的管控程度大于所述第一管控方式对资源的管控程度。The first management and control method and the second management and control method are respectively adopted to process the resources of the critical process and the non-critical process; the second management and control method has a greater degree of resource management and control than the first management and control method .
  14. 根据权利要求13所述的电子设备,其特征在于,所述确定所述第一应用程序中的关键进程和非关键进程,包括:The electronic device according to claim 13, wherein the determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程在进程白名单中,则确定所述第一进程为所述关键进程;If the first process in the first application is in the process whitelist, determining that the first process is the key process;
    若所述第一应用程序中的所述第一进程在进程黑名单中,则确定所述第一进程为所述非关键进程。If the first process in the first application is in the process blacklist, it is determined that the first process is the non-critical process.
  15. 根据权利要求13所述的电子设备,其特征在于,所述确定所述第一应用程序中的关键进程和非关键进程,包括:The electronic device according to claim 13, wherein the determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程的ADJ值小于或者等于FOREGROUND_APP_ADJ,则确定所述第一进程为所述关键进程;If the ADJ value of the first process in the first application is less than or equal to FORegROUND_APP_ADJ, determine that the first process is the key process;
    若所述第一应用程序中的所述第一进程的ADJ值大于所述FOREGROUND_APP_ADJ,则确定所述第一进程为所述非关键进程。If the ADJ value of the first process in the first application is greater than the FORegROUND_APP_ADJ, it is determined that the first process is the non-critical process.
  16. 根据权利要求13所述的电子设备,其特征在于,所述确定所述第一应用程序中的关键进程和非关键进程,包括:The electronic device according to claim 13, wherein the determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程位于SCHED_GROUP_BACKGROUND分组中,则确定所述第一进程为所述关键进程;If the first process in the first application is in the SCHED_GROUP_BACKGROUND group, determine that the first process is the key process;
    若所述第一应用程序中的所述第一进程位于其他分组中,则确定所述第一进程为所述非关键进程。If the first process in the first application is located in another group, it is determined that the first process is the non-critical process.
  17. 根据权利要求13所述的电子设备,其特征在于,所述确定所述第一应用程序中的关键进程和非关键进程,包括:The electronic device according to claim 13, wherein the determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程使用了前台服务,则确定所述第一进程为所述关键进程;If the first process in the first application program uses the foreground service, determine that the first process is the key process;
    若所述第一应用程序中的所述第一进程未使用前台服务,则确定所述第一进程为所述非关键进程。If the first process in the first application does not use the foreground service, it is determined that the first process is the non-critical process.
  18. 根据权利要求13所述的电子设备,其特征在于,所述确定所述第一应用程序中的关键进程和非关键进程,包括:The electronic device according to claim 13, wherein the determining the critical process and the non-critical process in the first application program comprises:
    若所述第一应用程序中的第一进程满足目标特征,则确定所述第一进程为所述关键进程;其中,所述目标特征为预设的特征,或者为所述电子设备训练获得的特征;If the first process in the first application program satisfies the target feature, it is determined that the first process is the key process; wherein, the target feature is a preset feature or is obtained by training of the electronic device feature;
    若所述第一应用程序中的所述第一进程不满足所述目标特征,则确定所述第一进程为所述非关键进程。If the first process in the first application does not meet the target feature, it is determined that the first process is the non-critical process.
  19. 根据权利要求13-18任一项所述的电子设备,其特征在于,所述分别采用第一管 控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理,包括:The electronic device according to any one of claims 13-18, wherein the respectively adopting a first management and control mode and a second management and control mode to perform resource processing on the critical process and the non-critical process comprises:
    在所述第一应用程序切换到后台运行,且经历预设时长T后,T大于0,分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理。After the first application program is switched to run in the background, and after a preset time period T, T is greater than 0, the first management and control mode and the second management and control mode are respectively adopted to perform resource processing on the critical process and the non-critical process .
  20. 根据权利要求13-19任一项所述的电子设备,其特征在于,当所述代码被所述电子设备执行时,还使得所述电子设备执行如下步骤:The electronic device according to any one of claims 13-19, wherein when the code is executed by the electronic device, the electronic device further causes the electronic device to perform the following steps:
    在所述分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理之前,为所述第一应用程序中的进程申请资源;Before the first management and control mode and the second management and control mode are respectively adopted to process the resources of the critical process and the non-critical process, apply for resources for the process in the first application;
    保存资源申请信息,所述资源申请信息包括进程与所申请的资源之间的对应关系;Save resource application information, where the resource application information includes the corresponding relationship between the process and the requested resource;
    分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理,包括:Respectively adopting the first management and control mode and the second management and control mode to perform resource processing on the critical process and the non-critical process, including:
    根据所述资源申请信息,分别采用第一管控方式和第二管控方式,对所述关键进程和所述非关键进程进行资源处理。According to the resource application information, the first management and control mode and the second management and control mode are respectively adopted to perform resource processing on the critical process and the non-critical process.
  21. 根据权利要求13-20任一项所述的电子设备,其特征在于,所述第一管控方式包括,统一所述关键进程基于定时告警Alarm的心跳包,允许所述关键进程使用其他资源;The electronic device according to any one of claims 13-20, wherein the first management and control method comprises unifying the heartbeat packets of the key process based on the timing alarm Alarm, and allowing the key process to use other resources;
    所述第二管控方式包括,限制所述非关键进程使用资源。The second management and control method includes restricting the use of resources by the non-critical process.
  22. 一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-12中任一项所述的资源管控方法。A computer storage medium, characterized by comprising computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the resource management and control method according to any one of claims 1-12.
  23. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-12中任一项所述的资源管控方法。A computer program product, characterized in that, when the computer program product runs on a computer, the computer is caused to execute the resource management and control method according to any one of claims 1-12.
PCT/CN2020/111494 2019-09-05 2020-08-26 Resource management and control method and device WO2021043046A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201910834397 2019-09-05
CN201910834397.7 2019-09-05
CN201910877656.4 2019-09-17
CN201910877656.4A CN110806926A (en) 2019-09-05 2019-09-17 Resource control method and equipment

Publications (1)

Publication Number Publication Date
WO2021043046A1 true WO2021043046A1 (en) 2021-03-11

Family

ID=69487530

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/111494 WO2021043046A1 (en) 2019-09-05 2020-08-26 Resource management and control method and device

Country Status (2)

Country Link
CN (1) CN110806926A (en)
WO (1) WO2021043046A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110806926A (en) * 2019-09-05 2020-02-18 华为技术有限公司 Resource control method and equipment
CN113672445A (en) * 2020-05-13 2021-11-19 华为技术有限公司 Method for recording running state information of target program and electronic equipment
CN114625525A (en) * 2020-12-14 2022-06-14 华为技术有限公司 Resource control method and equipment
CN113568748B (en) * 2021-07-27 2024-06-18 Oppo广东移动通信有限公司 Application process processing method and device, storage medium and electronic equipment
CN116567132A (en) * 2022-01-28 2023-08-08 荣耀终端有限公司 Power consumption control method and device
CN116055546A (en) * 2022-07-21 2023-05-02 荣耀终端有限公司 Process management method, electronic device, storage medium, and program product
CN117632393A (en) * 2022-08-12 2024-03-01 华为技术有限公司 Resource management and control method, electronic device, storage medium and program product
CN117931418A (en) * 2022-10-26 2024-04-26 荣耀终端有限公司 Resource management and control method, device, chip, electronic equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981906A (en) * 2012-11-16 2013-03-20 广东欧珀移动通信有限公司 Application program background process management method and device
US20150347181A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Resource management with dynamic resource policies
CN107479953A (en) * 2017-07-31 2017-12-15 广东欧珀移动通信有限公司 process management method, device, storage medium and electronic equipment
CN109992398A (en) * 2017-12-29 2019-07-09 广东欧珀移动通信有限公司 Method for managing resource, device, mobile terminal and computer readable storage medium
CN110018905A (en) * 2018-01-10 2019-07-16 广东欧珀移动通信有限公司 Information processing method, device, computer equipment and computer readable storage medium
CN110806926A (en) * 2019-09-05 2020-02-18 华为技术有限公司 Resource control method and equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164229A (en) * 2013-04-08 2013-06-19 北京奇虎科技有限公司 Method and device for clearing progresses of mobile terminal
CN104050035B (en) * 2014-05-14 2018-05-25 小米科技有限责任公司 The processing method and processing device of application program
CN107807847B (en) * 2016-09-09 2022-04-29 华为技术有限公司 Application process management method and terminal equipment
CN108804207A (en) * 2017-04-28 2018-11-13 珠海全志科技股份有限公司 A kind of process management-control method based on android system
CN109992399B (en) * 2017-12-29 2021-04-23 Oppo广东移动通信有限公司 Resource management method, resource management device, mobile terminal and computer-readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981906A (en) * 2012-11-16 2013-03-20 广东欧珀移动通信有限公司 Application program background process management method and device
US20150347181A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Resource management with dynamic resource policies
CN107479953A (en) * 2017-07-31 2017-12-15 广东欧珀移动通信有限公司 process management method, device, storage medium and electronic equipment
CN109992398A (en) * 2017-12-29 2019-07-09 广东欧珀移动通信有限公司 Method for managing resource, device, mobile terminal and computer readable storage medium
CN110018905A (en) * 2018-01-10 2019-07-16 广东欧珀移动通信有限公司 Information processing method, device, computer equipment and computer readable storage medium
CN110806926A (en) * 2019-09-05 2020-02-18 华为技术有限公司 Resource control method and equipment

Also Published As

Publication number Publication date
CN110806926A (en) 2020-02-18

Similar Documents

Publication Publication Date Title
WO2021043046A1 (en) Resource management and control method and device
WO2020259452A1 (en) Full-screen display method for mobile terminal, and apparatus
WO2021052263A1 (en) Voice assistant display method and device
WO2021000807A1 (en) Processing method and apparatus for waiting scenario in application
EP4084486B1 (en) Cross-device content projection method, and electronic device
WO2021185141A1 (en) Wi-fi aware link establishment method and system, electronic device, and storage medium
WO2021052410A1 (en) Application management method and apparatus
WO2021047567A1 (en) Callback stream processing method and device
WO2022033320A1 (en) Bluetooth communication method, terminal device, and computer-readable storage medium
WO2020150917A1 (en) Application permission management method and electronic device
WO2022042770A1 (en) Method for controlling communication service state, terminal device and readable storage medium
WO2021253975A1 (en) Permission management method and apparatus for application, and electronic device
WO2021017935A1 (en) Wakelock management method and electronic device
WO2023005282A9 (en) Message pushing method and apparatus
WO2022017474A1 (en) Task processing method and related apparatus
WO2021197071A1 (en) Wireless communication system and method
WO2022042637A1 (en) Bluetooth-based data transmission method and related apparatus
KR102524305B1 (en) Connection establishment method and terminal device
WO2022170856A1 (en) Method for establishing connection, and electronic device
WO2022188511A1 (en) Voice assistant wake-up method and apparatus
WO2022252972A1 (en) Window display method and electronic device
WO2022170854A1 (en) Video call method and related device
CN114500732B (en) Interface display method, electronic equipment and storage medium
WO2023160205A1 (en) Method for controlling process, and electronic device and readable storage medium
WO2023226881A1 (en) Device registration method and system, and device

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: 20861479

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20861479

Country of ref document: EP

Kind code of ref document: A1