WO2023116167A1 - 生命周期事件管理方法、装置、存储介质以及电子设备 - Google Patents

生命周期事件管理方法、装置、存储介质以及电子设备 Download PDF

Info

Publication number
WO2023116167A1
WO2023116167A1 PCT/CN2022/126729 CN2022126729W WO2023116167A1 WO 2023116167 A1 WO2023116167 A1 WO 2023116167A1 CN 2022126729 W CN2022126729 W CN 2022126729W WO 2023116167 A1 WO2023116167 A1 WO 2023116167A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
life cycle
parasitic
host application
event
Prior art date
Application number
PCT/CN2022/126729
Other languages
English (en)
French (fr)
Inventor
金炼城
袁科杰
钟炳鑫
Original Assignee
北京有竹居网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京有竹居网络技术有限公司 filed Critical 北京有竹居网络技术有限公司
Publication of WO2023116167A1 publication Critical patent/WO2023116167A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present disclosure relates to the field of computer technologies, and in particular, to a life cycle event management method, device, storage medium and electronic equipment.
  • a parasitic application is an application that can be used on the host application without downloading and installing.
  • the host application provides the operating environment required for the parasitic application to run, such as running the parasitic application through a sandbox, without installing and registering in the system.
  • the parasitic application runs in the sandbox environment of the host application, how to manage the life cycle of the parasitic application becomes a technical problem to be solved.
  • the present disclosure provides a lifecycle event management method, including:
  • the parasitic application is controlled to execute the lifecycle event and the host application is controlled to execute a service function matching the lifecycle event.
  • a lifecycle event management device including:
  • An acquisition module configured to acquire lifecycle events sent by the operating system to the parasitic application running on the host application
  • a forwarding module configured to forward the life cycle event to the parasitic application and the host application respectively;
  • a control module configured to control the parasitic application to execute the lifecycle event and control the host application to execute a service function matching the lifecycle event.
  • the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the method described in the first aspect are implemented.
  • an electronic device including:
  • a processing device configured to execute the computer program in the storage device to implement the steps of the method of the first aspect.
  • the original life cycle function call logic of the parasitic application can be blocked, and the intercepted life cycle events can be forwarded to the parasitic application and the host application, so that when the parasitic application executes the life cycle event, the host application can perceive the life cycle event executed by the parasitic application, and the host application simultaneously executes the business function matching the life cycle event.
  • Fig. 1 is a schematic flowchart of a life cycle event management method provided according to an exemplary embodiment
  • Fig. 2 is a schematic flowchart of a life cycle event management method provided according to another exemplary embodiment
  • Fig. 3 is a schematic diagram of the principle of providing life cycle event management according to an exemplary embodiment
  • Fig. 4 is a schematic flowchart of a method for managing lifecycle events according to yet another exemplary embodiment
  • Fig. 5 is a schematic diagram of module connections of a lifecycle event management device according to yet another exemplary embodiment
  • Fig. 6 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • An operating system is a computer program that manages computer hardware and software resources.
  • the operating system needs to handle basic tasks such as managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating the network, and managing the file system.
  • the operating system also provides an interface for the user to interact with the system.
  • the operating system may be an Android (Android) operating system, an Apple operating system (iphone Operation System, IOS), a Hongmeng operating system, and the like.
  • the host application can be referred to as the host for short, and can be used to represent the application body that provides the operating environment for the integrated module.
  • the host application running on the client can be referred to as a social application as an example.
  • the social application may have the ability to open and display the applet.
  • the installation-free platform is integrated with a free-installation framework (engine), and the installation-free platform can run other native applications.
  • a parasitic application refers to an application program that is subordinate to the host application and runs depending on the operating environment provided by the host application.
  • Lifecycle events also known as lifecycle functions, refer to a series of executive functions that pass through the process from object creation to destruction.
  • the Instrumentation object is an object used to monitor the interaction between the application and the system, and it is instantiated before all components of the application.
  • Hook function is a program segment for processing messages, and the hook function is hung into the system through system calls. Whenever a specific message is sent, before reaching the destination window, the hook function first captures the message, that is, the hook function first obtains the control right. At this time, the hook function can process (change) the message, or continue to deliver the message without processing it, or forcibly end the message delivery.
  • Fig. 1 is a schematic flowchart of a method for managing life cycle events provided according to an 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, which can be implemented in software and/or hardware and configured in the electronic device.
  • the life cycle event management method provided by the embodiment of the present disclosure may include the following steps.
  • lifecycle events may be lifecycle functions such as callActivityOnCreate, callActivityOnstart, callActivityOnResume, callActivityOnPause, callActivityOnStop, callActivityOnDestroy, etc.
  • the installation-free framework (engine) of the host application receives the life cycle event triggered by the operating system and needs to be executed by the parasitic application, and then intercepts the life cycle event in the installation-free framework.
  • the operating system provides life cycle functions (processing functions) at key time points.
  • the life cycle event triggered by the operating system is transmitted to the host application's installation-free framework through the instrumentation of the operating system, and then the host application transmits the life cycle event to the parasitic application through the instrumentation of its installation-free framework, and the parasitic application Call the lifecycle function of the corresponding lifecycle event to execute the corresponding lifecycle event.
  • the life cycle events sent by the operating system to the parasitic application are intercepted, and are no longer directly forwarded to the parasitic application.
  • acquiring the lifecycle events that need to be executed by the parasitic application triggered by the operating system refers to interrupting the original lifecycle function call logic of the parasitic application.
  • the electronic device can proxy the Instrumentation of the installation-free framework of the host application through the proxy program, so as to obtain the life cycle events that need to be executed by the parasitic application triggered by the operating system in the installation-free framework.
  • the life cycle events are forwarded to the parasitic application and the host application respectively, so that the host application can perceive the life cycle that the parasitic application needs to execute. event.
  • the parasitic application After forwarding the life cycle event to the parasitic application and the host application respectively, the parasitic application responds to the life cycle event and invokes the corresponding life cycle function, and the host application executes the business function matching the life cycle event.
  • the host application determines the corresponding service functions according to the lifecycle events.
  • the business function may include one of a pop-up window matching the life cycle event, a floating window matching the life cycle event, and a countdown component matching the life cycle event.
  • a pop-up window refers to a window that pops up automatically when a webpage or an application program is opened. For example, when the life cycle event is displaying advertisement content on the page of the parasitic application, the host application responds to the life cycle event and displays a pop-up window in the host application. Application lifecycle events.
  • the floating window refers to floating a movable window on the surface of the application so as to open different applications. For example, when the life cycle event is to temporarily exit the interface of the parasitic application, the host application responds to the life cycle event by displaying a floating window through which the user can return to the parasitic application to match the life cycle event of the parasitic application.
  • the countdown component refers to the countdown clock.
  • the host application displays a countdown component in response to the life cycle event, so as to count down the time for page exit.
  • the original life cycle function call logic of the parasitic application can be blocked, and the intercepted life cycle events can be forwarded to the parasitic application and the host application. Therefore, when the parasitic application executes the life cycle event, the host application can perceive the life cycle event executed by the parasitic application, and the host application simultaneously executes the service function matching the life cycle event.
  • Fig. 2 is a schematic flowchart of a method for managing life cycle events 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, which can be implemented in software and/or hardware and configured in the electronic device.
  • the life cycle event management provided by the embodiment of the present disclosure may include the following steps.
  • the Instrumentation object of the host application can track the life cycle of Application (object) and Activity (an application component).
  • object an application component
  • callActivityOnCreate, callApplicationOnCreate, newActivity, callActivityOnNewIntent, etc. basically call the corresponding method of the Instrumentation object in all life cycle calls of Application and Activity.
  • the Instrumentation object of the host application can be hooked through a hook function running in the virtual machine.
  • the virtual machine can be a JVM (Java Virtual Machine, Java Virtual Machine), or an ART virtual machine.
  • JVM Java Virtual Machine, Java Virtual Machine
  • ART virtual machine an ART virtual machine.
  • instrumentation object of the host application can be directly hooked through the hook function running in the virtual machine, without knowing the source code of the installation-free framework of the host application.
  • the first proxy object since the first proxy object is built based on the Instrumentation object, the first proxy object inherits the original methods of the Instrumentation object, that is, the first proxy object has the function of the Instrumentation object sending lifecycle events to the parasitic application. It is worth noting that the first proxy object is constructed by adding a preset judgment method on the basis of the Instrumentation object.
  • the first proxy object is configured to receive a life cycle event that needs to be executed by the parasitic application triggered by the operating system, and forward the life cycle event to the parasitic application and/or the host application when the life cycle event meets a preset condition.
  • replacing the Instrumentation object in the installation-free framework of the host application with the first proxy object is to insert the first proxy object into the position of the Instrumentation object in the installation-free framework. In this way, it can not only ensure that the first proxy object takes effect, but also avoid interference with the Instrumentation logic of the installation-free framework itself.
  • steps S210 to S230 are actually HOOKing (hooking) the Instrumentation object of the host application, so that the HOOKed Instrumentation object can execute a preset method.
  • the first proxy object since the first proxy object is built based on the Instrumentation object and inherits the methods of the Instrumentation object, the first proxy object can receive life cycle events triggered by the operating system that the parasitic application needs to execute.
  • S250 Respectively forward the lifecycle event to the parasitic application and the host application through the first proxy object.
  • the first proxy object After the first proxy object receives a life cycle event sent by the operating system that needs to be executed by the parasitic application, the first proxy object simultaneously forwards the life cycle event to the parasitic application and the host application.
  • the first proxy object is used to receive the life cycle event that the parasitic application needs to execute triggered by the operating system, and forward the life cycle event to the parasitic application and the host application.
  • step S260 for the specific implementation manner of step S260, reference may be made to step S130, which will not be described in detail here.
  • Fig. 3 is a schematic diagram of the principle of providing lifecycle event management according to an exemplary embodiment.
  • the operating system sends the life cycle events that the parasitic application needs to execute to the first proxy object running in the virtual machine.
  • the first proxy object passes the host application
  • the instant framework (engine) of ® forwards this lifecycle event to the host application.
  • the first proxy object forwards the lifecycle event to the host application, so that the host application can perceive the lifecycle event executed by the parasitic application.
  • the life cycle events that the parasitic application needs to execute can be forwarded to the parasitic application and the host application, so that the host application can perceive when the parasitic application executes the life cycle event A life cycle event executed by a parasitic application, and executes a business function matching the life cycle event.
  • the electronic device may also obtain the Instrumentation object of the operating system, and build a second proxy object based on the Instrumentation object of the operating system, where the second proxy object is used to receive the life cycle event sent by the operating system to the host application and Forward the life cycle event to the host application, and then replace the Instrumentation object of the operating system with a second proxy object, so as to obtain the life cycle event sent by the operating system to the host application through the second proxy object, and determine whether to Send this lifecycle event to the host application.
  • 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.
  • the Instrumentation object of the operating system is used to communicate with the host application, and the host application invokes the life cycle function through the Instrumentation object of the operating system.
  • the second proxy object can receive life cycle events sent by the operating system to the host application. , it can also determine whether to send a life cycle event that needs to be executed by the host application to the host application according to the running status of the host application.
  • Fig. 4 is a schematic flowchart of a method for managing lifecycle events according to yet another exemplary embodiment. As shown in Fig. 4, the life cycle management method may include the following steps.
  • Step S410 acquiring life cycle events sent by the operating system to the parasitic application running on the host application.
  • step S410 for the specific implementation manner of step S410, reference may be made to step S110, which will not be described in detail here.
  • Step S420 judging whether the current running state of the parasitic application is consistent with a preset running state, wherein the preset running state is a running state required by the parasitic application when executing the obtained life cycle event.
  • the preset running state refers to the running state required by the parasitic application when executing the obtained lifecycle event, that is, the preset running state is used to represent whether the parasitic application has an execution environment for executing 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 currently does not have an execution environment for executing the life cycle event; if the current running state of the parasitic application matches the preset running state, it means that the parasitic application currently has the ability to execute the The execution environment for lifecycle events.
  • the current running state of the parasitic application can be obtained through the first proxy object, and the obtained current running state is compared with the preset running state corresponding to the obtained lifecycle event to determine whether the current running state is consistent with Whether the preset operating status matches.
  • Step S430 if the current running state does not match the preset running state, stop sending the lifecycle event to the parasitic application, and stop sending the result of the lifecycle event to the parasitic application sent to the host application.
  • the current running state of the parasitic application does not match the preset running state corresponding to the life cycle event, it means that the parasitic application does not have an execution environment for executing the life cycle event, so stop forwarding the life cycle event to the parasitic application to Block the logic of calling this lifecycle event by the parasitic application.
  • the result of stopping the forwarding of the life cycle event to the parasitic application may be forwarded to the host application, so that the host application can perceive the result of the failure of the parasitic application to call the corresponding life cycle event. For example, when the page executes the life cycle event of closing the page, it needs to conform to the preset running state of the closing page. If it does not meet the requirement, the life cycle function corresponding to the life cycle event cannot be called.
  • Step S440 controlling the host application to execute a service function that matches the result of stopping forwarding the lifecycle event to the parasitic application.
  • the host application may execute a service function that matches the result of stopping forwarding the life cycle event to the parasitic application.
  • the business function that matches the result of stopping the forwarding of lifecycle events to the parasitic application may be a pop-up window, floating window, countdown component, etc. that matches the result of stopping the forwarding of lifecycle events to the parasitic application.
  • the original calling logic of the parasitic application can be blocked, and the host application can perceive The result of the failure of the parasitic application to call the life cycle function, so as to execute the corresponding business function, so as to realize the preset functional requirements.
  • Fig. 5 is a schematic diagram of module connections of a lifecycle event management device according to yet another exemplary embodiment.
  • the life cycle management apparatus may include an acquisition module 501 , a forwarding module 502 and a control module 503 . in:
  • the acquiring module 501 is configured to acquire lifecycle events sent by the operating system to the parasitic application running on the host application;
  • the control module 503 is configured to control the parasitic application to execute the lifecycle event and control the host application to execute a service function matching the lifecycle event.
  • the obtaining module 501 includes:
  • the first obtaining unit is configured to obtain the Instrumentation object of the host application
  • a first program creating unit configured to build a first proxy object based on the Instrumentation object
  • a first program replacement unit configured to replace the Instrumentation object of the host application with the first proxy object
  • a first event obtaining unit configured to obtain, through the first proxy object, life cycle events sent by the operating system to the parasitic application.
  • the forwarding module 502 is specifically configured to: respectively forward the life cycle event to the parasitic application and the host application through the first proxy object.
  • the first acquiring unit is specifically configured to: hook the Instrumentation object of the host application through a hook function running in a virtual machine.
  • the device also includes:
  • a judging module configured to judge whether the current running state of the parasitic application is consistent with a preset running state, wherein the preset running state is the running required by the parasitic application when executing the obtained life cycle event state;
  • the forwarding of the life cycle events to the parasitic application and the host application respectively includes:
  • 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 stop sending the life cycle event to the parasitic application. sending the result of said lifecycle event to said host application;
  • the control module 503 is specifically configured to: control the host application to execute a service function that matches the result of stopping forwarding the lifecycle event to the parasitic application.
  • the judging module is specifically configured to obtain the current running state of the parasitic application through the first proxy object, and compare the obtained current running state with the preset running state corresponding to the obtained life cycle event, To determine whether the current operating state is consistent with the preset operating state.
  • the device also includes:
  • the second acquiring unit is configured to acquire the Instrumentation object of the operating system
  • 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 configured to receive a lifecycle event sent by the operating system to the host application and send a message to the host application.
  • the host application forwards the life cycle event;
  • a second program replacement unit configured to replace the Instrumentation object of the operating system with the second proxy object
  • the second event obtaining unit is configured to obtain the life cycle event sent by the operating system to the host application through the second proxy object, and determine whether to send the life cycle event to the host application according to the running state of the host application. Describe the host application.
  • the business functions include one of the following:
  • FIG. 6 it shows a schematic structural diagram of an electronic device 600 suitable for implementing an embodiment of the present disclosure.
  • the terminal equipment in the embodiment of the present disclosure may include but not limited to such as mobile phone, notebook computer, digital broadcast receiver, PDA (personal digital assistant), PAD (tablet computer), PMP (portable multimedia player), vehicle terminal (such as mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers and the like.
  • the electronic device shown in FIG. 6 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
  • an electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may be randomly accessed according to a program stored in a read-only memory (ROM) 602 or loaded from a storage device 608.
  • a processing device such as a central processing unit, a graphics processing unit, etc.
  • RAM memory
  • various programs and data necessary for the operation of the electronic device 600 are also stored.
  • the processing device 601, ROM 602, and RAM 603 are connected to each other through a bus 604.
  • An input/output (I/O) interface 605 is also connected to the bus 604 .
  • the following devices can be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 607 such as a computer; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609.
  • the communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While FIG. 6 shows electronic device 600 having various means, it should be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602.
  • the processing device 601 When the computer program is executed by the processing device 601, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, 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 device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
  • the electronic device can communicate with any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium (for example, communication networks) interconnect.
  • network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol)
  • Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: obtains a life cycle event sent by the operating system to the parasitic application running on the host application; Forwarding the lifecycle events to the parasitic application and the host application respectively; controlling the parasitic application to execute the lifecycle events and controlling the host application to execute business functions matching the lifecycle events.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as "C" or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer may be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, using an Internet service provider to connected via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service provider for example, using an Internet service provider to connected via the Internet.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the module does not constitute a limitation on the module itself under certain circumstances.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs System on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may 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 may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read-only memory
  • optical storage devices magnetic storage devices, or any suitable combination of the foregoing.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本公开涉及一种生命周期事件管理方法、装置、存储介质以及电子设备,涉及计算机技术领域,该方法包括以下步骤:获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件,将生命周期事件分别转发至寄生应用以及宿主应用,控制寄生应用执行生命周期事件以及控制宿主应用执行与生命周期事件相匹配的业务功能。

