Application of keep-alive methods, electronic devices and storage media

By establishing a collaborative relationship between the first and second applications and extending the lifespan of the first application using unique identifiers and subscription lists, the problem of collaborative functionality being affected by the operating system forcibly killing applications is solved, thereby improving user experience and reducing device power consumption.

CN115328566BActive Publication Date: 2025-11-14HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110449195.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-25
Publication Date
2025-11-14
Estimated Expiration
2041-04-25

AI Technical Summary

Technical Problem

When the operating system of the first device forcibly kills the first application during the application collaboration process, the collaboration function between the first application and the second application is affected, impacting the user experience. Furthermore, existing technologies that extend the application's lifespan through heartbeat relationships increase device power consumption.

Method used

By establishing a collaborative relationship between the first and second applications, and utilizing unique identifiers and subscription lists, the lifespan of the first application is extended, preventing the operating system from forcibly killing it. This includes generating unique identifiers, sending subscription requests, adding identification information to the subscription list, and the operating system querying the subscription list to extend the application's lifespan.

Benefits of technology

It effectively avoids the impact of application collaboration functions, improves the user experience, and reduces device power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115328566B_ABST
    Figure CN115328566B_ABST
Patent Text Reader

Abstract

This application provides an application keep-alive method, an electronic device, and a storage medium, relating to the field of electronic devices. The method can be applied to a first device, which includes a first application. The method includes: when the first application detects that a second application has obtained first information from the first application, creating a first object and generating a unique identifier for the first object, which is then sent to the second application. The first application receives a subscription request from the second application based on the unique identifier of the first object. Based on the subscription request, the first application adds the identification information of the second application to the subscription list of the first object. When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, it first queries the subscription list of the first object; if the subscription list of the first object includes the identification information of the second application, the lifespan of the first application is extended. This method can extend the lifespan of the first application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic devices, and more particularly to an application keep-alive method, electronic device, and storage medium. Background Technology

[0002] App collaboration refers to the ability of two applications (Apps) to work together to provide services to the user, enriching the user experience. An application can be simply called an app. For example, a first device has an app installed, and a second device has an app installed. When the first and second devices are connected, the first and second apps can collaborate to provide services to the user. The user can view information from the first app on the first device through the second app on the second device.

[0003] During the process of the first and second applications working together to provide services to the user, the operating system of the first device may forcibly kill some applications running on the first device to free up system resources due to system resource limitations (insufficient system resources). When the applications killed by the first device include the first application (which can be referred to as the associated application of the application collaboration function), the application collaboration function between the first and second applications will be affected, impacting the user experience.

[0004] Currently, regarding the issue of the application collaboration function between the first and second applications being affected, one implementation involves the second application registering a death notification for the first application. When the first application is killed by the first device, the second application can receive the death notification and restart itself to continue the application collaboration function between the two applications. However, in this implementation, the second application only receives the death notification after the first application is killed, at which point the application collaboration function between the first and second applications is already affected.

[0005] In another implementation, a heartbeat relationship can be established between the first and second applications, with the second application periodically sending heartbeat information to the first application. If the operating system of the first device forcibly kills certain applications running on the first device to release system resources, and detects the periodic heartbeat information sent by the second application, the lifespan of the first application can be extended. While this implementation avoids affecting the application collaboration function between the first and second applications, it significantly increases the power consumption of both the first and second devices. Summary of the Invention

[0006] To address the aforementioned problems, embodiments of this application provide an application keep-alive method, an electronic device, and a storage medium. The technical solution of this application embodiment can be applied to scenarios where application collaboration functions are implemented between the first and second applications, extending the lifespan of the first application to prevent the application collaboration function between the first and second applications from being affected. Furthermore, the devices housing the first and second applications have low power consumption.

[0007] In a first aspect, embodiments of this application provide an application keep-alive method. The method is applied to a first device, which includes a first application. The first application and a second application have application collaboration functionality. The method includes: when the first application detects that the second application has acquired first information from the first application, the first application creates a first object and generates a unique identifier for the first object. The first application sends the unique identifier of the first object to the second application. The first application receives a subscription request sent by the second application based on the unique identifier of the first object, the subscription request including the identification information of the second application. Based on the subscription request, the first application adds the identification information of the second application to the subscription list of the first object. When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object includes the identification information of the second application, the operating system of the first device extends the lifespan of the first application.

[0008] In this embodiment of the application, when a user views the first information in the first application through the second application, if the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, the first device can first query the subscription list of the first object. If the subscription list of the first object includes the identification information of the second application, it indicates that there is a collaborative relationship between the first application and the second application. The first device can extend the lifespan of the first application to avoid affecting the application collaboration function between the first application and the second application.

[0009] As can be seen, this method can establish a collaborative relationship between the first and second applications in a simple way without requiring periodic heartbeats. Therefore, the power consumption of both the first and second devices can be lower. Furthermore, this method offers a better user experience compared to methods where the first application is killed and then restarted.

[0010] According to the first aspect, the operating system of the first device extends the lifespan of the first application by: the operating system of the first device raising the priority of the first application among all currently running applications in the first device by at least one priority, wherein the higher the priority, the longer the lifespan of the application.

[0011] Optionally, the operating system of the first device raises the priority of the first application among all currently running applications on the first device by at least one priority, including: the operating system of the first device raising the priority of the first application to the highest priority among all currently running applications on the first device.

[0012] According to the first aspect, or any implementation of the first aspect above, the subscription request is sent to the first application by the second application after verifying that the second application has permission to read the unique identifier of the first object.

[0013] In this embodiment, after the second application receives the unique identifier of the first object from the first application, it first verifies the unique identifier of the first object. After confirming that it has the permission to read the unique identifier of the first object, it then executes the subsequent steps (i.e., sends a subscription request), which can better protect user privacy.

