CN110572866B - Management method of wake-up lock and electronic equipment - Google Patents

Management method of wake-up lock and electronic equipment Download PDF

Info

Publication number
CN110572866B
CN110572866B CN201910687713.2A CN201910687713A CN110572866B CN 110572866 B CN110572866 B CN 110572866B CN 201910687713 A CN201910687713 A CN 201910687713A CN 110572866 B CN110572866 B CN 110572866B
Authority
CN
China
Prior art keywords
wakelock
target process
wake
identifier
electronic device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910687713.2A
Other languages
Chinese (zh)
Other versions
CN110572866A (en
Inventor
钱华君
张贵文
赵凡凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201910687713.2A priority Critical patent/CN110572866B/en
Publication of CN110572866A publication Critical patent/CN110572866A/en
Priority to PCT/CN2020/103128 priority patent/WO2021017935A1/en
Application granted granted Critical
Publication of CN110572866B publication Critical patent/CN110572866B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • H04W52/0261Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level
    • H04W52/0274Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level by switching on or off the equipment or parts thereof
    • H04W52/028Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level by switching on or off the equipment or parts thereof switching on or off only a part of the equipment circuit blocks
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Human Computer Interaction (AREA)
  • Telephone Function (AREA)

Abstract

The application provides a management method of a wake-up lock and electronic equipment, and relates to the field of electronic equipment. The problems that due to the fact that abnormal locking is applied, a system cannot sleep for a long time and the electricity consumption of equipment is high are solved, and the endurance time of the equipment is prolonged. The process creates wakelock, the process including a target process, the target process including one or more of the following: creating a wakelock process in a file node writing mode, and creating the wakelock process in a kernel layer corresponding interface calling mode; storing the mark of the target process and the wakelock established by the target process in a correlation manner; when the target process is determined to be abnormally exited, acquiring wakelock corresponding to the identification of the target process; and releasing wakelock when the state of wakelock corresponding to the identification of the target process is determined to be the activated state.

Description

Management method of wake-up lock and electronic equipment
Technical Field
The present application relates to the field of electronic devices, and in particular, to a management method for an awake lock and an electronic device.
Background
Nowadays, electronic devices such as mobile phones and the like become indispensable communication tools in daily life and work of people. By installing an application (APP, hereinafter referred to as application) in the mobile phone, the functions of the mobile phone can be improved, and richer use experience is provided for users. For the application installed in the mobile phone, the normal operation of some services can be ensured by applying for a wake lock (wakelock).
The wakeup lock (wakelock) is a mechanism of a lock, as long as an application applies for the lock (or as long as the lock is held), a Central Processing Unit (CPU) of the mobile phone is always in a working state, and a system cannot enter a sleep state, so as to ensure normal operation of a service corresponding to the application. For example, a process for implementing a function of an application may create wakelock, so that the mobile phone screen may still be woken up to display a prompt message of the application when the mobile phone screen is closed.
However, if the application is abnormally locked, the system cannot sleep, which causes a problem of high power consumption, and the endurance time of the mobile phone is greatly shortened.
Disclosure of Invention
The embodiment of the application provides a management method of a wake-up lock and electronic equipment, and solves the problems that a system cannot sleep for a long time and the electric quantity of the equipment is consumed quickly due to abnormal lock holding of the application, and the endurance time of the equipment is prolonged.
In order to achieve the above purpose, the embodiment of the present application adopts the following technical solutions:
in a first aspect, an embodiment of the present application provides a method for managing a wake-up lock, where the method may include: the process of the electronic device creates wakelock, which includes a target process that may include one or more of the following processes: creating a wakelock process in a file node writing mode, and creating the wakelock process in a mode of calling a corresponding interface of a kernel layer of the electronic equipment; the electronic equipment stores the identification of the target process and wakelock created by the target process in a correlation manner; when the target process is determined to be abnormally exited, acquiring wakelock corresponding to the identifier of the target process; and releasing wakelock when the state of wakelock corresponding to the identification of the target process is determined to be the activated state.
According to the management method for the wake-up lock, the wakelock created by writing the file node or calling the corresponding interface of the kernel layer is recorded by the kernel layer to serve as a resource bound with the process. Therefore, after the corresponding process exits abnormally, when the process exits, the wakelock applied by the process can be automatically released, the condition that the lock is held abnormally is avoided, the system is ensured to sleep in time, and the endurance time of the electronic equipment is prolonged. In addition, the scheme provided by the embodiment does not bring large system overhead and has universality.
In a possible implementation manner, creating wakelock by a target process of an electronic device in a manner of writing a file node may include: the target process writes the lock name of wakelock required to be created by the target process into the corresponding file node; the step of the electronic device storing the identifier of the target process and the wakelock created by the target process in an associated manner may include: and the kernel layer acquires the identifier of the target process, and creates a wake _ source node which awakens the source, wherein the wake _ source node comprises the identifier of the target process and the lock name of the wakelock which is required to be created by the target process. Therefore, for the process of creating the wakelock by adopting the file node writing mode, when the kernel layer creates the wake _ source node, the identification of the process to which the wake _ source node belongs is written into the wake _ source node, and the association between the wakelock created by the process and the identification of the process is realized.
In another possible implementation manner, the creating wakelock by the target process of the electronic device in a manner of calling the corresponding interface of the kernel layer may include: the target process calls a corresponding interface of the kernel layer and inputs a lock name of wakelock required to be created by the target process; the step of the electronic device storing the identifier of the target process and the wakelock created by the target process in an associated manner may include: and the kernel layer acquires the identifier of the target process, and creates a wake _ source node which comprises the identifier of the target process and the lock name of the wakelock required to be created by the target process. Therefore, for the process which adopts the mode of calling the corresponding interface of the kernel layer to create the wakelock, when the kernel layer creates the wake _ source node, the identification of the process which the wake _ source node belongs to is written into the wake _ source node, and the association between the wakelock created by the process and the identification of the process is realized.
In another possible implementation manner, when determining that the target process exits abnormally, the electronic device acquires wakelock corresponding to the identifier of the target process, which may include: when the target process exits abnormally, the kernel layer acquires a wake _ source node containing the identifier of the target process; when determining that the wakelock corresponding to the identifier of the target process is in an activated state, the electronic device may release the wakelock, including: and when the kernel layer determines that the state of the wake _ source node containing the identification of the target process is an activated state, deactivating the wake _ source node. Thus, after the abnormal exit of the process, when the process exit processing is carried out on the kernel layer, wakelock as a process management resource can be automatically released.
In another possible implementation manner, the target process may be an application process, a native process, or a kernel process.
In a second aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; a processor coupled to a memory for storing computer program code, the computer program code comprising computer instructions that, when executed by the electronic device, cause the electronic device to perform operations comprising: the process creates a wakelock, the process includes a target process, and the target process includes one or more of the following processes: creating a wakelock process in a file node writing mode, and creating the wakelock process in a mode of calling a corresponding interface of a kernel layer of the electronic equipment; storing the mark of the target process and the wakelock established by the target process in a correlation manner; when the target process is determined to be abnormally exited, acquiring wakelock corresponding to the identification of the target process; and releasing wakelock when the state of wakelock corresponding to the identification of the target process is determined to be the activated state.
In a possible implementation manner, the creating wakelock by the target process in a manner of writing a file node includes: the target process writes the lock name of wakelock required to be created by the target process into the corresponding file node; storing the identification of the target process and the wakelock created by the target process in an associated manner, wherein the storing comprises the following steps: and the kernel layer acquires the identifier of the target process, and creates a wake _ source node which awakens the source, wherein the wake _ source node comprises the identifier of the target process and the lock name of the wakelock which is required to be created by the target process.
In another possible implementation manner, the creating wakelock by the target process in a manner of calling the corresponding interface of the kernel layer includes: the target process calls a corresponding interface of the kernel layer and inputs a lock name of wakelock required to be created by the target process; storing the identification of the target process and the wakelock created by the target process in an associated manner, wherein the storing comprises the following steps: and the kernel layer acquires the identifier of the target process, and creates a wake _ source node which comprises the identifier of the target process and the lock name of the wakelock required to be created by the target process.
In another possible implementation manner, when it is determined that the target process exits abnormally, acquiring wakelock corresponding to the identifier of the target process, including: when the target process exits abnormally, the kernel layer acquires a wake _ source node containing the identifier of the target process; when determining that the wakelock corresponding to the identifier of the target process is in an activated state, releasing wakelock, including: and when the kernel layer determines that the state of the wake _ source node containing the identification of the target process is an activated state, deactivating the wake _ source node.
In another possible implementation, the target process may be an application process, a native process, or a kernel process.
In a third aspect, an embodiment of the present application provides a computer storage medium, where the computer storage medium includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to perform a method for managing a wake lock according to the first aspect or any one of possible implementation manners of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer program product, which when run on a computer, causes the computer to execute the method for managing a wake lock according to the first aspect or any one of the possible implementation manners of the first aspect.
In a fifth aspect, an embodiment of the present application provides an apparatus having a function of implementing the behavior of the electronic device in the method of the first aspect. The functions may be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, for example, a creating unit or module, an acquiring unit or module, a releasing unit or module, and the like.
It should be appreciated that the description of technical features, solutions, benefits, or similar language in this application does not imply that all of the features and advantages may be realized in any single embodiment. Rather, it is to be understood that the description of a feature or advantage is intended to include the specific features, aspects or advantages in at least one embodiment. Therefore, the descriptions of technical features, technical solutions or advantages in the present specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and advantages described in the present embodiments may also be combined in any suitable manner. One skilled in the relevant art will recognize that an embodiment may be practiced without one or more of the specific features, aspects, or advantages of a particular embodiment. In other instances, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments.
Drawings
Fig. 1 is a schematic diagram of a network architecture applied to an APT scenario provided in the prior art;
FIG. 2 is a simplified diagram of a system architecture according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for managing a wake-up lock according to an embodiment of the present disclosure;
fig. 4 is a schematic composition diagram of a management apparatus for a wake-up lock according to an embodiment of the present disclosure.
Detailed Description
For applications in an electronic device, the electronic device usually creates a plurality of processes (processes) for executing different services to realize corresponding functions. Of these services, some services (such as the display of a prompt message) require the system to be in an active state and not be dormant. Android (Android) provides a mechanism for locks, wakelock, which cannot go to sleep as long as the lock system is held. Therefore, the process for implementing the function of the application can ensure that the system does not sleep in the process of executing the corresponding service by creating wakelock.
Generally, processes in the Android system can be divided into three categories: an application process, a native process, and a kernel process. Wherein, an application process may refer to a process of application creation. The Native process may be a process created in a Native layer of an Android system of the electronic device, and is used for providing a function of a local service or a system library. The process created in kernel mode may be referred to as a kernel process, such as a kernel driven process. In addition, the native process and the kernel process are always resident, that is, the native process and the kernel process are established when the system is started, and when an application needs to realize a corresponding function, the native process and the kernel process can provide corresponding services.
The functions of the application may be implemented through one or more of the three types of processes described above in conjunction. In this embodiment, wakelock created by a process for implementing a function of an application may be considered as wakelock of the application, or a lock held by the application. An application may hold one or more wakelocks. In addition, when a process exits, it also needs to release the wakelock it created. It should be noted that, in the electronic device, as long as a process applies for wakelock, or as long as an application holds a lock, the CPU of the electronic device does not sleep and is always in a working state.
Currently, a process may create/release wakelock in the following way:
mode 1, wakelock is created/released by calling a corresponding interface of a power saving management service (powermanager service). For example, wakelock is created by calling the acquire interface of the PowerManagerService, and is released by calling the release interface of the PowerManagerService.
Mode 2, wakelock is created by calling the acquire _ wake _ lock interface, and released by calling the release _ wake _ lock interface.
Mode 3, creating/releasing wakelock by directly writing a file node, for example, by writing a lock name of wakelock to be created to a corresponding file node. For example, wakelock is created by writing file/sys/power/wake _ lock, and released by writing file/sys/power/wake _ unlock.
Mode 4, wakelock is created/released by calling the corresponding interface of the kernel layer. For example, wakelock is created by calling wake _ lock/wake _ lock _ timeout, and released by calling wake _ unlock/wake _ lock _ active.
Wherein the application process generally creates/releases wakelock in manner 1. The native process may create/release wakelock in way 2 or way 3. The kernel process creates/releases wakelock in mode 4.
However, the above-described manner of releasing wakelock may only take effect if the process normally exits. The wakelock release method cannot be effective under the condition that the process is abnormally exited, for example, the process is abnormally exited when the process is accessed beyond the boundary. That is to say, when a process exits abnormally, wakelock created by the process cannot be released normally, or release omission occurs, which may cause the system to be unable to sleep, resulting in high power consumption. The case where the process for implementing the function of the application exits but wakelock applied for the process is not released is referred to as an application exception holding lock.
In the prior art, in order to avoid the occurrence of an abnormal lock holding situation of an application, a Power Management Service (PMS) of an electronic device may detect an application state of the lock holding through a binder mechanism. When the application is abnormal, the electronic equipment with the binder mechanism can detect that the application does not respond. At this time, the electronic device actively releases wakelock held by the application. However, the binder mechanism can only release wakelock created by the above mode 1 or mode 2, and cannot be effective for wakelock created by the above mode 3 and mode 4.
For wakelock created by the above-described manner 3 or manner 4, the following two detection mechanisms can be utilized for detection of application-abnormal holding. Mechanism 1, the application holding lock detects whether the application has abnormal lock holding condition according to the service ending condition. And if the service of the application is ended but wakelock applied by the process executing the service is not released, determining that the condition that the lock is held abnormally by the application exists. At this point, the corresponding wakelock may be released. Mechanism 2, by the system, monitors all applications that hold locks in a monitor-like manner (watchdog). If a certain application does not respond within a period of time, the application is considered to be abnormal, or the situation that the application is abnormally locked is determined. At this point, wakelock held by the application may be released.
However, in the mechanism 1, the application cannot accurately identify the end condition of the service, that is, a false judgment may occur, for example, the service is ended but the application is not identified. In addition, the detection mechanism may also fail when an application is abnormal. Thus, an application exception holding lock may still occur. In the above mechanism 2, the system is required to perform polling monitoring on all applications holding locks, which causes a large system overhead. In addition, the monitoring mechanism needs to modify the implementation of the application so that the application can register watchdog without universality. That is to say, for wakelock created by the above-mentioned method 3 or method 4, the current mechanism cannot well solve the problems that the system cannot sleep and the power consumption of the device is high due to abnormal lock holding.
The embodiment of the application provides a management method of wake-up lock, for wakelock established by the above mode 3 or mode 4, after the corresponding process exits abnormally, wakelock applied by the process can be automatically released, the occurrence of the situation of holding lock in abnormal application is avoided, the system is ensured to sleep in time, and the endurance time of electronic equipment is prolonged. In addition, the scheme provided by the embodiment does not bring large system overhead and has universality.
For example, the electronic device described in the embodiments of the present application may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a Personal Digital Assistant (PDA), an Augmented Reality (AR) \ Virtual Reality (VR) device, a wearable device (such as a smart watch), a media player, and the like, and the embodiments of the present application do not particularly limit the specific form of the device.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Please refer to fig. 1, which is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 1, the electronic device 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, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identification Module (SIM) card interface 195, and the like.
Wherein, the sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
It is to be understood that the illustrated structure of the present embodiment does not constitute a specific limitation to the electronic device. In other embodiments, an electronic device may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be a neural center and a command center of the electronic device. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a SIM interface, and/or a USB interface, etc.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
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 provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be disposed in the same device.
The wireless communication function of the electronic device may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave.
The wireless communication module 160 may provide solutions for wireless communication applied to electronic devices, including Wireless Local Area Networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Global Navigation Satellite Systems (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. 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, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, antenna 1 of the electronic device is coupled to the mobile communication module 150 and antenna 2 is coupled to the wireless communication module 160 so that the electronic device can communicate with the network and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), Long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The electronic device implements the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device may include 1 or N display screens 194, with N being a positive integer greater than 1.
The electronic device may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. In some embodiments, the electronic device may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing the digital signal. Video codecs are used to compress or decompress digital video. The electronic device may support one or more video codecs.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. The NPU can realize applications such as intelligent cognition of electronic equipment, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device and data processing by executing instructions stored in the internal memory 121. For example, in the embodiment of the present application, the processor 110 may automatically release wakelock applied by the process after the process exits abnormally by executing the instruction stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The data storage area can store data (such as audio data, phone book and the like) created in the using process of the electronic device. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
The electronic device may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic device answers a call or voice information, it can answer the voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking the user's mouth near the microphone 170C. The electronic device may be provided with at least one microphone 170C.
The headphone interface 170D is used to connect a wired headphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor is used for sensing a pressure signal and converting the pressure signal into an electric signal. In some embodiments, the pressure sensor may be disposed on the display screen 194. There are many types of pressure sensors, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, and the like.
The gyroscope sensor may be used to determine a motion gesture of the electronic device. In some embodiments, the angular velocity of the electronic device about three axes (i.e., the x, y, and z axes) may be determined by the gyroscope sensors. The gyro sensor may be used for photographing anti-shake. The gyroscope sensor can also be used for navigation and body feeling game scenes.
The air pressure sensor is used for measuring air pressure. In some embodiments, the electronic device calculates altitude from barometric pressure values measured by a barometric pressure sensor, aiding in positioning and navigation. The magnetic sensor includes a hall sensor. The electronic device can detect the opening and closing of the flip leather sheath by using the magnetic sensor. The acceleration sensor can detect the magnitude of acceleration of the electronic device in various directions (generally three axes). When the electronic device is at rest, the magnitude and direction of gravity can be detected. The method can also be used for recognizing the posture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications. A distance sensor for measuring a distance.
The proximity light sensor may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The electronic device emits infrared light to the outside through the light emitting diode. The electronic device detects infrared reflected light from nearby objects using a photodiode to determine whether there are objects in the vicinity of the electronic device.
The ambient light sensor is used for sensing the ambient light brightness. The electronic device may adaptively adjust the brightness of the display screen 194 based on the perceived ambient light level. The ambient light sensor can also be used to automatically adjust the white balance when taking a picture. The ambient light sensor can also be matched with the proximity light sensor to detect whether the electronic equipment is in a pocket or not so as to prevent mistaken touch.
The fingerprint sensor is used for collecting fingerprints. The electronic equipment can utilize the collected fingerprint characteristics to realize fingerprint unlocking, access to an application lock, fingerprint photographing, fingerprint incoming call answering and the like.
The temperature sensor is used for detecting temperature. In some embodiments, the electronic device implements a temperature processing strategy using the temperature detected by the temperature sensor.
Touch sensors, also known as "touch panels". The touch sensor may be disposed on the display screen 194, and the touch sensor and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor may be disposed on a surface of the electronic device at a different location than the display screen 194.
The bone conduction sensor may acquire a vibration signal. In some embodiments, the bone conduction sensor may acquire a vibration signal of a human voice vibrating a bone mass. The bone conduction sensor can also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, the bone conduction sensor may also be disposed in the earpiece.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic device may receive a key input, and generate a key signal input related to user settings and function control of the electronic device. The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be attached to and detached from the electronic device by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic equipment can support 1 or N SIM card interfaces, and N is a positive integer greater than 1. The SIM card interface 195 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. The electronic equipment realizes functions of conversation, data communication and the like through the interaction of the SIM card and the network. In some embodiments, the electronic device employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
The software system of the electronic device may employ a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the application takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of an electronic device.
Fig. 2 is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application. The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. As shown in fig. 2, in some embodiments, the Android system is divided into four layers, which are an application layer, an application framework layer (framework), a native layer, and a kernel layer from top to bottom.
Wherein the application layer may include a series of application packages. For example, the application packages may include WeChat, Amazon, calendar, call, map, music player, video player, short message, and other applications.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer, so as to provide support for the running of the application in the application layer.
The native layer is used for providing system service, position service, touch service, display service and the like for the application in the application program layer.
The kernel layer is a layer between hardware and software. The kernel layer at least comprises a display driver, a camera driver, an audio driver, a sensor driver, a position driver (such as a GPS driver) and the like.
In this embodiment, when the system is started, the electronic device may create a native process and/or a kernel process for providing a corresponding service. In addition, when the application of the application layer of the electronic device is started, a corresponding application process is created. In this way, with one or more of these processes in cooperation, corresponding functionality of the application may be implemented. For example, at system start-up, the electronic device creates native process 1 and kernel process 1 for providing location services. Then, native process 1 and kernel process 1 can provide corresponding location services to implement applications, such as amazon positioning functions.
For example, the technical solutions involved in the following embodiments may be implemented in an electronic device having the above hardware architecture and software architecture. The following describes in detail a control method provided in an embodiment of the present application with reference to the accompanying drawings and application scenarios.
Fig. 3 is a flowchart illustrating a method for managing a wake-up lock according to an embodiment of the present disclosure. As shown in fig. 3, the method may include:
s301, creating wakelock by the process of the electronic equipment.
For an application in the electronic device, the electronic device creates a plurality of processes for the application, and the processes are used for executing corresponding services to realize functions of the application. In the created process, the service executed by some processes needs the system to be in a working state all the time and cannot be dormant. These processes may ensure that the system does not sleep during the execution of the corresponding service by creating a wake lock (wakelock).
Generally, an operating system of an electronic device is taken as an Android system as an example. Referring to fig. 2, processes in the Android system can be divided into three categories: an application process, a native process, and a kernel process. The functionality of the application may be implemented through one or more of these three types of processes in cooperation. In this embodiment, wakelock created by a process for implementing a function of an application may be considered as wakelock of the application, or a lock held by the application. An application may hold one or more wakelocks.
The current process can create/release wakelock in four ways:
mode 1, wakelock is created/released by calling the corresponding interface of PowerManagerService.
Mode 2, wakelock is created by calling the acquire _ wake _ lock interface, and released by calling the release _ wake _ lock interface.
Mode 3, creating/releasing wakelock by directly writing a file node, for example, by writing a lock name of wakelock that needs to be created by a process to a corresponding file node.
Mode 4, wakelock is created/released by calling the corresponding interface of the kernel layer.
Illustratively, wakelock may be created/released for an application process generally in manner 1 above. The native process may create/release wakelock in way 2 or way 3. The kernel process can create/release wakelock in way 4. In addition, wakelock, created in any way, will eventually create a wake _ source node at the kernel level.
For example, take the example that an application process (e.g., referred to as process a) creates wakelock in manner 1. When the service executed by the process A needs the system not to be dormant, the process A can call an acquire interface of PowerManagerService to create wakelock through a power saving management service (PowerManger service) provided by an application framework layer. For example, wakelock created by process a is referred to as wakelock _ a. Specifically, the process a inputs the lock name of wakelock _ a that the process a needs to create by calling the acquire interface of the PowerManagerService. The native layer can acquire an identifier of the process a, such as PID _ a, according to the call, and write the identifier of the process a, i.e., the lock names of PID _ a and wakelock _ a, in a corresponding file node, such as/sys/power/wake _ lock, by calling an acquire _ wake _ lock interface. Thereafter, wakelock _ a creation of process a is complete.
For another example, wakelock is created by a native process (e.g., called process B) in manner 2. When the service executed by the process B needs the system not to sleep, the process B may create wakelock by calling a corresponding interface, such as acquire _ wake _ lock. For example, wakelock created by process B is referred to as wakelock _ B. Specifically, the process B inputs the lock name of wakelock _ B that the process B needs to create by calling the interface acquire _ wake _ lock. The native layer can acquire the identifier of the process B, such as PID _ B, according to the call, and write the identifier of the process B, namely the lock names of the PID _ B and wakelock _ B, into the corresponding file node, such as/sys/power/wake _ lock. Thereafter, wakelock _ B creation of process B is complete.
As another example, wakelock is created by a native process (e.g., referred to as process C) in manner 3. When the service executed by the process C needs the system not to be dormant, the process C can create wakelock in a file node writing mode. For example, wakelock created by process C is referred to as wakelock _ C. Specifically, the process C may directly write the lock name of wakelock _ C that the process C needs to create in the corresponding file node, such as/sys/power/wake _ lock. Thereafter, wakelock _ C creation of process C is complete.
As another example, a kernel process (e.g., referred to as process D) creates wakelock in manner 4. When the service executed by the process D needs the system not to be dormant, the process D may input the lock name of wakelock required to be created by the process D by calling a corresponding interface of the kernel layer, such as wake _ lock/wake _ lock _ timeout. For example, wakelock created by process D is referred to as wakelock _ D. Thereafter, wakelock _ D creation of process D is complete.
S302, the electronic equipment stores the identification of the target process and wakelock created by the target process in a correlation mode, wherein the target process comprises one or more of the following processes: and establishing the wakelock process in a file node writing mode, and establishing the wakelock process in a mode of calling a corresponding interface of the kernel layer.
At present, resources such as file handles, occupied memories, sockets (sockets), and the like of processes are used as resources managed by the processes, and are automatically released when the processes exit. In this embodiment, wakelock may also be used as a resource for process management, so as to achieve the purpose of automatically releasing wakelock created by the wakelock when the process exits. For the process of creating wakelock by adopting the above mode 1 and mode 2, when the process exits abnormally, the wakelock created by the process can be released through a binder mechanism. Since the mechanism is not suitable for creating the wakelock process by using the above-mentioned method 3 and method 4, in this embodiment, the wakelock created by using the above-mentioned method 3 and method 4 may be used as a resource for process management.
Specifically, for a process that creates wakelock by using a file node writing mode and a mode that calls a corresponding interface of the kernel layer, for example, called a target process, when the corresponding wake _ source node is created in the kernel layer, the kernel layer may store wakelock created by the target process and an identifier of the target process in an associated manner. For example, the kernel layer stores the wake _ source node created in the kernel layer in association with the PID of the process to which the wake _ source node belongs. Therefore, wakelock created by the wakelock can be used as a resource for process management, and subsequent management is facilitated.
For example, in connection with the example in S301, process C creates wakelock by writing to a file node. After the process C writes the lock name of the wakelock _ C to be created into the corresponding file node, and completes the creation of the wakelock _ C, the kernel layer may obtain the identifier of the process C, that is, PID _ C, and when the kernel layer creates a wake _ source node of the process C, for example, called wake _ source node C, the PID of the process C, that is, PID _ C and the lock name of the wakelock _ C to be created by the process C may be written into the wake _ source node C, so as to associate the created wake _ source node C with the PID of the process to which the wake _ source node C belongs.
For another example, in connection with the example in S301, the process D creates wakelock by calling the corresponding interface of the kernel layer. After the process D inputs the lock name of wakelock _ D required to be created by the process D by calling the corresponding interface of the kernel layer, and completes creation of wakelock _ D, the kernel layer may obtain the identifier of the process D, i.e., PID _ D, according to the call, and create a wake _ source node of the process D, e.g., called wake _ source node D, in the kernel layer, may write the PID of the process D, i.e., PID _ D and the lock name of wakelock _ D required to be created by the process D, into the wake _ source node D, so as to associate the created wake _ source node D with the PID of the process to which the wake _ source node D belongs.
Of course, for the process that creates wakelock by way of mode 1, such as process a in the example with reference to S301, and the process that creates wakelock by way of mode 2, such as process B, after the process a and the process B complete the creation of wakelock, the kernel layer also creates a wake _ source node in the kernel layer, where the wake _ source node may include the lock name of wakelock that needs to be created by the corresponding process. For example, the kernel layer creates a wake _ source node a for process a at the kernel layer, which includes the lock name of wakelock _ a that process a needs to create. As another example, the kernel layer creates a wake _ source node B for process B at the kernel layer, which includes the lock name of the wakelock _ B that process B needs to create.
S303, when the electronic equipment determines that the target process exits abnormally, acquiring wakelock corresponding to the identification of the target process.
S304, when the electronic device determines that the wakelock corresponding to the identification of the target process is in an activated state, releasing the wakelock.
If the process for implementing the function of the application exits but wakelock applied for the process is not released, it can be considered that an application holding lock abnormally occurs. In order to avoid this situation, for the processes that create wakelock in the above manner 1 and manner 2, as in the example of S301, the PMS of the electronic device may detect, through the binder mechanism, that the application has an abnormal lock holding condition when the processes a and B exit abnormally, that is, it is detected that the processes a and B exit but the wakelock created by the processes a and B is not released, and at this time, the electronic device may actively release the wakelock created by the processes. For the processes that create wakelock by using the above-mentioned methods 3 and 4, such as the process C and the process D in the example of S301, the above binder mechanism is not applicable when the processes exit abnormally.
In this embodiment, the electronic device may trigger, at the kernel layer, the process exit processing procedure when it is determined that the target process, such as the process C or the process D, exits abnormally. For example, the kernel layer may clean resources such as a file handle, an occupied memory, and a socket of the target process. In addition, the kernel layer may also execute the above S303-S304, so as to release wakelock created by the target process. Specifically, the kernel layer may obtain wakelock corresponding to the identifier of the target process. And then releasing wakelock when the state of wakelock corresponding to the identification of the target process is determined to be activated.
For example, when the process C exits abnormally, the kernel layer of the electronic device may obtain the wake _ source node including the identifier of the process C, such as when the kernel layer determines that the wake _ source node C includes the identifier of the process C. At this time, when the kernel layer determines that the state of the wake _ source node C is the active state, it indicates that the wakelock created by the process C is not released, and the kernel layer may release the wake _ source node C. For another example, when the process D exits abnormally, the kernel layer of the electronic device may obtain a wake _ source node that includes the identifier of the process D, e.g., the kernel layer determines that the wake _ source node D includes the identifier of the process D. At this time, when the kernel layer determines that the state of the wake _ source node D is the active state, it indicates that the wakelock created by the process D is not released, and the kernel layer may release the wake _ source node D. This avoids the occurrence of an application holding the lock abnormally. The specific process of releasing the corresponding wake _ source node may be to deactivate the wake _ source node, so as to ensure that the system can sleep in time.
According to the management method for the wake-up lock, the wakelock created by writing the file node or calling the corresponding interface of the kernel layer is recorded by the kernel layer to serve as a resource bound with the process. Therefore, after the corresponding process exits abnormally, when the process exits, the wakelock applied by the process can be automatically released, the condition that the lock is held abnormally is avoided, the system is ensured to sleep in time, and the endurance time of the electronic equipment is prolonged. In addition, the scheme provided by the embodiment does not bring large system overhead and has universality.
Still other embodiments of the present application provide a computer storage medium that may include computer instructions that, when executed on an electronic device, cause the electronic device to perform the steps as performed by the electronic device in the embodiment shown in fig. 3.
Further embodiments of the present application also provide a computer program product, which when run on a computer causes the computer to perform the steps performed by the electronic device in the embodiment shown in fig. 3.
Still other embodiments of the present application provide a chip system, which can be applied to an electronic device; the system-on-a-chip may include one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a line; the interface circuit is used for receiving signals from a memory of the electronic equipment and sending the signals to the processor, and the signals comprise computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device performs the method as in the corresponding embodiment of fig. 3.
Still other embodiments of the present application provide an electronic device, which may include: a processor and a memory; coupled to the processor and the memory, the memory for storing computer program code comprising computer instructions which, when executed by the electronic device, cause the electronic device to perform the method of the respective embodiment of fig. 3.
Other embodiments of the present application further provide a management apparatus for a wake-up lock, where the apparatus has a function of implementing the behavior of the electronic device in the embodiment corresponding to fig. 3. The functions can be realized by hardware, and the functions can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above functions, for example, a creating unit or module, an acquiring unit or module, a releasing unit or module, and the like.
As shown in fig. 4, the apparatus may include a creating unit 401, an acquiring unit 402, and a releasing unit 403.
A creating unit 401, configured to create a wakelock for a process, where the process may include a target process, and the target process may include one or more of the following processes: creating a wakelock process in a file node writing mode, and creating the wakelock process in a kernel layer corresponding interface calling mode; and storing the identification of the target process and the wakelock created by the target process in a correlation manner.
An obtaining unit 402, configured to obtain wakelock corresponding to the identifier of the target process when it is determined that the target process exits abnormally.
And a releasing unit 403, configured to release wakelock when determining that the state of wakelock corresponding to the identifier of the target process is an active state.
Further, the creating unit 401 is specifically configured to write, by the target process, the lock name of the wakelock that needs to be created by the target process into the corresponding file node, acquire an identifier of the target process, and create a wake _ source node in the kernel layer, where the wake _ source node includes the identifier of the target process and the lock name of the wakelock that needs to be created by the target process.
Further, the creating unit 401 is specifically configured to invoke a corresponding interface of the kernel layer by the target process, and input a lock name of wakelock that the target process needs to create; and acquiring the identifier of the target process, and creating a wake _ source node in the kernel layer, wherein the wake _ source node comprises the identifier of the target process and the lock name of the wakelock required to be created by the target process.
Further, the obtaining unit 402 is specifically configured to, when the target process exits abnormally, obtain a wake _ source node including an identifier of the target process.
The releasing unit 403 is specifically configured to deactivate the wake _ source node when it is determined that the state of the wake _ source node including the identifier of the target process is an activated state.
Further, the target process may be an application process, a native process, or a kernel process.
The computer storage medium, the computer program product, the electronic device, the management apparatus for a wake-up lock, and the chip system according to the embodiment of the present application are used to execute the method in the corresponding embodiment of fig. 3, so that the same effect can be achieved, and details are not described here.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. A method of managing a wake lock, the method comprising:
the method comprises the steps that a wakelock is created by a process of the electronic equipment, the process comprises a target process, and the target process comprises one or more of the following processes: creating a wakelock process in a file node writing mode, and creating the wakelock process in a mode of calling a kernel layer corresponding interface of the electronic equipment;
the electronic equipment stores the identification of the target process and wakelock created by the target process in a correlation manner;
when the electronic equipment determines that the target process exits abnormally, acquiring wakelock corresponding to the identification of the target process;
when the electronic equipment determines that the wakelock corresponding to the identification of the target process is in an activated state, releasing the wakelock;
the target process of the electronic device creates wakelock in a file node writing mode, and the wakelock comprises the following steps:
the target process writes the lock name of wakelock required to be created by the target process into the corresponding file node;
the electronic device stores the identifier of the target process and the wakelock created by the target process in an associated manner, including:
and the kernel layer acquires the identifier of the target process, and creates a wake _ source node in the kernel layer, wherein the wake _ source node comprises the identifier of the target process and the lock name of wakelock required to be created by the target process.
2. The method of claim 1,
the target process of the electronic device creates wakelock by calling the corresponding interface of the kernel layer, and the wakelock comprises the following steps:
the target process calls a corresponding interface of the kernel layer and inputs a lock name of wakelock required to be created by the target process;
the electronic device stores the identifier of the target process and the wakelock created by the target process in an associated manner, including:
the kernel layer acquires the identifier of the target process, and creates a wake _ source node in the kernel layer, wherein the wake _ source node comprises the identifier of the target process and a lock name of wakelock required to be created by the target process.
3. The method of claim 1,
when the electronic device determines that the target process exits abnormally, acquiring wakelock corresponding to the identifier of the target process, including:
when the target process exits abnormally, the kernel layer acquires a wake _ source node containing the identifier of the target process;
when the electronic device determines that the wakelock corresponding to the identifier of the target process is in an activated state, releasing the wakelock, including:
and when the kernel layer determines that the state of the wake _ source node containing the identifier of the target process is an activated state, deactivating the wake _ source node.
4. The method of any one of claims 1-3, wherein the target process is an application process, a native process, or a kernel process.
5. An electronic device, characterized in that the electronic device comprises: a processor and a memory; the processor is coupled with the memory, which is used to store computer program code comprising computer instructions that, when executed by the electronic device, cause the electronic device to perform the following:
creating a wakelock by a process, wherein the process comprises a target process, and the target process comprises one or more of the following processes: creating a wakelock process in a file node writing mode, and creating the wakelock process in a mode of calling a kernel layer corresponding interface of the electronic equipment;
storing the identification of the target process and the wakelock established by the target process in a correlation manner;
when the target process is determined to be abnormally exited, acquiring wakelock corresponding to the identifier of the target process;
when determining that the wakelock corresponding to the identifier of the target process is in an activated state, releasing the wakelock;
the target process creates wakelock in a file node writing mode, and the wakelock comprises the following steps:
the target process writes the lock name of wakelock required to be created by the target process into the corresponding file node;
the storing the identifier of the target process and the wakelock created by the target process in an associated manner includes:
and the kernel layer acquires the identifier of the target process, and creates a wake _ source node in the kernel layer, wherein the wake _ source node comprises the identifier of the target process and the lock name of wakelock required to be created by the target process.
6. The electronic device of claim 5, wherein the target process creates wakelock by calling a corresponding interface of the kernel layer, and comprises:
the target process calls a corresponding interface of the kernel layer and inputs a lock name of wakelock required to be created by the target process;
the storing the identifier of the target process and the wakelock created by the target process in an associated manner includes:
the kernel layer acquires the identifier of the target process, and creates a wake _ source node in the kernel layer, wherein the wake _ source node comprises the identifier of the target process and a lock name of wakelock required to be created by the target process.
7. The electronic device of claim 5, wherein the obtaining the wakelock corresponding to the identifier of the target process when it is determined that the target process exits abnormally comprises:
when the target process exits abnormally, the kernel layer acquires a wake _ source node containing the identifier of the target process;
when determining that the wakelock corresponding to the identifier of the target process is in an activated state, releasing the wakelock includes:
and when the kernel layer determines that the state of the wake _ source node containing the identifier of the target process is an activated state, deactivating the wake _ source node.
8. The electronic device of any of claims 5-7, wherein the target process is an application process, a native process, or a kernel process.
9. A computer storage medium storing computer instructions which, when run on an electronic device, cause the electronic device to perform the method of managing a wake lock as claimed in any one of claims 1 to 4.
CN201910687713.2A 2019-07-26 2019-07-26 Management method of wake-up lock and electronic equipment Active CN110572866B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910687713.2A CN110572866B (en) 2019-07-26 2019-07-26 Management method of wake-up lock and electronic equipment
PCT/CN2020/103128 WO2021017935A1 (en) 2019-07-26 2020-07-20 Wakelock management method and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910687713.2A CN110572866B (en) 2019-07-26 2019-07-26 Management method of wake-up lock and electronic equipment

Publications (2)

Publication Number Publication Date
CN110572866A CN110572866A (en) 2019-12-13
CN110572866B true CN110572866B (en) 2021-03-30

Family

ID=68773587

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910687713.2A Active CN110572866B (en) 2019-07-26 2019-07-26 Management method of wake-up lock and electronic equipment

Country Status (2)

Country Link
CN (1) CN110572866B (en)
WO (1) WO2021017935A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110572866B (en) * 2019-07-26 2021-03-30 华为技术有限公司 Management method of wake-up lock and electronic equipment
CN113747552B (en) * 2021-06-18 2024-03-19 荣耀终端有限公司 Power consumption optimization method and electronic equipment
CN116723384B (en) * 2022-02-28 2024-04-19 荣耀终端有限公司 Process control method, electronic device and readable storage medium
CN116701134B (en) * 2022-10-14 2024-05-17 荣耀终端有限公司 Data processing method and electronic equipment
CN117131497A (en) * 2023-02-28 2023-11-28 荣耀终端有限公司 Software detection method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103885565A (en) * 2012-12-21 2014-06-25 希姆通信息技术(上海)有限公司 Dormancy method and dormancy system for intelligent equipment
CN104023147A (en) * 2014-06-27 2014-09-03 广东欧珀移动通信有限公司 Method and system for facilitating stable dormancy of mobile terminal
CN105807894A (en) * 2016-03-22 2016-07-27 北京小米移动软件有限公司 Processing method and device of lock holding of application

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10013511B2 (en) * 2012-04-09 2018-07-03 Purdue Research Foundation System and method for energy usage accounting in software applications
US9351254B2 (en) * 2014-01-22 2016-05-24 Seven Networks, Llc Method for power saving in mobile devices by optimizing wakelocks
CN105183137B (en) * 2015-09-09 2018-06-01 厦门美图移动科技有限公司 A kind of mobile terminal and its wake-up lock control method and control system
WO2017070894A1 (en) * 2015-10-29 2017-05-04 华为技术有限公司 Terminal-based wakelock control method and apparatus, and terminal
CN105867581A (en) * 2015-12-16 2016-08-17 乐视移动智能信息技术(北京)有限公司 Power optimization method and device and mobile terminal
CN106125891A (en) * 2016-06-24 2016-11-16 北京奇虎科技有限公司 Terminal power optimization method, device and terminal
CN106502687A (en) * 2016-10-24 2017-03-15 深圳市金立通信设备有限公司 A kind of method and terminal for entering resting state
CN108268116B (en) * 2017-01-03 2022-06-07 中兴通讯股份有限公司 Method and device for solving abnormal power consumption of mobile terminal and mobile terminal
CN107608724A (en) * 2017-09-26 2018-01-19 深圳市金立通信设备有限公司 A kind of method, terminal and computer-readable recording medium for managing application program
CN110572866B (en) * 2019-07-26 2021-03-30 华为技术有限公司 Management method of wake-up lock and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103885565A (en) * 2012-12-21 2014-06-25 希姆通信息技术(上海)有限公司 Dormancy method and dormancy system for intelligent equipment
CN104023147A (en) * 2014-06-27 2014-09-03 广东欧珀移动通信有限公司 Method and system for facilitating stable dormancy of mobile terminal
CN105807894A (en) * 2016-03-22 2016-07-27 北京小米移动软件有限公司 Processing method and device of lock holding of application

Also Published As

Publication number Publication date
WO2021017935A1 (en) 2021-02-04
CN110572866A (en) 2019-12-13

Similar Documents

Publication Publication Date Title
CN110572866B (en) Management method of wake-up lock and electronic equipment
CN113704014B (en) Log acquisition system, method, electronic device and storage medium
CN110347269B (en) Empty mouse mode realization method and related equipment
CN111369988A (en) Voice awakening method and electronic equipment
CN111819533B (en) Method for triggering electronic equipment to execute function and electronic equipment
CN111742539B (en) Voice control command generation method and terminal
WO2021218540A1 (en) Antenna power adjustment method, terminal device and storage medium
CN113728295B (en) Screen control method, device, equipment and storage medium
CN113704205B (en) Log storage method, chip, electronic device and readable storage medium
WO2020056778A1 (en) Method for shielding touch event, and electronic device
CN115589051B (en) Charging method and terminal equipment
CN112684969B (en) Always displaying method and mobile device
WO2022170856A1 (en) Method for establishing connection, and electronic device
CN114880251A (en) Access method and access device of storage unit and terminal equipment
CN114822525A (en) Voice control method and electronic equipment
CN113901485B (en) Application program loading method, electronic device and storage medium
WO2022170854A1 (en) Video call method and related device
CN115206308A (en) Man-machine interaction method and electronic equipment
CN113050864A (en) Screen capturing method and related equipment
CN116723384B (en) Process control method, electronic device and readable storage medium
CN117271170B (en) Activity event processing method and related equipment
CN113672454B (en) Screen freezing monitoring method, electronic equipment and computer readable storage medium
WO2023207715A1 (en) Screen-on control method, electronic device, and computer-readable storage medium
CN116795604B (en) Processing method, device and equipment for application exception exit
CN112583651B (en) Method, device and medium for testing applet communication interface

Legal Events

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