Method for managing system service and electronic equipment
By detecting and uninstalling idle system services in the Android operating system, the problem of degradation in the operation speed of electronic devices caused by memory usage is solved, and the fluency and user experience are improved.
Patent Information
- Application Number
- CN202310573752.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2024-11-22
AI Technical Summary
As the number of integrated system services in the Android operating system increases, the memory occupied causes the operation speed of electronic devices to decrease, which may cause lag and affect the operation of third-party applications.
By detecting the status of the system service, offloading the system service that is in an idle state, freeing its associated memory and threads, blocking call requests, saving and restoring data to ensure the user experience.
It improves the smooth operation of the operating system, enhances the flexibility of management system services, avoids task interruptions, and improves user experience.
Smart Images

Figure CN119003145A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic devices, and more specifically, to a method for managing system services and an electronic device. Background Art
[0002] With the advancement of technology and the improvement of user needs, more and more system services are integrated into the operating system. Taking the Android operating system as an example, there are more than 200 resident system services in the Android operating system with system version Q, which occupy 800+MB of memory of electronic devices. The hardware capabilities of electronic devices carrying operating systems are different. More and more system services running at the same time may cause electronic devices to freeze and affect the running of third-party applications on electronic devices. Based on this, how to effectively manage system services has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The present application provides a method for managing system services and an electronic device, which can uninstall system services in an idle state and improve the operating speed of the electronic device.
[0004] In a first aspect, a method for managing system services is provided, the method comprising: detecting the status of N system services, the N system services including a first system service, N ≥ 1 and being an integer; determining that a trigger condition is satisfied, and releasing memory and threads associated with the first system service, the trigger condition comprising that the first system service has not been called and / or that the first system service has no task processing.
[0005] In an embodiment of the present application, the electronic device can detect the status of the system service in real time, and when it is determined that there is an idle system service, it can release the memory and threads associated with the system service. Task interruption will not be caused by uninstalling the system service, and the released resources can be allocated to other services, which can improve the running smoothness of the operating system and enhance the flexibility of managing system services.
[0006] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: in the process of releasing the memory and threads associated with the first system service, detecting a first request, the first request being used to request a call to the first system service; and blocking the first request.
[0007] In combination with the first aspect, in some implementations of the first aspect, the method further includes: after releasing the memory and thread associated with the first system service, responding to the first request to reload the first system service.
[0008] In an embodiment of the present application, when the electronic device is in the process of uninstalling the first system service, if it receives a first request to call the first system service, the electronic device may first block the first request, and after completing the uninstallation of the first system service, respond to the first request to reload the first system service, thereby ensuring that the client's request will not be lost, thereby improving the user experience.
[0009] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: in the process of releasing the memory and thread associated with the first system service, saving the pointer data of the first system service to the memory associated with the first client process, and saving the data of the first system service other than the pointer data to the external memory, wherein the first client is the client that calls the first system service.
[0010] In combination with the first aspect, in certain implementations of the first aspect, the response to the first request to reload the first system service includes: reading data of the first system service other than the pointer data from the external memory, reading the pointer data from the memory associated with the first client process to reload the first system service and restore the data of the first system service.
[0011] In an embodiment of the present application, during the process of uninstalling the first system service, the electronic device can save the data of the first system service. When the first system service needs to be reloaded, the data of the first system service can be read, thereby restoring the first system service to the state before uninstallation, which helps to improve the user experience.
[0012] In combination with the first aspect, in certain implementations of the first aspect, the trigger condition also includes one or more of the following: the memory usage rate is greater than or equal to the first threshold; the remaining rate of the memory is less than or equal to the second threshold; the memory usage is greater than or equal to the third threshold; the remaining amount of the memory is less than or equal to the fourth threshold.
[0013] In an embodiment of the present application, when the electronic device determines whether to release the memory and threads associated with the first system service, it can also detect the memory usage. When the electronic device determines that the memory is insufficient and the first system service is in an idle state, the memory and threads associated with the first system service can be released, thereby releasing some resources and improving the running smoothness of the operating system.
[0014] According to a second aspect, an electronic device is provided, comprising a detection module and a processing module, wherein the detection module is used to detect the status of N system services, where the N system services include a first system service, and N ≥ 1 and is an integer; and the processing module is used to determine whether a trigger condition is satisfied and release memory and threads associated with the first system service, wherein the trigger condition includes that the first system service has not been called and / or that the first system service has no task processing.
[0015] In combination with the second aspect, in certain implementations of the second aspect, the detection module is also used to detect a first request during the process of releasing memory and threads associated with the first system service, where the first request is used to request a call to the first system service; the processing module is also used to block the first request.
[0016] In combination with the second aspect, in some implementations of the second aspect, the processing module is further used to respond to the first request to reload the first system service after releasing the memory and thread associated with the first system service.
[0017] In combination with the second aspect, in certain implementations of the second aspect, the processing module is also used to save the pointer data of the first system service to the memory associated with the first client process during the process of releasing the memory and thread associated with the first system service, and save the data of the first system service other than the pointer data to the external memory, wherein the first client is the client that calls the first system service.
[0018] In combination with the second aspect, in certain implementations of the second aspect, the processing module is specifically used to read data of the first system service other than the pointer data from the external memory, and read the pointer data from the memory associated with the first client process to reload the first system service and restore the data of the first system service.
[0019] In combination with the second aspect, in certain implementations of the second aspect, the trigger condition also includes one or more of the following: the memory usage rate is greater than or equal to the first threshold; the remaining rate of the memory is less than or equal to the second threshold; the memory usage is greater than or equal to the third threshold; the remaining amount of the memory is less than or equal to the fourth threshold.
[0020] The third aspect is a chip of an embodiment of the present application, which is coupled to a memory in an electronic device and is used to call a computer program stored in the memory and execute the above-mentioned aspects of the embodiment of the present application and any possible design of the above-mentioned aspects of the embodiment of the present application; "coupling" in the embodiment of the present application refers to the direct or indirect combination of two components with each other.
[0021] The fourth aspect is a computer-readable storage medium of an embodiment of the present application, which includes a computer program. When the computer program runs on an electronic device, the electronic device executes a technical solution such as the above aspect and any possible design of the above aspect.
[0022] The fifth aspect is a computer program according to an embodiment of the present application, which includes instructions. When the instructions are executed on a computer, the computer executes a technical solution such as the above aspect and any possible design of the above aspect.
[0023] The sixth aspect is an electronic device of an embodiment of the present application, which includes one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the one or more processors, the above aspects or any possible implementation method of the above aspects is executed.
[0024] Among them, for the beneficial effects of the second to sixth aspects, please refer to the beneficial effects of the first aspect and will not be repeated. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0026] Figure 2 This is a software structure block diagram of an electronic device provided in an embodiment of the present application.
[0027] Figure 3 It is a schematic flowchart of the management system service method provided in an embodiment of the present application.
[0028] Figure 4 is another schematic flowchart of a management system service provided according to an embodiment of the present application.
[0029] Figure 5 is another schematic flowchart of a management system service provided according to an embodiment of the present application.
[0030] Figure 6 It is a schematic diagram of the internal data flow of the management system service of the electronic device provided in the embodiment of the present application.
[0031] Figure 7 This is a schematic diagram of the composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind of", "the", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one, two or more. The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0033] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0034] The following describes electronic devices and embodiments for using such electronic devices. In some embodiments, the electronic device may be a portable electronic device that also includes other functions such as a personal digital assistant and / or a music player, such as a mobile phone, a tablet computer, a wearable electronic device with wireless communication functions (such as a smart watch), etc. Exemplary embodiments of portable electronic devices include but are not limited to devices equipped with , OpenHarmony or other operating systems. The portable electronic device may also be other portable electronic devices, such as a laptop computer. It should also be understood that in some other embodiments, the electronic device may not be a portable electronic device, but a desktop computer.
[0035] For example, Figure 11 shows a schematic diagram of the structure 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, 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 compass 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0036] It is to 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 in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0037] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units may be independent components or integrated into one or more processors. In some embodiments, the electronic device 100 may also include one or more processors 110. Among them, the controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. In some other embodiments, a memory may also be set in the processor 110 for storing instructions and data. Exemplarily, the memory in the processor 110 may be a high-speed cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the electronic device 100 in processing data or executing instructions.
[0038] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. Among them, the USB interface 130 is an interface that complies with the USB standard specification, and can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. The USB interface 130 can also be used to connect headphones to play audio through the headphones.
[0039] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0040] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0041] 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 charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0042] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0043] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0044] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0045] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0046] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects 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 that execute program instructions to generate or change display information.
[0047] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments of the present application, when the display panel is made of materials such as OLED, AMOLED, FLED, etc., the above Figure 1 The display screen 194 in the embodiment can be bent. Here, the display screen 194 can be bent, which means that the display screen can be bent to any angle at any position and can be kept at the angle. For example, the display screen 194 can be folded in half from the middle to the left or right. It can also be folded in half from the middle to the top or bottom.
[0048] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
[0049] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0050] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can 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 passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include one or more cameras 193.
[0051] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0052] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0053] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0054] The external memory interface 120 can be used to connect an external memory, such as a Micro SD card, a hard disk, to expand the storage capacity of the electronic device 100. The external memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in an external memory card. In the embodiment of the present application, the external memory connected to the external memory interface 120 can be referred to as an external memory.
[0055] The internal memory 121 can be used to store one or more computer programs, which include instructions. The processor 110 can enable the electronic device 100 to perform the methods provided in some embodiments of the present application, as well as various applications and data processing, etc. by running the above instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system; the program storage area can also store one or more applications (such as a gallery, contacts, etc.). The data storage area can store data (such as photos, contacts, etc.) created during the use of the electronic device 100. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, a flash memory component, a universal flash storage (UFS), etc. In some embodiments, the processor 110 can enable the electronic device 100 to perform the methods provided in the embodiments of the present application, as well as other applications and data processing by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor 110. The electronic device 100 can implement audio functions such as music playback, weather, etc. through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor, etc. In the embodiment of the present application, the internal memory 121 can be referred to as a memory.
[0056] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0057] Among them, 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 can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on 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 touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on 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.
[0058] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., X, Y, and Z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking 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.
[0059] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all 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 the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0060] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The 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 a pocket to prevent accidental touches.
[0061] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0062] 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, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J 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 other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0063] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The 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. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0064] Figure 2 1 is a software structure diagram of the electronic device 100 of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer. The application layer can include a series of application packages.
[0065] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0066] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0067] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0068] The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0069] Content providers are used to store and retrieve data and make it accessible to applications. This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0070] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0071] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0072] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0073] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the display in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0074] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0075] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0076] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG and PNG, etc.
[0077] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing.
[0078] A 2D graphics engine is a drawing engine for 2D drawings.
[0079] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0080] Before introducing the embodiments of the present application, concepts related to the embodiments of the present application are first introduced.
[0081] System services: Services integrated into the operating system of electronic devices are called system services, such as Bluetooth services, Wi-Fi services, etc.
[0082] With the advancement of technology and the increase in user needs, more and more system services are integrated into the operating system. Taking the Android operating system as an example, there are more than 200 resident system services in the Android operating system with system version Q, which occupy 800+MB of memory of electronic devices. The hardware capabilities of electronic devices that carry the operating system are different. More and more system services may cause electronic devices to freeze and affect the running of third-party applications on electronic devices.
[0083] Based on this, an embodiment of the present application provides a method for managing system services, which can detect the status of system services. When it is determined that the system services are in an idle state, the idle system services can be uninstalled, thereby freeing up the memory occupied by the system services to increase the operating speed of the electronic device.
[0084] Figure 3 A schematic flow chart of a management system service method 300 provided in an embodiment of the present application is shown. Figure 3 As shown, the method 300 includes:
[0085] S301, detecting the status of N system services.
[0086] Specifically, the electronic device may detect the status of N system services after the operating system is started, where N≥1 and is an integer, and the N system services include the first system service.
[0087] Optionally, in some embodiments, the N system services are all system services of the operating system, that is, the electronic device can detect all system services in the operating system after the operating system is started.
[0088] Optionally, in some embodiments, the N system services are some system services of the operating system. For example, the number of system services of the operating system is 240, and N=120, that is, the electronic device can detect some system services in the operating system after the operating system is started.
[0089] When N system services are partial system services of an operating system, the N system services may be determined based on preset rules. The preset rules are not limited in the embodiment of the present application. The preset rules may be set by the provider of the operating system. In this case, the preset rules may be updated as the operating system version is updated, or the preset rules may be set by the user.
[0090] Exemplarily, a user or a provider of an operating system may provide information about system services that need to be detected, and the electronic device may detect N system services based on the information.
[0091] For example, the user sets the need to detect the status of the Bluetooth service, and the electronic device can detect the status of the Bluetooth service after the operating system is started.
[0092] Exemplarily, the electronic device may determine the N system services according to the memory occupied by the system services.
[0093] For example, the electronic device may detect system services that occupy memory exceeding threshold #1, that is, the N system services are system services that occupy memory exceeding threshold #1.
[0094] In S301, the electronic device detecting the status of N system services can be understood as the electronic device detecting whether the N system services are called and / or whether the N system services have tasks to be processed. In the embodiment of the present application, when the system service is called and / or processes tasks, the status of the system service can be considered to be a busy state (or active state); conversely, when the system service is not called and / or has no tasks to be processed, the status of the system service can be considered to be an idle state.
[0095] S302: Determine that a trigger condition is met, and release the memory and thread associated with the first system service. The trigger condition includes that the first system service is not called and / or the first system service has no task to process.
[0096] Specifically, when the electronic device determines that the trigger condition is met, the electronic device may release the memory and thread associated with the first system service to uninstall the first system service.
[0097] Optionally, in some embodiments, the trigger condition includes that the first system service is not called and / or the first system service has no task processing.
[0098] For example, taking the first system service as the Bluetooth service, when the operating system is running, when the Bluetooth service is called by the music application #1, it means that the Bluetooth service is in a busy state. When the electronic device detects that the Bluetooth service is no longer called by the music application #1, the electronic device can determine that the Bluetooth service is in an idle state, and the electronic device can uninstall the Bluetooth service, that is, release the memory and threads associated with the Bluetooth service.
[0099] For another example, taking the first system service as a distributed camera service, when the operating system is running, when the distributed camera service is called by distributed device #1 and distributed device #2, it means that the distributed camera service is in a busy state. When the electronic device detects that the distributed camera service is no longer called by distributed device #1 and distributed device #2, the electronic device can also detect whether the distributed camera service has task processing. If the electronic device detects that the distributed camera service still has tasks, that is, it is determined that the distributed camera service is still in a busy state, the distributed camera service can be uninstalled after the distributed camera service task processing is completed instead of uninstalling it first. If the electronic device detects that the distributed camera service has no task processing, that is, it is determined that the distributed camera service is in an idle state, the electronic device can uninstall the distributed camera service, that is, release the memory and threads associated with the distributed camera service.
[0100] In the above examples, the system service is called as an example, but in other examples of the present application, the system service may not be called but may process tasks independently. In these examples, when the electronic device determines that the system service has no task to process, it can be determined that the system service is in an idle state, and the system service can be uninstalled, that is, the thread and memory associated with the system service are released.
[0101] In an embodiment of the present application, the electronic device can detect the status of the system service in real time, and when it is determined that there is an idle system service, it can release the memory and threads associated with the system service, thereby avoiding task interruption, and can allocate the released resources to other services, thereby improving the running smoothness of the operating system and enhancing the flexibility of managing system services.
[0102] Optionally, in some embodiments, the trigger condition also includes: a memory usage rate is greater than or equal to a first threshold.
[0103] For example, if the electronic device detects that the usage rate of its memory reaches 90% (the first threshold is 85%) and the first system service is not called and no task is processed, the electronic device can release the memory and thread associated with the first system service.
[0104] Optionally, in some embodiments, the trigger condition also includes: a remaining rate of the memory is less than or equal to a second threshold.
[0105] For example, if the electronic device detects that the remaining rate of its memory is 10% (the second threshold is 10%) and the first system service is not called and no task is processed, the electronic device can release the memory and thread associated with the first system service.
[0106] Optionally, in some embodiments, the trigger condition also includes: memory usage is greater than or equal to a third threshold.
[0107] For example, if the electronic device detects that the used memory usage is 6 GB (the third threshold is 5 GB) and the first system service is not called and no task is processed, the electronic device can release the memory and thread associated with the first system service.
[0108] Optionally, in some embodiments, the trigger condition also includes: the remaining amount of memory is less than or equal to a fourth threshold.
[0109] For example, if the electronic device detects that the unused memory size is 2 GB (the fourth threshold is 3 GB) and the first system service is not called and no task is processed, the electronic device can release the memory and thread associated with the first system service.
[0110] In an embodiment of the present application, when the electronic device determines whether to release the memory and threads associated with the first system service, it can also detect the memory usage. When the electronic device determines that the memory is insufficient and the first system service is in an idle state, the memory and threads associated with the first system service can be released, thereby releasing some resources and improving the running smoothness of the operating system.
[0111] Figure 4 Another schematic flow chart of a management system service provided according to an embodiment of the present application is shown. Figure 4 As shown, the method 300 also includes:
[0112] S303: In the process of releasing the memory and the thread associated with the first system service, a first request is detected, where the first request is used to instruct to load the first system service.
[0113] S304, blocking the first request.
[0114] Specifically, the electronic device determines that the trigger condition needs to be met and the memory and thread associated with the first system service need to be released. The memory and thread associated with the first system service can be released. In the process of releasing the memory and thread associated with the first system service, if a new first request for calling the first system service is detected, the electronic device can first block the first request, that is, suspend the thread corresponding to the first request.
[0115] For example, taking the first system service as a Bluetooth service, when the operating system is running, when the Bluetooth service is called by music application #1, it means that the Bluetooth service is in a busy state. When the electronic device detects that the Bluetooth service is no longer called by music application #1, the electronic device can determine that the Bluetooth service is in an idle state, and the electronic device can release the memory and threads associated with the Bluetooth service. When the electronic device is in the process of releasing the memory and threads associated with the Bluetooth service, if it detects a first request for requesting to call the first system service, since it is still in the state of uninstalling the first system service, the electronic device can first block the first request, wherein the first request can be sent by music application #1 or by other clients.
[0116] Optionally, in some embodiments, the method further comprises:
[0117] S305: After releasing the memory and thread associated with the first system service, respond to the first request to reload the first system service.
[0118] Specifically, after releasing the memory and thread associated with the first system service, the electronic device may respond to the suspended first request to reload the first system service.
[0119] In an embodiment of the present application, when the electronic device is in the process of uninstalling the first system service, if it receives a first request to call the first system service, the electronic device may first block the first request, and after completing the uninstallation of the first system service, respond to the first request to reload the first system service, thereby ensuring that the client's request will not be lost, thereby improving the user experience.
[0120] Figure 5 Another schematic flow chart of a management system service provided according to an embodiment of the present application is shown. Figure 5 As shown, before releasing the memory and thread associated with the first system service, the method 300 further includes:
[0121] S306, in the process of releasing the memory and thread associated with the first system service, the pointer data of the first system service is saved in the memory of the process associated with the first client, and the data of the first system service other than the pointer data is saved in the external memory. The first client is the client that calls the first system service.
[0122] Specifically, when the electronic device determines that the trigger condition is met and the memory and thread associated with the first system service need to be released, the data of the first system service can be stored, wherein, since the pointer data will become invalid after the electronic device releases the thread associated with the first system service, the pointer data cannot be saved in the external memory (external memory), and the data other than the pointer data will not become invalid even after the thread associated with the first system service is released. In order to save memory resources, the data other than the pointer data can be stored in the external memory (external memory), and the first client is the client that calls the first system service. In the embodiment of the present application, the party that calls the system service is referred to as the client. In the embodiment of the present application, there is no limitation on the type of the client. For example, the client that calls the system service can be a third-party application, a hardware device, a system service (that is, the one that calls the system service can be another system service), etc. In the embodiment of the present application, the data that becomes invalid after the thread is released can be referred to as non-persistent data, and the data that will not become invalid after the thread is released can be referred to as persistent data.
[0123] Optionally, in other embodiments, in the process of releasing the memory and thread associated with the first system service, the data of the first system service is saved in the memory of the process associated with the first client.
[0124] Optionally, in some embodiments, S305, after releasing the memory and thread associated with the first system service, responding to the first request to reload the first system service includes:
[0125] S3051, reading data other than pointer data of the first system service from the external memory, and reading pointer data from the memory associated with the first client process to reload the first system service and restore data of the first system service.
[0126] Specifically, because the electronic device saves the pointer data of the first system service in the memory associated with the first client process and stores data other than the pointer in the external memory during the process of releasing the memory and thread associated with the first system service, when the electronic device reloads the first system service in response to the first request, the electronic device can read the stored data, so that the first system service is restored to the state before the memory and thread associated with the first system service are released.
[0127] Optionally, in some other embodiments, S305, after releasing the memory and thread associated with the first system service, responding to the first request to reload the first system service includes:
[0128] The data of the first system service is read from the memory associated with the first client process to reload the first system service and restore the state of the first system service.
[0129] Specifically, because the electronic device saves the data of the first system service in the memory associated with the first client process during the process of releasing the memory and thread associated with the first system service, when the electronic device reloads the first system service in response to the first request, the electronic device can read the stored data, so that the first system service is restored to the state before the memory and thread associated with the first system service are released.
[0130] In an embodiment of the present application, during the process of uninstalling the first system service, the electronic device can save the data of the first system service. When the first system service needs to be reloaded, the data of the first system service can be read, thereby restoring the first system service to the state before uninstallation, which helps to improve the user experience.
[0131] The above mainly introduces a method for managing system services provided by an embodiment of the present application from the perspective of electronic equipment. Figure 6 The internal data flow of the management system service of the embodiment of the present application is introduced.
[0132] Figure 6 The diagram shows the internal data flow of the management system service of the electronic device provided by the embodiment of the present application. Figure 6 As shown, the electronic device 600 includes a system management module 610, a server 620 and a client 630. The system management module is used to maintain system services. The system management module 610 includes a system service handle management module 611, a system service uninstall decision module 612 and a system service status management module 613. The server 620 can be understood as a system service. The server includes a system service framework 621 and a business processing module 622. The system service framework 621 of the server 620 includes an idle decision module 6211 and a data preservation and recovery module 6212. The client 630 can be understood as a module for calling system services. The client 630 includes a business calling module 631 and a system service framework 632. The system service framework includes a callback preservation and recovery module 6321. The internal data flow of the method for managing system services provided in the embodiment of the present application is introduced in combination with each module.
[0133] When the trigger condition includes that the system service is not called (ie, the server is not called), the idle decision module 6211 can configure the uninstall condition to the system service uninstall decision module 612, and the uninstall condition is used to indicate that the server 620 is not called. In other words, the trigger condition can include the uninstall condition.
[0134] For example, taking the server as a distributed camera service, the server 620 may configure an uninstallation condition that the distributed device that calls the server is offline, that is, the server is not called.
[0135] The system service uninstallation decision module 612 can detect whether the status of the server 620 meets the uninstallation conditions. When the system service uninstallation decision module 612 determines that the server 620 does not meet the uninstallation conditions, the system service status management module 613 can mark the server 620 as active, that is, it cannot be uninstalled.
[0136] When the system service uninstallation decision module 612 determines that the server 620 meets the uninstallation condition, there are two possible implementation methods:
[0137] In a possible implementation, the system service decision module 612 may call back the idle decision module 6211 to sense whether the server 620 has any task processing. If the system service decision module 612 determines that the server 620 has no task processing, the system service status management module 613 may mark the status of the server 620 as an idle state. If the system service decision module 612 determines that the server 620 has a task processing, the system service status management module 613 may mark the status of the server 620 as an idle state after the server 620 completes the task processing. In other words, in this possible implementation, the triggering conditions include that the server 620 has not been called and that the server 620 has no task processing.
[0138] In a possible implementation, when the system service uninstallation decision module 612 determines that 620 meets the uninstallation condition, the system service state management module 613 may mark the server 620 as idle. In other words, in this possible implementation, the trigger condition includes that the server 620 is not called.
[0139] Optionally, in some embodiments, in combination with the trigger conditions in the above two possible implementation methods, the trigger conditions also include one or more of the following: the memory usage rate is greater than or equal to the first threshold; the memory remaining rate is less than or equal to the second threshold; the memory usage is greater than or equal to the third threshold; the memory remaining amount is less than or equal to the fourth threshold.
[0140] When determining that the trigger condition is met, the system service management module 610 can uninstall the server 620, that is, release the memory and storage associated with the server 620.
[0141] It should be noted that when the trigger condition includes multiple conditions, the multiple conditions may not be met at the same time.
[0142] For example, taking the trigger condition that the remaining memory rate is less than or equal to the second threshold, the server 620 is not called and no task is processed as an example, assuming that when the remaining memory rate is greater than the second threshold, the server 620 is not called and no task is processed, the system service management module 610 can first mark the server 620 as idle, and then when the remaining memory rate is less than or equal to the second threshold, uninstall the server 620.
[0143] For another example, taking the trigger condition that the remaining memory rate is less than or equal to the second threshold, the server 620 is not called and no task is processed as an example, assuming that when the remaining memory rate is less than or equal to the second threshold, the server 620 is being called by application #1 and there is a task being processed, the system service management module 610 can uninstall the server 620 when it is determined that the server 620 is no longer called by application #1 and there is no task being processed.
[0144] Optionally, in some embodiments, when the system service management module 610 is in the process of uninstalling the server 620, if it receives a first request sent by the client 620, the first request is used to request to call the server 620, that is, to request to obtain the handle of the server 602, the system service management module 610 may block the first request, wherein the first request may be sent by the client 630 through the business calling module 631. After the system service management module 610 completes uninstalling the server 620, it may respond to the first request, reload the server 620, and send the first request to the server 620 for processing, thereby realizing the call of the client 630 to the server 620.
[0145] Optionally, in some embodiments, during the process of the system service management module 610 uninstalling the server 620, the system service uninstall module 612 may call back the data saving and recovery module 6212 to save the data of the server 620 except the pointer to the external memory. When the server 620 is reloaded, the data except the pointer may be read from the external memory.
[0146] Optionally, in some embodiments, during the process of the system service management module 610 uninstalling the server 620, the system service uninstall module 612 may call back the save and restore module 6321 to save the pointer data of the server 620 to the memory of the client 630 process. After determining that the server 620 is reloaded, the client 630 process may send the pointer data to the server 620 process.
[0147] After the server 620 reads data other than the pointer from the external memory and receives the pointer data sent by the client 630, it can be restored to the state before uninstallation.
[0148] In the above-mentioned internal data flow, the idle decision module 6211 configures the unloading conditions to the system service unloading decision module 612 and the unloading is performed by the system service management module 610, but the embodiments of the present application are not limited to this. In other embodiments of the present application, the idle decision module 6211 can configure the trigger conditions, and when it is determined that the trigger conditions are met, the memory and threads associated with the server 620 are released.
[0149] For example, taking the trigger condition that the server has no task to process as an example, when the idle decision module 6211 determines that the server 620 has no task to process, the memory and thread associated with the server 620 can be released.
[0150] The above mainly introduces a method for managing system services provided by an embodiment of the present application from the perspective of an electronic device. It is understandable that, in order to implement the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0151] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0152] In the case of dividing each functional module into corresponding functional modules, Figure 7 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application is shown. Figure 7 As shown, the electronic device 700 includes: a detection module 710 and a processing module 720 .
[0153] The detection module 710 is used to detect the status of N system services.
[0154] The processing module 720 is used to determine whether a trigger condition is met and release the memory and thread associated with the first system service.
[0155] Optionally, in some embodiments, the N system services are all system services of the operating system.
[0156] Optionally, in some embodiments, the N system services are partial system services of an operating system.
[0157] In an embodiment of the present application, the electronic device can detect the status of the system service in real time, and when it is determined that there is an idle system service, it can release the memory and threads associated with the system service, thereby avoiding task interruption, and can allocate the released resources to other services, thereby improving the running smoothness of the operating system and enhancing the flexibility of managing system services.
[0158] Optionally, in some embodiments, the trigger condition also includes one or more of the following: the memory usage rate is greater than or equal to a first threshold; the memory remaining rate is less than or equal to a second threshold; the memory usage is greater than or equal to a third threshold; the memory remaining amount is less than or equal to a fourth threshold.
[0159] In an embodiment of the present application, when the electronic device determines whether to release the memory and threads associated with the first system service, it can also detect the memory usage. When the electronic device determines that the memory is insufficient and the first system service is in an idle state, the memory and threads associated with the first system service can be released, thereby releasing some resources and improving the running smoothness of the operating system.
[0160] Optionally, in some embodiments, the detection module 710 is further configured to detect the first request during the process in which the processing module 720 releases the memory and thread associated with the first system service.
[0161] The processing module 720 is further configured to block the first request.
[0162] Optionally, in some embodiments, the processing module 720 is further configured to, after releasing the memory and threads associated with the first system service, respond to the first request to reload the first system service.
[0163] In an embodiment of the present application, when the electronic device is in the process of uninstalling the first system service, if it receives a first request to call the first system service, the electronic device may first block the first request, and after completing the uninstallation of the first system service, respond to the first request to reload the first system service, thereby ensuring that the client's request will not be lost, thereby improving the user experience.
[0164] Optionally, in some embodiments, the processing module 720 is also used to save the pointer data of the first system service to the memory of the process associated with the first client during the process of releasing the memory and thread associated with the first system service, and save the data of the first system service other than the pointer data to the external memory.
[0165] Optionally, in some embodiments, the processing module 720 is specifically used to read data other than pointer data of the first system service from the external memory, and read the pointer data from the memory associated with the first client process to reload the first system service and restore the first system service to a state.
[0166] In an embodiment of the present application, during the process of uninstalling the first system service, the electronic device can save the data of the first system service. When the first system service needs to be reloaded, the data of the first system service can be read, thereby restoring the first system service to the state before uninstallation, which helps to improve the user experience.
[0167] The embodiment of the present application also provides an electronic device, including: a processor, a memory, an application, and a computer program. The above-mentioned devices can be connected via one or more communication buses. Among them, the one or more computer programs are stored in the above-mentioned memory and are configured to be executed by the one or more processors, and the one or more computer programs include instructions, which can be used to enable the folding screen electronic device to perform the various steps of the electronic device in the above-mentioned embodiments.
[0168] Exemplarily, the processor may be Figure 1 The processor 110 shown in the figure, the above-mentioned memory can be specifically Figure 1 An internal memory 120 and / or an external memory connected to the electronic device is shown.
[0169] An embodiment of the present application also provides a chip, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method for managing system services as described in any possible implementation method in the foregoing is executed.
[0170] This embodiment also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method of managing system services in the above-mentioned embodiment.
[0171] This embodiment also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement the method of managing system services in the above-mentioned embodiment.
[0172] As used in the above embodiments, the term "when..." or "after..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrase "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0173] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0174] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0175] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0176] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0177] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0178] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0179] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for managing system services, characterized in that: The method comprises: Detecting states of N system services, where the N system services include a first system service, and N≥1 is an integer; It is determined that a trigger condition is met, and the memory and thread associated with the first system service are released, wherein the trigger condition includes that the first system service is not called and / or the first system service has no task processing.
2. The method according to claim 1, characterized in that The method further comprises: In a process of releasing memory and threads associated with the first system service, a first request is detected, where the first request is used to request to call the first system service; The first request is blocked.
3. The method according to claim 2, characterized in that The method further comprises: After releasing the memory and the thread associated with the first system service, responding to the first request to reload the first system service.
4. The method according to claim 3, characterized in that The method further comprises: In the process of releasing the memory and thread associated with the first system service, the pointer data of the first system service is saved in the memory associated with the first client process, and the data of the first system service except the pointer data is saved in the external memory, wherein the first client is the client that calls the first system service.
5. The method according to claim 4, characterized in that The responding to the first request to reload the first system service includes: The data of the first system service except the pointer data is read from the external memory, and the pointer data is read from the memory associated with the first client process to reload the first system service and restore the data of the first system service.
6. The method according to any one of claims 1 to 5, characterized in that The triggering conditions also include one or more of the following: The memory usage is greater than or equal to a first threshold; The remaining rate of the memory is less than or equal to a second threshold; The memory usage is greater than or equal to a third threshold; The remaining amount of the memory is less than or equal to a fourth threshold.
7. An electronic device, characterized in that: The electronic device comprises a detection module and a processing module, wherein: The detection module is used to detect the status of N system services, where the N system services include the first system service, and N≥1 is an integer; The processing module is used to determine whether a trigger condition is met and release the memory and thread associated with the first system service. The trigger condition includes that the first system service is not called and / or the first system service has no task processing.
8. The electronic device according to claim 7, characterized in that: The detection module is further configured to detect a first request during a process of releasing the memory and the thread associated with the first system service, where the first request is used to request to call the first system service; The processing module is further used to block the first request.
9. The electronic device according to claim 8, characterized in that: The processing module is further configured to respond to the first request to reload the first system service after releasing the memory and thread associated with the first system service.
10. The electronic device according to claim 9, characterized in that: The processing module is also used to save the pointer data of the first system service to the memory associated with the first client process and save the data of the first system service other than the pointer data to the external memory during the process of releasing the memory and thread associated with the first system service, wherein the first client is the client that calls the first system service.
11. The electronic device according to claim 10, characterized in that: The processing module is specifically used to read data other than the pointer data of the first system service from the external memory, and read the pointer data from the memory associated with the first client process to reload the first system service and restore data of the first system service.
12. The electronic device according to any one of claims 7 to 11, characterized in that: The triggering conditions also include one or more of the following: The memory usage is greater than or equal to a first threshold; The remaining rate of the memory is less than or equal to a second threshold; The memory usage is greater than or equal to a third threshold; The remaining amount of the memory is less than or equal to a fourth threshold.
13. An electronic device, characterized in that: The method comprises one or more processors; one or more memories; the one or more memories store one or more computer programs, the one or more computer programs include instructions, and when the instructions are executed by the one or more processors, the method according to any one of claims 1 to 6 is executed.
14. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method according to any one of claims 1 to 6 is executed.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the method according to any one of claims 1 to 6 is executed.
16. A computer program product comprising instructions, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 6.