[0014] According to the first aspect, or any implementation of the first aspect above, the first application adds the identification information of the second application to the subscription list of the first object according to the subscription request, including: the first application verifies whether the second application has the permission to subscribe to the first object; when the first application verifies that the second application has the permission to subscribe to the first object, the first application adds the identification information of the second application to the subscription list of the first object according to the subscription request.

[0015] In this embodiment, after receiving a subscription request from the second application, the first application first verifies the subscription request. Only after confirming that the second application has permission to subscribe to the first object will subsequent steps be executed, which can better protect user privacy.

[0016] In other words, since this application keep-alive method involves the application's runtime data, it can only be implemented after the user agrees and grants the corresponding permissions, in order to better protect user privacy.

[0017] According to the first aspect, or any implementation of the first aspect above, the method further includes: a first application receiving an unsubscribe request sent by a second application based on a unique identifier of a first object, the unsubscribe request including the identification information of the second application. The first application deletes the identification information of the second application from the subscription list of the first object based on the unsubscribe request. When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object does not include the identification information of the second application, then the operating system of the first device does not need to extend the lifespan of the first application.

[0018] According to the first aspect, or any implementation of the first aspect above, the unique identifier of the first object includes the device information of the first device, the application information of the first application, the object information of the first object, and the timestamp information when the first object was created.

[0019] It should be noted that this application does not impose any restrictions on the specific format of the unique identifier of the first object.

[0020] According to the first aspect, or any implementation of the first aspect above, the devices on which the first application and the second application reside are the same device or different devices.

[0021] For example, in one implementation, the second application may be installed on a second device, which is different from the first device.

[0022] In another embodiment, the second application may also be installed on the first device.

[0023] According to the first aspect, or any implementation of the first aspect above, the second application includes multiple third applications; the step of extending the lifespan of the first application by the operating system of the first device if the subscription list of the first object includes the identification information of the second application includes: extending the lifespan of the first application by the operating system of the first device if the subscription list of the first object includes the identification information of at least one third application.

[0024] For example, if there are multiple applications that implement collaborative functions with the first application, when the operating system of the first device needs to forcibly kill some applications running on the first device to release system resources due to system resource limitations, the operating system of the first device can first query the subscription list of the first application. If the subscription list of the first application includes the identification information of other applications, it indicates that the first application has been subscribed to by other applications, and there is a collaborative relationship between the first application and other applications. The operating system of the first device can extend the lifespan of the first application.

[0025] Secondly, embodiments of this application provide an application keep-alive device. This device is applied to a first device, which can then implement the functions of the first application in the application keep-alive method described in the first aspect. The first application and the second application have application collaboration capabilities.

[0026] The device may include: an object management module, configured to create a first object and generate a unique identifier for the first object when a second application is detected to have obtained first information from a first application; and a transceiver module, configured to send the unique identifier of the first object to the second application; and receive a subscription request sent by the second application based on the unique identifier of the first object, wherein the subscription request includes the identification information of the second application. A keep-alive management module, configured to add the identification information of the second application to the subscription list of the first object according to the subscription request.

[0027] When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object includes the identification information of the second application, the operating system of the first device extends the lifespan of the first application.

[0028] In some embodiments, the operating system of the first device is specifically configured to raise the priority of the first application among all currently running applications on the first device by at least one priority, wherein the higher the priority, the longer the application's lifespan.

[0029] Optionally, the operating system of the first device is specifically configured to elevate the priority of the first application to the highest priority among all currently running applications on the first device.

[0030] Optionally, the subscription request is sent to the first application by the second application after verifying that the second application has permission to read the unique identifier of the first object.

[0031] Optionally, the device may further include: a permission verification module for verifying whether the second application has permission to subscribe to the first object; and a keep-alive management module, specifically used to add the identification information of the second application to the subscription list of the first object according to the subscription request after the permission verification module verifies that the second application has permission to subscribe to the first object.

[0032] Optionally, the transceiver module is further configured to receive an unsubscribe request sent by the second application based on the unique identifier of the first object, the unsubscribe request including the identification information of the second application. The keep-alive management module is further configured to delete the identification information of the second application from the subscription list of the first object based on the unsubscribe request. When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the identification information of the second application is not included in the subscription list of the first object, then the operating system of the first device does not need to extend the lifespan of the first application.

[0033] Optionally, the unique identifier of the first object includes device information of the first device, application information of the first application, object information of the first object, and timestamp information when the first object was created.

[0034] Optionally, the first application and the second application may be located on the same device or different devices.

[0035] Optionally, the second application includes multiple third applications; the operating system of the first device is specifically configured to extend the lifespan of the first application if the subscription list of the first object includes the identification information of at least one third application.

[0036] Thirdly, embodiments of this application provide an electronic device, including: a processor; a memory; and a computer program; wherein the computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device implements the application keep-alive method as described in the first aspect and any implementation thereof.

[0037] Fourthly, embodiments of this application provide a computer-readable storage medium including a computer program that, when executed on an electronic device, causes the electronic device to implement the application keep-alive method as described in the first aspect and any implementation thereof.

[0038] Fifthly, embodiments of this application also provide a computer program product, including computer-readable code, which, when executed on an electronic device, causes the electronic device to implement the application keep-alive method as described in the first aspect and any implementation thereof.

[0039] In the third to fifth aspects mentioned above, the electronic device may be the first device mentioned in the first aspect.

[0040] The technical effects corresponding to the second aspect and any implementation of the second aspect, the third aspect and any implementation of the third aspect, the fourth aspect and any implementation of the fourth aspect, and the fifth aspect and any implementation of the fifth aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0041] Figure 1 This is a schematic diagram illustrating an application scenario provided in the embodiments of this application;

[0042] Figure 2 A schematic diagram of the structure of the first device provided in the embodiments of this application;

[0043] Figure 3A flowchart illustrating the application keep-alive method provided in this application embodiment;

[0044] Figure 4 This is another schematic diagram of the application keep-alive method provided in the embodiments of this application;

[0045] Figure 5 This is a schematic diagram of the application keep-alive device provided in the embodiments of this application;

