Resource management method, electronic device, storage medium and program product
By establishing the relationship between electronic devices in distributed scenarios and adopting differentiated resource management strategies, the problem of applications being mishandled when running in the background is solved, improving user experience and resource utilization efficiency.
Patent Information
- Application Number
- CN202210965984.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-12
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-08-12
AI Technical Summary
In distributed scenarios, the existing technology lacks an effective application control mechanism, which leads to the application being mishandled or over-use of resources when running in the background, affecting the user experience.
By establishing an association between the first electronic device and the second electronic device, different levels of management and control are used to manage the resource use of the application, including different policies in the foreground and backend states, ensuring that the application is not cleaned up in the background and providing sufficient resource support.
It effectively avoids the application being cleaned up when running in the background, improves the user experience and optimizes resource usage, avoids lag, and improves the application's running speed.
Smart Images

Figure CN117632393B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a resource management method, electronic equipment, storage medium, and program product. Background Art
[0002] With the advancement of communications technology, interconnected collaboration among multiple electronic devices has become widely used. For example, deploying different devices such as mobile phones, tablets, wristbands, watches, and monitors on the same distributed network enables the use of multiple electronic devices in various fields such as distributed education, distributed gaming, distributed computing, distributed office, and distributed fitness. However, in distributed scenarios, there is currently no mechanism for controlling and managing applications. Summary of the Invention
[0003] In view of the above, it is necessary to provide a resource management method, electronic device, storage medium and program product that can manage and control applications in distributed scenarios.
[0004] In a first aspect, an embodiment of the present application provides a resource management method, including: a first electronic device displays the interface of a first application; the first electronic device calls a second application of an associated second electronic device in response to an operation on the first application, and establishes a first association relationship between the first application and the second application; the first association relationship includes the first application being in a foreground running state; when the first application switches from a foreground running state to a background running state, the first electronic device updates the first association relationship to a second association relationship; the second association relationship includes the first application being in a background running state; according to the second association relationship, the first electronic device keeps the first application active.
[0005] In the first aspect of the present application, when a first application calls a second application of a second electronic device, the first electronic device establishes a first association relationship between the first application and the second application. When the first application switches from a foreground running state to a background running state, the first association relationship can be updated to a second association relationship, and the first application can be kept alive based on the second association relationship. Since the first application has an association relationship with the second application of the second electronic device, the first electronic device can keep the first application alive based on the association relationship. Therefore, even after the first application is switched to a background running state, the first application will not be cleared by the system in the background, and the first application can subsequently switch directly from the background running state to the foreground running state.
[0006] According to some embodiments of the present application, before the first electronic device calls the second application of the associated second electronic device in response to an operation on the first application, the method further includes: the first electronic device uses a first control method to control the first application; when the first application switches from the foreground running state to the background running state, before the first electronic device updates the first association relationship to the second association relationship, the method further includes: the first electronic device uses a second control method to control the first application, and the second control method has a lower degree of control over resources than the first control method. This application uses a second control method after the first application of the first electronic device calls the second application of the second electronic device, before the first application switches from the foreground running state to the background running state, wherein the second control method has a lower degree of control than the first control method before the first application calls the second application. In a distributed scenario, sufficient resources can be provided for the first application running in the distributed foreground, which can increase the running speed of the first application, avoid the first application from being stuck when multiple applications are running at the same time, and improve the user's performance experience.
[0007] According to some embodiments of the present application, based on the second association relationship, the first electronic device keeps the first application alive, including: when the second application is in the foreground running state, the first electronic device uses a third control method to keep the first application alive, and the degree of control of resources by the third control method is greater than the degree of control of resources by the first control method. The present application can keep the first application alive without occupying more resources by using a third control method with a greater degree of control than the first control method to keep the first application alive in a distributed scenario when the first application is in the background running state and the second application is in the foreground running state.
[0008] According to some embodiments of the present application, according to the second association relationship, the first electronic device keeps the first application alive, and further includes: when the second application is in the background running state, the first electronic device uses a fourth control method to keep the first application alive, and the fourth control method has a greater degree of control over resources than the third control method. The present application uses a fourth control method with a greater degree of control than the third control method to keep the first application alive in a distributed scenario when the first application is in the background running state and the second application is in the background running state. This can keep the first application alive and occupy fewer resources, thereby avoiding the jamming of other applications caused by the first application occupying more resources.
[0009] According to some embodiments of the present application, the method further includes: when the first electronic device receives a message from the second electronic device indicating that the second application has ended, or when the first electronic device detects that the second electronic device is offline, the first electronic device deletes the second association relationship and uses a fifth control method to control the first application, and the degree of control of resources by the fifth control method is greater than the degree of control of resources by the fourth control method. The present application deletes the second association relationship in a distributed scenario when the first application is in the background running state and the second application ends or the second electronic device goes offline, so that the first application exits the distributed scenario and is in a normal background running scenario, occupying fewer resources.
[0010] According to some embodiments of the present application, using the second control method to control the first application includes: increasing the priority of the first application's process; or, locking the priority; or, increasing the frequency of at least one of the central processing unit, graphics processing unit, and double-data-rate synchronous dynamic random access memory to process the first application. The present application can provide sufficient resources for the first application running in a distributed foreground by increasing the priority of the first application's process, locking the priority, increasing the frequency of at least one of the central processing unit, graphics processing unit, and double-data-rate synchronous dynamic random access memory to process the first application, etc.
[0011] According to some embodiments of the present application, a third control method is used to keep the first application alive, including: increasing the priority of the first application's process; or placing the first application's process at the end of a list of killable processes. In a distributed scenario, when the second application is in the foreground, the first application running in the background can be kept alive by increasing the priority of the first application's process or placing the first application's process at the end of a list of killable processes, without occupying too many resources.
[0012] According to some embodiments of the present application, a fourth control method is used to keep the first application alive, including: keeping the first application alive for a preset time. In a distributed scenario, when a second application is in the background, by keeping the first application alive for a preset time, the first application in the background can be kept alive for the preset time, thereby avoiding the lag of other applications caused by the first application occupying more resources.
[0013] According to some embodiments of the present application, a fifth control method is used to control the first application, including: lowering the priority of the first application's process; or freezing the first application when the system memory is lower than a preset memory value; or clearing the first application when the system memory is lower than a preset memory value. The present application avoids waste of resources by lowering the priority of the first application's process, freezing the first application when the system memory is lower than a preset memory value, or clearing the first application when the system memory is lower than a preset memory value when the first application in the background running state exits the distributed scenario.
[0014] According to some embodiments of the present application, the method further includes: when the first electronic device monitors that the first application has ended, the first electronic device deletes the second association relationship. In the present application, when the first application ends, the first electronic device deletes the second association relationship, and then when the first application is subsequently restarted, the first electronic device will directly control the first application in a normal manner.
[0015] According to some embodiments of the present application, establishing a first association relationship between a first application and a second application includes: receiving a result of a call sent by a second electronic device; and establishing the first association relationship between the first application and the second application based on the result. The present application can establish the first association relationship by having the first electronic device establish the first association relationship based on the result of the call sent by the second electronic device.
[0016] In a second aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory is used to store program instructions. When the processor calls the stored instructions, it implements the method of any possible embodiment of the first aspect above.
[0017] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a program, and the program enables an electronic device to implement the method of any possible embodiment of the first aspect above.
[0018] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes computer execution instructions, and the computer execution instructions are stored in a computer-readable storage medium; at least one processor of an electronic device can read the computer execution instructions from the computer-readable storage medium, and at least one processor executes the computer execution instructions so that the electronic device executes the method of any possible embodiment of the first aspect above.
[0019] The beneficial effects of the second to fourth aspects of this application and their various implementations can refer to the first aspect and its various implementations, as well as the analysis of the beneficial effects in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of a resource management and control system provided in an embodiment of the present application.
[0021] Figure 2 A schematic diagram of the physical structure of a first electronic device provided in an embodiment of the present application.
[0022] Figure 3 A schematic diagram of the composition of the software architecture of the first electronic device and the second electronic device provided in an embodiment of the present application.
[0023] Figure 4 A schematic diagram of the composition of the software architecture of the first electronic device and the second electronic device provided in an embodiment of the present application illustrates the working process when a first application of the first electronic device calls a second application of the second electronic device.
[0024] Figure 5 A schematic diagram of the composition of the software architecture of the first electronic device and the second electronic device provided in an embodiment of the present application shows the working process when the first application of the first electronic device switches from the foreground running state to the background running state.
[0025] Figure 6 A schematic diagram of the composition of the software architecture of the first electronic device and the second electronic device provided in an embodiment of the present application illustrates the working process when the first application of the first electronic device ends.
[0026] Figure 7 A schematic diagram of the composition of the software architecture of the first electronic device and the second electronic device provided in an embodiment of the present application illustrates the working process when the second electronic device is offline.
[0027] Figure 8 A schematic diagram of the functional modules of the first distributed control unit provided in an embodiment of the present application.
[0028] Figure 9-12 Flowchart of the resource management method provided in this embodiment of the application.
[0029] Figure 13 A schematic diagram of a distributed gaming scenario provided in an embodiment of the present application.
[0030] Figure 14 A schematic diagram of a distributed computing scenario provided in an embodiment of the present application.
[0031] Figure 15 This is a flowchart of another resource management method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In the description of the embodiments of this application, words such as "for example" and "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" is intended to present the relevant concepts in a concrete manner.
[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art in the art to which this application relates. The terms used in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. It should be understood that, in this application, unless otherwise specified, "a plurality" means two or more than two.
[0034] Existing electronic devices can be managed based on whitelists or application types. When managed based on whitelists, an application whitelist can be stored in the system of the electronic device. The application whitelist is a list of applications that are allowed to run in the background. Therefore, applications in the application whitelist will not be cleared when they are running in the background, while applications outside the application whitelist will be cleared when they are running in the background. When managed based on application types, the electronic device can classify the applications in the electronic device into multiple categories according to the type of application, such as instant messaging, payment, video, sports, etc. The instant messaging category may include etc. Payment category may include Wallet and other applications. Video category may include Huawei Video, The sports category may include sports and health applications. Electronic devices can also sort multiple categories according to important programs, for example, the instant messaging category has the highest importance and can be placed at the end of the list of killable processes when sorting. In this way, when the electronic device system performs background cleaning of applications, it can clean up the instant messaging category last. However, due to the installation or uninstallation of applications, the applications in the electronic device will change anytime and anywhere. The system's whitelist and the sorting of applications in the electronic device depend on the system upgrade and cannot be updated in real time. This may cause the application to be mistakenly processed when running in the background.
[0035] Existing electronic devices can also predict the user's current behavior based on the user's habits and manage the resources of applications based on the prediction. For example, if an electronic device detects that the user has used the address book at 5:30 pm for two consecutive weeks, the electronic device can build a model based on the detected information, and predict that the user will use the address book at 5:30 pm on the same day. The electronic device will automatically switch the address book to the foreground, or keep the address book running in the background active. However, since the resources of applications are managed based on predictions, when the user's behavior is not regular, the electronic device will not be able to predict the user's current behavior, and will not be able to reasonably manage the resources of the application, which may cause the application to be mistakenly processed when running in the background.
[0036] In view of this, an embodiment of the present application proposes a resource management method, which can avoid the situation where distributed applications are cleared while running in the background in a distributed scenario.
[0037] refer to Figure 1 , which is a schematic diagram of a resource management and control system according to an embodiment of the present application, wherein the resource management and control system 10 may include a first electronic device 11 and a second electronic device 12, but is not limited thereto. In other embodiments, the resource management and control system 10 may further include a third electronic device, etc., which is not limited in the present application.
[0038] The first electronic device 11 may be a mobile phone, tablet computer, digital camera, personal digital assistant (PDA), wearable device, laptop computer, etc. The second electronic device 12 may be a mobile phone, tablet computer, digital camera, personal digital assistant (PDA), laptop computer, smart TV, large screen, smart screen, monitor, etc. Figure 1 Only one first electronic device 11 is shown in the figure, but it can be understood that there may be multiple first electronic devices 11, and this application does not impose any limitation on this.
[0039] A first application 110 is installed on the first electronic device 11. A second application 120 is installed on the second electronic device 12. The first application 110 and the second application 120 can be gaming applications, computing applications, and the like. The first and second electronic devices 11 and 12 can be networked to establish a distributed network. The distributed network can be a mesh network, a Bluetooth network, a Wi-Fi network, and the like, and this application does not limit this.
[0040] In some embodiments, after the first electronic device 11 and the second electronic device 12 establish a distributed network, the first application 110 of the first electronic device 11 may launch the second application 120 of the second electronic device 12. At this time, the second application 120 of the second electronic device 12 may be in a foreground running state or a background running state. The first electronic device 11 may establish a first association relationship between the first application 110 and the second application 120 and store the first association relationship.
[0041] When the first application 110 switches to the background running state, the first electronic device 11 may also update the association relationship, for example, from the first association relationship to the second association relationship. The first electronic device 11 may keep the first application 110 active according to the second association relationship.
[0042] It is understandable that after the first application 110 of the first electronic device 11 starts the second application 120 of the second electronic device 12, the first application 110 of the first electronic device 11 and the second application 120 of the second electronic device 12 can communicate with each other, and this application does not limit this.
[0043] refer to Figure 2 , is a schematic diagram of the physical structure of the first electronic device provided in an embodiment of the present application. The first electronic device 20 can be a mobile phone, tablet computer, digital camera, personal digital assistant (PDA), wearable device, laptop computer, etc.
[0044] The first electronic device 20 may include a memory 21, a processor 22 and a communication interface 23. It is understood that Figure 2 The structure shown in the figure does not constitute a limitation on the first electronic device 20. The first electronic device 20 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently.
[0045] The memory 21 can be used to store software programs and / or modules / units. The processor 22 implements various functions of the first electronic device 20 by running or executing the software programs and / or modules / units stored in the memory 21 and calling the data stored in the memory 21. The memory 21 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data (such as audio data, etc.) created based on the use of the first electronic device 20. In addition, the memory 21 may include a non-volatile computer-readable memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device.
[0046] The processor 22 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 22 may be a microprocessor or any conventional processor. The processor 22 is the control center of the first electronic device 20 and connects various parts of the first electronic device 20 using various interfaces and lines.
[0047] Processor 22 may also be provided with memory 21 for storing instructions and data. In some embodiments, memory 21 in processor 22 is a cache memory. Memory 21 can store instructions or data that processor 22 has just used or is reusing. If processor 22 needs to use an instruction or data again, it can directly retrieve it from memory 21. This avoids duplicate accesses, reduces processor 22's waiting time, and thus improves system efficiency.
[0048] In some embodiments, the processor 22 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and / or a USB interface.
[0049] The communication interface 23 may include a standard wired interface, a wireless interface, etc. The communication interface 23 is used for the first electronic device 20 to communicate with the second electronic device.
[0050] In order to better understand this application, some terms and concepts involved in this application are introduced below.
[0051] Application status: Application status includes non-running state and running state. When an application is in non-running state, it means that the application has exited the running state.
[0052] Running status: The running status of an application in the operating system can be divided into foreground running status and background running status. The foreground running status refers to running directly on the display window or interface of the display screen, presenting the current interface of the program running, and can interact with the user of the terminal device through the displayed interface. The background running status means that the display screen does not present the running interface of the application, but the application continues to provide services in the background. For applications with a visual display interface, it can switch from the background running state to the foreground running state, or from the foreground running state to the background running state; for applications without a visual display interface, it can be in the background running state, and generally cannot be switched to the foreground running state.
[0053] Application Identifier: Also known as User Identifier (UID) or Application ID, it is an identifier assigned by the system during the application installation process. Multiple applications can share an application identifier.
[0054] Process ID: This can be a process identifier (PID) or a process name. The PID is assigned by the operating system to an application process after it starts. When the application stops running, the operating system reclaims the PID. When the application starts running again, the operating system assigns a new PID. A process identifier uniquely identifies a process.
[0055] Package name: The package name is mainly used by the system to identify applications. Multiple applications can share a package name.
[0056] Distributed network: A type of wireless local area network, also known as a mesh network. Every two electronic devices in a distributed network can communicate with each other.
[0057] Binder system: The Binder system is a server / client model, including the Binder server, Binder client, Binder proxy object (BpBinder) and Binder driver.
[0058] Binder server: The Binder server provides services for Binder clients. The Binder server is in user space.
[0059] Binder client: The Binder client is the service object of the Binder server. The Binder client is in the user space.
[0060] Binder proxy object: A Binder proxy object is a Binder interface that can monitor the termination of the referenced Binder server. The Binder proxy object can register with the Binder driver to receive death notifications for the Binder server referenced by the Binder proxy object. Before the Binder proxy object registers with the Binder driver to receive death notifications for the Binder server referenced by the Binder proxy object, the Binder proxy object can first define a death notification recipient.
[0061] Binder driver: The Binder driver is in kernel space. When the Binder proxy object monitors the end of the referenced Binder server, the Binder driver can send a Binder server death notification to the death notification recipient object.
[0062] refer to Figure 3, which is a schematic diagram of the software architecture of the first electronic device and the second electronic device provided in an embodiment of the present application. The first electronic device 31 includes a first application 310, a first distributed control unit 311, and a first soft bus 312. The second electronic device 32 includes a second application 320, a second distributed control unit 321, and a second soft bus 322.
[0063] The first application 310 and the second application 320 can be determined based on actual application needs and are not limited here. For example, the first application 310 and the second application 320 can be game apps, computing apps, etc. The first application 310 can be game application A1, and the second application 320 can be game application A2; alternatively, the first application 310 can be computing application C1, and the second application 320 can be computing application C2.
[0064] The first distributed control unit 311 and the second distributed control unit 321 can implement the invocation and startup of cross-device applications. The first distributed control unit 311 can also control the resources used by the first application 310. The second distributed control unit 321 can also control the resources used by the second application 320. Resources may include memory resources and computing resources. Memory resources may include random access memory (RAM) resources, etc. Computing resources may include processor resources, etc.
[0065] The first soft bus 312 and the second soft bus 322 can provide functions such as cross-device communication, device online monitoring, and device offline monitoring.
[0066] In some embodiments, as Figure 4 As shown, when a first application 310 on a first electronic device 31 initiates a distributed scheduling of a second application 320 on a second electronic device 32, the distributed scheduling request output by the first application 310 can be transmitted to the second electronic device 32 via the first distributed control unit 311 and the first soft bus 312, for example, to the second soft bus 322 of the second electronic device 32. The second soft bus 322 transmits the distributed scheduling request to the second application 320 via the second distributed control unit 321, so that the second application 320 can respond to the distributed scheduling initiated by the first application 310. Thus, the first application 310 on the first electronic device 31 can call the second application 320 on the second electronic device 32.
[0067] In some embodiments, the calling may include launching. Then, the calling may include calling when the second application is in a running state and launching when the second application is in a non-running state.
[0068] In some embodiments, the first application 310 of the first electronic device 31 is in the foreground running state, and the second application 320 of the second electronic device 32 can be in the foreground running state or the background running state. When the first application 310 calls the second application 320, the second application 320 can communicate with the first application 310. The second distributed control unit 321 returns the result of the call to the first electronic device 31 via the second soft bus 322, for example, returns the result of the call to the first soft bus 312 of the first electronic device 31. The first soft bus 312 sends the result to the first distributed control unit 311. The first distributed control unit 311 also establishes a first association relationship between the first application 310 and the second application 320 based on the result. In some embodiments, the second distributed control unit 321 also establishes a third association relationship between the first application 310 and the second application 320 based on the result. The third association relationship includes basic information of the application, running status information of the application, and device ID of the electronic device.
[0069] In some embodiments, when the second application 320 is in the foreground, the first distributed control unit 311 and the second distributed control unit 321 may respectively control the resources used by the first application 310 and the second application 320 based on the first association relationship and the third association relationship. In some embodiments, before the first application 310 initiates distributed scheduling of the second application 320 on the second electronic device 32, the first distributed control unit 311 may control the first application 310 using the first control method.
[0070] In some embodiments, after the first application 310 calls the second application 320 on the second electronic device 32 , the first distributed management and control unit 311 may manage the first application 310 using the second management and control method.
[0071] In some embodiments, the second control method may have a lower degree of control over the resource than the first control method. In other embodiments, the second control method may have a degree of control over the resource equal to the first control method.
[0072] In some embodiments, when the second application 320 is running in the background, the first distributed control unit 311 applies a second control method to the first application 310 based on the first association relationship. The second distributed control unit 321 also keeps the second application 320 alive based on the third association relationship. In some embodiments, the second distributed control unit 321 also uses a third control method to keep the second application 320 alive based on the third association relationship. In some embodiments, the degree of resource control provided by the third control method may be equal to that provided by the first control method. In other embodiments, the degree of resource control provided by the third control method may be greater than that provided by the first control method.
[0073] In some embodiments, as Figure 5 As shown, in a distributed scenario, when the first application 310 on the first electronic device 31 switches from a foreground running state to a background running state, the information output by the first application 310 that the first application 310 has switched to the background running state can be sent to the second electronic device 32 via the first distributed control unit 311 and the first soft bus 312, for example, to the second soft bus 322 of the second electronic device 32. The second soft bus 322 can send the information that the first application 310 has switched to the background running state to the second distributed control unit 321. At this time, the first distributed control unit 311 can update the first association relationship to the second association relationship based on the information that the first application 310 has switched to the background running state, and the second distributed control unit 321 can update the third association relationship to the fourth association relationship based on the information that the first application 310 has switched to the background running state.
[0074] In some embodiments, when the second application 320 is in the foreground, the first distributed control unit 311 keeps the first application 310 alive based on the second association. In some embodiments, the first distributed control unit 311 keeps the first application 310 alive using a third control method based on the second association. The second distributed control unit 321 controls the second application 320 using the second control method based on the fourth association.
[0075] In some embodiments, when the second application 320 is running in the background, the first distributed control unit 311 and the second distributed control unit 321 may keep the first application 310 and the second application 320 alive based on the second association relationship and the fourth association relationship, respectively. In some embodiments, the first distributed control unit 311 and the second distributed control unit 321 may use a fourth control method to keep the first application 310 and the second application 320 alive based on the second association relationship and the fourth association relationship, respectively. The fourth control method provides a greater degree of resource control than the third control method.
[0076] Accordingly, when the second application 320 switches from the foreground running state to the background running state, the second application 320 outputs information indicating that the second application 320 has switched to the background running state. This information can be sent to the first electronic device 31 via the second distributed control unit 321 and the second soft bus 322, for example, to the first soft bus 312 of the first electronic device 31. The first soft bus 312 can send the information indicating that the second application 320 has switched to the background running state to the first distributed control unit 311. The first distributed control unit 311 updates the association relationship based on the information indicating that the second application 320 has switched to the background running state. The second distributed control unit 321 also updates the association relationship based on the information indicating that the second application 320 has switched to the background running state. When the first application 310 is in the foreground running state, the first distributed control unit 311 controls the first application 310 using the second control method based on the updated association relationship, and the second distributed control unit 321 uses the third control method based on the updated association relationship to keep the second application 320 alive. When the first application 310 is in the background running state, the first distributed control unit 311 and the second distributed control unit 321 may respectively keep the first application 310 and the second application 320 alive using the fourth control method according to the updated association relationship.
[0077] It is understood that the first application 310 on the first electronic device 31 can also switch from the background running state to the foreground running state. At this time, the control process of the first electronic device 31 on the first application 310 is the same as the above Figure 5 The control process of the first electronic device 31 for the first application 310 is similar, and the control process of the second electronic device 32 for the second application 320 is similar to the above Figure 5 The control process of the second electronic device 32 for the second application 320 is similar and will not be repeated here.
[0078] In some embodiments, as Figure 6As shown, in a distributed scenario, when the first application 310 ends, that is, when the first application 310 is in a non-running state, the first distributed control unit 311 can monitor the end of the first application 310. The first distributed control unit 311 can send the information of the end of the first application 310 to the second electronic device 32 through the first soft bus 312, for example, to the second soft bus 322 of the second electronic device 32. The second soft bus 322 can send the information of the end of the first application 310 to the second distributed control unit 321. The second distributed control unit 321 deletes the fourth association relationship based on the information of the end of the first application 310. The first distributed control unit 311 also deletes the second association relationship based on the information of the end of the first application 310. At this time, the first electronic device 31 can no longer control the second electronic device 32.
[0079] In some embodiments, when the first application 310 ends and the second application 320 is in the foreground running state, the second distributed control unit 321 controls the second application 320 using the first control method. When the first application 310 ends and the second application 320 is in the background running state, the second distributed control unit 321 controls the second application 320 using the fifth control method. The degree of control of resources by the fifth control method is greater than the degree of control of resources by the fourth control method. In some embodiments, the fifth control method may be to limit the use of resources by applications. It is understandable that if the first electronic device 31 restarts the first application 310 later, the first distributed control unit 311 will first control the first application 310 using the first control method, and this application does not impose any restrictions on this.
[0080] It is understandable that in a distributed scenario, the second application 320 may also be terminated. At this time, the control process of the first electronic device 31 on the first application 310 is the same as the above-mentioned Figure 6 The control process of the second electronic device 32 on the second application 320 is similar to that of the second electronic device 32 on the second application 320. Figure 6 The control process of the first electronic device 31 on the first application 310 is similar and will not be repeated here.
[0081] In some embodiments, as Figure 7As shown, in a distributed scenario, when the first soft bus 312 detects that the second electronic device 32 is offline, the first soft bus 312 outputs the offline information of the second electronic device 32 to the first distributed control unit 311. The first distributed control unit 311 deletes the association relationship with the second electronic device 32 based on the offline information of the second electronic device 32. The first distributed control unit 311 also controls the first application 310 using the first control method when the first application 310 is in the foreground. The first distributed control unit 311 also controls the first application 310 using the fifth control method when the first application 310 is in the background.
[0082] In some embodiments, in a distributed scenario, when the second electronic device 32 goes offline, all associations related to the second electronic device 32 will be deleted, and this application does not impose any restrictions on this.
[0083] It is understood that in a distributed scenario, the second soft bus 322 may also detect that the first electronic device 31 is offline. In this case, the second electronic device's control process for the second application is similar to the first electronic device's control process for the first application, and will not be further described here. It is understood that in a distributed scenario, when the first electronic device 31 goes offline, the association with the first electronic device 32 will be deleted, and this application does not impose any restrictions on this.
[0084] Please also refer to Figure 8 , the first distributed control unit 311 may include a first distributed scheduling module 313 and a first control module 314. The first distributed scheduling module 313 is used to implement the call startup of the cross-device application and report information to the first control module 314. The first control module 314 is used to control the resources used by the first application 310. In different systems, the first control module 314 may be different. For example, in In the system, the first control module 314 can be AMS (Activity Manager Service). AMS refers to the Activity Management Service, a key system service in the Android platform. In the Hongmeng system, the first control module 314 can be the iAware module. iAware is a security protection detection program.
[0085] The first application 310 of the first electronic device 31 sends a distributed scheduling request or information to the second electronic device 32 through the first distributed scheduling module 313. The information may be information about the switching of the foreground and background running states of the first application 310, or information about the termination of the first application 310.
[0086] The first electronic device 31 controls resources used by the first application 310 through the first control module 314. For example, the first application 310 may be controlled using a first control method, controlled using a second control method, kept alive using a third control method, kept alive using a fourth control method, or controlled using a fifth control method.
[0087] The first electronic device 31 receives the call result through the first distributed scheduling module 313 and reports the call result to the first control module 314. The first electronic device 31 establishes a first association relationship based on the reported call result through the first control module 314.
[0088] The first electronic device 31 reports information that the first application 310 has switched to the background running state to the first control module 314 through the first distributed scheduling module 313. The first electronic device 31 updates the first association relationship to the second association relationship based on the reported information that the first application 310 has switched to the background running state through the first control module 314.
[0089] The first electronic device 31 reports the termination information of the first application 310 to the first control module 314 through the first distributed scheduling module 313. The first electronic device 31 deletes the second association relationship according to the reported termination information of the first application 310 through the first control module 314.
[0090] The first electronic device 31 reports the offline information of the second electronic device 32 to the first control module 314 through the first distributed scheduling module 313. The first electronic device 31 deletes the association relationship with the second electronic device 32 according to the reported offline information of the second electronic device 32 through the first control module 314.
[0091] It is understandable that the first application 310 can also switch from a background running state to a foreground running state, and this application does not impose any restrictions on this.
[0092] It is understandable that the second distributed control unit 312 may include a second distributed scheduling module and a second control module, which is not limited in this application.
[0093] refer to Figure 9-12 , is a flow chart of the resource control method provided in the embodiment of this application. The resource control method can be applied to distributed game scenarios. In distributed game scenarios, such as Figure 13As shown, the first electronic device 1301 may be a mobile phone, and the second electronic device 1302 may be a large-screen device, such as a monitor, a TV, etc. The first application installed in the first electronic device 1301 and the second application installed in the second electronic device 1302 may be game applications. For example, a game application A1 is installed in the first electronic device 1301, and a game application A2 is installed in the second electronic device 1302. The game application A1 of the first electronic device 1301 can call the game application A2 of the second electronic device 1302 and communicate with the game application A2 of the second electronic device 1302. Thus, the first electronic device 1301 can control the game application A2 of the second electronic device 1302 by virtualizing the game application A1 as a remote control. It can be understood that Figure 13 This is an example of a distributed game scenario. The number of first electronic devices 1301 can be other numbers, such as two, and the interfaces displayed by the first electronic device 1301 and the second electronic device 1302 can also be other interfaces. This application does not impose any restrictions on this.
[0094] Resource management methods may include:
[0095] S901: The first electronic device and the second electronic device are networked and establish a distributed network.
[0096] In some embodiments, the first electronic device can establish a network with the second electronic device by scanning a QR code on the second electronic device. The distributed network can be a mesh network, a Bluetooth network, a Wi-Fi network, etc., and this application does not limit this. It is understood that the first electronic device and the second electronic device can also establish a network in other ways, and this application does not limit this.
[0097] In some embodiments, when a first electronic device and a second electronic device are successfully networked, the soft bus of the first electronic device and the soft bus of the second electronic device may assign corresponding device IDs to the first electronic device and the second electronic device, respectively, according to a preset device ID generation rule. In some embodiments, after the first electronic device and the second electronic device are successfully networked, the second electronic device sends an online message to the first electronic device. The online message includes the device ID of the second electronic device.
[0098] S902: The first electronic device receives an instruction to start the game application A1, and starts the game application A1 according to the instruction to start the game application A1.
[0099] When a user wants to play a game on a second electronic device through a first electronic device, the user can operate the application icon of game application A1 displayed on the first electronic device, thereby generating an instruction to launch game application A1. In response to the instruction to launch game application A1, the first electronic device launches game application A1 and displays the interface of game application A1. Generally, applications with a visual display interface can have corresponding application icons, while applications without a visual display interface do not have corresponding application icons.
[0100] In some embodiments, after the game application A1 is started, the first electronic device may use a first control method to control the game application A1. The first control method is a common foreground control method.
[0101] After the above networking and starting the game application A1, the following description of the resource management and control used by the game application A1 when calling the game application A2 can be performed:
[0102] S903: When the game application A1 on the first electronic device initiates distributed scheduling of the game application A2 on the second electronic device, the game application A1 on the first electronic device outputs a distributed scheduling request to the second electronic device.
[0103] In some embodiments, when a user wants to control a game application A2 on a second electronic device through a game application A1 on a first electronic device, the user can operate the scheduling function displayed in the interface of the game application A1 that is running in the foreground on the first electronic device. In response to the operation of the scheduling function, the game application A1 on the first electronic device initiates a distributed scheduling of the game application A2 on the second electronic device. The distributed scheduling request includes the device ID of the first electronic device and the device ID of the second electronic device, which is not limited in this application. In some embodiments, the game application A1 of the first electronic device can transmit the distributed scheduling request to the second soft bus of the second electronic device through the first distributed scheduling module and the first soft bus. The second soft bus of the second electronic device can transmit the distributed scheduling request to the game application A2 through the second distributed scheduling module, so that the game application A2 can respond or not respond to the distributed scheduling initiated by the game application A1, so that the game application A1 can call or not call the game application A2.
[0104] In some embodiments, when transmitting a distributed scheduling request, the first distributed scheduling module may further serialize the distributed scheduling request and then send it to the first soft bus. Serializing the distributed scheduling request may be a process of converting state information of the distributed scheduling request into a form that can be stored or transmitted. During serialization of the distributed scheduling request, the current state of the distributed scheduling request may be written to a temporary or persistent storage area. Thereafter, the distributed scheduling request may be recreated by reading or deserializing the state of the object from the storage area.
[0105] In some embodiments, when transmitting a distributed scheduling request, the second distributed scheduling module may parse the serialized distributed scheduling request and then send the parsed distributed scheduling request to the game application A2. Parsing the serialized distributed scheduling request is a deserialization process, thereby recreating the distributed scheduling request.
[0106] S904: The second electronic device detects that the game application A1 calls the game application A2.
[0107] In some embodiments, the second distributed scheduling module of the second electronic device detects whether game application A1 calls game application A2 based on the return value of the distributed scheduling. For example, when the return value of the distributed scheduling is OK, the second distributed scheduling module detects that game application A1 calls game application A2. Otherwise, the second distributed scheduling module detects that game application A1 does not call game application A2.
[0108] In some embodiments, when game application A1 does not call game application A2, the process ends, and this application does not impose any restrictions on this.
[0109] S905: The second electronic device returns the call result to the first electronic device.
[0110] In some embodiments, the second distributed scheduling module of the second electronic device returns the call result to the first soft bus of the first electronic device via the second soft bus. The first soft bus of the first electronic device transmits the call result to the first control module via the first distributed scheduling module.
[0111] In some embodiments, the result of the call includes basic information of game application A1, running status information (status) of game application A1, device ID (device ID) of the first electronic device, basic information of game application A2, running status information of game application A2 and device ID of the second electronic device, etc. This application does not impose any restrictions on this.
[0112] In some embodiments, the basic information may be a package name, application identifier (UID), and process identifier (PID), which is not limited in this application. The basic information can uniquely identify the running application. The running status information can be the foreground running status or the background running status. In some embodiments, when game application A1 calls game application A2, the running status information of game application A1 is the foreground running status, and the running status information of game application A2 is the foreground running status.
[0113] In some embodiments, the second soft bus sends the result of the call to the first soft bus of the first electronic device through the distributed network.
[0114] In some embodiments, the second distributed scheduling module also serializes the result of the call before returning the result of the call to the first soft bus of the first electronic device, so that after receiving the serialized result of the call, the first distributed scheduling module also parses the serialized result of the call to recreate the result of the call. This application does not impose any restrictions on this.
[0115] S906: The first electronic device establishes a first association relationship between the game application A1 and the game application A2 according to the call result.
[0116] In some embodiments, the first management and control module of the first electronic device establishes a first association relationship between the game application A1 and the game application A2 according to the call result.
[0117] In some embodiments, the first electronic device further stores the first association relationship. In some embodiments, the first management and control module of the first electronic device further stores the first association relationship.
[0118] In some embodiments, the first association relationship includes basic information of game application A1, running status information of game application A1, device ID of the first electronic device, basic information of game application A2, running status information of game application A2, and device ID of the second electronic device. For example, the basic information of game application A1 is package name 1, UID 1 and PID 1, the device ID of the first electronic device is device ID 1, the basic information of game application A2 is package name 2, UID 2 and PID 2, and the device ID of the second electronic device is device ID 2. Then the first association relationship is: package name 1, UID 1, PID 1, foreground running status, device ID 1; package name 2, UID 2, PID 2, foreground running status, device ID 2.
[0119] S907: The first electronic device controls the game application A1 using the second control method according to the first association relationship.
[0120] In some embodiments, the first control module of the first electronic device controls the game application A1 using the second control method according to the first association relationship.
[0121] In some embodiments, the degree of resource control by the second control method may be less than the degree of resource control by the first control method. Controlling the game application A1 using the second control method may be to increase the priority of the process of the game application A1, the lock priority, or to increase the frequency of at least one of the central processing unit (CPU), graphics processing unit (GPU), and double-rate synchronous dynamic random access memory (DDR) to process the game application A1, etc. Among them, the lock priority represents that the process of the game application A1 competes for the lock first. Controlling the game application A1 using the second control method may also be to migrate the process of the game application A1 from the first processor of the first electronic device to the second processor of the first electronic device, etc., where the operating speed of the second processor is higher than the operating speed of the first processor, and this application is not limited to this. Thus, in a distributed game scenario, sufficient resources can be provided for the game application A1 running in the distributed foreground, the running speed of the game application A1 can be increased, the jamming of the game application A1 when multiple applications are running at the same time is avoided, and the user's performance experience is improved.
[0122] In some other embodiments, the degree of resource control in the second control method may be equal to that in the first control method. Then, the resources used by the game application A1 in the foreground in the distributed game scenario are the same as those used in the non-distributed scenario.
[0123] S908: The second electronic device establishes a third association relationship between the game application A1 and the game application A2 according to the call result.
[0124] In some embodiments, the second distributed scheduling module of the second electronic device reports the call result to the second control module. The second control module establishes a third association relationship between the game application A1 and the game application A2 according to the call result.
[0125] The process of the second control module establishing the third association relationship between game application A1 and game application A2 based on the call result is similar to the process of the first control module establishing the first association relationship between game application A1 and game application A2 based on the reported call result, and will not be repeated here.
[0126] In some embodiments, the second electronic device further stores a third association relationship. In some embodiments, the second control module of the second electronic device further stores a third association relationship.
[0127] S909: The second electronic device controls the game application A2 using the second control method according to the third association relationship.
[0128] In some embodiments, the second control module of the second electronic device controls the game application A2 using a second control method according to the third association relationship.
[0129] In some embodiments, the second control method can be used to control the game application A2 by increasing the priority of the game application A2 process, the lock priority, or increasing the frequency of at least one of the central processing unit (CPU), graphics processing unit (GPU), and double-rate synchronous dynamic random access memory (DDR) to process the game application A2, etc. Among them, the lock priority represents that the process of the game application A2 competes for the lock first. The second control method can also be used to control the game application A2 by migrating the process of the game application A2 from the first processor of the first electronic device to the second processor of the first electronic device, and the operating speed of the second processor is higher than the operating speed of the first processor. This is not limited in this application. Thus, in a distributed game scenario, sufficient resources can be provided for the game application A2 running in the distributed foreground, the running speed of the game application A2 can be increased, the jamming of the game application A2 when multiple applications are running at the same time is avoided, and the user's performance experience is improved.
[0130] In some other embodiments, the resources used by the game application A2 in the foreground running state in the distributed game scenario are the same as the resources used in the non-distributed scenario.
[0131] In some embodiments, when the game application A1 of the first electronic device switches from the foreground running state to the background running state, the existing electronic device may clear the game application A1. Figure 10 , the embodiment of the present application also provides another resource management method, which may include:
[0132] S1001: When the game application A1 on the first electronic device switches from the foreground running state to the background running state, the first electronic device outputs information indicating that the game application A1 has switched to the background running state to the second electronic device.
[0133] In some embodiments, when a user wishes to switch game application A1 from a foreground state to a background state, the user may perform a first predetermined operation, such as swiping upward from the bottom edge of the screen of the first electronic device on the interface of game application A1. In response to the first predetermined operation, game application A1 is switched to a background state. It is understood that other methods may be used to switch game application A1 from a foreground state to a background state, and this application does not limit this.
[0134] In some embodiments, game application A1 outputs information that game application A1 has switched to a background running state to a second soft bus of a second electronic device via the first distributed scheduling module and the first soft bus. The second soft bus of the second electronic device can transmit information that game application A1 has switched to a background running state to a second control module via the second distributed scheduling module.
[0135] In some embodiments, when transmitting the information that the game application A1 switches to the background running state, the first distributed scheduling module may serialize the information that the game application A1 switches to the background running state and then send it to the first soft bus. In some embodiments, serializing the information that the game application A1 switches to the background running state is a process of converting the state information of the information that the game application A1 switches to the background running state into a form that can be stored or transmitted. During the serialization of the information that the game application A1 switches to the background running state, the current state of the information that the game application A1 switches to the background running state can be written to a temporary or persistent storage area. Thereafter, the information that the game application A1 switches to the background running state can be recreated by reading or deserializing the state of the information that the game application A1 switches to the background running state from the storage area.
[0136] In some embodiments, when transmitting information indicating that game application A1 has switched to the background running state, the second distributed scheduling module may parse the serialized information indicating that game application A1 has switched to the background running state, and report the parsed information indicating that game application A1 has switched to the background running state to the second control module. Parsing the serialized distributed scheduling request is a deserialization process, thereby recreating the information indicating that game application A1 has switched to the background running state.
[0137] S1002: The second electronic device updates the third association relationship to a fourth association relationship according to the information that the game application A1 switches to the background running state.
[0138] In some embodiments, the second control module of the second electronic device updates the third association to a fourth association based on the information that game application A1 has switched to the background running state. In some embodiments, the second control module searches for a third association that matches game application A1 based on the information that game application A1 has switched to the background running state, and updates the running state information of game application A1 in the third association to the background running state based on the information that game application A1 has switched to the background running state, thereby updating the third association to the fourth association. In some embodiments, the second control module searches for a third association that matches game application A1 based on the package name, UID, and PID. Continuing with the above example of the basic information of game applications A1 and A2, the fourth association may be, for example: Package name 1, UID 1, PID 1, background running state, device ID 1; Package name 2, UID 2, PID 2, foreground running state, device ID 2.
[0139] In some embodiments, the second electronic device further stores a fourth association relationship. In some embodiments, the second management and control module of the second electronic device further stores a fourth association relationship.
[0140] S1003: The second electronic device controls the game application A2 using a second control method according to the fourth association relationship.
[0141] In some embodiments, the second control module of the second electronic device uses the second control method to control the game application A2 based on the fourth association relationship. In some embodiments, in the fourth association relationship, the game application A1 is in the background running state, and the game application A2 is in the foreground running state. At this time, the game application A1 of the first electronic device and the game application A2 of the second electronic device still have a distributed association relationship, and the game application A2 can be controlled by the second control module using the second control method. Thus, sufficient resources can be provided for the distributed foreground running game application A2, the running speed of the game application A2 can be improved, and the jamming of the game application A2 when multiple applications are running at the same time can be avoided, thereby improving the user's performance experience.
[0142] S1004: The first electronic device updates the first association relationship to a second association relationship according to the information that the game application A1 switches to the background running state.
[0143] In some embodiments, the first distributed scheduling module of the first electronic device reports information that the game application A1 switches to the background running state to the first control module. The first control module updates the first association relationship to the second association relationship based on the information that the game application A1 switches to the background running state.
[0144] It can be understood that in a distributed gaming scenario, as long as the second electronic device is not offline, the data transmission channel formed between the first soft bus of the first electronic device and the second soft bus of the second electronic device will not be disconnected, then the information output by the game application A1 that the game application A1 switches to the background running state can be transmitted to the second electronic device, and at this time, the second electronic device does not need to return the transmission result to the first distributed scheduling module of the first electronic device.
[0145] In some embodiments, the process by which the first control module updates the first association relationship to the second association relationship based on the information that game application A1 switches to the background running state is similar to the process by which the second control module updates the third association relationship to the fourth association relationship based on the information that game application A1 switches to the background running state, and is not further described here. In some embodiments, the first control module further stores the second association relationship.
[0146] S1005: The first electronic device keeps the game application A1 active according to the second association relationship.
[0147] In some embodiments, the first control module of the first electronic device keeps game application A1 alive based on a second association relationship. In this second association relationship, game application A1 is running in the background, and game application A2 is running in the foreground. At this point, since game application A1 of the first electronic device and game application A2 of the second electronic device still have a distributed association relationship, and game application A1 is a program that the user may reactivate, the first control module may keep game application A1 alive.
[0148] In some embodiments, the first control module uses a third control method to keep game application A1 alive based on the second association relationship. In some embodiments, the third control method can control the resource to the same degree as the first control method, and the first control module allows game application A1 to use the resource normally.
[0149] In some other embodiments, the third control method may provide a greater degree of resource control than the first control method. Using the third control method to keep game application A1 alive may involve increasing the priority of the game application A1 process, or placing the game application A1 process at the end of a list of killable processes. Thus, when game application A1 is in the background, it can be kept alive, preventing the system from clearing the background game application A1. When the user subsequently needs to continue playing the game, they can directly switch game application A1 from the background to the foreground, eliminating the need to re-run the code scanning, networking, and call processes.
[0150] refer to Figure 11 In some embodiments, the resource management method may further include:
[0151] S1101: When the game application A1 on the first electronic device ends, the first electronic device monitors that the game application A1 ends.
[0152] In some embodiments, when the user wants to close the game application A1 running in the background, the user can use the second preset operation, such as sliding upward from the bottom edge of the screen of the first electronic device to the middle of the screen on the main interface. In response to the second preset operation, the first electronic device enters the multitasking interface. The multitasking interface can at least display task thumbnails of running applications. In the multitasking interface, the user can press and hold the task thumbnail of the game application A1 and slide upward to exit the game application A1 and put it in a non-running state. It is understandable that the game application A1 can also exit in other ways, and this application does not limit this.
[0153] In some embodiments, the first distributed scheduling module of the first electronic device can monitor the end of the game application A1. The first distributed scheduling module can monitor the end of the first application program through the Binder object death notification mechanism, which is not limited in this application.
[0154] In some embodiments, the Binder proxy object may register with the Binder driver to receive a death notification for the game application A1 referenced by the Binder proxy object. Before registering with the Binder driver to receive a death notification for the game application A1 referenced by the Binder proxy object, the Binder proxy object may first define the first distributed scheduling module as the death notification recipient. When the Binder proxy object monitors the end of the referenced game application A1, the Binder driver may send a death notification for the game application A1 to the first distributed scheduling module. Thus, the first distributed scheduling module can monitor the end of the game application A1.
[0155] S1102: The first electronic device outputs information indicating that the game application A1 has ended to the second electronic device.
[0156] In some embodiments, the first distributed scheduling module of the first electronic device transmits the information that the game application A1 has ended to the second soft bus of the second electronic device via the first soft bus. The second soft bus of the second electronic device can transmit the information that the game application A1 has ended to the second control module via the second distributed scheduling module.
[0157] In some embodiments, when transmitting the message indicating the end of game application A1, the first distributed scheduling module may serialize the information indicating the end of game application A1 and then send it to the first soft bus. In some embodiments, serializing the information indicating the end of game application A1 is the process of converting the information indicating the end of game application A1 into a form that can be stored or transmitted. During the serialization of the information indicating the end of game application A1, the current state of the information indicating the end of game application A1 may be written to a temporary or persistent storage area. Thereafter, the information indicating the end of game application A1 can be recreated by reading or deserializing the state of the object from the storage area.
[0158] In some embodiments, when transmitting a distributed scheduling request, the second distributed scheduling module may parse the serialized information indicating the end of game application A1 and then report the parsed information indicating the end of game application A1 to the second control module. Parsing the serialized information indicating the end of game application A1 is a deserialization process, thereby recreating the information indicating the end of game application A1.
[0159] S1103: The second electronic device deletes the fourth association relationship according to the information that the game application A1 is terminated.
[0160] In some embodiments, the second control module of the second electronic device deletes the fourth association based on the information that game application A1 has terminated. In some embodiments, the second control module searches for a matching fourth association based on the information that game application A1 has terminated, and deletes the fourth association. In some embodiments, the second control module searches for a matching fourth association based on the package name, UID, and PID.
[0161] S1104: The second electronic device controls the game application A2 using the first control method.
[0162] In some embodiments, the second control module of the second electronic device controls game application A2 using the first control method. In some embodiments, if the fourth association relationship does not exist within the second electronic device, game application A2 and game application A1 are no longer associated, and game application A2, which is currently running in the foreground, is no longer in a distributed scenario. In this case, normal foreground resource control can be performed directly on game application A2.
[0163] S1105: The first electronic device deletes the second association relationship according to the information that the game application A1 is terminated.
[0164] In some embodiments, the first distributed scheduling module of the first electronic device reports the end information of the game application A1 to the first control module. The first control module deletes the second association relationship according to the end information of the game application A1.
[0165] In some embodiments, the first control module searches for a second association that matches game application A1 based on the information indicating the game application A1 has terminated, and deletes the second association. In some embodiments, the first control module searches for a second association that matches game application A1 based on the package name, UID, and PID. Consequently, the second association no longer exists within the first electronic device. Subsequently, when game application A1 is restarted, the first control module will directly control game application A1 using the first control method.
[0166] refer to Figure 12 In some embodiments, the resource management method may further include:
[0167] S1201: When the first electronic device detects that the second electronic device is offline, the first electronic device deletes the association relationship with the second electronic device.
[0168] In some embodiments, a first electronic device can detect that a second electronic device has gone offline via a first soft bus of the first electronic device. When the first soft bus detects that the second electronic device has gone offline, the first soft bus can output the information about the second electronic device going offline to a first control module via a first distributed scheduling module. The first control module deletes the association with the second electronic device based on the information about the second electronic device going offline.
[0169] In some embodiments, a first soft bus of a first electronic device periodically sends heartbeat packets to a second soft bus of a second electronic device. If the first soft bus does not receive a response packet within a preset time, the first soft bus detects that the second electronic device has gone offline. It is understood that the first soft bus may detect that the second electronic device has gone offline in other ways, which are not limited by this application.
[0170] In some embodiments, the first control module may search for an association relationship matching the second electronic device based on the information that the second electronic device is offline, and delete the matching association relationship.
[0171] S1202: The first electronic device controls the game application A1 using the fifth control method.
[0172] In some embodiments, the first control template of the first electronic device controls game application A1 using the fifth control method. In some embodiments, if the first electronic device does not have an association relationship with the second electronic device, game application A2 and game application A1 are no longer associated, and game application A2, which is running in the background, is no longer in a distributed scenario. Game application A1 can be controlled using the fifth control method, thereby reducing resource consumption and power consumption of the first electronic device.
[0173] In some embodiments, the fifth control method can provide a greater degree of resource control than the third control method. The fifth control method can be to restrict application resource usage. In some embodiments, the fifth control method can be used to control game application A1 by lowering the priority of the game application A1 process, freezing game application A1 when system memory falls below a preset memory value, or clearing game application A1 when system memory falls below a preset memory value.
[0174] It is understandable that step S907 and step S909 can be omitted, and this application does not impose any restrictions on this.
[0175] It is understood that game application A1 on the first electronic device may also switch from a background running state to a foreground running state. In this case, the transmission process of the information of game application A1 switching to the foreground running state and the updating process of the association relationship are similar to the above-mentioned steps S1001-S1002 and step S1004, respectively. The control process of the first control module and the second control module are similar to the above-mentioned steps S907 and S909, and will not be repeated here.
[0176] It is understandable that steps S908-S909 may be performed before step S905, or steps S908-S909 may be performed simultaneously with step S905, and this application does not impose any restrictions on this.
[0177] It can be understood that when the game application A1 on the first electronic device switches from the foreground running state to the background running state, steps S1004-S1005 can be executed first, and then the first electronic device outputs the information that the game application A1 switches to the background running state to the second electronic device; or steps S1004-S1005 and the first electronic device outputs the information that the game application A1 switches to the background running state to the second electronic device are executed simultaneously, and this application does not impose any restrictions on this.
[0178] It is understandable that step S1105 may be performed before step S1102, or step S1105 may be performed simultaneously with step S1102, and this application does not impose any restrictions on this.
[0179] Understandable, Figure 9-12 The resource management method shown can be applied not only to distributed game scenarios, but also to distributed computing scenarios. In distributed computing scenarios, Figure 14As shown, the first electronic device 1401 may be a smart watch, and the second electronic device 1402 may be a mobile phone. The first application installed in the first electronic device 1401 and the second application installed in the second electronic device 1402 may be computing applications. For example, a computing application C1 is installed in the first electronic device 1401, and a computing application C2 is installed in the second electronic device 1402. The computing application C1 of the first electronic device 1401 can call the computing application C2 of the second electronic device 1402, and communicate with the computing application C2 of the second electronic device 1402. Thus, the first electronic device 1401 can send computing tasks to the second electronic device 1402 for computing, thereby transferring computing requirements with higher energy consumption to the second electronic device 1402 for processing. It can be understood that Figure 14 This is an example of a distributed computing scenario. The interfaces displayed by the first electronic device 1401 and the second electronic device 1402 may also be other interfaces, and this application does not limit this.
[0180] The resource control method used in distributed computing scenarios is similar to that used in distributed gaming scenarios, with the following differences:
[0181] In a distributed computing scenario, computing application C1 calls computing application C2. When computing application C1 on a first electronic device calls computing application C2 on a second electronic device, computing application C1 is in the foreground and computing application C2 is in the background. In this case, the running status information for computing application C1 in both the first and third associations is foreground, while the running status information for computing application C2 is background. The first control module of the first electronic device uses the second control method to control computing application C1 based on the first association, and the second control module of the second electronic device uses the third control method to keep computing application C2 alive based on the third association.
[0182] When computing application C1 switches from a foreground running state to a background running state, the running state information of computing application C1 in both the second and fourth associations indicates a background running state, and the running state information of computing application C2 also indicates a background running state. The first control module of the first electronic device uses the fourth control method to keep computing application C1 alive based on the second association, and the second control module of the second electronic device uses the fourth control method to keep computing application C2 alive based on the fourth association. The fourth control method may provide a greater degree of resource control than the third control method, but less than the fifth control method. For example, using the fourth control method to keep computing application C1 alive may include keeping computing application C1 alive for a predetermined time (e.g., 3 minutes). That is, the priority of the computing application C1 process may be increased within the predetermined time, or the computing application C1 process may be placed at the end of a list of killable processes. In some embodiments, using the fourth control method to keep computing application C1 alive may also include further lowering the priority of the computing application C1 process compared to the third control method, etc., and this application is not limited to this.
[0183] When the computing application C1 ends, the second control module controls the computing application C2 using the fifth control method, which is not limited in this application.
[0184] It is understood that the computing application C1 on the first electronic device may also switch from a background running state to a foreground running state. When the computing application C1 switches to the foreground running state, the first control module uses the second control method to perform resource control on the computing application C1, and the second control module uses the third control method to keep the computing application C2 alive. This application does not impose any restrictions on this.
[0185] Understandable, Figure 9-12 The resource management method shown can also be applied to other distributed scenarios, and this application does not limit this.
[0186] Figure 15 This is a flowchart of another resource management method provided in an embodiment of the present application. The method includes:
[0187] S1501: The first electronic device displays an interface of a first application.
[0188] S1502: The first electronic device calls the second application of the associated second electronic device in response to the operation on the first application, and establishes a first association relationship between the first application and the second application; the first association relationship includes the first application being in the foreground running state.
[0189] S1503: When the first application is switched from the foreground running state to the background running state, the first electronic device updates the first association relationship to a second association relationship; the second association relationship includes that the first application is in the background running state.
[0190] S1504: According to the second association relationship, the first electronic device keeps the first application program active.
[0191] In some embodiments, before the first electronic device calls the second application of the associated second electronic device in response to an operation on the first application, the method also includes: the first electronic device uses a first control method to control the first application; when the first application switches from a foreground running state to a background running state, before the first electronic device updates the first association relationship to a second association relationship, the method also includes: the first electronic device uses a second control method to control the first application, and the degree of control of resources by the second control method is less than the degree of control of resources by the first control method.
[0192] In some embodiments, based on the second association relationship, the first electronic device keeps the first application active, including: when the second application is in the foreground running state, the first electronic device uses a third control method to keep the first application active, and the degree of control of resources by the third control method is greater than the degree of control of resources by the first control method.
[0193] In some embodiments, based on the second association relationship, the first electronic device keeping the first application active also includes: when the second application is in the background running state, the first electronic device uses a fourth control method to keep the first application active, and the fourth control method has a greater degree of control over resources than the third control method.
[0194] In some embodiments, when the first electronic device receives a message from the second electronic device indicating the end of the second application, or when the first electronic device detects that the second electronic device is offline, the first electronic device deletes the second association relationship and uses the fifth control method to control the first application. The degree of control of resources by the fifth control method is greater than the degree of control of resources by the fourth control method.
[0195] In some embodiments, using the second control method to control the first application includes: increasing the priority of the process of the first application; or, locking the priority; or, increasing the frequency of at least one of the central processing unit, graphics processing unit, and double-rate synchronous dynamic random access memory to process the first application.
[0196] In some embodiments, using the third control method to keep the first application alive includes: increasing the priority of the process of the first application; or placing the process of the first application at the end of the list of killable processes.
[0197] In some embodiments, keeping the first application alive using the fourth control method includes keeping the first application alive for a preset time. In some embodiments, controlling the first application using the fifth control method includes lowering the priority of the first application's process; freezing the first application when system memory falls below a preset memory value; or clearing the first application when system memory falls below a preset memory value.
[0198] In some embodiments, the method further includes: when the first electronic device monitors that the first application ends, the first electronic device deletes the second association relationship.
[0199] In some embodiments, establishing the first association relationship between the first application and the second application includes: receiving a result of a call sent by the second electronic device; and establishing the first association relationship between the first application and the second application according to the result.
[0200] In addition to the above methods and devices, the present application also provides a computer-readable storage medium, which stores a program that enables the electronic device to implement Figure 15 The method shown.
[0201] A computer program product includes computer-executable instructions stored in a computer-readable storage medium; at least one processor of an electronic device can read the computer-executable instructions from the computer-readable storage medium, and at least one processor executes the computer-executable instructions so that the electronic device performs Figure 15 The method shown.
[0202] In this case, the interface of the first application is displayed on the first electronic device, and in response to the operation of the first application, the second application of the associated second electronic device is called and a first association relationship between the first application and the second application is established. When the first application switches from the foreground running state to the background running state, the first association relationship is updated to the second association relationship, and the first application is kept alive according to the second association relationship, thereby avoiding the situation where the distributed application is cleared when running in the background in a distributed scenario.
[0203] Through the description of the above embodiments, it is clear to those skilled in the art that the present application can be implemented by means of software plus necessary general-purpose hardware, and of course it can also be implemented by means of dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits, or dedicated circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0204] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0205] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, a computer, a server or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. Available media can be magnetic media, (such as floppy disk, hard disk, tape), optical media (such as DVD) or semiconductor media (such as solid-state drive (SSD)) etc.
[0206] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A resource management method, characterized in that: The method comprises: The first electronic device displays an interface of a first application; The first electronic device, in response to an operation on the first application, calls a second application of an associated second electronic device and establishes a first association relationship between the first application and the second application; the first association relationship includes the first application being in a foreground running state; When the first application switches from the foreground running state to the background running state, the first electronic device updates the first association relationship to a second association relationship; the second association relationship includes that the first application is in the background running state; According to the second association relationship, the first electronic device keeps the first application program active.
2. The method according to claim 1, wherein Before the first electronic device calls a second application of an associated second electronic device in response to an operation on the first application, the method further includes: The first electronic device controls the first application using a first control method; Before the first electronic device updates the first association relationship to a second association relationship when the first application switches from the foreground running state to the background running state, the method further includes: The first electronic device controls the first application program using a second control method, where the second control method controls resources to a lesser degree than the first control method controls the resources.
3. The method according to claim 2, wherein The first electronic device keeping the first application active according to the second association relationship includes: When the second application is in the foreground running state, the first electronic device uses a third control method to keep the first application alive, and the degree of control of the resources by the third control method is greater than the degree of control of the resources by the first control method.
4. The method according to claim 3, wherein The step of keeping the first application program active by the first electronic device according to the second association relationship further includes: When the second application is in the background running state, the first electronic device uses a fourth control method to keep the first application active, and the degree of control of the resources by the fourth control method is greater than the degree of control of the resources by the third control method.
5. The method according to claim 4, wherein The method further comprises: When the first electronic device receives a message indicating the end of the second application sent by the second electronic device, or when the first electronic device detects that the second electronic device is offline, the first electronic device deletes the second association relationship and uses the fifth control method to control the first application. The degree of control of the resources by the fifth control method is greater than the degree of control of the resources by the fourth control method.
6. The method according to any one of claims 2 to 5, characterized in that The adopting the second control method to control the first application includes: increasing the priority of the process of the first application; Alternatively, lock priority; Alternatively, the frequency of at least one of the central processing unit, the graphics processing unit, and the double data rate synchronous dynamic random access memory is increased to process the first application.
7. The method according to any one of claims 3 to 5, characterized in that The adopting the third control method to keep the first application alive includes: increasing the priority of the process of the first application; Alternatively, the process of the first application is placed at the end of the killable process list.
8. The method according to any one of claims 4 to 5, characterized in that The adopting the fourth control method to keep the first application alive includes: The first application is kept active within a preset time.
9. The method according to claim 5, wherein The fifth control method for controlling the first application includes: Lowering the priority of the process of the first application; Alternatively, freezing the first application when the system memory is lower than a preset memory value; Alternatively, the first application is cleared when the system memory is lower than the preset memory value.
10. The method according to any one of claims 1 to 5, characterized in that The method further comprises: When the first electronic device monitors that the first application ends, the first electronic device deletes the second association relationship.
11. The method according to any one of claims 1 to 5, characterized in that The establishing of a first association relationship between the first application and the second application includes: receiving a result of the call sent by the second electronic device; The first association relationship between the first application and the second application is established according to the result.
12. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store program instructions, and when the processor calls the program instructions, it implements the resource management method according to any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, and the program enables the electronic device to implement the resource management method according to any one of claims 1 to 11.
14. A computer program product, characterized in that The computer program product includes computer execution instructions, which are stored in a computer-readable storage medium; at least one processor of an electronic device can read the computer execution instructions from the computer-readable storage medium, and the at least one processor executes the computer execution instructions so that the electronic device executes the resource management method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Resource management and control method and equipment
CN110806926A
Control method and control device
CN113220365A