Description

生命周期事件管理方法、装置、存储介质以及电子设备
本公开要求于2021年12月20日提交的,申请名称为“生命周期事件管理方法、装置、存储介质以及电子设备”的、中国专利申请号为“202111565125.5”的优先权,该中国专利申请的全部内容通过引用结合在本公开中。
技术领域
本公开涉及计算机技术领域,具体地,涉及一种生命周期事件管理方法、装置、存储介质以及电子设备。
背景技术
随着智能手机等移动终端的大量普及应用,智能手机能够支持的应用越来越多,功能越来越强大。相关技术中,为了使得用户使用应用程序更加便利,开发出了寄生应用。寄生应用是无需下载安装即可在宿主应用上使用的应用程序,宿主应用为寄生应用提供运行所需的运行环境,如通过沙盒运行寄生应用,而无需在系统中安装注册。但是,由于寄生应用运行在宿主应用的沙盒环境中,如何对寄生应用的生命周期进行管理成为需要解决的技术问题。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
第一方面,本公开提供一种生命周期事件管理方法,包括:
获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件;
将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用;
控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
第二方面,本公开提供一种生命周期事件管理装置,包括:
获取模块,配置为获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件;
转发模块,配置为将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用;
控制模块,配置为控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现第一方面所述方法的步骤。
第四方面,本公开提供一种电子设备,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现第一方面所述方法的步 骤。
基于上述技术方案,通过对操作系统触发的需要寄生应用执行的生命周期事件进行拦截,可以阻断寄生应用原有的生命周期函数调用逻辑,并将拦截到的生命周期事件转发给寄生应用以及宿主应用,从而使得寄生应用在执行生命周期事件时,宿主应用能够感知到寄生应用执行的生命周期事件,且宿主应用同时执行与该生命周期事件相匹配的业务功能。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是根据一示例性实施例提供的一种生命周期事件管理方法的流程示意图;
图2是根据另一示例性实施例提供的一种生命周期事件管理方法的流程示意图;
图3是根据一示例性实施例提供生命周期事件管理的原理示意图;
图4是根据又一示例性实施例提供一种生命周期事件管理方法的流程示意图;
图5是根据又一示例性实施例提供一种生命周期事件管理装置的模块连接示意图;
图6是根据一示例性实施例提供一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
为了方便理解,下面对本公开实施例涉及的名词进行介绍。
操作系统:操作系统(operating system,简称OS)是管理计算机硬件与软件资源的计算机程序。操作系统需要处理如管理与配置内存、决定系统资源供需的优先次序、控制输入设备与输出设备、操作网络与管理文件系统等基本事务。操作系统也提供一个让用户与系统交互的操作界面。在本公开实施例中,操作系统可以是Android(安卓)操作系统、苹果操作系统(iphone Operation System,IOS)、鸿蒙操作系统等等。
宿主应用:宿主应用可以简称为宿主,可以用于表示为集成模块提供运行环境的应用主体,例如,以运行在客户端中的宿主应用为社交应用为例,当社交应用中集成了小程序引擎的模块时,该社交应用可以具备打开并展示小程序的能力。又例如,以运行在客户端中的宿主应用为免安装平台为例,免安装平台集成有免安装框架(引擎),该免安装平台可以运行其他原生应用程序。
寄生应用:寄生应用是指从属于宿主应用,依赖于宿主应用所提供的运行环境而运行的应用程序。
生命周期事件:生命周期事件又称为生命周期函数,是指从对象的创建到销毁的过程中,经过的一系列执行性函数。
Instrumentation对象:Instrumentation对象是用于监控应用与系统交互的对象,其在应用的所有组件之前进行实例化。
钩子函数:钩子函数是一个处理消息的程序段,通过系统调用,将钩子函数挂入系统。每当特定的消息发出,在没有到达目的窗口前,钩子函数就先捕获该消息,即钩子函数先得到控制权。这时,钩子函数可以加工处理(改变)该消息,也可以不作处理而继续传递该消息,还可以强制结束消息的传递。
图1是根据一示例性实施例提供的一种生命周期事件管理方法的流程示意图。本实施例公开的生命周期事件管理方法可以通过电子设备执行,具体可以通过生命周期事件管理装置来执行,该装置可以有软件和/或硬件的方式实现,配置于电子设备中。请参考图1,本公开实施例提供的生命周期事件管理方法可以包括以下步骤。
S110,获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件。
这里,生命周期事件可以是callActivityOnCreate、callActivityOnstart、callActivityOnResume、callActivityOnPause、callActivityOnStop、callActivityOnDestroy等生命周期函数。
其中,宿主应用的免安装框架(引擎)接收操作系统触发的需要寄生应用执行的生命周 期事件,然后,在免安装框架中拦截该生命周期事件。应当理解的是,寄生应用的每个页面从打开到关闭,操作系统都提供了关键时间点的生命周期函数(处理函数)。一般而言,操作系统触发的生命周期事件通过操作系统的Instrumentation向宿主应用的免安装框架传递该生命周期事件,然后宿主应用通过其免安装框架的Instrumentation向寄生应用传递该生命周期事件,寄生应用调用该对应的生命周期事件的生命周期函数,执行对应的生命周期事件。但是,在本公开实施例中,在宿主应用的免安装框架中,将操作系统向寄生应用发送的生命周期事件进行拦截,不再直接转发至寄生应用。
可以理解的是,获取操作系统触发的寄生应用需要执行的生命周期事件是指中断寄生应用原有的生命周期函数调用逻辑。电子设备可以通过代理程序对宿主应用的免安装框架的Instrumentation进行代理,以在免安装框架中获取操作系统触发的寄生应用需要执行的生命周期事件。
S120,将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用。
这里,电子设备在将操作系统触发的寄生应用需要执行的生命周期事件进行拦截之后,分别将该生命周期事件转发至寄生应用以及宿主应用,以使宿主应用能够感知到寄生应用需要执行的生命周期事件。
S130,控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
这里,在分别将该生命周期事件转发至寄生应用以及宿主应用之后,寄生应用响应该生命周期事件,调用对应的生命周期函数,宿主应用则执行与该生命周期事件相匹配的业务功能。其中,在一些实施方式中,业务功能可以与生命周期事件具有一一对应的关系,当宿主应用感知到寄生应用要执行的生命周期事件时,根据该生命周期事件确定对应的业务功能。
示例性地,业务功能可以包括与生命周期事件匹配的弹窗、与生命周期事件匹配的悬浮窗和与生命周期事件相匹配的倒计时组件中的一种。
其中,弹窗是指打开网页、应用程序是自动弹出的窗口。例如,当生命周期事件是在寄生应用的页面中显示广告内容时,宿主应用响应于该生命周期事件,在宿主应用中显示弹窗,该弹窗的内容为“点击免广告”,以配合寄生应用的生命周期事件。
悬浮窗是指在应用的表面悬浮一可移动的窗口,以便打开不同应用。例如,当生命周期事件是暂时退出寄生应用的界面时,宿主应用响应于该生命周期事件,显示悬浮窗,用户可以通过该悬浮窗重新返回寄生应用,以配合寄生应用的生命周期事件。
倒计时组件是指倒计时时钟。例如,当生命周期事件是寄生应用退出当前页面时,宿主应用响应于该生命周期事件,显示倒计时组件,以对于页面退出的时间进行倒计时。
由此,通过对操作系统触发的需要寄生应用执行的生命周期事件进行拦截,可以阻断寄 生应用原有的生命周期函数调用逻辑,并将拦截到的生命周期事件转发给寄生应用以及宿主应用,从而使得寄生应用在执行生命周期事件时,宿主应用能够感知到寄生应用执行的生命周期事件,且宿主应用同时执行与该生命周期事件相匹配的业务功能。
图2是根据另一示例性实施例提供的一种生命周期事件管理方法的流程示意图。本实施例公开的生命周期事件管理方法可以通过电子设备执行,具体可以通过生命周期事件管理装置来执行,该装置可以有软件和/或硬件的方式实现,配置于电子设备中。请参考图2,本公开实施例提供的生命周期事件管理可以包括以下步骤。
S210,获取所述宿主应用的Instrumentation对象。
这里,宿主应用的Instrumentation对象可以跟踪Application(对象)及Activity(一个应用程序组件)的生命周期。比如,callActivityOnCreate、callApplicationOnCreate、newActivity、callActivityOnNewIntent等基本在Application和Activity所有的生命周期调用中,都会先调用Instrumentation对象的相应方法。
在一些实施例中,可以通过在虚拟机中运行的钩子函数钩取宿主应用的Instrumentation对象。
其中,虚拟机可以是JVM(Java Virtual Machine,Java虚拟机),也可以是ART虚拟机。
应当理解的是,通过在虚拟机中运行的钩子函数可以直接钩取宿主应用的Instrumentation对象,无需知道宿主应用的免安装框架的源代码。
S220,基于所述Instrumentation对象构建第一代理对象。
这里,由于第一代理对象是基于Instrumentation对象构建的,第一代理对象继承Instrumentation对象原有的方法,即第一代理对象具有Instrumentation对象向寄生应用发送生命周期事件的功能。值得说明的是,第一代理对象是在Instrumentation对象的基础上加入预设的判断方法而构建的。例如,第一代理对象用于接收操作系统触发的寄生应用需要执行的生命周期事件,并在该生命周期事件符合预设条件的情况下将该生命周期事件转发至寄生应用和/或宿主应用。
S230,将所述宿主应用的Instrumentation对象替换为所述第一代理对象。
这里,将宿主应用的免安装框架中的Instrumentation对象替换为第一代理对象是将第一代理对象插入到免安装框架中Instrumentation对象所在的位置。这样,既能够保证第一代理对象生效,而且还能避免对免安装框架本身的Instrumentation逻辑造成干扰。
可以理解的是,步骤S210至步骤S230实际上是对宿主应用的Instrumentation对象进行HOOK(钩子)处理,以使得HOOK处理后的Instrumentation对象能够执行预设的方法。
S240,通过所述第一代理对象获取所述操作系统向所述寄生应用发送的生命周期事件。
这里,由于第一代理对象是基于Instrumentation对象构建的,第一代理对象继承Instrumentation对象的方法,因此,第一代理对象可以接收到操作系统触发的寄生应用需要执行的生命周期事件。
S250,通过所述第一代理对象将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用。
这里,第一代理对象在接收到操作系统发送的需要寄生应用执行的生命周期事件之后,第一代理对象将该生命周期事件同时转发至寄生应用与宿主应用。
可以理解的是,第一代理对象用于接收操作系统触发的寄生应用需要执行的生命周期事件,并向寄生应用与宿主应用转发该生命周期事件。
S260,控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
这里,步骤S260的具体实施方式可以参考步骤S130,在此不再详细赘述。
下面结合附图3对上述实施方式进行详细说明。
图3是根据一示例性实施例提供生命周期事件管理的原理示意图。如图3所示,操作系统将寄生应用需要执行的生命周期事件发送至在虚拟机中运行的第一代理对象,第一代理对象在接收到该生命周期事件之后,第一代理对象通过宿主应用的免安装框架(引擎)将该生命周期事件转发至寄生应用。同时,第一代理对象将该生命周期事件转发至宿主应用,以使宿主应用能够感知寄生应用执行的生命周期事件。
由此,通过基于宿主应用的Instrumentation对象构建的第一代理对象,可以将寄生应用需要执行的生命周期事件转发至寄生应用以及宿主应用,使得寄生应用在执行生命周期事件时,宿主应用能够感知到寄生应用执行的生命周期事件,并执行与该生命周期事件相匹配的业务功能。
在一些实施方式中,电子设备还可以获取操作系统的Instrumentation对象,并基于操作系统的Instrumentation对象构建第二代理对象,其中,第二代理对象用于接收操作系统向宿主应用发送的生命周期事件并向宿主应用转发该生命周期事件,然后将操作系统的Instrumentation对象替换为第二代理对象,以通过第二代理对象获取操作系统向宿主应用发送的生命周期事件,并根据宿主应用的运行状态确定是否将该生命周期事件发送至宿主应用。
这里,第二代理对象的构建过程与第一代理对象一致,在此不再详细描述。
其中,操作系统的Instrumentation对象用于与宿主应用进行通信,宿主应用通过操作系统Instrumentation对象调用生命周期函数。通过将操作系统的Instrumentation对象进行HOOK处理,在操作系统的Instrumentation对象中加入预设的判断方法构建第二代理对象,可以使 得第二代理对象既能够接收到操作系统向宿主应用发送的生命周期事件,也能够根据宿主应用的运行状态确定是否向宿主应用发送需要宿主应用执行的生命周期事件。
图4是根据又一示例性实施例提供一种生命周期事件管理方法的流程示意图。如图4所示,该生命周期管理方法可以包括以下步骤。
步骤S410,获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件。
这里,步骤S410的具体实施方式可以参考步骤S110,在此不再详细赘述。
步骤S420,判断所述寄生应用的当前运行状态与预设运行状态是否相符,其中,所述预设运行状态是所述寄生应用在执行获取到的所述生命周期事件时所需的运行状态。
这里,预设运行状态是指寄生应用在执行获取到的生命周期事件时所需的运行状态,即预设运行状态用于表征寄生应用是否具有执行该生命周期事件的执行环境。若寄生应用的当前运行状态与预设运行状态不符,表示寄生应用当前不具有执行该生命周期事件的执行环境;若寄生应用的当前运行状态与预设运行状态相符,表示寄生应用当前具有执行该生命周期事件的执行环境。
在一些实施方式中,可以通过第一代理对象获取寄生应用的当前运行状态,并将获取到的当前运行状态与获取到的生命周期事件对应的预设运行状态进行比较,以判断当前运行状态与预设运行状态是否相符。
可以理解的是,不同的生命周期事件对应不同的预设运行状态。比如,页面在创建或关闭时,其所需的执行环境不同,则对应的预设运行状态也不相同。
步骤S430,在所述当前运行状态与所述预设运行状态不符的情况下,停止向所述寄生应用发送所述生命周期事件,以及将停止向所述寄生应用发送所述生命周期事件的结果发送至所述宿主应用。
这里,若寄生应用的当前运行状态与该生命周期事件对应的预设运行状态不符,表示寄生应用不具有执行该生命周期事件的执行环境,因此,停止将该生命周期事件转发至寄生应用,以阻断寄生应用调用该生命周期事件的逻辑。同时,可以将停止将生命周期事件转发至寄生应用的结果转发至宿主应用,以使宿主应用能够感知到寄生应用调用对应的生命周期事件失败的结果。比如,页面在执行关闭页面的生命周期事件时,需要符合关闭页面的预设运行状态,若不符合,则无法调用该生命周期事件对应的生命周期函数。
步骤S440,控制所述宿主应用执行与停止将所述生命周期事件转发至所述寄生应用的结果相匹配的业务功能。
这里,宿主应用在感知到寄生应用调用对应的生命周期事件失败的结果之后,宿主应用可以执行与停止将生命周期事件转发至寄生应用的结果相匹配的业务功能。其中,与停止将生命周期事件转发至寄生应用的结果相匹配的业务功能可以是与停止将生命周期事件转发 至寄生应用的结果相匹配的弹窗、悬浮窗、倒计时组件等。
由此,通过在寄生应用的当前运行状态与该生命周期事件对应的预设运行状态不符的情况下,拦截该生命周期事件,可以阻断寄生应用原本的调用逻辑,并且,宿主应用可以感知到寄生应用调用生命周期函数失败的结果,从而执行对应的业务功能,从而实现预设的功能需求。
图5是根据又一示例性实施例提供一种生命周期事件管理装置的模块连接示意图。如图5所示,该生命周期管理装置可以包括获取模块501、转发模块502以及控制模块503。其中:
获取模块501,配置为获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件;
转发模块502,配置为将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用;
控制模块503,配置为控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
在一些实施例中,所述获取模块501包括:
第一获取单元,配置为获取所述宿主应用的Instrumentation对象;
第一程序创建单元,配置为基于所述Instrumentation对象构建第一代理对象;
第一程序替换单元,配置为将所述宿主应用的Instrumentation对象替换为所述第一代理对象;
第一事件获取单元,配置为通过所述第一代理对象获取所述操作系统向所述寄生应用发送的生命周期事件。
所述转发模块502具体配置为:通过所述第一代理对象将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用。
在一些实施例中,所述第一获取单元具体配置为:通过在虚拟机中运行的钩子函数钩取所述宿主应用的Instrumentation对象。
在一些实施例中,所述装置还包括:
判断模块,配置为判断所述寄生应用的当前运行状态与预设运行状态是否相符,其中,所述预设运行状态是所述寄生应用在执行获取到的所述生命周期事件时所需的运行状态;
所述将所述生命周期事件分别转发至所述寄生应用以及宿主应用,包括:
所述转发模块502具体配置为:在所述当前运行状态与所述预设运行状态不符的情况下,停止向所述寄生应用发送所述生命周期事件,以及将停止向所述寄生应用发送所述生命周期事件的结果发送至所述宿主应用;
所述控制模块503具体配置为:控制所述宿主应用执行与停止将所述生命周期事件转发 至所述寄生应用的结果相匹配的业务功能。
在一些实施例中,判断模块具体用于通过第一代理对象获取所述寄生应用的当前运行状态,并将获取到的当前运行状态与获取到的生命周期事件对应的预设运行状态进行比较,以判断当前运行状态与预设运行状态是否相符。
在一些实施例中,所述装置还包括:
第二获取单元,配置为获取所述操作系统的Instrumentation对象;
第二程序创建单元,配置为基于所述操作系统的Instrumentation对象构建第二代理对象,其中,所述第二代理对象用于接收所述操作系统向所述宿主应用发送的生命周期事件并向所述宿主应用转发该生命周期事件;
第二程序替换单元,配置为将所述操作系统的Instrumentation对象替换为所述第二代理对象;
第二事件获取单元,配置为通过所述第二代理对象获取所述操作系统向所述宿主应用发送的生命周期事件,并根据所述宿主应用的运行状态确定是否将该生命周期事件发送至所述宿主应用。
在一些实施例中,所述业务功能包括以下一种:
与所述生命周期事件匹配的弹窗、与所述生命周期事件匹配的悬浮窗、与所述生命周期事件相匹配的倒计时组件。
关于上述实施例中的装置的各个功能模块的具体实施方式,已在关于方法的部分进行了详细说明,在此不再赘述。
下面参考图6,其示出了适于用来实现本公开实施例的电子设备600的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图6示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图6所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。
通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。 通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,电子设备可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备 执行时,使得该电子设备:获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件;将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用;控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM 或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (11)

  1. 一种生命周期事件管理方法,其包括:
    获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件;
    将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用;
    控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
  2. 根据权利要求1所述的生命周期事件管理方法,其中,所述获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件,包括:
    获取所述宿主应用的Instrumentation对象;
    基于所述Instrumentation对象构建第一代理对象;
    将所述宿主应用的Instrumentation对象替换为所述第一代理对象;
    通过所述第一代理对象获取所述操作系统向所述寄生应用发送的生命周期事件;
    所述将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用,包括:
    通过所述第一代理对象将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用。
  3. 根据权利要求2所述的生命周期事件管理方法,其中,所述获取所述宿主应用的Instrumentation对象,包括:
    通过在虚拟机中运行的钩子函数钩取所述宿主应用的Instrumentation对象。
  4. 根据权利要求1至3中任一项所述的生命周期事件管理方法,其中,所述方法还包括:
    判断所述寄生应用的当前运行状态与预设运行状态是否相符,其中,所述预设运行状态是所述寄生应用在执行获取到的所述生命周期事件时所需的运行状态;
    所述将所述生命周期事件分别转发至所述寄生应用以及宿主应用,包括:
    在所述当前运行状态与所述预设运行状态不符的情况下,停止向所述寄生应用发送所述生命周期事件,以及将停止向所述寄生应用发送所述生命周期事件的结果发送至所述宿主应用;
    所述控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能,包括
    控制所述宿主应用执行与停止将所述生命周期事件转发至所述寄生应用的结果相匹配的业务功能。
  5. 根据权利要求1至3中任一项所述的生命周期事件管理方法,其中,所述方法还包括:
    获取所述操作系统的Instrumentation对象;
    基于所述操作系统的Instrumentation对象构建第二代理对象,其中,所述第二代理对象用于接收所述操作系统向所述宿主应用发送的生命周期事件并向所述宿主应用转发该生命周期事件;
    将所述操作系统的Instrumentation对象替换为所述第二代理对象;
    通过所述第二代理对象获取所述操作系统向所述宿主应用发送的生命周期事件,并根据所述宿主应用的运行状态确定是否将该生命周期事件发送至所述宿主应用。
  6. 根据权利要求1所述的生命周期事件管理方法,其中,所述业务功能包括以下一种:
    与所述生命周期事件匹配的弹窗、与所述生命周期事件匹配的悬浮窗、与所述生命周期事件相匹配的倒计时组件。
  7. 根据权利要求4所述的生命周期事件管理方法,其中,所述判断所述寄生应用的当前运行状态与预设运行状态是否相符,包括:
    通过第一代理对象获取所述寄生应用的当前运行状态,并将获取到的当前运行状态与获取到的生命周期事件对应的预设运行状态进行比较,以判断当前运行状态与预设运行状态是否相符。
  8. 一种生命周期事件管理装置,其包括:
    获取模块,配置为获取操作系统向在宿主应用上运行的寄生应用发送的生命周期事件;
    转发模块,配置为将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用;
    控制模块,配置为控制所述寄生应用执行所述生命周期事件以及控制所述宿主应用执行与所述生命周期事件相匹配的业务功能。
  9. 根据权利要求8所述的生命周期事件管理装置,其中,所述获取模块包括:
    获取单元,配置为获取所述宿主应用的Instrumentation对象;
    程序创建单元,配置为基于所述Instrumentation对象构建第一代理对象;
    程序替换单元,配置为将所述宿主应用的Instrumentation对象替换为所述第一代理对象;
    事件获取单元,配置为通过所述第一代理对象获取所述操作系统向所述寄生应用发送的生命周期事件;
    所述转发模块具体配置为:通过所述第一代理对象将所述生命周期事件分别转发至所述寄生应用以及所述宿主应用。
  10. 一种计算机可读介质,其上存储有计算机程序,其中,该程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
  11. 一种电子设备,其包括:
    存储装置,其上存储有计算机程序;
    处理装置,用于执行所述存储装置中的所述计算机程序,以实现权利要求1-7中任一项所述方法的步骤。