[0046] Figure 6 This is another structural schematic diagram of the application keep-alive device provided in the embodiments of this application. Detailed Implementation

[0047] The terminology used in the following embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, “at least one” and “one or more” refer to one or more (including two). The character “ / ” generally indicates that the preceding and following objects are in an “or” relationship.

[0048] References to "one embodiment" or "some embodiments" as used in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. The term "connection" includes both direct and indirect connections, unless otherwise stated.

[0049] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0050] In the embodiments of this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.

[0051] App collaboration refers to the ability of two applications (Apps) to work together to provide services to the user, enriching the user experience. An application can be simply called an app. For example, a first device has an app installed, and a second device has an app installed. When the first and second devices are connected, the first and second apps can collaborate to provide services to the user. The user can view information from the first app on the first device through the second app on the second device.

[0052] During the collaborative service provided by the first and second applications, the operating system of the first device may forcibly kill certain applications running on the first device to free up system resources due to system resource limitations (insufficient system resources). Killing an application refers to terminating its process. When the first device's operating system kills applications including the first application (which can be referred to as an associated application for application collaboration), the collaborative functionality between the first and second applications will be affected, impacting the user experience.

[0053] For example, suppose the first device is a mobile phone, and the first application is Gallery app 1 installed on the phone; the second device is a smartwatch, and the second application is Gallery app 2 installed on the smartwatch. When the phone and smartwatch are connected, Gallery app 1 and Gallery app 2 can work together to provide services to the user, allowing the user to view images from Gallery app 1 on the phone via Gallery app 2 on the smartwatch.

[0054] When Gallery App 1 and Gallery App 2 work together to provide services to the user, the phone's operating system may forcibly kill certain applications running on the phone to free up system resources due to system resource limitations. If Gallery App 1 is among the applications killed by the phone, the collaborative function between Gallery App 1 and Gallery App 2 will be affected, and Gallery App 1 and Gallery App 2 will be unable to continue working together to provide services to the user. At this time, the user's operation of viewing pictures from Gallery App 1 on the phone through Gallery App 2 on the smartwatch may be forcibly interrupted, preventing the user from continuing to view pictures from Gallery App 1 on the phone through Gallery App 2 on the smartwatch, severely impacting the user experience.

[0055] Currently, regarding the issue of the application collaboration function between the first and second applications being affected, one implementation involves the second application registering a death notification for the first application. When the first application is killed by the first device, the second application can receive the death notification and restart itself to continue the application collaboration function between the two applications. However, in this implementation, the second application only receives the death notification after the first application is killed, at which point the application collaboration function between the first and second applications is already affected.

[0056] In another implementation, a heartbeat relationship can be established between the first and second applications, with the second application periodically sending heartbeat information to the first application. If the operating system of the first device forcibly kills certain applications running on the first device to release system resources, and detects the periodic heartbeat information sent by the second application, the lifespan of the first application can be extended. While this implementation avoids affecting the application collaboration function between the first and second applications, it significantly increases the power consumption of both the first and second devices.

[0057] Against this background, embodiments of this application provide an application keep-alive method applicable to scenarios where application collaboration is implemented between the first and second applications. The method includes: when the second application receives an operation from a user to view first information in the first application, the second application retrieves the first information from the first application and displays it to the user. When the first application detects that the second application has retrieved the first information, the first application creates a first object and generates a unique identifier for the first object. After generating the unique identifier, the first application sends (shares) the unique identifier to the second application. The second application sends a subscription request to the first application based on the unique identifier of the first object. The subscription request is used to indicate to the first application that the second application has subscribed to the first object, and the subscription request may include the identification information of the second application. After receiving the subscription request, the first application adds the identification information of the second application to the subscription list of the first object according to the subscription request. When the first application adds the identification information of the second application to the subscription list of the first object, it indicates that a collaborative relationship (or dependency relationship) has been established between the first and second applications.

[0058] When a user views information from the first application through the second application, and the operating system of the first device needs to forcibly kill certain applications running on the first device to free up system resources due to system resource limitations, the operating system of the first device can first query the subscription list of the first object. If the subscription list of the first object includes the identification information of the second application, it indicates that there is a collaborative relationship between the first and second applications, and the operating system of the first device can extend the lifespan of the first application. This application keep-alive method can extend the lifespan of the first application to avoid affecting the collaborative function between the first and second applications. Moreover, the power consumption of both the first and second devices can be low.

[0059] The technical solutions of the embodiments of this application will be described by way of example below with reference to the accompanying drawings.

[0060] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application. For example... Figure 1 As shown, the application scenario of this application embodiment may include: a first device 100 and a second device 200. The first device 100 and the second device 200 can establish a connection via wired or wireless means. A first application 110 is installed on the first device 100, and a second application 210 is installed on the second device 200. When the first device 100 and the second device 200 are connected, the first application 110 and the second application 210 can work together to provide services to the user, and the user can view information in the first application 110 on the first device 100 through the second application 210 on the second device 200.

[0061] Optionally, when the first device 100 and the second device 200 establish a wireless connection, the wireless communication protocol used can be Wi-Fi, Bluetooth, ZigBee, Near Field Communication (NFC), various cellular network protocols, etc., without specific limitations.

[0062] In specific implementations, the first device 100 and / or the second device 200 may be a mobile phone, tablet computer, handheld computer, PC, cellular phone, personal digital assistant (PDA), wearable device (such as smartwatch, smart bracelet), smart home device (such as television), vehicle system (such as in-vehicle computer), smart screen, game console, headphones, artificial intelligence (AI) speaker, and augmented reality (AR) / virtual reality (VR) device, etc. The embodiments of this application do not impose special restrictions on the specific device form of the first device 100 and the second device 200.

[0063] Optionally, in some embodiments, the first device 100 and the second device 200 may have the same device form. For example, both the first device 100 and the second device 200 may be mobile phones.

