System resource scheduling method, electronic equipment and storage medium
By dynamically freezing and unfreezing of system resources of background applications based on the service duration of interactive operation of display interfaces, the problem of flexibility and poor effect caused by fixed freezing control time in the prior art is solved, and the front-end response speed of electronic devices and users are improved Experience.
Patent Information
- Application Number
- CN202310824242.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2025-01-07
AI Technical Summary
In the prior art, the freezing control time of the backend application in the electronic device is fixed, resulting in poor flexibility and effect of the freezing control, which may lead to slow response speed of the front-end application and reduce user experience.
The system resources of the background application dynamically freeze and thaw according to the interactive operation service coverage duration of the display interface are used to dynamically freeze and thaw the system resources of the background application, and freeze control is realized through the Input subsystem and the Cgroups freezer subsystem to avoid fixed preset time limits.
It improves the flexibility and effect of freezing control, avoids conflicts in freezing strategies, significantly improves the front-end response speed and user experience, and does not require engineering experiments of product or chip granularity.
Smart Images

Figure CN119271287A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method for scheduling system resources, an electronic device, and a storage medium. Background Art
[0002] As the functions of electronic devices continue to increase, there are more and more applications on electronic devices, and the functions of applications are becoming more and more abundant and powerful. Users usually install many applications on electronic devices, some of which are pre-installed on the electronic devices, and the other are installed by users during subsequent use.
[0003] When a user opens an application (APP) in the foreground while using an electronic device, other APPs that have been opened before will run in the background. At this time, if the APPs running in the background occupy too many system resources, it will cause insufficient system resources for the foreground APP, resulting in long startup time, lag and other problems. Summary of the invention
[0004] In order to solve the above problems, the present application provides a system resource scheduling method, electronic device and storage medium, which improves the flexibility, rationality and effect of freezing control, and effectively improves the foreground response speed and user experience.
[0005] In a first aspect, the present application provides a method for system resource scheduling, which is applied to an electronic device, and the electronic device supports running applications. The method includes: when a user-triggered interactive operation on a display interface of the electronic device is detected, freezing control is performed on all or part of the applications running in the background, and the freezing control is used to recycle system resources allocated to the corresponding applications; allocating the recovered system resources to the business corresponding to the interactive operation on the display interface; when the business corresponding to the interactive operation on the display interface is completed, releasing the freezing control on all or part of the applications running in the background.
[0006] In this solution, the interactive operation of the display interface may include the operation triggered by the user on the desktop of the electronic device, and the operation triggered by the user on the interface of the application. The purpose of the interactive operation is to realize the corresponding business, such as application opening, transition, triggering animation effects and other businesses. Utilizing the above technical solution provided by the present application, the freezing control of the background application is no longer based on a fixed preset time, but is frozen on demand according to the coverage duration of the business corresponding to the interactive operation of the display interface. When the user triggers the interactive operation of the display interface, that is, when the corresponding business starts, the freezing control starts, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control ends, which improves the flexibility, rationality and effect of the freezing control. There will be no conflicts in the freezing strategy under high-frequency multi-operation sequences, which effectively improves the foreground response speed and user experience. In addition, considering that the capabilities of chips used in electronic devices vary greatly, the solution used in the prior art to perform freezing control according to a fixed preset time requires engineering experimental adjustment at the product or chip granularity to ensure the accuracy of the freezing control time. The solution of the present application is more flexible because the length of the freezing control time is not fixed, but is frozen on demand according to the coverage duration of the business corresponding to the interactive operation of the display interface. Therefore, the above-mentioned engineering experimental adjustment is not required, and it is highly practical.
[0007] In a possible implementation, when an interactive operation on the display interface of the electronic device triggered by a user is detected, freezing control is performed on all or part of the background applications running in the background, specifically including:
[0008] The hardware driver of the electronic device reports the operation event corresponding to the interactive operation of the display interface to the input subsystem of the electronic device; the Input subsystem notifies the control group freeze Cgroups freezer subsystem of the electronic device to freeze and control all or part of the background running applications.
[0009] In the present application scheme, when the Input subsystem obtains the operation event reported by the hardware driver, the Input subsystem notifies the Cgroups subsystem that it is necessary to freeze the background application at this time, thereby realizing the real-time triggering of the freezing control, and the freezing control is performed early, so the freezing control of the background program can be realized in time.
[0010] In a possible implementation, when the interactive operation of the display interface is an operation triggered by the user on the desktop, when the interactive operation on the display interface of the electronic device triggered by the user is detected, all or part of the applications running in the background are frozen and controlled, specifically including: the hardware driver of the electronic device reports the operation event corresponding to the interactive operation of the display interface to the input subsystem of the electronic device; the Input subsystem reports the operation event to the desktop application; when the desktop application determines that freezing control is required based on the identification result of the operation event, the control group freeze Cgroups freezer subsystem of the electronic device is notified to freeze the application running in the background.
[0011] In a possible implementation, when an interactive operation on the display interface of the electronic device triggered by a user is detected, all or part of the applications running in the background are frozen and controlled, specifically including: when a detection plug-in point of a business path of an application is executed, it is determined that the user has triggered the interactive operation of the display interface, and the control group freeze Cgroups freezer subsystem of the electronic device is notified to freeze and control all or part of the applications running in the background, and each of the detection plug-in points is located in the business path of the interactive operation of each display interface in the framework layer Framework.
[0012] In a possible implementation, the service path is any one of the following: a startup service path of an application or a service path of a transition animation.
[0013] In a possible implementation, the system resources include one or more of the following: central processing unit CPU resources, network bandwidth resources, input and output I / O channel resources or framework layer Framework system resources.
[0014] In one possible implementation, the interactive operation of the display interface is to start a first application, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, specifically including: when the first frame of the main interface of the first application is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
[0015] At this time, the CPU usage of the background application can be restored faster, reducing the impact on the background application. It can avoid the first application being affected by the network, causing the first frame of the content page to load too long, causing the background application to freeze for too long. The application can be an application that is opened in the foreground and not running in the background, and a cold start of the application is achieved at this time.
[0016] In one possible implementation, the interactive operation of the display interface is to start a first application, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, specifically including: when the first frame content of the first application is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
[0017] When the application is already running in the background, a hot start of the application is implemented. The first frame content of the first application can be the page content of the application when the application was placed in the background last time, or the page content of the application after refreshing.
[0018] In a possible implementation, the interactive operation of the display interface is to start a first application program, and when the service corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, specifically including:
[0019] When it is determined that the first application needs to connect to the network, when the first frame of the main interface of the first application is loaded, it is determined that the service corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released;
[0020] When it is determined that the first application does not need to connect to the network, when the first frame content of the first application is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
[0021] This implementation method can determine the specific completion time of the service corresponding to the interactive operation of the display interface according to whether the first application needs to connect to the network, thereby realizing flexible freezing control.
[0022] In a possible implementation, the interactive operation of the display interface is to start a camera application, and when the service corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, specifically including:
[0023] When the camera interface starts to display a preview screen, it is determined that the service corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
[0024] In a possible implementation, the interactive operation of the display interface is clicking a shooting button in a camera application interface, and when the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes:
[0025] When the camera application completes shooting and resumes displaying the preview screen, it is determined that the service corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
[0026] In a possible implementation, the foreground operation is triggering an animation effect on the desktop, and when the business corresponding to the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes:
[0027] When the animation effect ends, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
[0028] In a possible implementation, the foreground operation is to trigger an animation effect on the desktop, and the animation effect is specifically to enter the negative one screen of the desktop from the home page of the desktop. When the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, which specifically includes:
[0029] When the first frame of the negative one screen interface of the desktop is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
[0030] In a possible implementation, the foreground operation is to trigger an animation effect on the desktop, and the animation effect is specifically to enter the second page of the desktop from the first page of the desktop. When the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, which specifically includes:
[0031] When the first frame of the interface of the second page of the desktop is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
[0032] In a possible implementation, the foreground operation is to trigger an animation effect on the desktop, and the animation effect is specifically to call out a display interface of a background application from the desktop, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the background running applications is released, which specifically includes:
[0033] When the first frame of the display interface of the background application is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
[0034] In a possible implementation, the foreground operation is to trigger an animation effect on the desktop, and the animation effect is specifically to call out a status bar interface from the desktop, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, which specifically includes:
[0035] When the first frame of the status bar interface is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
[0036] In a possible implementation, the interactive operation of the display interface is switching from a first page of the second application to a second page of the second application, and when the service corresponding to the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes:
[0037] When the content of the second page is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
[0038] In one possible implementation, the interactive operation of the display interface is to switch from the second page of the second application to the third page of the third application, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control of each of the applications is released, specifically including: when the content of the third page is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of each of the applications is released.
[0039] For example, the second application is a shopping application, and the third application is a payment application. The second application's checkout page jumps to the third application's payment page to enter the password; for another example, the second application is a video player software, and the third application is an instant messaging APP. The user can select the login account as an instant messaging APP account through the video player software login interface, triggering the page to transition to the instant messaging APP for login authorization. The solution of this application can also be applied to the above transition scenarios. When the business critical path is triggered, the transition animation effect is smooth and not stuck through freezing control, which improves the user experience.
[0040] In one possible implementation, the releasing of the freezing control on the all or part of the applications running in the background specifically includes: recovering the recovered system resources from the business corresponding to the interactive operation of the display interface; and reallocating the recovered system resources to the all or part of the applications running in the background.
[0041] At this time, system resources are reallocated to each application running in the background. The system resources obtained by the background application may be the same as or different from those before the freezing control.
[0042] In one possible implementation, the releasing of the freezing control on all or part of the applications running in the background specifically includes: recovering the recovered system resources from the business corresponding to the interactive operation of the display interface; and allocating the recovered system resources so that all or part of the applications running in the background can restore the system resources before the freezing control.
[0043] In a second aspect, the present application also provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, the processor being used to call and execute the computer program to implement the system resource scheduling method described in any of the above implementation methods.
[0044] In a third aspect, the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by an electronic device, the method for system resource scheduling provided by any of the above implementation methods is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 Principle of the freezing control scheme of the related art Figure 1 ;
[0046] Figure 2 Scenario illustration provided for this application Figure 1 ;
[0047] Figure 3 Principle of the freezing control scheme of the related art Figure 2 ;
[0048] Figure 4 Scenario illustration provided for this application Figure 2 ;
[0049] Figure 5 An architectural diagram of the software system of the electronic device provided for this application;
[0050] Figure 6 A flowchart of a method for system resource scheduling provided in an embodiment of the present application;
[0051] Figure 7 Schematic diagram of the principle provided by the embodiment of this application Figure 1 ;
[0052] Figure 8 Schematic diagram of the principle provided by the embodiment of this application Figure 2 ;
[0053] Fig. 9 A flowchart of another method for system resource scheduling provided in an embodiment of the present application;
[0054] Fig.10 Scenario diagram provided for the embodiment of this application Figure 1 ;
[0055] Fig.11 A flowchart of another method for system resource scheduling provided in an embodiment of the present application;
[0056] Fig.12 Scenario diagram provided for the embodiment of the present application Figure 2 ;
[0057] Fig.13 A flowchart of another method for system resource scheduling provided in an embodiment of the present application;
[0058] Fig.14 Scenario diagram provided for the embodiment of this application Figure 3 ;
[0059] Fig.15A A flowchart of another method for system resource scheduling provided in an embodiment of the present application;
[0060] Fig. 15B Scenario diagram provided for the embodiment of the present application Figure 4 ;
[0061] Fig.16 A flowchart of another method for system resource scheduling provided in an embodiment of the present application;
[0062] Fig.17 Scenario diagram provided for the embodiment of the present application Figure 5 ;
[0063] Fig.18 A flowchart of another method for system resource scheduling provided in an embodiment of the present application;
[0064] Fig.19 Scenario diagram provided for the embodiment of the present application Figure 6 ;
[0065] Fig. 20 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to enable those skilled in the art to more clearly understand the present application scheme, the application scenario of the present application technical scheme is first described below.
[0067] At present, in order to ensure that the system resources of the APP running in the foreground are sufficient, the relevant technology uses a freezing control technology to improve the foreground response speed by controlling the APP running in the background. When the APP is opened in the foreground, the background application is frozen within a preset time length to reduce the system resource occupation of the background application and ensure that the system resources of the foreground APP are sufficient. However, the preset time length set by the current freezing control technology is fixed, resulting in poor flexibility, rationality and effect of the freezing control, and sometimes even slowing down the foreground response speed, reducing the user experience. The following is a detailed explanation.
[0068] See also Figure 1 , this figure shows the principle of the freezing control scheme of the related art Figure 1 .
[0069] The user's interactive operations on the display interface of the electronic device, that is, the user's interactive operations on the display interface of the electronic device, include operations on the foreground application and operations performed by the user on the system desktop. For example, interactive operations such as starting, exiting, sliding, clicking, and pop-up processing, as well as sliding in the circle of friends in instant messaging apps, clicking to open mini-programs in instant messaging apps, and jumping to the branch app after clicking payment in shopping apps, etc., also include users opening apps on the desktop, users switching apps through the background application display interface, and users triggering dynamic effects on the desktop. Desktop dynamic effects operations can include users switching desktop windows, pulling down the status bar, and other operations that trigger desktop animation effects.
[0070] In the related art, the freezing time of the background APP is set to a preset time, and the length of the preset time is t1-t2.
[0071] When the user is operating in the foreground, due to the diversity of interactive operations on the display interface, it is difficult to ensure that the time required for the business corresponding to the interactive operations on the display interface is exactly equal to the preset time. When the time required for the business corresponding to the interactive operations on the display interface is greater than the preset time, for example, the time required for the interactive operations on the display interface is t1-t3, t3 is greater than t2.
[0072] At this time, the background APP is frozen in the time period of t1-t2, that is, the system resources of the background APP are recovered in the time period of t1-t2, and the system resources allocated to the business corresponding to the interactive operation are increased.
[0073] However, in the time period of t2-t3, the background APP is unfrozen, and the background APP resumes the occupation of system resources, making the system resources allocated to the business corresponding to the foreground interactive operation less than the system resources allocated to the business corresponding to the foreground interactive operation in t1-t2. That is, in the time period of t2-t3, the response time of the business corresponding to the interactive operation is not shortened by increasing the system resources, resulting in poor improvement of the foreground response speed, and thus poor effect of freezing control.
[0074] See also Figure 2 , which is a schematic diagram of the scenario provided by this application Figure 1 .
[0075] Figure 2 2-(a) in the figure shows a schematic diagram of the background program interface when the electronic device is running apps such as camera, video, and music in the background. The user returns to the desktop homepage shown in 2-(b) by swiping up the bottom center of the screen, and selects the email app on the desktop to open it. Part 2-(c) shows a schematic diagram of the interface after the first frame of content is loaded after the email app is opened. The time taken for the service corresponding to the interactive operation at this time can be the time taken to switch from 2-(b) to 2-(c).
[0076] When the user clicks to open the email app, the electronic device can shorten the time taken to switch from 2-(b) to 2-(c) by freezing the background app. Figure 1 As described in the description, since the preset time is set short, the freeze control of the background APP ends before the first frame of the page 2-(c) is loaded, which reduces the system resources allocated for loading 2-(c) for a period of time. As a result, it will take longer for 2-(c) to load, and the effect of the freeze control is poor.
[0077] The following describes the drawbacks when the preset time of the freeze control is set too long.
[0078] See also Figure 3 , this figure shows the principle of the freezing control scheme of the related art Figure 2 .
[0079] At this time, the relevant technology generally sets the freezing time of the background APP to a preset time, and the length of the preset time is t1-t4.
[0080] When the user performs interactive operation 1 in the foreground, the time taken for the service corresponding to interactive operation 1 is t1-t2, and t4 is greater than t2. At this time, when the service corresponding to interactive operation 1 is completed, the freezing control of the background APP is not completed, and the background APP is still in a frozen state. If the user performs interactive operation 2 at time t3 before t4, when the electronic device freezes the background APP in order to improve the response speed of the service corresponding to interactive operation 2, the freezing time of the background APP is theoretically t3-t6 corresponding to the dotted line. But in fact, since the background APP itself is in a frozen state at this time, the freezing control of the background APP by the electronic device is invalid. This will cause the background APP to be unfrozen after reaching time t4, and the response time of the service corresponding to interactive operation 2 is not improved by increasing system resources in the time period t4-t5, so the effect of freezing control is poor.
[0081] In a possible scenario, if the app opened by interaction operation 2 is the one that was frozen by interaction operation 1, then at t3-t4, since the app is frozen, the foreground response speed may be slowed down or even stuck, which reduces the user experience. The following example illustrates this.
[0082] Continue to see Figure 2 , the user swipes up on the bottom center of the screen to return, triggering the animation effect of returning to the desktop home page shown in 2-(b). In order to ensure the response speed of the desktop return operation and the smoothness of the animation effect, the electronic device freezes the background APP in 2-(a) to increase the system resources allocated for the desktop animation. There is no email APP running in the background, but the user quickly clicks on the desktop home page shown in 2-(b) to open the email APP. At this time, the freezing control of the background APP has not ended, and a strategic conflict has occurred, resulting in the failure of the freezing control to improve the response speed of opening the email APP. As a result, the response speed of opening the email APP this time has not been effectively improved, and the effect of the freezing control is poor.
[0083] See also Figure 4 , which is a schematic diagram of the scenario provided by this application Figure 2 .
[0084] Figure 44-(a) in the figure shows a schematic diagram of the interface when the electronic device runs apps such as camera, video, and music in the background. The user returns to the desktop homepage shown in 4-(b) by swiping up the bottom of the center of the screen, and selects the camera on the desktop to open it. 4-(c) shows a schematic diagram of the interface after the camera is opened and the preview is loaded. At this time, the time required for the service corresponding to the interactive operation of opening the camera can be the time required to switch from 4-(b) to 4-(c).
[0085] The user returns to the desktop home page shown in 4-(b) by swiping up the bottom center of the screen. In order to ensure the response speed of the desktop return operation and the smoothness of the animation effect of returning to the desktop, the electronic device will freeze the background APP in 4-(a) to increase the system resources allocated for the desktop animation effect. At this time, the camera is also frozen in the background. The user quickly clicks to open the camera on the desktop home page shown in 4-(b). At this time, the freezing control of the camera has not ended, and a strategic conflict has occurred, which may cause the foreground response speed to slow down or even freeze, reducing the user experience.
[0086] In order to solve the above technical problems, the present application provides a method, electronic device and storage medium for system resource scheduling. The freezing control of the background APP is no longer based on a fixed preset time, but is frozen on demand according to the coverage duration of the business corresponding to the interactive operation of the display interface. That is, when the business corresponding to the interactive operation of the display interface starts, the background APP starts to be frozen, and when the business corresponding to the interactive operation of the display interface ends, the background APP is unfrozen, which improves the flexibility, rationality and effect of the freezing control, avoids conflicts in the freezing strategy, and effectively improves the foreground response speed and user experience.
[0087] In order to enable persons skilled in the art to more clearly understand the solution of the present application, the technical solution in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0088] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0089] The electronic device in the embodiment of the present application may be a mobile phone, a tablet computer, a personal digital assistant (PDA), a vehicle-mounted terminal device, or other electronic device. The embodiment of the present application does not impose any special restrictions on the specific form of the electronic device. The following description takes the electronic device as an example of a mobile phone.
[0090] See also Figure 5 , which is an architecture diagram of the software system of the electronic device provided in this application.
[0091] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.
[0092] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into the application layer, the application framework layer (Framework), the system runtime layer, the hardware abstraction layer (HAL) and the kernel layer (Linux Kernel) from top to bottom.
[0093] The application layer can include a series of application packages. Both built-in system applications and non-system-level applications belong to the application layer, which is responsible for direct interaction with users. For example, it can include camera APP, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications. It can also include desktop, negative one screen and other system applications.
[0094] Among them, the negative one screen is a page added to the leftmost side of the desktop, called the smart assistant. As smartphones can accomplish more and more tasks, some information and applications are often used at any time, and the negative one screen can integrate all these functions and information together, making it more convenient and quick to use.
[0095] The system user interface (system UI) is one of the core applications of the system. It is responsible for providing feedback on the system and application status and maintaining a large amount of interaction with the user. With system UI as the base class, subclasses of system UI implement different system interfaces. The main view structure of system UI includes the negative one screen, lock screen wallpaper (wallpaper), status bar (Status Bar), lock screen interface (Keyguard) and lock screen password interface (Bouncer). The status bar (StatusBar) is used to display system status information. The lock screen interface is used to handle functions such as locking the screen, unlocking the screen, and displaying notifications under the lock screen.
[0096] 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. This layer is generally written in Java code and can be called a Java Framework.
[0097] The application framework layer may include but is not limited to the following services and components.
[0098] Window Manager Service (WMS): Mainly responsible for managing the window view on the Android device, and controlling the application interface and correct display and input. WMS is responsible for managing the position, size and layout of application windows, taking care of multitasking and switching between applications, thus ensuring a stable, smooth and consistent user interface. The window manager can also obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0099] Activity Manager Service (AMS) is a key component in the Android system, responsible for managing the application life cycle, task stack, and interactions between applications.
[0100] Input subsystem: A system for processing input events, supporting multiple input sources, such as touch screens, buttons, etc. The Input subsystem sends input events to the event queue of the application, and remaps input events that need to be remapped so that the application can handle them correctly.
[0101] Location Manager: Provides geographic location and positioning services.
[0102] Package Manager: Manages all applications installed in the Android system.
[0103] 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 screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0104] Resource Manager: Provides various non-code resources used by applications, such as localized strings, images, layout files, color files, video files, etc.
[0105] Telephony Manager: manages mobile device functions and provides communication functions for electronic devices, such as call status management (including answering, hanging up, etc.).
[0106] Content Provider is used to store and retrieve data and make it accessible to applications so that different applications can share data. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0107] View System: includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. The display interface can be composed of one or more views. For example, the display interface including the SMS notification icon can include a view for displaying text and a view for displaying images.
[0108] The system runtime layer mainly includes the Android runtime library and program library (Native C / C++ Libraries).
[0109] The Native C / C++ Libraries may include multiple functional modules, such as a surface manager, a media library, a 3D graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), etc.
[0110] The low memory killer daemon (lmkd) at the system runtime layer monitors the state of the running Android system memory and responds to high memory pressure by terminating the most unnecessary processes, keeping the system running at an acceptable level.
[0111] The Webview of the system runtime layer is a webkit-based engine that can parse document object model (DOM) elements and display controls of Hypertext Markup Language (HTML) pages. It is a visual component and serves as the visual part of the native APP.
[0112] The Android runtime library includes: the core library and the Android Runtime (ART). ART is responsible for the scheduling and management of the Android system and is a running environment on the Android operating system. In the ART environment, when the application is installed for the first time, the bytecode will be pre-compiled into machine code, making it a truly native application.
[0113] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0114] The Hardware Abstraction Layer (HAL) is a routine package of the software layer. It is an interface layer between the operating system kernel and the hardware circuit. Its purpose is to abstract the hardware and simulate the details of a specific system platform so that the program can directly access the hardware resources.
[0115] The Linux Kernel is the layer between hardware and software. The kernel layer includes at least the touch panel (TP) driver, camera driver, audio driver, sensor driver, button driver, binder and control groups (Cgroups) subsystem.
[0116] Cgroups is a physical resource isolation mechanism provided by the Linux kernel. Through this mechanism, resource restrictions, isolation and statistics can be implemented for Linux processes or process groups. The Cgroups subsystem defines a subsystem for each controllable resource. Typical subsystems are as follows.
[0117] Freezer subsystem: used to suspend and resume processes in Cgroup. In the embodiment of the present application, the freezing operation of the background APP is implemented based on the freezer subsystem.
[0118] Cpuset subsystem: can allocate separate CPU nodes or memory nodes to processes in Cgroups.
[0119] The cpu subsystem mainly limits the CPU usage of the process.
[0120] Each subsystem of Cgroups needs to cooperate with other subsystems of the kernel to complete resource control. For example, the limitation of CPU resources can be completed through the process scheduling module according to the configuration of the cpu subsystem, cpuset subsystem and freezer subsystem.
[0121] In the embodiments of the present application, the system resources include, but are not limited to, central processing unit CPU resources, network bandwidth resources, input / output (I / O) channel resources or framework layer Framework system resources.
[0122] In the embodiment of the present application, the applications running in the background can be divided into two categories, one is the application that can be frozen and controlled, and the other is the application that cannot be frozen and controlled. Among them, the application that cannot be frozen and controlled can be, for example, a special program set by the system, such as an instant messaging app, and can also be an application related to the System Server. The frozen and controlled background applications recorded in the following description of the embodiment of the present application refer to applications that can be frozen and controlled by the system, and do not include applications that cannot be frozen and controlled, which will not be repeated in the following description.
[0123] An embodiment of the present application provides a method for system resource scheduling, which is described in detail below with reference to the accompanying drawings.
[0124] See also Figure 6 , which is a flowchart of a system resource scheduling method provided in an embodiment of the present application.
[0125] The method comprises the following steps:
[0126] S11: The user performs interactive operations on the interface.
[0127] In the embodiment of the present application, the interactive operation of the display interface is triggered by the user. The interactive operation of the display interface is the interactive operation performed by the user on the system interface. The interactive operation of the display interface includes but is not limited to:
[0128] Open the APP on the desktop, switch the APP through the background application display interface, close the background APP through the background application display interface, trigger the animation effect on the desktop, and trigger the animation effect on the APP interface.
[0129] The methods for triggering animation effects on the desktop include but are not limited to:
[0130] Switching desktop windows, such as switching the desktop window from the desktop home page to the negative one screen, switching the desktop window from the negative one screen to the home page, switching and transitioning between adjacent pages of the desktop window, etc.;
[0131] Pull down the status bar to display;
[0132] Drag and drop to adjust the position of the APP or desktop card;
[0133] The animation effect of the desktop background is triggered by changing the horizontal state of the electronic device.
[0134] Triggering animation effects on the APP interface includes: switching windows using gestures, virtual buttons or physical buttons on the APP interface; and transitioning within the APP.
[0135] In the embodiment of the present application, if any of the following conditions are met, the APP will be considered to be in the foreground:
[0136] Has a visible Activity; has a foreground Service; another foreground App has been associated with this App, for example, another App is bound to this App's Service.
[0137] If none of the above conditions are met, the APP will be considered to be in the background. The APP in the background can be viewed on the background application display interface. The background application interface can be seen in Figure 4 As shown in 4-(a) in .
[0138] When a user triggers an interactive operation on the display interface, the present application scheme aims to reclaim system resources by freezing the background APP, thereby increasing the system resources allocated to the business corresponding to the interactive operation on the display interface, and improving the response speed of the business corresponding to the interactive operation on the display interface.
[0139] S12: The hardware driver detects an operation event.
[0140] The hardware driver of the electronic device is located in the kernel layer (Linux Kernel) and is used to detect operation events, such as touch screen drivers for detecting touch screen related operations, key drivers for detecting key related operations, and sensor drivers for detecting sensor operations.
[0141] S13: The hardware driver reports the operation event to the Input subsystem.
[0142] For example, an electronic device includes a touch sensor and a touch screen. When the touch sensor receives a touch operation or a click operation, the corresponding hardware interrupt is sent to the touch screen driver of the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The raw input event is reported to the Input subsystem of the application framework layer, and the Input subsystem identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation, and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer to capture static images or videos through the camera.
[0143] For another example, an electronic device includes buttons, and the present application does not limit the number and position of the buttons. The button can be a mechanical button or a touch button. When the button is pressed by the user, the button driver of the kernel layer processes the button operation into a raw input event (which may include the function of the button, the timestamp of the button operation, and other information). The raw input event is stored in the kernel layer. The raw input event is reported to the Input subsystem of the application framework layer, and the Input subsystem identifies the control corresponding to the input event.
[0144] For another example, the electronic device includes an acceleration sensor that can detect the magnitude of the acceleration of the electronic device in various directions (generally three axes). When the electronic device is stationary, the magnitude and direction of gravity can be detected, and it can also be used to identify the posture of the electronic device, such as horizontal posture or tilted state. When the user changes the tilt posture of the electronic device, the velocity sensor obtains the corresponding detection data, and the kernel layer processes the detection data into raw input events. The raw input events are stored in the kernel layer. The raw input events are reported to the Input subsystem of the application framework layer, and the Input subsystem identifies the control corresponding to the input event and informs the system UI, which controls the animation effect of the desktop background.
[0145] S14: The Input subsystem notifies the Cgroups subsystem to perform freezing control.
[0146] The Input subsystem notifies the Cgroups subsystem that it needs to freeze the apps that can be frozen in the background.
[0147] Freeze Control is used to reclaim system resources allocated to individual applications.
[0148] S15: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0149] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0150] S16: The Cgroups subsystem allocates the recovered system resources to the services corresponding to the interactive operations.
[0151] The cpuset subsystem and cpu subsystem in the Cgroups subsystem cooperate to increase the CPU usage of the business corresponding to the interactive operation and allocate the recovered system resources to the business corresponding to the interactive operation.
[0152] It is understandable that the Cgroups subsystem allocates all or part of the recovered system resources to the business corresponding to the interactive operation.
[0153] S17: When the foreground operation is completed, the Cgroups subsystem releases the freeze control on the applications running in the background.
[0154] When the foreground operation is completed, the acceleration of the foreground operation also ends accordingly. At this time, the Cgroups subsystem releases the freeze control of the applications running in the background, that is, unfreezes the applications running in the background in time.
[0155] In a possible implementation, after the Cgroups subsystem unfreezes the background applications, it can reallocate system resources to the background applications. The system resources previously allocated for the business corresponding to the interactive operation of the display interface can be recovered and reallocated to the background applications, so that the system resources for the business corresponding to the interactive operation of the display interface are restored to the state before the increase.
[0156] In another possible implementation, after the Cgroups subsystem unfreezes the background applications, it can reclaim the portion of system resources previously allocated for the business increase corresponding to the interactive operations of the display interface, and restore the system resources of each background application according to the system resource occupancy of each background application before the freezing control.
[0157] The technical solution provided by the present application no longer controls the freezing of background APPs according to a fixed preset time, but freezes them on demand according to the coverage duration of the business corresponding to the interactive operation of the display interface.
[0158] The above embodiments illustrate the implementation method of notifying the Cgroups subsystem to perform freezing control through the Input subsystem. In another possible implementation method, when the interactive operation of the display interface is an interactive operation triggered by the user on the desktop, after the hardware driver of the electronic device reports the operation event corresponding to the interactive operation of the display interface to the input subsystem of the electronic device, the Input subsystem reports the operation event to the desktop application, and performs plugging control at the desktop stage, that is, plugging points are pre-set on the critical paths of various businesses corresponding to the desktop application. When the plugging points are executed, it can be determined that the business corresponding to the plugging points is activated. At this time, the desktop application realizes the recognition of the operation event, that is, through the business critical path corresponding to the plugging points, the corresponding business is identified to be turned on. At this time, the desktop application determines that freezing control is required based on the recognition result of the operation event, notifies the Cgroups freezer subsystem of the electronic device to freeze all or part of the applications running in the background, and allocates system resources to the corresponding turned-on businesses.
[0159] Compared with the method in which the Input subsystem notifies the Cgroups subsystem to perform freezing control, this implementation method can realize the identification operation at the desktop stage and can distinguish the operation type according to the business critical path.
[0160] In another possible implementation, for each application, an instrumentation point can be set in the critical path of its business. The detection instrumentation point is located in the business path of each foreground operation in the framework layer. When the business path is accessed, the instrumentation point is executed to achieve detection. Instrumentation technology refers to inserting probes into the program on the basis of ensuring the logical integrity of the original program, and collecting the running status of the original code through the probe.
[0161] The critical path of the business may include but is not limited to the startup business path of the application and the transition business path of the application. The interactive operation of the display interface includes two mainstream granularity processing methods. One is when there is an activity change in the system, this scenario is based on activity control (if there is an animation effect here, the activity policy takes precedence); the other is when there is no activity change, but there is a system animation effect, this scenario is controlled based on the system animation effect. However, these two situations will cause the insertion points set in the critical path of the business to be executed, and the application can determine that the user has triggered the foreground operation. At this time, the application can notify the Cgroups freezer subsystem of the electronic device to freeze all or part of the background running applications. At the same time, insertion is also performed at the end point of each business path. When the insertion is executed, it can be determined that the business corresponding to the foreground operation is ended at this time, and the Cgroups freezer subsystem is notified to release the freezing control.
[0162] By using the above implementation method, the application's business path can be frozen when it is executed, and unfrozen after the business path is executed, which means that detection at the application level is achieved. Figure 7 , which is a schematic diagram of the principle provided by the embodiment of the present application Figure 1 .
[0163] In the solution of the present application, the background APP is frozen according to the time of the business corresponding to the interactive operation, so that when the business corresponding to the interactive operation starts, the background APP starts to be frozen and controlled, and when the business corresponding to the interactive operation ends, the background APP is unfrozen. That is, the time when the interactive operation starts and the background APP starts to be frozen is t1, and the time when the business corresponding to the interactive operation ends and the background APP is unfrozen is t2.
[0164] Does not exist at this time Figure 1 and Figure 2In order to solve the problem of poor freezing control effect mentioned in the corresponding description, the solution of the present application freezes the background APP during the entire coverage period of the business corresponding to the interactive operation, and increases the system resources allocated to the business corresponding to the interactive operation, effectively improving the response time of the business corresponding to the interactive operation.
[0165] See also Figure 8 , which is a schematic diagram of the principle provided by the embodiment of the present application Figure 2 .
[0166] When the user performs interactive operation 1 in the foreground, the coverage duration of the service corresponding to interactive operation 1 and the first freezing control duration are both t1-t2; when the user continues to perform interactive operation 2 in the foreground, the coverage duration of the service corresponding to interactive operation 2 and the second freezing control duration are both t3-t4. Even if t3 and t2 are close to each other, the second freezing control of the background APP in order to improve the response speed of interactive operation 2 will not conflict with the previous first freezing control in terms of strategy, and the above does not exist. Figure 3 and Figure 4 Corresponding to the questions in the instructions.
[0167] In summary, by using the technical solution provided by the embodiment of the present application, the freezing control of the background APP is no longer based on a fixed preset time, but is frozen on demand according to the coverage duration of the business corresponding to the interactive operation, which improves the flexibility, rationality and effect of the freezing control. There will be no conflicts in the freezing strategy under high-frequency multi-operation sequences, which effectively improves the front-end response speed and user experience. In addition, considering that the chip capabilities used in electronic devices vary, the solution of the present application does not require engineering experimental adjustment based on product or chip granularity, and is highly practical.
[0168] The following is an explanation in combination with specific scenarios and implementation methods. For the convenience of explanation, the interactive operation on the display interface of the electronic device triggered by the user in the following introduction is referred to as the foreground operation.
[0169] The following first takes the example of opening the mailbox APP on the desktop to explain.
[0170] See also Fig. 9 and Fig.10 .in, Fig. 9 A flowchart of another method for system resource scheduling provided in an embodiment of the present application; Fig.10 Scenario diagram provided for the embodiment of the present application Figure 1 .
[0171] S20: The user clicks the mailbox on the system desktop.
[0172] In the embodiment of the present application, it is taken as an example that the user opens the mailbox APP for the first time in the foreground, that is, the mailbox APP has not been opened before and is not in the background running state.
[0173] S21: The touch screen driver detects an operation event.
[0174] The electronic device includes a touch sensor and a touch screen. When the touch sensor receives a click operation from the user, the corresponding hardware interrupt is sent to the touch screen driver of the kernel layer. The touch screen driver of the kernel layer processes the touch operation into a raw input event (including click coordinates, click operation timestamp and other information).
[0175] S22: The touch screen driver reports the operation event to the Input subsystem.
[0176] The original input event is reported to the Input subsystem of the application framework layer, and the Input subsystem identifies that the input event corresponds to the user's click operation on the mailbox.
[0177] S23a: The Input subsystem notifies the Cgroups subsystem to perform freezing control.
[0178] The Input subsystem notifies the Cgroups subsystem that the background APP needs to be frozen at this time, so that the system resources of the background APP can be recovered and allocated to the foreground operation to speed up the startup of the mailbox.
[0179] Freeze Control is used to reclaim system resources allocated to individual applications.
[0180] S23b: The Input subsystem notifies the mailbox to start.
[0181] S23c: The Input subsystem notifies the Window Manager Service to start the animation effect.
[0182] The Window Manager Service switches the page from the desktop to the mailbox program window according to the set position, size and layout of the mailbox program window, and starts the transition animation effect.
[0183] S24: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0184] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0185] S25: The Cgroups subsystem allocates the recovered system resources to start the mailbox.
[0186] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of foreground operations and allocate recovered system resources to mailbox applications.
[0187] S26: Window Manager Service starts the animation effect.
[0188] See also Fig.10 , Fig.10 10-(a) shows a schematic diagram of a user clicking on the mailbox icon on the desktop to open the mailbox APP; 10-(b) shows a schematic diagram of the main interface of the mailbox after clicking the mailbox icon; 10-(c) shows a schematic diagram of the interface after the first frame of content is loaded after the mailbox is opened.
[0189] Understandably, Fig.10 The main interface and the interface after the first frame of content is loaded are shown for illustrative purposes only and do not constitute a limitation on the technical solution of the present application.
[0190] In a possible implementation, the foreground operation time may be from the time 10-(a) is clicked and the input subsystem of the electronic device receives a report of the operation event until the first frame content in 10-(c) is loaded.
[0191] S27: The first frame of the mailbox main interface is loaded.
[0192] At this time, the interface of the electronic device is as follows Fig.10 -(b) As shown in FIG. 1 , after the first frame of the mailbox main interface is loaded, the main interface can be displayed on the desktop.
[0193] S28: The first frame of the mailbox content is loaded.
[0194] At this time, the interface of the electronic device is as follows Fig.10 -(c) As shown in the figure, the first frame of the mailbox is loaded, that is, the first frame of the content page is loaded, and the content page can be displayed on the desktop.
[0195] S29: Notify the Cgroups subsystem to unfreeze.
[0196] After the mailbox is started, AMS notifies the Cgroups subsystem to unfreeze the background APP so that the background APP can obtain system resources.
[0197] In one possible implementation, a plug-in is also performed at the end point of the startup business path of the mailbox APP in the application framework layer. When the plug-in is executed, it can be determined that the corresponding foreground operation started at this time is completed. AMS can monitor and notify the Cgroups freezer subsystem to lift the freeze control.
[0198] S30: The Cgroups subsystem releases the freeze control of the applications running in the background.
[0199] The Cgroups subsystem unfreezes the applications running in the background when the foreground operation is completed.
[0200] In a possible implementation, after the Cgroups subsystem unfreezes the background application, it reclaims the previously allocated additional system resources from the foreground operation and reallocates the system resources to each background-running application.
[0201] In another possible implementation, the previously additionally allocated system resources are recovered from the foreground operation and allocated to the applications running in the background, so that the applications running in the background can restore the system resources before the freezing control.
[0202] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of background apps and allocate system resources to background applications.
[0203] In summary, by utilizing the technical solution provided by the embodiment of the present application, when an application is opened in the foreground, the freezing control of the background APP is no longer based on a fixed preset time, but is triggered to freeze when an operation event is reported to the Input subsystem, and is unfrozen after the first frame of the APP content page is loaded, thereby improving the flexibility, rationality and effect of the freezing control. When multiple applications are opened at a high frequency, there will be no conflict in the freezing strategy, which effectively improves the foreground response speed and user experience. In addition, considering that the chip capabilities used in electronic devices vary greatly, the solution of the present application does not require engineering experimental adjustments based on product or chip granularity, and is highly practical.
[0204] Furthermore, in the above description, "S28: the first frame of the mailbox content is loaded" is used as the end time of the foreground operation. In another implementation method, "S27: the first frame of the main interface of the mailbox is loaded" can be used as the end time of the foreground operation. At this time, after S27, S29 and S30 can be executed. This is because some applications require a network connection. If the network status is not good, it takes a long time to load the first frame of content, which may cause the background application to be frozen for a long time. At this time, the background application can be unfrozen in advance.
[0205] The technical solution of the present application is explained below by taking opening the negative one screen on the desktop as an example.
[0206] See also Fig.11 and Fig.12 .in, Fig.11 A flowchart of another method for system resource scheduling provided in an embodiment of the present application; Fig.12 Scenario diagram provided for the embodiment of the present application Figure 2 .
[0207] S30: The user swipes right on the system desktop home page.
[0208] Fig.12 12-(a) shows a schematic diagram of a user swiping right on the desktop homepage to switch to the negative one screen; 12-(b) shows a schematic diagram of the interface after the negative one screen is loaded.
[0209] Understandably, Fig.12 The desktop homepage and negative one screen interface shown are only for illustrative purposes and do not constitute a limitation on the technical solution of the present application.
[0210] S31: The touch screen driver detects an operation event.
[0211] When the touch sensor receives a swipe operation from the user, the corresponding hardware interrupt is sent to the touch screen driver at the kernel layer, which processes the touch operation into raw input events.
[0212] S32: The touch screen driver reports the operation event to the Input subsystem.
[0213] The original input event is reported to the Input subsystem of the application framework layer, and the Input subsystem identifies that the input event corresponds to a user's swiping operation on the screen.
[0214] S33a: The Input subsystem notifies the Cgroups subsystem to perform freezing control.
[0215] The Input subsystem notifies the Cgroups subsystem that the background APP needs to be frozen at this time, so that the system resources of the background APP can be recovered and allocated to the Window Manager Service to achieve animation effects and speed up the loading of the negative one screen.
[0216] S33b: The Input subsystem notifies the Window Manager Service to start the animation effect.
[0217] The Window Manager Service switches the window from the home page to the negative one screen according to the window's position, size, and layout, and starts the transition animation effect.
[0218] S34: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0219] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0220] S35: The Cgroups subsystem allocates the recovered system resources to start the negative one screen.
[0221] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of the foreground WindowManager Service and allocate the recovered system resources to the Window Manager Service.
[0222] S36: Window Manager Service starts the animation effect.
[0223] S37: The first frame of the negative one screen interface is loaded.
[0224] At this time, the interface of the electronic device is as follows Fig.12 -(b) As shown in FIG. 1 , after the first frame of the negative one screen interface is loaded, the content page can be displayed on the desktop.
[0225] S38: Window Manager Service notifies the Cgroups subsystem to unfreeze.
[0226] After the first frame of the negative one screen interface is loaded, the Window Manager Service can notify the Cgroups subsystem to unfreeze the background APP so that the background APP can obtain system resources.
[0227] S39: The Cgroups subsystem releases the freeze control of the applications running in the background.
[0228] In a possible implementation, after the Cgroups subsystem unfreezes the background application, it reclaims the previously allocated additional system resources from the foreground operation and reallocates the system resources to each background-running application.
[0229] In another possible implementation, the previously additionally allocated system resources are recovered from the foreground operation and allocated to the applications running in the background, so that the applications running in the background can restore the system resources before the freezing control.
[0230] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of background apps and allocate system resources to background applications.
[0231] In summary, by utilizing the technical solution provided by the embodiment of the present application, when switching to the negative one screen, the freezing control of the background APP is no longer based on a fixed preset time, but is triggered to freeze when an operation event is reported to the Input subsystem, and is unfrozen after the first frame of the negative one screen is loaded, thereby improving the flexibility, rationality and effect of the freezing control. When the user quickly triggers the animation effect again after switching to the negative one screen, for example, switching from the negative one screen back to the desktop homepage, there will be no conflict in the freezing strategy, which effectively improves the foreground response speed and user experience. In addition, considering that the chip capabilities used in electronic devices vary greatly, the solution of the present application does not require engineering experimental adjustments based on product or chip granularity, and is highly practical.
[0232] In addition, in another possible implementation, the Input subsystem can report the operation event to the desktop application. When the desktop application determines that freezing control is required based on the identification result of the operation event, it notifies the Cgroups freezer subsystem of the electronic device to freeze all or part of the applications running in the background.
[0233] The following takes opening the camera on the desktop as an example.
[0234] See also Fig.13 and Fig.14 .in, Fig.13 A flowchart of another method for system resource scheduling provided in an embodiment of the present application; Fig.14 Scenario diagram provided for the embodiment of the present application Figure 3 .
[0235] S40: The user clicks the camera on the system desktop.
[0236] In the embodiment of the present application, it is taken as an example that the user opens the camera for the first time in the foreground, that is, the camera has not been opened before and is in the background running state.
[0237] S41: The touch screen driver detects an operation event.
[0238] When the touch sensor receives a click operation from the user, the corresponding hardware interrupt is sent to the touch screen driver at the kernel layer. The touch screen driver at the kernel layer processes the touch operation into raw input events (including click coordinates, click operation timestamp and other information).
[0239] S42: The touch screen driver reports the operation event to the Input subsystem.
[0240] The original input event is reported to the Input subsystem of the application framework layer, and the Input subsystem identifies that the input event corresponds to a user click operation on the camera.
[0241] S43a: The Input subsystem notifies the camera to start.
[0242] S43b: After the camera's insertion point at the application framework layer is executed, it notifies the Cgroups subsystem to perform freezing control.
[0243] After the camera application is triggered to start, the camera starts the service path in the application framework layer, and the insertion point at the beginning is executed. At this time, the camera startup is determined to be triggered, and the Cgroups subsystem is notified that the background APP needs to be frozen at this time, so that the system resources of the background APP can be recovered and allocated to the camera, thereby speeding up the completion of the camera startup.
[0244] S44: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0245] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0246] S45: The Cgroups subsystem allocates the recovered system resources to start the camera.
[0247] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of the camera and allocate the recovered system resources to the camera application.
[0248] S46: The camera interface is loaded.
[0249] See also Fig.14 , Fig.14 14-(a) shows a schematic diagram of a user clicking on the camera icon on the desktop to open the email APP; 14-(b) shows a schematic diagram after the camera interface is loaded after clicking the camera icon; 14-(c) shows a schematic diagram when the camera interface starts to display a preview screen.
[0250] When the camera interface is loaded, the device interface is in state 14-(b). The camera application has completed loading the interface, but has not yet displayed a preview screen based on the acquired data frame. The state 14-(b) generally lasts for a short time, and its duration is related to the hardware of the device, and is not specifically limited in the present embodiment.
[0251] The bottom of the camera interface generally includes a picture preview box 141, a shooting button 142 and a virtual lens reversal button 143. Among them, the picture preview box 141 is used to display the last picture taken. The shooting button 142 is used to trigger the photo. The virtual lens reversal button 143 is used to switch between the front camera and the rear camera of the electronic device.
[0252] S47: The camera starts to display the preview screen.
[0253] At this time, the device interface is in Fig.14 -(c) status indicates that the camera opening operation is completed.
[0254] S48: Notify the Cgroups subsystem to unfreeze.
[0255] After the camera is started, the camera starts the service path in the application framework layer, and the plug-in point at the end is executed, triggering the notification Cgroups subsystem to unfreeze the background APP so that the background APP can obtain system resources. In this embodiment, in the process of reporting the camera click event to the completion of the loading of the camera preview screen, the camera application can obtain more system resources to shorten the time of the entire process, saving the user's waiting time for the preview screen to appear, and improving the user experience.
[0256] S49: The Cgroups subsystem releases the freeze control of the applications running in the background.
[0257] The Cgroups subsystem determines that when the camera is turned on, all applications running in the background are unfrozen.
[0258] In a possible implementation, after the Cgroups subsystem unfreezes the background application, it reclaims the previously allocated additional system resources from the foreground operation and reallocates the system resources to each background-running application.
[0259] In another possible implementation, the previously additionally allocated system resources are recovered from the foreground operation and allocated to the applications running in the background, so that the applications running in the background can restore the system resources before the freezing control.
[0260] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of background apps and allocate system resources to background applications.
[0261] In summary, by using the technical solution provided by the embodiment of the present application, when the camera is turned on in the foreground, the freezing control of the background APP is triggered after the operation event is reported to the Input subsystem, and the APP is unfrozen after the camera preview screen is loaded, which improves the flexibility, rationality and effect of the freezing control, and effectively improves the foreground response speed and user experience. In addition, considering that the chip capabilities used in electronic devices vary, the solution of the present application does not require engineering experimental adjustment based on product or chip granularity, and is highly practical.
[0262] Furthermore, when an interactive operation is triggered in an application, the solution of the present application can also improve the response speed of the application, as illustrated below with an example.
[0263] based on Fig.13 and Fig.14 In the following, we will first take the example of triggering a photo-taking operation in the camera.
[0264] See also Fig.15A and Fig. 15B .in, Fig.15A A flowchart of another method for system resource scheduling provided in an embodiment of the present application; Fig. 15B Scenario diagram provided for the embodiment of the present application Figure 4 .
[0265] S50: The user clicks the capture button.
[0266] When the preview interface of the camera program is displayed, the user can view the last photo in the picture preview box 141 .
[0267] After the user observes a suitable image through the preview screen, the user triggers a photo-taking operation by clicking the capture button 142 .
[0268] Fig. 15B 15-(a) in FIG. 1 shows a schematic diagram of a user clicking the capture button 142.
[0269] S51: The touch screen driver detects an operation event.
[0270] When the touch sensor receives a click operation from the user, the corresponding hardware interrupt is sent to the touch screen driver at the kernel layer. The touch screen driver at the kernel layer processes the touch operation into raw input events (including click coordinates, click operation timestamp and other information).
[0271] S52: The touch screen driver reports the operation event to the Input subsystem.
[0272] The original input event is reported to the Input subsystem of the application framework layer, and the Input subsystem recognizes the input event as a camera photo event.
[0273] S53a: Input subsystem notifies the camera.
[0274] The Input subsystem notifies the camera of the photo event.
[0275] S53b: After the camera's insertion point at the application framework layer is executed, it notifies the Cgroups subsystem to perform freezing control.
[0276] After the camera's photo service is triggered, the camera's insertion point at the beginning of the photo service path in the application framework layer is executed. At this time, it is determined that the photo service is triggered, and the Cgroups subsystem is notified that the background APP needs to be frozen at this time, so that the system resources of the background APP can be recovered and allocated to the camera, ensuring smooth camera shooting and enabling the camera to resume displaying the preview screen as soon as possible.
[0277] S54: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0278] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0279] S55: The Cgroups subsystem allocates the recovered system resources to the camera.
[0280] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of the camera and allocate system resources to the camera application.
[0281] S56: The screen flashes when the camera takes a photo.
[0282] The camera determines that it needs to take a photo based on the notification from the Input subsystem.
[0283] The state of the camera flash screen corresponds to Fig. 15B 15-(b) in the figure, at this time, the camera is in the process of generating the photo taken this time, and the picture preview box 141 of the camera interface generally still displays the photo taken last time, and the camera has a short black screen state, which visually appears as a flashing screen.
[0284] S57: The camera resumes displaying the preview screen.
[0285] After the photo is taken, the camera resumes displaying the preview screen. Fig. 15B 15-(c) in the figure, at this time, the picture preview box 141 of the camera interface displays the picture taken this time, and the preview screen of the camera is the current screen. The time of this foreground operation can be regarded as the time length from when the Input subsystem receives the operation event to when the camera resumes displaying the preview screen.
[0286] S58: Notify the Cgroups subsystem to unfreeze.
[0287] After the camera completes taking pictures, the insertion point for the picture-taking service is executed. At this time, it is determined that the picture-taking service is finished, and the Cgroups subsystem is notified to release the freeze control.
[0288] S59: The Cgroups subsystem releases the freeze control on the applications running in the background.
[0289] In a possible implementation, after the Cgroups subsystem unfreezes the background application, it reclaims the previously allocated additional system resources from the foreground operation and reallocates the system resources to each background-running application.
[0290] In another possible implementation, the previously additionally allocated system resources are recovered from the foreground operation and allocated to the applications running in the background, so that the applications running in the background can restore the system resources before the freezing control.
[0291] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of background apps and allocate system resources to background applications.
[0292] It is understandable that the principle when using a camera to record a video is similar and will not be described in detail here.
[0293] In this embodiment, in the process from reporting the capture button click event to the camera restoring the preview screen display, the camera application can obtain more system resources to shorten the time of the entire process, that is, shorten the time of the screen flash when taking a photo, and shorten the time the user waits for the preview screen to be restored, thereby increasing the smoothness of the photo-taking process and improving the user experience.
[0294] The above embodiments are described using the photo-taking operation as an example. In addition, the technical solution of the present application may also be used when triggering a transition operation in other applications. The following description is given using an instant messaging APP as an example.
[0295] See also Fig.16 and Fig.17 .in, Fig.16 A flowchart of another method for system resource scheduling provided in an embodiment of the present application; Fig.17 Scenario diagram provided for the embodiment of the present application Figure 5 .
[0296] S60: The user clicks an option in the APP to trigger the APP transition.
[0297] Fig.17 17-(a) in FIG. 17 shows a schematic diagram of a user clicking an option on the interface of an instant messaging APP to trigger a transition within the APP. The interface after the transition is shown in 17-(b) in FIG. That is, after clicking on a short video on the page, the user enters the short video playback interface. At this time, the application has an activity change.
[0298] S61: The touch screen driver detects an operation event.
[0299] When the touch sensor receives a click from the user, the corresponding hardware interrupt is sent to the touch screen driver at the kernel layer, which processes the touch operation into raw input events.
[0300] S62: The touch screen driver reports the operation event to the Input subsystem.
[0301] The original input event is reported to the Input subsystem of the application framework layer, and the Input subsystem identifies that the input event corresponds to a user's click operation on the screen in the interface of the instant messaging APP.
[0302] S63a: The Input subsystem notifies the Cgroups subsystem to perform freezing control.
[0303] The Input subsystem notifies the Cgroups subsystem that the background APP needs to be frozen at this time, so that the system resources of the background APP can be recovered and allocated to the Window Manager Service to achieve the transition animation effect and speed up the loading of the interface after the special scene is completed.
[0304] S63b: The Input subsystem notifies the instant messaging app.
[0305] S64: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0306] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0307] S65: The Cgroups subsystem allocates the recovered system resources to instant messaging apps.
[0308] S66: The instant messaging app reports a request to the Activity Manager Service to start the transition Activity.
[0309] The instant messaging app determines that a transition is required based on the notification from the Input subsystem, starts the transition Activity, and reports the start request of the transition Activity to the Activity Manager Service.
[0310] S67: The Activity Manager Service notifies the instant messaging app that it agrees to start the transition Activity.
[0311] S68: The instant messaging app notifies the Window Manager Service to start the transition animation effect.
[0312] At this time, there are the following three implementation methods.
[0313] In implementation A in the figure:
[0314] S69: Window Manager Service starts the transition animation.
[0315] The Window Manager Service switches windows according to the position, size, and layout of the interface windows, and starts the transition animation effects.
[0316] S70: After the transition, the first frame of the APP page is loaded.
[0317] S70b: AMS notifies the Cgroups subsystem to unfreeze.
[0318] When the transition activity is completed, the AMS of the application framework layer notifies the Cgroups subsystem to unfreeze.
[0319] S71: After the transition, the APP page content is loaded.
[0320] In implementation B in the figure:
[0321] S69: Window Manager Service starts the transition animation.
[0322] The Window Manager Service switches windows according to the position, size, and layout of the interface windows, and starts the transition animation effects.
[0323] S69b: WMS notifies the Cgroups subsystem to unfreeze.
[0324] When the transition animation is completed, the WMS of the application framework layer notifies the Cgroups subsystem to unfreeze.
[0325] S70: After the transition, the first frame of the APP page is loaded.
[0326] S71: After the transition, the APP page content is loaded.
[0327] When the application uses the Webview component, you can also use method C in the figure:
[0328] S69: Window Manager Service starts the transition animation.
[0329] The Window Manager Service switches windows according to the position, size, and layout of the interface windows, and starts the transition animation effects.
[0330] S70: After the transition, the first frame of the APP page is loaded.
[0331] S71: After the transition, the APP page content is loaded.
[0332] S72: Webview notifies the Cgroups subsystem to unfreeze.
[0333] The Webview component of the application framework layer notifies the Cgroups subsystem to unfreeze the background APP so that the background APP can obtain system resources.
[0334] S73: The Cgroups subsystem releases the freeze control on the applications running in the background.
[0335] In a possible implementation, after the Cgroups subsystem unfreezes the background application, it reclaims the previously allocated additional system resources from the foreground operation and reallocates the system resources to each background-running application.
[0336] In another possible implementation, the previously additionally allocated system resources are recovered from the foreground operation and allocated to the applications running in the background, so that the applications running in the background can restore the system resources before the freezing control.
[0337] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of background apps and allocate system resources to background applications.
[0338] In summary, by using the technical solution provided by the embodiment of the present application, when the application interface triggers the transition animation effect, the background APP can be frozen when the input subsystem is reported an operation event, and the APP can be unfrozen after the page content is loaded after switching, which can make the transition animation smoother, improve the flexibility, rationality and effect of the freezing control, and effectively improve the foreground response speed and user experience. In addition, considering the uneven capabilities of the chips used in electronic devices, the solution of the present application does not need to be adjusted based on product or chip granularity engineering experiments, and is highly practical.
[0339] In another possible implementation, an insertion point can be set in the startup path of the short video service. The detection insertion point is located in the service path of the framework layer Framework. When the service path of the short video is accessed, the insertion point is executed to achieve detection. At this time, the application can notify the control group of the electronic device to freeze the Cgroups freezer subsystem to freeze all or part of the background running applications. At the same time, insertion is also performed at the end point of each service path. When the insertion is executed, it can be determined that the service corresponding to the foreground operation is ended at this time, that is, the short video service is started, and the Cgroups freezer subsystem is notified to lift the freeze control.
[0340] The above describes the implementation method of triggering transitions through foreground operations in a single application, resulting in activity changes, and realizing foreground response acceleration through freezing control. In other embodiments, different applications can trigger transitions between each other, resulting in activity changes. For example, when switching from the first page of the second application to the third page of the third application, when the content of the third page is loaded, the third application determines that the foreground operation is completed, and notifies the Cgroups freezer subsystem to release the freezing control of each of the applications. For example, the second application is a shopping program, and the third application is a payment application. The second application jumps to the payment page of the third application through the checkout page of the second application to enter the password; for another example, the second application is a video playback software, and the third application is an instant messaging APP. The user can select the login account as an instant messaging APP account through the login interface of the video playback software, triggering the page to transition to the instant messaging APP for authorization. The solution of this application can also be applied to the above transition scenarios. When the business critical path is triggered, the transition animation effect is smooth and not stuck through freezing control, which improves the user experience.
[0341] The following takes triggering the hand-following animation effect on the desktop as an example for explanation.
[0342] See also Fig.18 and Fig.19 .in, Fig.18 A flowchart of another method for system resource scheduling provided in an embodiment of the present application; Fig.19 Scenario diagram provided for the embodiment of the present application Figure 6 .
[0343] In the embodiment of the present application, taking the user triggering window switching on the desktop as an example, the principles of other desktop animations, including but not limited to, for example, pulling down the status bar, pulling up the status bar, side sliding, application shifting, opening animations of desktop editing mode, opening desktop folders, closing desktop folders, creating and merging folders, releasing folders, swapping desktop application positions, click effects, long press effects, animations corresponding to application installation prompts, or entering one-handed operation mode are similar and will not be elaborated here.
[0344] Fig.19 19-(a) in the figure shows a schematic diagram of a user swiping left on the desktop home page; 19-(b) is a schematic diagram of an intermediate state when the desktop home page transitions to the desktop second page during the finger sliding process; 19-(c) is a schematic diagram of switching to the desktop second page after the sliding is completed. The method includes the following steps:
[0345] S81: The user swipes on the desktop.
[0346] S82: The touch screen driver detects an operation event.
[0347] When the touch sensor receives a swipe operation from the user, the corresponding hardware interrupt is sent to the touch screen driver at the kernel layer, which processes the swipe operation into a raw input event (including click coordinates, click operation timestamp, etc.).
[0348] S83: The touch screen driver reports the sliding event to the Input subsystem.
[0349] The original input event is reported to the Input subsystem of the application framework layer, and the Input subsystem recognizes that the input event corresponds to the user sliding the desktop.
[0350] S84a: The Input subsystem notifies the Cgroups subsystem to perform freezing control.
[0351] The Input subsystem notifies the Cgroups subsystem that it needs to freeze the background apps at this time, so that the system resources of the background apps can be recovered and allocated to the foreground operations to ensure smooth desktop animation effects.
[0352] S84b: The Input subsystem notifies the desktop application to start the animation effect.
[0353] S85: The Cgroups subsystem freezes and controls the applications currently running in the background.
[0354] The freezer subsystem of the Cgroups subsystem is used to implement freezing control for each application.
[0355] S86: The Cgroups subsystem allocates the recovered system resources to foreground operations.
[0356] The cpuset subsystem and cpu subsystem in the Cgroups subsystem work together to increase the CPU usage of the foreground desktop application and allocate the recovered system resources to the desktop application.
[0357] S87: Desktop application realizes the animation effect of interface switching.
[0358] S88: The interface content after the transition is loaded.
[0359] S89: Notify the Cgroups subsystem to unfreeze.
[0360] After the interface switching is completed, the Cgroups subsystem is notified to unfreeze the background APP so that the background APP can obtain system resources.
[0361] S90: The Cgroups subsystem releases the freeze control of applications running in the background.
[0362] In summary, by using the technical solution provided by the embodiment of the present application, when the desktop triggers the animation effect, the freezing control of the background APP is no longer based on a fixed preset time, but is frozen according to the coverage duration of the animation effect, which improves the flexibility, rationality and effect of the freezing control, and effectively improves the foreground response speed and user experience. In addition, considering that the chip capabilities used in electronic devices vary, the solution of the present application does not require engineering experimental adjustment based on product or chip granularity, and is highly practical.
[0363] Based on the method for system resource scheduling provided in the above embodiments, the embodiment of the present application further provides an electronic device, which is described in detail below with reference to the accompanying drawings.
[0364] See also Fig. 20 , which is a schematic diagram of an electronic device provided in an embodiment of the present application.
[0365] The electronic device may be a mobile phone, a wearable electronic device (such as a smart watch), a tablet computer, an augmented reality (AR) device, a virtual reality (VR) device, and a vehicle-mounted computer, etc. The electronic device may run an Android system.
[0366] The electronic device 10 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 1401, a battery 1402, an antenna group 1, an antenna group 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, and a subscriber identification module (SIM) card interface 195, etc.
[0367] The sensor module 180 may include one or more of 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, and the like.
[0368] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown in the figure, or combine some components, or separate 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.
[0369] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. 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.
[0370] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0371] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can 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 10, and can also be used to transfer data between the electronic device 10 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0372] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0373] 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 10. While the charging management module 140 is charging the battery 1402, it may also power the electronic device through the power management module 1401.
[0374] The power management module 1401 is used to connect the battery 1402, the charging management module 140 and the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be arranged in the same device.
[0375] The wireless communication function of the electronic device 10 can be implemented through the antenna group 1, the antenna group 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0376] The electronic device 10 implements the display function through a GPU, a display screen 194, and an application processor.
[0377] The display screen 194 is used to display images, videos, etc. In some embodiments, the electronic device 10 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
[0378] The electronic device 10 can realize the shooting function through an image signal processor (ISP), a camera 193, a video codec, a GPU, a display screen 194, and an application processor. The camera 193 is used to capture a still image or a video. In some embodiments, the electronic device 10 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0379] The processor 110 of the electronic device includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the above system resource scheduling method is implemented by adjusting kernel parameters.
[0380] An embodiment of the present application provides a storage medium on which a program is stored. When the program is executed by a processor, the method for scheduling system resources is implemented.
[0381] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, parameter random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically-erasable programmable read-only memory (EEPROM), flash memory or other memory technologies.
[0382] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.
[0383] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware.
[0384] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for system resource scheduling, characterized in that: Applied to electronic equipment, the method comprises: When an interactive operation on the display interface of the electronic device triggered by a user is detected, freezing control is performed on all or part of the applications running in the background, wherein the freezing control is used to reclaim system resources allocated to the corresponding applications; Allocating the recovered system resources to the services corresponding to the interactive operations on the display interface; When the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the application programs running in the background is released.
2. The method according to claim 1, characterized in that When an interactive operation on the display interface of the electronic device triggered by a user is detected, freezing control is performed on all or part of the background applications running in the background, specifically including: The hardware driver of the electronic device reports the operation event corresponding to the interactive operation of the display interface to the input subsystem of the electronic device; The Input subsystem notifies the control group freezer subsystem of the electronic device to freeze all or part of the application programs running in the background.
3. The method according to claim 1, characterized in that When the interactive operation on the display interface is an operation triggered by the user on the desktop, when the interactive operation on the display interface of the electronic device triggered by the user is detected, freezing control is performed on all or part of the applications running in the background, specifically including: The hardware driver of the electronic device reports the operation event corresponding to the interactive operation of the display interface to the input subsystem of the electronic device; The Input subsystem reports the operation event to the desktop application; When the desktop application determines that freezing control needs to be performed according to the identification result of the operation event, the control group freeze Cgroups freezer subsystem of the electronic device is notified to perform freezing control on all or part of the applications running in the background.
4. The method according to claim 1, characterized in that: When an interactive operation on the display interface of the electronic device triggered by a user is detected, freezing control is performed on all or part of the applications running in the background, specifically including: When a detection plug-in point of a business path of an application is executed, it is determined that the user has triggered an interactive operation of the display interface, and the control group freeze Cgroups freezer subsystem of the electronic device is notified to freeze and control all or part of the applications running in the background, and each of the detection plug-in points is located in the business path of the interactive operation of each display interface in the framework layer Framework.
5. The method according to claim 4, characterized in that The business path of the application is any of the following: The startup service path of the application or the service path of the transition animation of the application.
6. The method according to claim 1, characterized in that The system resources include one or more of the following: Central processing unit CPU resources, network bandwidth resources, input and output I / O channel resources or framework layer Framework system resources.
7. The method according to claim 1, characterized in that The interactive operation of the display interface is to start a first application program, and when the service corresponding to the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes: When the first frame of the main interface of the first application is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
8. The method according to claim 1, characterized in that The interactive operation of the display interface is to start a first application program, and when the service corresponding to the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes: When the first frame content of the first application is loaded, it is determined that the service corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
9. The method according to claim 1, characterized in that: The interactive operation of the display interface is to start a camera application, and when the service corresponding to the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes: When the camera interface starts to display a preview screen, it is determined that the service corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
10. The method according to claim 1, characterized in that The interactive operation of the display interface is clicking a shooting button in the camera application interface, and when the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes: When the camera application completes shooting and resumes displaying the preview screen, it is determined that the service corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the applications running in the background is released.
11. The method according to claim 1, characterized in that: The interactive operation of the display interface is to trigger an animation effect on the desktop, and when the business corresponding to the interactive operation of the display interface is completed, the freezing control of all or part of the applications running in the background is released, which specifically includes: When the animation effect ends, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
12. The method according to claim 1, characterized in that The interactive operation of the display interface is switching from a first page of the second application to a second page of the second application, and when the service corresponding to the interactive operation of the display interface is completed, releasing the freezing control of all or part of the applications running in the background specifically includes: When the content of the second page is loaded, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of all or part of the application programs running in the background is released.
13. The method according to claim 1, characterized in that The interactive operation of the display interface is switching from the second page of the second application to the third page of the third application, and when the service corresponding to the interactive operation of the display interface is completed, releasing the freezing control of each of the applications specifically includes: When the loading of the content of the third page is completed, it is determined that the business corresponding to the interactive operation of the display interface is completed, and the freezing control of each of the application programs is released.
14. The method according to any one of claims 1 to 13, characterized in that The releasing of the freezing control of all or part of the applications running in the background specifically includes: Reclaiming the recovered system resources from the business corresponding to the interactive operation on the display interface; The recovered system resources are reallocated to all or part of the application programs running in the background.
15. The method according to any one of claims 1 to 13, characterized in that The releasing of the freezing control of all or part of the applications running in the background specifically includes: Reclaiming the recovered system resources from the business corresponding to the interactive operation on the display interface; The recovered system resources are allocated so that all or part of the applications running in the background can restore the system resources before the freezing control.
16. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor is used to call and execute the computer program to implement the system resource scheduling method according to any one of claims 1 to 15.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by an electronic device, the method for system resource scheduling described in any one of claims 1 to 15 is implemented.
Citation Information
Cited By
Multi-task switching processing method and system of intelligent terminal
CN121029359A
System resource scheduling method, electronic device, and storage medium
EP4693035A1
System resource scheduling method, electronic device, and storage medium
WO2025007569A1