PCT/CN2022/126729 2021-12-20 2022-10-21 生命周期事件管理方法、装置、存储介质以及电子设备 WO2023116167A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111565125.5A CN116302142A (zh) 2021-12-20 2021-12-20 生命周期事件管理方法、装置、存储介质以及电子设备
CN202111565125.5 2021-12-20

Publications (1)

Publication Number Publication Date
WO2023116167A1 true WO2023116167A1 (zh) 2023-06-29

Family

ID=86776633

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/126729 WO2023116167A1 (zh) 2021-12-20 2022-10-21 生命周期事件管理方法、装置、存储介质以及电子设备

Country Status (2)

Country Link
CN (1) CN116302142A (zh)
WO (1) WO2023116167A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130167157A1 (en) * 2009-08-25 2013-06-27 Adobe Systems Incorporated Embedded Application Communication
CN105550017A (zh) * 2015-12-11 2016-05-04 北京奇虎科技有限公司 针对应用进行虚拟输入控制的方法、装置及系统
CN110321189A (zh) * 2019-04-03 2019-10-11 上海连尚网络科技有限公司 一种在宿主程序中呈现寄宿程序的方法与设备
CN112492091A (zh) * 2019-08-21 2021-03-12 腾讯科技(深圳)有限公司 对应用的处理方法、装置、终端及存储介质
CN112836153A (zh) * 2019-11-25 2021-05-25 百度在线网络技术(北京)有限公司 寄宿应用的页面处理方法、装置、电子设备及可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130167157A1 (en) * 2009-08-25 2013-06-27 Adobe Systems Incorporated Embedded Application Communication
CN105550017A (zh) * 2015-12-11 2016-05-04 北京奇虎科技有限公司 针对应用进行虚拟输入控制的方法、装置及系统
CN110321189A (zh) * 2019-04-03 2019-10-11 上海连尚网络科技有限公司 一种在宿主程序中呈现寄宿程序的方法与设备
CN112492091A (zh) * 2019-08-21 2021-03-12 腾讯科技(深圳)有限公司 对应用的处理方法、装置、终端及存储介质
CN112836153A (zh) * 2019-11-25 2021-05-25 百度在线网络技术(北京)有限公司 寄宿应用的页面处理方法、装置、电子设备及可读存储介质