[0064] Alternatively, in some other embodiments, the first device 100 and the second device 200 may have different device forms. For example, the first device 100 may be a mobile phone, and the second device 200 may be a smartwatch.

[0065] The first device 100 and the second device 200 mentioned above can be touch screen devices or non-touch screen devices.

[0066] Optionally, the operating system of the first device 100 and / or the second device 200 may be Android™, iOS™, Windows™, macOS™, Linux™, etc. More specifically, it may also be Xiaomi™, EMUI™, Android Wear™, Lite OS™, Tizen™, watchOS™, etc.

[0067] In some embodiments, the operating systems of the first device 100 and the second device 200 may be the same. In other embodiments, the operating systems of the first device 100 and the second device 200 may be different. This application does not impose specific limitations on the operating systems of the first device 100 and / or the second device 200.

[0068] As an example, the first device 100 and the second device 200 may each include a memory, a processor, and a display. The memory may be used to store an operating system, and the processor may be used to run the operating system stored in the memory. The display may be used to display various user interfaces (UIs). The display of the first device 100 may be used to display the application interface of a first application installed on the first device 100, as well as the user interface of the operating system of the first device 100.

[0069] For example, Figure 2 This is a schematic diagram of the structure of the first device provided in an embodiment of this application. Figure 2 As shown, taking a mobile phone as an example, the first device 100 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, a sensor module 280, buttons 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc.

[0070] Processor 210 may include one or more processing units, such as application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0071] The controller can serve as the nerve center and command center of the mobile phone. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.

[0072] The processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. This memory can store instructions or data that the processor 210 has just used or that are used repeatedly. If the processor 210 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.

[0073] The application keep-alive method provided in this application embodiment can be implemented by writing code or a program into the processor 210. When the processor 210 executes the code or program, the first device 100 can implement the application keep-alive method provided in this application embodiment. For example, the first application 110 in the first device 100 can implement the following Figure 3 The steps S303, S304, S306, etc., shown in the diagram. The operating system of the first device 100 can implement the following... Figure 3 S307 and S308 are shown in the figure.

[0074] In some embodiments, the processor 210 may include one or more interfaces. 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, etc.

[0075] The external storage interface 220 can be used to connect an external storage card, such as a Micro SD card, to expand the phone's storage capacity. The external storage card communicates with the processor 210 through the external storage interface 220 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0076] Internal memory 221 can be used to store computer executable program code, which includes instructions. Processor 210 executes various mobile phone functions and data processing by running the instructions stored in internal memory 221. Internal memory 221 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during mobile phone use (such as image data, phonebook, etc.). Furthermore, internal memory 221 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0077] The charging management module 240 receives charging input from the charger. While charging the battery 242, the charging management module 240 can also power the mobile phone via the power management module 241. The power management module 241 connects to the battery 242, the charging management module 240, and the processor 210. The power management module 241 can also receive input from the battery 242 to power the mobile phone.

[0078] The wireless communication function of a mobile phone can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the mobile phone can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0079] Mobile phones can perform audio functions, such as music playback and recording, through an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, and an application processor.

[0080] The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, a barometric pressure sensor 280C, a magnetic sensor 280D, an accelerometer sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a bone conduction sensor 280M, etc.

[0081] Display screen 294 is used to display images, videos, etc. Display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone may include one or M displays 294, where M is a positive integer greater than 1. For example, display screen 294 can be used to display the interface of an application.

[0082] The mobile phone implements its display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0083] Understandable, Figure 2 The structure shown does not constitute a specific limitation on the mobile phone. In some embodiments, the mobile phone may also include... Figure 2 This could mean having more or fewer components, combining some components, separating some components, or having different component arrangements. Or, Figure 2 Some of the components shown can be implemented in hardware, software, or a combination of both.

[0084] Additionally, when the first device 100 is a tablet, handheld computer, PC, cellular phone, PDA, wearable device, smart home device, in-vehicle system, smart screen, game console, headphones, AI speaker, AR / VR device, or other terminal device, the specific structure of these other terminal devices can also be referenced. Figure 2 As shown. For example, other terminal devices may be... Figure 2 The components were added or removed based on the given structure, which will not be elaborated here.

[0085] When the second device 200 has the same device form as the first device 100, the structure of the second device 200 is the same as the structure of the first device 100. When the second device 200 has a different device form than the first device 100, the structure of the second device 200 can still be referenced. Figure 2 As shown, it can be in Figure 2 The components may have been added or removed from the given structure, which will not be elaborated here.

[0086] Optionally, the application types of the first application 110 and the second application 210 can be the same or different. For example, both the first application 110 and the second application 210 can be gallery applications. Alternatively, the first application 110 can be a file management application, and the second application 210 can be a gallery application. This application does not impose any limitations here.

[0087] The application keep-alive method provided in this application embodiment can be applied Figure 1 In the application scenarios shown.

[0088] The following is combined Figure 3 The process shown illustrates the application keep-alive method provided in the embodiments of this application. Figure 1 The specific implementation process in the application scenario shown is illustrated by example. Figure 3 This is a flowchart illustrating the application keep-alive method provided in an embodiment of this application. Figure 3 As shown, the method may include S301-S308.

[0089] S301, the second application 210 receives the user's operation to view the first information in the first application 110.

[0090] For example, the application interface of the second application 210 can provide a first control. When the user clicks the first control, the second application 210 can be triggered to retrieve first information from the first application 110 and display it to the user. The user's operation of clicking the first control is the operation of the user viewing the first information in the first application 110 as described in S301.

[0091] The first information refers to the information contained in the first application 110. For example, when the first application 110 is a gallery application, the first information may be the images stored in the first application 110.

[0092] S302, the second application 210 obtains the first information from the first application 110 and displays it to the user.

[0093] When the first application 110 detects that the second application 210 has obtained the first information, it can execute S303-S304.

