Life cycle event management method and apparatus, storage medium, and electronic device
Patent Information
- Application Number
- CN202111565125.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2041-12-20
AI Technical Summary
但是,由于寄生应用运行在宿主应用的沙盒环境中,如何对寄生应用的生命周期进行管理成为需要解决的技术问题
[0016] Based on the above technical solution, by intercepting the lifecycle events triggered by the operating system that require the parasitic application to execute, the original lifecycle function call logic of the parasitic application can be blocked, and the intercepted lifecycle events can be forwarded to both the parasitic application and the host application. This allows the host application to be aware of the lifecycle events executed by the parasitic application when it executes them, and the host application can simultaneously execute the business functions that match the lifecycle events.
Smart Images

Figure CN116302142B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a lifecycle event management method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the widespread adoption of smartphones and other mobile devices, smartphones can support an increasing number of applications with ever-growing functionality. In related technologies, parasitic applications have been developed to make using these applications more convenient for users. Parasitic applications are applications that can be used on a host application without downloading or installing them. The host application provides the necessary runtime environment for the parasitic application, such as running it in a sandbox without requiring installation or registration on the system. However, because parasitic applications run in the host application's sandbox environment, managing their lifecycle becomes a technical challenge that needs to be addressed. Summary of the Invention
[0003] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] Firstly, this disclosure provides a lifecycle event management method, including:
[0005] Obtain lifecycle events sent by the operating system to the parasitic application running on the host application;
[0006] The lifecycle events are forwarded to both the parasitic application and the host application.
[0007] Control the parasitic application to execute the lifecycle event and control the host application to execute business functions that match the lifecycle event.
[0008] Secondly, this disclosure provides a lifecycle event management device, comprising:
[0009] The acquisition module is configured to acquire lifecycle events sent by the operating system to the parasitic application running on the host application;
[0010] The forwarding module is configured to forward the lifecycle events to the parasitic application and the host application, respectively.
[0011] The control module is configured to control the parasitic application to execute the lifecycle event and to control the host application to execute business functions that match the lifecycle event.
[0012] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0013] Fourthly, this disclosure provides an electronic device, comprising:
[0014] A storage device on which computer programs are stored;
[0015] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.
[0016] Based on the above technical solution, by intercepting the lifecycle events triggered by the operating system that require the parasitic application to execute, the original lifecycle function call logic of the parasitic application can be blocked, and the intercepted lifecycle events can be forwarded to both the parasitic application and the host application. This allows the host application to be aware of the lifecycle events executed by the parasitic application when it executes them, and the host application can simultaneously execute the business functions that match the lifecycle events.
[0017] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings:
[0019] Figure 1 This is a flowchart illustrating a lifecycle event management method according to an exemplary embodiment;
[0020] Figure 2 This is a flowchart illustrating a lifecycle event management method according to another exemplary embodiment;
[0021] Figure 3 This is a schematic diagram illustrating the principle of lifecycle event management according to an exemplary embodiment;
[0022] Figure 4 This is a flowchart illustrating a lifecycle event management method according to yet another exemplary embodiment;
[0023] Figure 5 This is a schematic diagram of module connections for a lifecycle event management device according to yet another exemplary embodiment;
[0024] Figure 6This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0025] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0026] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0027] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0028] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0029] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0030] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0031] For ease of understanding, the terms used in the embodiments of this disclosure will be introduced below.
[0032] Operating System: An operating system (OS) is a computer program that manages computer hardware and software resources. The operating system handles basic tasks such as managing and allocating memory, determining the priority of system resource supply and demand, controlling input and output devices, operating networks, and managing file systems. The operating system also provides a user interface for users to interact with the system. In this embodiment of the disclosure, the operating system may be Android, Apple's iOS (iPhone Operating System), HarmonyOS, etc.
[0033] Host application: A host application, often simply referred to as the host, represents the main application that provides the runtime environment for integrated modules. For example, if a social application is running on a client, and it integrates a mini-program engine module, then the social application can open and display mini-programs. Another example is a portable platform running on a client. This portable platform integrates a portable framework (engine), allowing it to run other native applications.
[0034] Parasitic applications: Parasitic applications are applications that are subordinate to host applications and depend on the runtime environment provided by the host application to run.
[0035] Lifecycle events: Lifecycle events, also known as lifecycle functions, refer to a series of executable functions that occur during the process from the creation to the destruction of an object.
[0036] Instrumentation object: An Instrumentation object is used to monitor the interaction between the application and the system. It is instantiated before all components of the application.
[0037] Hook functions: A hook function is a program segment that processes messages. It is attached to the system via a system call. Whenever a specific message is sent, the hook function captures the message before it reaches the destination window, meaning it gains control first. At this point, the hook function can process (modify) the message, continue passing the message without processing it, or forcibly terminate the message transmission.
[0038] Figure 1 This is a flowchart illustrating a lifecycle event management method according to an exemplary embodiment. The lifecycle event management method disclosed in this embodiment can be executed by an electronic device, specifically a lifecycle event management device. This device can be implemented in software and / or hardware and configured within the electronic device. Please refer to... Figure 1 The lifecycle event management method provided in this disclosure may include the following steps.
[0039] S110: Obtain lifecycle events sent by the operating system to the parasitic application running on the host application.
[0040] Here, lifecycle events can be lifecycle functions such as callActivityOnCreate, callActivityOnstart, callActivityOnResume, callActivityOnPause, callActivityOnStop, and callActivityOnDestroy.
[0041] In this embodiment, the host application's portable framework (engine) receives lifecycle events triggered by the operating system that require execution by the parasitic application. Then, the portable framework intercepts these lifecycle events. It should be understood that the operating system provides lifecycle functions (processing functions) for critical time points in each page of the parasitic application, from opening to closing. Generally, the lifecycle event triggered by the operating system is passed to the host application's portable framework via the operating system's Instrumentation. The host application then passes the lifecycle event to the parasitic application via its portable framework's Instrumentation. The parasitic application calls the corresponding lifecycle function to execute the lifecycle event. However, in this embodiment, the lifecycle events sent by the operating system to the parasitic application are intercepted within the host application's portable framework and are no longer directly forwarded to the parasitic application.
[0042] It is understandable that obtaining the lifecycle events that the parasitic application needs to execute triggered by the operating system refers to interrupting the original lifecycle function call logic of the parasitic application. Electronic devices can use a proxy program to proxies the Instrumentation of the host application's portable framework in order to obtain the lifecycle events that the parasitic application needs to execute triggered by the operating system within the portable framework.
[0043] S120, the lifecycle events are forwarded to the parasitic application and the host application respectively.
[0044] Here, after the electronic device intercepts the lifecycle events that the parasitic application needs to execute triggered by the operating system, it forwards the lifecycle events to both the parasitic application and the host application, so that the host application can be aware of the lifecycle events that the parasitic application needs to execute.
[0045] S130, control the parasitic application to execute the lifecycle event and control the host application to execute business functions that match the lifecycle event.
[0046] Here, after forwarding the lifecycle event to both the parasitic application and the host application, the parasitic application responds to the lifecycle event by calling the corresponding lifecycle function, while the host application executes the business function that matches the lifecycle event. In some implementations, the business function can have a one-to-one correspondence with the lifecycle event; when the host application senses the lifecycle event that the parasitic application is about to execute, it determines the corresponding business function based on that lifecycle event.
[0047] For example, business functionality may include one of the following: a pop-up window that matches a lifecycle event, a floating window that matches a lifecycle event, and a countdown component that matches a lifecycle event.
[0048] Pop-ups refer to windows that automatically appear when a webpage or application is opened. For example, when a lifecycle event occurs that displays advertising content on a parasitic application's page, the host application responds to this lifecycle event by displaying a pop-up window in the host application with the message "Click to skip ads," in accordance with the parasitic application's lifecycle event.
[0049] A floating window refers to a movable window that floats on the surface of an application, allowing users to open different applications. For example, when a lifecycle event temporarily exits the parasitic application's interface, the host application responds to this lifecycle event by displaying a floating window, which the user can use to return to the parasitic application, thus aligning with the parasitic application's lifecycle event.
[0050] A countdown component refers to a countdown clock. For example, when the parasitic application exits the current page via a lifecycle event, the host application responds to this lifecycle event by displaying a countdown component to count down the time until the page exits.
[0051] Therefore, by intercepting the lifecycle events triggered by the operating system that require the parasitic application to execute, the original lifecycle function call logic of the parasitic application can be blocked, and the intercepted lifecycle events can be forwarded to both the parasitic application and the host application. This allows the host application to be aware of the lifecycle events executed by the parasitic application when it executes them, and the host application can simultaneously execute the business functions that match the lifecycle events.
[0052] Figure 2 This is a flowchart illustrating a lifecycle event management method according to another exemplary embodiment. The lifecycle event management method disclosed in this embodiment can be executed by an electronic device, specifically by a lifecycle event management device. This device can be implemented in software and / or hardware and configured within the electronic device. Please refer to... Figure 2 The lifecycle event management provided in this disclosure may include the following steps.
[0053] S210, Obtain the Instrumentation object of the host application.
[0054] Here, the host application's Instrumentation object can track the lifecycle of the Application (object) and the Activity (an application component). For example, in almost all lifecycle calls of the Application and Activity, the corresponding methods of the Instrumentation object will be called first.
[0055] In some embodiments, the host application's Instrumentation object can be hooked through a hook function that runs in the virtual machine.
[0056] The virtual machine can be either a JVM (Java Virtual Machine) or an ART virtual machine.
[0057] It should be understood that hook functions running in the virtual machine can directly hook the host application's Instrumentation object without needing to know the source code of the host application's no-install framework.
[0058] S220, Construct a first proxy object based on the Instrumentation object.
[0059] Here, since the first proxy object is built upon the Instrumentation object, it inherits the original methods of the Instrumentation object. This means the first proxy object has the functionality to send lifecycle events to the parasitic application. It's worth noting that the first proxy object is built upon the Instrumentation object by adding predefined judgment methods. For example, the first proxy object is used to receive lifecycle events triggered by the operating system that the parasitic application needs to execute, and forwards these lifecycle events to the parasitic application and / or the host application if the lifecycle event meets predefined conditions.
[0060] S230, replace the Instrumentation object of the host application with the first proxy object.
[0061] Here, replacing the Instrumentation object in the host application's portable framework with the first proxy object involves inserting the first proxy object into the location where the Instrumentation object is in the portable framework. This ensures that the first proxy object works while avoiding interference with the portable framework's own Instrumentation logic.
[0062] It is understandable that steps S210 to S230 are actually performing hook processing on the Instrumentation object of the host application so that the hooked Instrumentation object can execute the preset method.
[0063] S240, obtain the lifecycle events sent by the operating system to the parasitic application through the first proxy object.
[0064] Here, since the first proxy object is built on top of the Instrumentation object and inherits the methods of the Instrumentation object, the first proxy object can receive the lifecycle events that the parasitic application needs to execute triggered by the operating system.
[0065] S250, the lifecycle events are forwarded to the parasitic application and the host application respectively through the first proxy object.
[0066] Here, after receiving the lifecycle event sent by the operating system that the parasitic application needs to execute, the first proxy object forwards the lifecycle event to both the parasitic application and the host application.
[0067] Understandably, the first proxy object is used to receive lifecycle events that the parasitic application needs to execute, triggered by the operating system, and to forward these lifecycle events to both the parasitic application and the host application.
[0068] S260, control the parasitic application to execute the lifecycle event and control the host application to execute business functions that match the lifecycle event.
[0069] Here, the specific implementation of step S260 can be referred to step S130, and will not be described in detail here.
[0070] The following is in conjunction with the appendix Figure 3 The above-described embodiments will be described in detail.
[0071] Figure 3 This is a schematic diagram illustrating the principle of lifecycle event management according to an exemplary embodiment. For example... Figure 3As shown, the operating system sends the lifecycle events that the parasitic application needs to execute to the first proxy object running in the virtual machine. After receiving the lifecycle event, the first proxy object forwards the lifecycle event to the parasitic application through the host application's portable framework (engine). At the same time, the first proxy object forwards the lifecycle event to the host application so that the host application can be aware of the lifecycle events executed by the parasitic application.
[0072] Therefore, by constructing a first proxy object based on the host application's Instrumentation object, the lifecycle events that the parasitic application needs to execute can be forwarded to both the parasitic application and the host application. This allows the host application to be aware of the lifecycle events executed by the parasitic application when it executes them, and to execute the business functions that match those lifecycle events.
[0073] In some implementations, the electronic device can also obtain the operating system's Instrumentation object and construct a second proxy object based on the operating system's Instrumentation object. The second proxy object is used to receive lifecycle events sent by the operating system to the host application and forward the lifecycle events to the host application. Then, the operating system's Instrumentation object is replaced with the second proxy object to obtain the lifecycle events sent by the operating system to the host application through the second proxy object, and to determine whether to send the lifecycle events to the host application based on the running status of the host application.
[0074] The construction process of the second proxy object is the same as that of the first proxy object, and will not be described in detail here.
[0075] The operating system's Instrumentation object is used to communicate with the host application, and the host application calls lifecycle functions through the operating system's Instrumentation object. By hooking the operating system's Instrumentation object and adding a pre-defined judgment method to it to construct a second proxy object, the second proxy object can both receive lifecycle events sent by the operating system to the host application and determine whether to send lifecycle events that the host application needs to execute based on the host application's running state.
[0076] Figure 4 This is a flowchart illustrating a lifecycle event management method according to yet another exemplary embodiment. For example... Figure 4 As shown, this lifecycle management method may include the following steps.
[0077] Step S410: Obtain lifecycle events sent by the operating system to the parasitic application running on the host application.
[0078] Here, the specific implementation of step S410 can be referred to step S110, and will not be described in detail here.
[0079] Step S420: Determine whether the current running state of the parasitic application matches the preset running state, wherein the preset running state is the running state required by the parasitic application when executing the acquired lifecycle event.
[0080] Here, the preset running state refers to the running state required by the parasitic application when executing the acquired lifecycle event. In other words, the preset running state is used to characterize whether the parasitic application has the execution environment to execute the lifecycle event. If the current running state of the parasitic application does not match the preset running state, it means that the parasitic application does not currently have the execution environment to execute the lifecycle event; if the current running state of the parasitic application matches the preset running state, it means that the parasitic application currently has the execution environment to execute the lifecycle event.
[0081] In some implementations, the current running state of the parasitic application can be obtained through a first proxy object, and the obtained current running state can be compared with the preset running state corresponding to the obtained lifecycle event to determine whether the current running state matches the preset running state.
[0082] It is understandable that different lifecycle events correspond to different preset running states. For example, the execution environment required when a page is created or closed is different, and therefore the corresponding preset running states are also different.
[0083] Step S430: If the current running state does not match the preset running state, stop sending the lifecycle event to the parasitic application and send the result of stopping sending the lifecycle event to the host application.
[0084] Here, if the current running state of the parasitic application does not match the preset running state corresponding to the lifecycle event, it means that the parasitic application does not have the execution environment to execute the lifecycle event. Therefore, forwarding the lifecycle event to the parasitic application is stopped to prevent the parasitic application from calling the lifecycle event logic. Simultaneously, the result of stopping forwarding the lifecycle event to the parasitic application can be forwarded to the host application so that the host application can be aware of the parasitic application's failure to call the corresponding lifecycle event. For example, when a page executes the lifecycle event to close the page, it needs to meet the preset running state for closing the page; if it does not meet the preset running state, the lifecycle function corresponding to the lifecycle event cannot be called.
[0085] Step S440: Control the host application to execute and stop the business function that matches the result of forwarding the lifecycle event to the parasitic application.
[0086] Here, after the host application detects that the parasitic application's call to the corresponding lifecycle event has failed, the host application can execute business functions that match the result of stopping the forwarding of lifecycle events to the parasitic application. These business functions can include pop-ups, floating windows, countdown components, etc.
[0087] Therefore, by intercepting the lifecycle event when the current running state of the parasitic application does not match the preset running state corresponding to the lifecycle event, the original calling logic of the parasitic application can be blocked. Furthermore, the host application can perceive the result of the parasitic application's failure to call the lifecycle function, thereby executing the corresponding business function and realizing the preset functional requirements.
[0088] Figure 5 This is a schematic diagram of module connections for a lifecycle event management device according to yet another exemplary embodiment. For example... Figure 5 As shown, the lifecycle management device may include an acquisition module 501, a forwarding module 502, and a control module 503. Wherein:
[0089] The acquisition module 501 is configured to acquire lifecycle events sent by the operating system to the parasitic application running on the host application;
[0090] Forwarding module 502 is configured to forward the lifecycle events to the parasitic application and the host application, respectively;
[0091] The control module 503 is configured to control the parasitic application to execute the lifecycle event and to control the host application to execute business functions that match the lifecycle event.
[0092] Optionally, the acquisition module 501 includes:
[0093] The first acquisition unit is configured to acquire the Instrumentation object of the host application;
[0094] The first program creation unit is configured to construct a first proxy object based on the Instrumentation object;
[0095] The first program replacement unit is configured to replace the Instrumentation object of the host application with the first proxy object;
[0096] The first event acquisition unit is configured to acquire lifecycle events sent by the operating system to the parasitic application through the first proxy object.
[0097] The forwarding module 502 is specifically configured to forward the lifecycle events to the parasitic application and the host application respectively through the first proxy object.
[0098] Optionally, the first acquisition unit is specifically configured to: hook the Instrumentation object of the host application through a hook function running in the virtual machine.
[0099] Optionally, the device further includes:
[0100] The judgment module is configured to determine whether the current running state of the parasitic application matches a preset running state, wherein the preset running state is the running state required by the parasitic application when executing the acquired lifecycle event;
[0101] The step of forwarding the lifecycle events to the parasitic application and the host application respectively includes:
[0102] The forwarding module 502 is specifically configured to: stop sending the lifecycle event to the parasitic application when the current running state does not match the preset running state, and send the result of stopping sending the lifecycle event to the host application.
[0103] The control module 503 is specifically configured to control the host application to execute and stop business functions that match the results of forwarding the lifecycle event to the parasitic application.
[0104] Optionally, the device further includes:
[0105] The second acquisition unit is configured to acquire the Instrumentation object of the operating system;
[0106] The second program creation unit is configured to construct a second proxy object based on the Instrumentation object of the operating system, wherein the second proxy object is used to receive lifecycle events sent by the operating system to the host application and forward the lifecycle events to the host application;
[0107] The second program replacement unit is configured to replace the operating system's Instrumentation object with the second proxy object;
[0108] The second event acquisition unit is configured to acquire lifecycle events sent by the operating system to the host application through the second proxy object, and determine whether to send the lifecycle events to the host application based on the running status of the host application.
[0109] Optionally, the business function includes one of the following:
[0110] A pop-up window matching the lifecycle event, a floating window matching the lifecycle event, and a countdown component matching the lifecycle event.
[0111] The specific implementation methods of each functional module of the device in the above embodiments have been described in detail in the section on methods, and will not be repeated here.
[0112] The following is for reference. Figure 6 This diagram illustrates a structural schematic of an electronic device 600 suitable for implementing embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0113] like Figure 6 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0114] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0115] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0116] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0117] In some implementations, electronic devices can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0118] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0119] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire lifecycle events sent by the operating system to a parasitic application running on a host application; forward the lifecycle events to both the parasitic application and the host application; control the parasitic application to execute the lifecycle events; and control the host application to execute business functions matching the lifecycle events.
[0120] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0121] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0122] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules are not, in some cases, intended to limit the functionality of the module itself.
[0123] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0124] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0125] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0126] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0127] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. A lifecycle event management method, characterized in that, include: Obtain lifecycle events sent by the operating system to the parasitic application running on the host application; The lifecycle events are forwarded to both the parasitic application and the host application. Control the parasitic application to execute the lifecycle event and control the host application to execute business functions that match the lifecycle event; Determine whether the current running state of the parasitic application matches a preset running state, wherein the preset running state is the running state required by the parasitic application when executing the acquired lifecycle event; If the current running state does not match the preset running state, stop sending the lifecycle event to the parasitic application, and send the result of stopping sending the lifecycle event to the host application. Control the host application to execute and stop business functions that match the results of forwarding the lifecycle events to the parasitic application.
2. The lifecycle event management method according to claim 1, characterized in that, The acquisition of lifecycle events sent by the operating system to the parasitic application running on the host application includes: Obtain the Instrumentation object of the host application; Construct a first proxy object based on the Instrumentation object; Replace the Instrumentation object of the host application with the first proxy object; The lifecycle events sent by the operating system to the parasitic application are obtained through the first proxy object; The step of forwarding the lifecycle events to the parasitic application and the host application respectively includes: The lifecycle events are forwarded to the parasitic application and the host application respectively through the first proxy object.
3. The lifecycle event management method according to claim 2, characterized in that, The step of obtaining the Instrumentation object of the host application includes: The host application's Instrumentation object is hooked through a hook function that runs in the virtual machine.
4. The lifecycle event management method according to any one of claims 1 to 3, characterized in that, The method further includes: Obtain the Instrumentation object of the operating system; A second proxy object is constructed based on the Instrumentation object of the operating system, wherein the second proxy object is used to receive lifecycle events sent by the operating system to the host application and forward the lifecycle events to the host application; Replace the Instrumentation object of the operating system with the second proxy object; The second proxy object obtains the lifecycle events sent by the operating system to the host application, and determines whether to send the lifecycle events to the host application based on the running status of the host application.
5. The lifecycle event management method according to claim 1, characterized in that, The business function includes one of the following: A pop-up window matching the lifecycle event, a floating window matching the lifecycle event, and a countdown component matching the lifecycle event.
6. A lifecycle event management device, characterized in that, include: The acquisition module is configured to acquire lifecycle events sent by the operating system to the parasitic application running on the host application; The forwarding module is configured to forward the lifecycle events to the parasitic application and the host application, respectively. The control module is configured to control the parasitic application to execute the lifecycle event and to control the host application to execute business functions that match the lifecycle event; The judgment module is configured to determine whether the current running state of the parasitic application matches a preset running state, wherein the preset running state is the running state required by the parasitic application when executing the acquired lifecycle event; The forwarding module is configured to: stop sending the lifecycle event to the parasitic application when the current running state does not match the preset running state, and send the result of stopping sending the lifecycle event to the host application. The control module is also configured to control the host application to execute and stop business functions that match the result of forwarding the lifecycle event to the parasitic application.
7. The lifecycle event management device according to claim 6, characterized in that, The acquisition module includes: The acquisition unit is configured to acquire the Instrumentation object of the host application; The program creation unit is configured to construct a first proxy object based on the Instrumentation object; The program replacement unit is configured to replace the Instrumentation object of the host application with the first proxy object; The event acquisition unit is configured to acquire lifecycle events sent by the operating system to the parasitic application through the first proxy object; The forwarding module is specifically configured to forward the lifecycle events to the parasitic application and the host application respectively through the first proxy object.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processing device, it implements the steps of the method described in any one of claims 1-5.
9. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-5.
Citation Information
Patent Citations
Application processing method and device, terminal and storage medium
CN112492091A