Also Published As

Publication number Publication date
CN116302142A (zh) 2023-06-23

Similar Documents

Publication Publication Date Title
CN109582310B (zh) 数据处理方法、装置、电子设备及计算机可读存储介质
CN110851863B (zh) 应用程序的权限控制方法、装置以及电子设备
CN110471738B (zh) 应用程序的主题切换方法、装置、电子设备及存储介质
WO2021139383A1 (zh) 直播间礼物资源更新方法、装置、介质及电子设备
WO2023083205A1 (zh) 显示控制方法、装置、电子设备和存储介质
WO2022111290A1 (zh) 展示方法、装置和电子设备
WO2022148231A1 (zh) 应用程序启动控制方法、装置、电子设备和存储介质
US20240104671A1 (en) Method and apparatus for group management, electronic device, and storage medium
US20230385080A1 (en) Method and apparatus for presenting information on lock screen interface, terminal, and storage medium
CN112256372B (zh) 信息处理方法、装置和电子设备
WO2024032708A1 (zh) 信息处理方法、装置、电子设备和存储介质
US20230379279A1 (en) Interaction method and apparatus, and electronic device
WO2023207788A1 (zh) 信息处理方法、装置、电子设备和存储介质
CN111596992B (zh) 导航栏展示方法、装置和电子设备
CN112905281A (zh) 视图显示方法、装置、电子设备及存储介质
WO2023072070A1 (zh) 显示控制方法、装置和电子设备
WO2023116167A1 (zh) 生命周期事件管理方法、装置、存储介质以及电子设备
WO2023011528A1 (zh) 信息交互方法、装置和电子设备
WO2022184012A1 (zh) 一种文档创建方法、装置、设备及存储介质
WO2021082893A1 (zh) 桌面显示控制的方法、装置、终端及存储介质
CN111797160B (zh) 共享智能合约的方法、系统及电子设备
CN111367590A (zh) 中断事件处理方法及其装置
WO2023109310A1 (zh) 进程管理方法、装置、存储介质以及电子设备
WO2023116503A1 (zh) 函数处理方法、装置、设备及存储介质
CN111310175A (zh) 基于插件化的iOS应用安全监测与防护方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22909485

Country of ref document: EP

Kind code of ref document: A1