[0094] For example, the second application 210 can send a request to the first application 110 to obtain the first information. After receiving the request, the first application 110 can return the first information to the second application 210. When the first application 110 receives the request, it can detect that the second application 210 has obtained the first information.

[0095] S303, First application 110 creates a first object and generates a unique identifier for the first object.

[0096] In some embodiments, the first object may be a virtual object created by the first application 110. For example, the virtual object may be text, numbers, etc. The virtual object may be randomly generated by the first application 110 or generated according to a certain rule, and there are no restrictions on this.

[0097] In other embodiments, the first object may be created by the first application 110 based on the first information, or the first object may be the first information itself. For example, when the first application 110 is a gallery application and the first information is image 1 stored in the first application 110, the first object may be text data created based on image 1, or the first object may be image 1 itself.

[0098] The unique identifier of the first object can be generated by the first application 110 based on the device information of the first device 100, the application information of the first application 110, the object information of the first object, and the timestamp information when the first object was created. The unique identifier of the first object may include: the device information of the first device 100, the application information of the first application 110, the object information of the first object, and the timestamp information when the first object was created.

[0099] For example, the device information of the first device 100 may be the device name or device model of the first device 100. The application information of the first application 110 may be the application name or application type of the first application 110. The object information of the first object may be the name of the first object.

[0100] For example, assuming the first object created by the first application 110 is "Object", the device model of the first device 100 is "12345", the application name of the first application 110 is "photo", and the timestamp when the first object is created is "20201027", then the unique identifier of the first object can be "12345_photo_Object_20201027".

[0101] It should be noted that the specific format of the unique identifier of the first object is not limited in the embodiments of this application.

[0102] S304, First application 110 sends the unique identifier of the first object to second application 210.

[0103] Accordingly, the second application 210 receives a unique identifier of the first object from the first application 110.

[0104] S305, the second application 210 sends a subscription request to the first application 110 based on the unique identifier of the first object.

[0105] Accordingly, the first application 110 receives a subscription request from the second application 210.

[0106] The subscription request is used to instruct the first application 110 that the second application 210 has subscribed to the first object, and the subscription request may include the identification information of the second application 210.

[0107] For example, the identification information of the second application 210 may be the name of the second application 210.

[0108] S306. The first application 110 adds the identification information of the second application 210 to the subscription list of the first object according to the subscription request.

[0109] When the first application 110 adds the identification information of the second application 210 to the subscription list of the first object, it indicates that a collaborative relationship has been established between the first application 110 and the second application 210.

[0110] During the process of a user viewing the first information in the first application 110 through the second application 210, if the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, the identification information of the second application 210 contained in the subscription list of the first object can be used to instruct the first device 100 to extend the lifespan of the first application 110. For example, see S307-S308.

[0111] S307. When the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, the operating system of the first device 100 queries the subscription list of the first object.

[0112] The operating system of the first device 100 is Android. TM Taking the system as an example, Android TM The system includes a lowmemorykiller component, which can be used to forcibly kill certain applications running on the first device 100 to free up system resources.

[0113] S308. When the subscription list of the first object includes the identification information of the second application 210, the operating system of the first device 100 extends the lifespan of the first application 110.

[0114] In some embodiments, the operating system of the first device 100 extends the lifespan of the first application 110, which may include: the operating system of the first device 100 does not forcibly kill the first application 110.

[0115] In other embodiments, the operating system of the first device 100 may extend the lifespan of the first application 110 by: the operating system of the first device 100 raising the priority of the first application 110 among all currently running applications, the higher the priority, the longer the lifespan of the application.

[0116] Optionally, the operating system of the first device 100 can elevate the priority of the first application 110 among all currently running applications. This can mean raising the priority of the first application 110 to the highest priority among all currently running applications. For example, suppose the applications currently running on the first device 100 include application A, application B, and the first application 110. The current priorities of application A, application B, and the first application 110 are: application A is higher than application B, and application B is higher than the first application 110. Then, the operating system of the first device 100 can adjust the priorities of these three applications as follows: the first application 110 is higher than application A, and application A is higher than application B. When the operating system of the first device 100 forcibly kills an application, it will kill application B first and then kill the first application 110 last. Thus, the survival time of the first application 110 can be longer.

[0117] Alternatively, the operating system of the first device 100 can raise the priority of the first application 110 among all currently running applications. This can also mean raising the priority of the first application 110 by at least one priority among all currently running applications. For example, if the applications currently running on the first device 100 include application A, application B, and the first application 110, the operating system of the first device 100 can adjust the priorities of these three applications as follows: application A is higher than the first application 110, and the first application 110 is higher than application B. When the operating system of the first device 100 forcibly kills an application, it will kill application B first and then kill application A last. The survival time of the first application 110 can also be extended.

[0118] It should be noted that the embodiments of this application do not limit the specific method by which the operating system of the first device 100 extends the lifespan of the first application 110.

[0119] Furthermore, it should be understood that in this embodiment, when the second application 210 does not receive an operation from the user to view the first information in the first application 110, there is no identification information of the second application 210 in the subscription list of the first object, indicating that there is no collaborative relationship between the first application 110 and the second application 210. When the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, after the operating system of the first device 100 queries the subscription list of the first object, since the subscription list of the first object does not include the identification information of the second application 210, the operating system of the first device 100 does not need to extend the lifespan of the first application 110, such as directly killing the first application 110 or maintaining the priority of the first application 110.

[0120] Based on this understanding, in this embodiment of the application, when the second application 210 receives an operation from the user to cancel viewing information in the first application, it can trigger the first application 110 to delete the identification information of the second application 210 from the subscription list of the first object. This way, when the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, there is no need to extend the lifespan of the first application 110. For example, Figure 4 This is another schematic diagram of the application keep-alive method provided in the embodiments of this application. For example... Figure 4 As shown, the method may include S401-S405.

[0121] S401, the second application 210 receives the user's operation to cancel viewing the first information in the first application 110.

[0122] For example, the application interface of the second application 210 may provide a second control. When the user clicks the second control, it can trigger the second application 210 to stop obtaining the first information from the first application 110. The user's operation of clicking the second control is the operation of the user canceling the viewing of the first information in the first application 110 as described in S401.

[0123] The first information can be found in S301.

[0124] After receiving the user's operation to cancel viewing the first information in the first application 110, the second application 210 stops obtaining the first information from the first application 110 and executes S402 at the same time.

[0125] S402, the second application 210 sends an unsubscribe request to the first application 110 based on the unique identifier of the first object.

[0126] Accordingly, the first application 110 receives an unsubscribe request from the second application 210.

[0127] The unsubscribe request is used to instruct the second application 210 to unsubscribe from the first object. The unsubscribe request may also include the identification information of the second application 210.

[0128] S403, the first application 110 deletes the identification information of the second application 210 from the subscription list of the first object according to the unsubscription request.

[0129] When the first application 110 deletes the identification information of the second application 210 from the subscription list of the first object, it indicates that there is no longer a collaborative relationship between the first application 110 and the second application 210.

[0130] At this point, when the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, the subscription list of the first object no longer contains the identification information of the second application 210, thus instructing the first device 100 not to extend the lifespan of the first application 110. For example, see S404-S405.

[0131] S404. When the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, the operating system of the first device 100 queries the subscription list of the first object.

[0132] S405. When the identification information of the second application 210 is not included in the subscription list of the first object, the operating system of the first device 100 does not need to extend the lifespan of the first application 110.

[0133] Optionally, the fact that the operating system of the first device 100 does not need to extend the lifespan of the first application 110 can mean that when the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, the operating system of the first device 100 does not need to adjust the priority of the first application 110, or directly kill the first application 110.

[0134] In this embodiment of the application, when a user views the first information in the first application 110 through the second application 210, if the operating system of the first device 100 needs to forcibly kill certain applications running on the first device 100 to release system resources due to system resource limitations, the first device can first query the subscription list of the first object for the first application 110. If the subscription list of the first object includes the identification information of the second application 210, it indicates that there is a collaborative relationship between the first application 110 and the second application 210. The first device 100 can extend the lifespan of the first application 110 to avoid affecting the application collaboration function between the first application 110 and the second application 210.

[0135] As can be seen, this method can establish a collaborative relationship between the first application 110 and the second application 210 in a simple way without requiring periodic heartbeats. Therefore, the power consumption of the first device 100 and the second device 200 can be lower. In addition, this method provides a better user experience compared to the method of restarting the first application 110 after it is killed.

[0136] For example, taking a mobile phone as the first device 100, a gallery app 1 installed on the phone as the first application 110, a smartwatch as the second device 200, and a gallery app 2 installed on the smartwatch as the second application 210, when the phone and smartwatch are connected, gallery app 2 can receive user requests to view images in gallery app 1. Gallery app 2 can respond to these requests by retrieving and displaying images from gallery app 1. When gallery app 1 detects that gallery app 2 has retrieved an image, it can create a first object and generate a unique identifier for that object. After generating the unique identifier, gallery app 1 can send (share) the unique identifier to gallery app 2. Gallery app 2 then sends a subscription request to gallery app 1 based on the unique identifier of the first object. Upon receiving the subscription request, gallery app 1 can add the identifier information of gallery app 2 to the subscription list of the first object. When Gallery App 1 adds the identification information of Gallery App 2 to the subscription list of the first object, it indicates that a collaborative relationship (or dependency relationship) has been established between Gallery App 1 and Gallery App 2.

[0137] When a user views images from Gallery app 1 through Gallery app 2, if the phone's operating system needs to forcibly kill certain applications running on the phone to free up system resources due to system resource limitations, for Gallery app 1, the phone's operating system can first query the subscription list of the first object. If the subscription list of the first object includes the identification information of Gallery app 2, the phone's operating system can extend the lifespan of Gallery app 1. This application keep-alive method can extend the lifespan of Gallery app 1, thus avoiding the impact on the application collaboration function between Gallery app 1 and Gallery app 2, thereby ensuring a better user experience. Moreover, the power consumption of the phone and smartwatch can be kept low.

[0138] Optionally, in this embodiment, after receiving the unique identifier of the first object from the first application 110, the second application 210 may first verify the unique identifier of the first object to determine whether the second application 210 has permission to read the unique identifier of the first object. When the second application 210 determines that it has permission to read the unique identifier of the first object, the second application 210 then executes subsequent steps, such as S305.

[0139] The permission for the second application 210 to read the unique identifier of the first object can be granted to the second application 210 by the user on the second device 200. For example, when the second application 210 first receives the unique identifier of the first object from the first application 110, or when the first device 100 establishes a connection with the second device 200, the second device 200 can display a first interface, which may include a prompt message: "Allow the second application 210 to read the information from the first application 110?", as well as "Confirm" and "Cancel" buttons. When the user clicks the "Confirm" button, the second application 210 is granted permission to read the unique identifier of the first object. When the user clicks the "Cancel" button, the second application 210 does not have permission to read the unique identifier of the first object.

[0140] It is understandable that if the user does not grant the second application 210 permission to read the unique identifier of the first object, the second application 210 will not perform subsequent steps.

[0141] In this embodiment of the application, after the second application 210 receives the unique identifier of the first object from the first application 110, it first verifies the unique identifier of the first object. After confirming that it has the permission to read the unique identifier of the first object, it then executes the subsequent steps, which can better protect user privacy.

[0142] Optionally, in this embodiment, after receiving a subscription request from the second application 210, the first application 110 may first verify the subscription request to determine whether the second application 210 has permission to subscribe to the first object. When the first application 110 determines that the second application 210 has permission to subscribe to the first object, subsequent steps, such as S306, are then executed.

[0143] Similarly, the permission for the second application 210 to subscribe to the first object can be granted to the second application 210 by the user on the first device 100. For example, when the first application 110 first receives a subscription request from the second application 210, or when the first device 100 establishes a connection with the second device 200, the first device 100 can display a second interface, which may include a prompt message: "Allow the second application 210 to subscribe to the first object?", as well as "Confirm" and "Cancel" buttons. When the user clicks the "Confirm" button, the permission for the second application 210 to subscribe to the first object is granted. When the user clicks the "Cancel" button, the second application 210 does not have the permission to subscribe to the first object.

[0144] It is understandable that if the user does not grant the second application 210 permission to subscribe to the first object, the first application 110 will not perform subsequent steps.

[0145] In this embodiment of the application, after the first application 110 receives the subscription request from the second application 210, it first verifies the subscription request. After confirming that the second application 210 has the permission to subscribe to the first object, it then executes the subsequent steps, which can better protect user privacy.

[0146] In other words, since the application keep-alive method provided in this application embodiment involves the application's runtime data, this method can only implement application keep-alive after the user agrees and grants the corresponding permissions, so as to better protect user privacy.

[0147] The above embodiments mainly illustrate the application keep-alive method provided in the embodiments of this application. Figure 1 The specific implementation process in the application scenario shown is illustrated. The first application 110 and the second application 210 are installed on two different devices (the first device 100 and the second device 200), respectively. However, it should be noted that the application keep-alive method provided in this embodiment is also applicable to two applications installed on the same device, achieving keep-alive functionality. When this application keep-alive method is applied between two applications installed on the same device, the specific process is similar to the interaction process between the first application 110 and the second application 210 described in the aforementioned embodiment, and will not be repeated here.

[0148] Finally, it should be noted that although this application embodiment uses the implementation of application collaboration function between the first application and the second application as an example for illustration, it should be understood that the applications implementing collaboration function with the first application can include multiple applications. Each application can implement collaboration function with the first application and subscribe to the first object created by the first application according to the process described in the foregoing embodiments. The first application can add the identification information of all applications that have subscribed to the first object to the subscription list of the first object. When there are multiple applications implementing collaboration function with the first application, when the operating system of the first device (or the device where the first application is located) needs to forcibly kill some applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device can first query the subscription list of the first object. If the subscription list of the first object includes the identification information of other applications, it indicates that the first object has been subscribed to by other applications, and there is a collaboration relationship between the first application and other applications. The operating system of the first device can extend the lifespan of the first application.

[0149] In other words, in this embodiment of the application, the aforementioned second application may include multiple applications (such as a third application). When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, if the subscription list of the first object includes the identification information of at least one third application, it indicates that the first object has been subscribed to by a third application, and there is a collaborative relationship between the first application and the third application. The operating system of the first device can extend the lifespan of the first application. Here, the third application can be referred to as the subscriber.

[0150] Optionally, in this embodiment, when the first object is first information in the first application, the technical solution of this embodiment can be understood as follows: when another application reads (obtains) the first information, the first application records the identification information of the other application in the subscription list of the first object (see the foregoing embodiments for details). The inclusion of the identification information of other applications in the subscription list of the first object indicates that the first information is being read by other applications. Therefore, when the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources, the lifespan of the first application can be appropriately extended.

[0151] Corresponding to the application keep-alive method described in the foregoing embodiments, this application also provides an application keep-alive device. This device can be applied to a first device. For example, the device can be deployed in the first device as code, together with the first application. The first device can call the code to implement the functions of the first application in the aforementioned application keep-alive method. The first application and the second application have application collaboration functions. Figure 5 This is a schematic diagram of the application keep-alive device provided in an embodiment of this application. Figure 5 As shown, the device may include:

[0152] The object management module 501 is used to create a first object and generate a unique identifier for the first object when it detects that a second application has obtained first information from a first application. The transceiver module 502 is used to send the unique identifier of the first object to the second application and receive a subscription request sent by the second application based on the unique identifier of the first object, the subscription request including the identification information of the second application. The keep-alive management module 503 is used to add the identification information of the second application to the subscription list of the first object according to the subscription request.

[0153] When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object includes the identification information of the second application, the operating system of the first device extends the lifespan of the first application.

[0154] In some embodiments, the operating system of the first device is specifically configured to raise the priority of the first application among all currently running applications on the first device by at least one priority, wherein the higher the priority, the longer the application's lifespan.

[0155] Optionally, the operating system of the first device is specifically configured to elevate the priority of the first application to the highest priority among all currently running applications on the first device.

[0156] Optionally, the subscription request is sent to the first application by the second application after verifying that the second application has permission to read the unique identifier of the first object.

[0157] Optionally, Figure 6 This is another structural schematic diagram of the application keep-alive device provided in an embodiment of this application. (See attached diagram.) Figure 6 As shown, the device may further include: a permission verification module 504, used to verify whether the second application has the permission to subscribe to the first object; and a keep-alive management module 503, specifically used to add the identification information of the second application to the subscription list of the first object according to the subscription request after the permission verification module 504 verifies that the second application has the permission to subscribe to the first object.

[0158] Optionally, the transceiver module 502 is further configured to receive an unsubscribe request sent by the second application based on the unique identifier of the first object, the unsubscribe request including the identification information of the second application. The keep-alive management module 503 is further configured to delete the identification information of the second application from the subscription list of the first object based on the unsubscribe request. When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object does not include the identification information of the second application, then the operating system of the first device does not need to extend the lifespan of the first application.

[0159] Optionally, the unique identifier of the first object includes device information of the first device, application information of the first application, object information of the first object, and timestamp information when the first object was created.

[0160] Optionally, the first application and the second application may be located on the same device or different devices.

[0161] Optionally, the second application includes multiple third applications; the operating system of the first device is specifically configured to extend the lifespan of the first application if the subscription list of the first object includes the identification information of at least one third application.

[0162] It is understandable that the specific implementation principles of each module in this device can be referred to the aforementioned method embodiments.

[0163] It should be understood that the division of units or modules (hereinafter referred to as units) in the above device is only a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, all units in the device can be implemented in software through processing element calls; all units can be implemented in hardware; or some units can be implemented in software through processing element calls, and some units can be implemented in hardware.

[0164] For example, each unit can be a separate processing element, or it can be integrated into a chip within the device. Alternatively, it can be stored as a program in memory, invoked and executed by a processing element within the device. Furthermore, these units can be integrated in whole or in part, or implemented independently. The processing element described here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each of the above units can be implemented through integrated logic circuits in the processor element or through software invoked by the processing element.

[0165] In one example, the unit in the above device may be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.

[0166] For example, when the units in the device can be implemented through a processing element scheduler, the processing element can be a general-purpose processor, such as a CPU or other processor capable of calling programs. Alternatively, these units can be integrated together to form a system-on-a-chip (SOC).

[0167] In one implementation, the units that implement the corresponding steps in the above methods can be implemented in the form of a processing element scheduler. For example, the device may include a processing element and a storage element, wherein the processing element calls a program stored in the storage element to execute the methods described in the above embodiments. The storage element may be a storage element located on the same chip as the processing element, i.e., an on-chip storage element.

[0168] In another implementation, the program used to perform the above methods can be located on a storage element on a different chip than the processing element, i.e., an off-chip storage element. In this case, the processing element calls or loads the program from the off-chip storage element onto the on-chip storage element to call and execute the methods described in the above method embodiments.

[0169] For example, embodiments of this application may also provide an apparatus, such as an electronic device, which may include a processor and a memory for storing processor-executable instructions. When the processor is configured to execute the aforementioned instructions, it causes the electronic device to implement the application keep-alive method as described in the foregoing embodiments. The memory may be located within or outside the electronic device. Furthermore, the processor may include one or more processors.

[0170] For example, the electronic device may be the first device described above.

[0171] In another implementation, the unit that implements the steps of the above method can be configured as one or more processing elements, which can be integrated circuits, such as one or more ASICs, or one or more DSPs, or one or more FPGAs, or combinations of these types of integrated circuits. These integrated circuits can be integrated together to form a chip.

[0172] For example, this application also provides a chip that can be applied to the aforementioned electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the processor receives and executes computer instructions from the memory of the electronic device through the interface circuits to implement the application keep-alive method as described in the foregoing embodiments.

[0173] This application also provides a computer program product, including computer-readable code, which, when executed in an electronic device, enables the electronic device to implement the application keep-alive method as described in the foregoing embodiments.

[0174] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0175] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0176] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0177] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0178] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product, such as a program. This software product is stored in a program product, such as a computer-readable storage medium, and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0179] For example, embodiments of this application may also provide a computer-readable storage medium storing computer program instructions thereon. When the computer program instructions are executed by an electronic device, the electronic device causes the electronic device to implement the application keep-alive method as described in the foregoing embodiments.

[0180] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for keeping applications alive, characterized in that, The method is applied to a first device, the first device including a first application, and the first application and a second application having application collaboration functionality; the method includes: When the first application detects that the second application has obtained the first information from the first application, the first application creates a first object and generates a unique identifier for the first object; the first object is created by the first application based on the first information, and the first object includes at least one of the following: text, numbers, or images; the first application sends the unique identifier of the first object to the second application; The first application receives a subscription request sent by the second application based on the unique identifier of the first object, the subscription request including the identification information of the second application; The first application adds the identification information of the second application to the subscription list of the first object according to the subscription request; When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object includes the identification information of the second application, the operating system of the first device extends the lifespan of the first application.

2. The method according to claim 1, characterized in that, The operating system of the first device extends the lifespan of the first application by including: The operating system of the first device will increase the priority of the first application by at least one priority among all currently running applications on the first device. The higher the priority, the longer the application will survive.

3. The method according to claim 2, characterized in that, The operating system of the first device raises the priority of the first application by at least one priority among all currently running applications on the first device, including: The operating system of the first device elevates the priority of the first application to the highest priority among all currently running applications on the first device.

4. The method according to claim 1, characterized in that, The subscription request is sent to the first application by the second application after verifying that the second application has permission to read the unique identifier of the first object.

5. The method according to claim 1, characterized in that, The first application, based on the subscription request, adds the identification information of the second application to the subscription list of the first object, including: The first application verifies whether the second application has permission to subscribe to the first object; Once the first application verifies that the second application has permission to subscribe to the first object, the first application adds the identification information of the second application to the subscription list of the first object according to the subscription request.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: The first application receives an unsubscribe request sent by the second application based on the unique identifier of the first object, the unsubscribe request including the identification information of the second application; Based on the unsubscribe request, the first application removes the identifier information of the second application from the subscription list of the first object; When the operating system of the first device needs to forcibly kill certain applications running on the first device to release system resources due to system resource limitations, for the first application, the operating system of the first device queries the subscription list of the first object. If the subscription list of the first object does not include the identification information of the second application, then the operating system of the first device does not need to extend the lifespan of the first application.

7. The method according to any one of claims 1-5, characterized in that, The unique identifier of the first object includes the device information of the first device, the application information of the first application, the object information of the first object, and the timestamp information when the first object was created.

8. The method according to any one of claims 1-5, characterized in that, The first application and the second application are located on the same device or different devices.

9. The method according to any one of claims 1-5, characterized in that, The second application includes multiple third applications; The step of extending the lifespan of the first application by its operating system if the first object's subscription list includes the identification information of the second application includes: If the subscription list of the first object includes the identification information of at least one of the third applications, the operating system of the first device extends the lifespan of the first application.

10. An electronic device, characterized in that, include: processor; Memory; And a computer program; wherein the computer program is stored on the memory, and when the computer program is executed by the processor, causes the electronic device to perform the method as described in any one of claims 1-9.

11. A computer-readable storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Internal memory cleaning method and cleaning device and terminal device

    CN103092700A

  • Memory cleaning method and memory cleaning device of mobile terminal

    CN104820545A