Plug-in process mapping method and related device

By calculating the running time of the plug-in process and reasonably allocating the mapping relationship, the problem that the host process resources cannot be recycled for a long time is solved, and the operation efficiency of electronic devices is improved.

CN118034889BActive Publication Date: 2024-11-19HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410263729.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-08
Publication Date
2024-11-19
Estimated Expiration
2044-03-08

AI Technical Summary

Technical Problem

In electronic devices, the resources that the host process maps the plug-in process cannot be recycled for a long time, resulting in an increase in memory footprint and reducing the operating efficiency of the device.

Method used

By calculating the running time of the plug-in process and the host process, reasonably allocate the mapping relationship between the plug-in process and the host process, so that multiple plug-in processes are evenly mapped to each host process, thereby timely recycling resources.

Benefits of technology

It effectively reduces the use of memory resources, improves the operation efficiency of electronic devices, and ensures timely recycling of plug-in processes and host processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118034889B_ABST
    Figure CN118034889B_ABST
Patent Text Reader

Abstract

The plug-in process mapping method and related device provided in the embodiment of the present application relate to the field of terminal technology. The method includes: by calculating the running time of the plug-in process and the host process, reasonably allocating the mapping relationship between the plug-in process and the host process, so that multiple plug-in processes can be more evenly mapped to each host process, so that the resources of the host process and the plug-in process can be recovered in time, the occupation of memory resources can be reduced, and the operation efficiency of the electronic device can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a plug-in process mapping method and related devices. Background Art

[0002] A plurality of applications may be installed in the system of an electronic device, some of which may load and manage plug-ins, and these applications that may load and manage plug-ins may be referred to as host applications.

[0003] However, when the electronic device recycles process resources, some host process resources mapped to the plug-in process may not be reclaimed for a long time, causing the host process to occupy more memory resources, thereby reducing the operating efficiency of the electronic device. Summary of the invention

[0004] The plug-in process mapping method and related device provided in the embodiment of the present application reasonably allocate the mapping relationship between the plug-in process and the host process by calculating the running time of the plug-in process and the host process, so that multiple plug-in processes can be mapped to each host process more evenly, so that the resources of the host process and the plug-in process can be recovered in time, the occupation of memory resources can be reduced, and the operating efficiency of the electronic device can be improved.

[0005] In a first aspect, a plug-in process mapping method provided in an embodiment of the present application is applied to an electronic device, and the method includes:

[0006] At the first moment, the first plug-in process is mapped to the first process. At the first moment, the electronic device runs the first process, the second process and the third process. The plug-in process is not mapped in the first process, or the remaining running time of the first process is less than the remaining running time of the second process, and the remaining running time of the first process is less than the remaining running time of the third process; at the second moment, the second plug-in process is mapped to the third process. At the second moment, the plug-in process is not mapped in the third process, or the remaining running time of the third process is less than the remaining running time of the first process, and the remaining running time of the third process is less than the remaining running time of the second process; wherein the first process, the second process and the third process are all processes of the first application, and in the process sequence configured when the first application is used to map the plug-in process, the first process, the second process and the third process are sequentially arranged, the first plug-in process and the second plug-in process are both processes of the second application, and the first plug-in process and the second plug-in process are adjacently mapped processes. In this way, when the host process does not run the plug-in process, or the remaining running time of the host process is the shortest or shorter, the electronic device can map the plug-in process to the host process, thereby reasonably allocating the mapping relationship between the plug-in process and the host process, and timely recovering the resources of the host process and the plug-in process.

[0007] In a possible implementation, the remaining running time of the first process is obtained by the running time required for one or more plug-in processes to terminate their running, and the one or more plug-in processes are plug-in processes running in the first process when calculating the remaining time of the first process. In this way, since the life span of the first process can be determined by the longest average running time remaining of all plug-in processes in the first process, the remaining running time of the first process is obtained by the running time required for one or more plug-in processes to terminate their running.

[0008] In a possible implementation, the running time of one or more plug-in processes is related to one or more of the following: the time point when one or more plug-in processes start running, the time point when one or more plug-in processes end running, and the recycling time of the first process, wherein the recycling time of the first process includes the time from the idle state to the recycling of the first process by the system of the electronic device. In this way, the running time of one or more plug-in processes can be proportional to the time period from the start of the plug-in process to the end of the plug-in process, because after the plug-in process ends running, it will take some time to recycle the first process. Therefore, the running time of a plug-in process can be related to the plug-in process from the start running time, the plug-in process end running time and the recycling time of the first process.

[0009] In one possible implementation, the running time of one or more plug-in processes is T plugin , satisfying the following formula:

[0010] T plugin = T end –T start + T recycle .

[0011] Among them, T start The time point when one or more plug-in processes start running, T end The time point when one or more plug-in processes end running, T recycle is the recycling time of the first process. In this way, the running time of one or more plug-in processes can be proportional to the time period during which the plug-in is in the running state. After the plug-in process ends, it takes some time for the first process to be recycled. Therefore, the running time of one or more plug-in processes can also be proportional to the recycling time of the first process.

[0012] In a possible implementation, the method further includes: recording the time points at which one or more plug-in processes call a target component, wherein the target component includes one or more of the following components: an Activity component, a Service component, a ContentProvider component, and a BroadcastReceiver component, and the time points of the target components include: the time points at which one or more plug-in processes start to run and the time points at which one or more plug-in processes end to run; calculating the running time of one or more plug-in processes based on the time points of the target components, and obtaining the remaining running time of the first process; mapping the first plug-in process to the first process, including: mapping the first plug-in process to the first process when the remaining running time of the first process is less than the remaining running time of the second process, and the remaining running time of the first process is less than the remaining running time of the third process. In this way, recording the time points at which one or more plug-in processes call the target component can be used as a basis for the electronic device to calculate the running time of the plug-in process, the recycling time of the host process, and the life time of the host process. When the remaining running time of the first process is the shortest or shorter, the electronic device can map the plug-in process to the first process, thereby reasonably allocating the mapping relationship between the plug-in process and the host process.

[0013] In a possible implementation, the electronic device also records the time point when the first process is recycled by the system, and the recycling time of the first process is related to the time point when the first process is recycled by the system and the time point when one or more plug-in processes end running. After the plug-in process in the first process ends running, the first process needs to run for a period of time before being recycled by the electronic device, so the recycling time of the first process can be related to the time interval between the recycling of the first process and the end of the plug-in running, for example, a positive correlation.

[0014] In one possible implementation, the recycling time of the first process is T recycle , satisfying the following formula:

[0015] T recycle = T re –T end .

[0016] Among them, T re is the time point when the first process is recycled by the system, T end The time point when one or more plug-in processes end running. After a plug-in process in a first process ends running, the first process needs to run for a period of time before being recycled by the electronic device. Therefore, the recycling time of the first process can be related to the time interval between the recycling of the first process and the end of the plug-in running, for example, a positive correlation.

[0017] In a possible implementation, the method further includes: at a third moment, mapping the third plug-in process to the first process, wherein at the third moment, the first process, the second process, and the third process are not mapped with the plug-in process; at a fourth moment, mapping the fourth plug-in process to the second process, wherein at the fourth moment, the second process and the third process are not mapped with the plug-in process; at a fifth moment, mapping the fifth plug-in process to the third process, wherein at the fifth moment, the third process has not mapped the plug-in process; wherein the third plug-in process, the fourth plug-in process, and the fifth plug-in process are all processes of the third application, and the third plug-in process, the fourth plug-in process, and the fifth plug-in process are adjacently mapped processes. In this way, if there is a non-running host process in the electronic device, the electronic device can map the plug-in process to be mapped to the non-running host process. Thus, it is not necessary to calculate the life span of the host process, reduce the computing power of the electronic device, and improve the efficiency of plug-in mapping.

[0018] In a possible implementation, the electronic device includes a first module, a second module and a third module, the first module is used to manage the second application, the second module is used to load the second application and obtain the process information of the second application, and the third module is used to determine the mapping relationship between the process of the second application and the process of the first application. The method also includes: judging whether the second application is loaded into the system of the electronic device through the first module; when the second application is loaded into the system of the electronic device, obtaining the process information of the first plug-in process from the second module through the first module; transmitting the first information to the third module through the first module, the first information includes an identifier for indicating that the third module is a mapping process of the first plug-in process; returning the process information of the first process to the first module through the third module; mapping the first plug-in process to the first process, including: mapping the first plug-in process to the first process through the first module based on the process information of the first process. In this way, the electronic device can manage and load the plug-in application through the interaction of each module, and can also obtain the process information of the plug-in application, and determine the mapping relationship between the plug-in process and the host process. Therefore, the reasonable mapping of the plug-in process can be achieved through the coordinated operation between the modules, so as to reasonably allocate the resources of the electronic device.

[0019] In a possible implementation, the electronic device records the mapping relationship between the first plug-in process and the first process, and before returning the process information of the first process to the first module through the third module, it also includes: querying the mapping relationship based on the first plug-in process through the third module to obtain the first process. In this way, when the host process mapped by the plug-in process is recycled by the system, the mapping relationship between the plug-in process and the host process in the mapping relationship table will also be cleared. Therefore, when the plug-in management module requests to map the host process, the data acquisition calculation and process allocation module needs to first query the mapping relationship table to see whether the plug-in process has mapped the host process.

[0020] In a second aspect, an embodiment of the present application provides a device for plug-in process mapping, which may be an electronic device, or a chip or chip system in an electronic device. The device may include a processing unit. The processing unit is used to implement any method related to processing performed by the first aspect or any possible implementation of the first aspect. When the device is an electronic device, the processing unit may be a processor. The device may also include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit so that the electronic device implements the method described in the first aspect or any possible implementation of the first aspect. When the device is a chip or chip system in an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the electronic device implements the method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit in the chip (for example, a register, a cache, etc.), or a storage unit in the electronic device located outside the chip (for example, a read-only memory, a random access memory, etc.).

[0021] In a third aspect, an embodiment of the present application provides an electronic device, comprising one or more processors and a memory, wherein the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.

[0022] In a fourth aspect, the present application provides a chip or a chip system, which is applied to an electronic device, and the chip or chip system includes one or more processors and a communication interface, wherein the communication interface and at least one processor are interconnected through a line, and the one or more processors are used to call computer instructions so that the electronic device executes the method described in the first aspect or any possible implementation of the first aspect. Among them, the communication interface in the chip can be an input / output interface, a pin or a circuit, etc.

[0023] In a possible implementation, the chip or chip system described above in the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (such as a read-only memory, a random access memory, etc.).

[0024] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.

[0025] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program code. When the computer program code runs on an electronic device, the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.

[0026] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0028] Figure 2 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0029] Figure 3 A schematic diagram of the relationship between a host application and a plug-in application provided in an embodiment of the present application;

[0030] Figure 4 A schematic diagram of mapping a plug-in process to a host process provided in an embodiment of the present application;

[0031] Figure 5 A schematic diagram of time points recorded when a plug-in process calls a component provided in an embodiment of the present application;

[0032] Figure 6 A schematic diagram of calculating the life span of a host process provided in an embodiment of the present application;

[0033] Figure 7 A schematic diagram of a module for mapping a plug-in process to a host process provided in an embodiment of the present application;

[0034] Figure 8 A schematic diagram of a plug-in process mapping method provided in an embodiment of the present application;

[0035] Fig. 9 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and technologies involved in the embodiments of the present application are briefly introduced below:

[0037] 1. Four major components of the Android system:

[0038] Activity component: A component that can be used to display the user interface and allow users to interact with the application. The Activity component can provide initialization functions such as onCreate() and destruction functions such as onDestroy(). When an electronic device creates an Activity, it can call the onCreate() function of the Activity component to initialize the interface, such as loading interface layout resources. When an electronic device destroys an Activity, it can call the onDestroy() function of the Activity component to recycle the Activity and release resources.

[0039] Service component: can be used for service programs running in the background of electronic devices. Service component can provide startService() function and bindService() function.

[0040] ContentProvider component: can be used to share data between different applications. ContentProvider component can provide functions to operate on data, such as inserting data function inset(), querying data function query(), updating data function update() and deleting data function delete(). In some scenarios, ContentProvider component can also be called Provider component.

[0041] BroadcastReceiver component: can be used to receive broadcast events sent between applications or within an application, and can also respond to broadcast events through the onReceive() function. In some scenarios, the BroadcastReceiver component can also be called the Broadcast component or the Broadcast component.

[0042] 2. Terminology

[0043] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0044] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0045] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.

[0046] 3. Electronic equipment

[0047] The electronic device of the embodiment of the present application may also be a terminal device in any form. For example, the electronic device may include: a mobile phone, a tablet computer, a PDA, a laptop computer, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a cellular phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA), a handheld device with wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle-mounted device, a wearable device, an electronic device in a 5G network or a public land mobile communication network (public land mobile communication network) to be evolved in the future. The electronic devices in the mobile network (PLMN) are not limited to this in the embodiments of the present application.

[0048] As an example but not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.

[0049] In addition, in the embodiments of the present application, the electronic device may also be an electronic device in an Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network that interconnects people and machines and things.

[0050] The electronic device in the embodiments of the present application may also be referred to as: user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.

[0051] In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.

[0052] For example, Figure 1 A schematic structural diagram of an electronic device is shown.

[0053] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0054] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may include hardware, software, or a combination of software and hardware.

[0055] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0056] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it may be directly called from the above-mentioned memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved. For example, in an embodiment of the present application, the processor 110 may be used to load a plug-in application, map a plug-in process to a host process, and calculate the recycling time of the host process, etc.

[0057] It is understandable that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0058] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data created during the use of the electronic device, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor. For example, in an embodiment of the present application, the internal memory 121 can be used to store relevant codes for calculating the average running time of the plug-in process, calculating the life time of the host process, and calculating the recovery time of the host process, etc.

[0059] Figure 2 It is a software structure block diagram of the electronic device of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, the hardware abstraction layer (hardware adaptation layer, HAL), and the kernel layer.

[0060] The application layer can also be called the application layer, which can include a series of application packages. Figure 2As shown, the application package may include basic services, authentication plug-ins, data collection plug-ins, advertising plug-ins, etc. Applications may include system applications and third-party applications.

[0061] The application framework layer can also be called the Framework layer. The Framework layer can provide application programming interface (API) and programming framework for the application layer applications. The Framework layer can include some predefined functions.

[0062] like Figure 2 As shown, the Framework layer may include a plug-in management module, a plug-in loading module, a data acquisition calculation and process allocation module, and an activity manager.

[0063] The plug-in management module may be used to manage the authentication plug-in. For example, the plug-in management module may determine whether the authentication plug-in is loaded, obtain relevant information of the plug-in process, and obtain information of the mapped host process.

[0064] The plug-in loading module can be used to parse the Manifest list and obtain the process information corresponding to the authentication plug-in from the Manifest list.

[0065] The data collection calculation and process allocation module can be used to cache the mapping relationship table between the plug-in process and the host process. The mapping relationship table may include the mapping relationship between the plug-in process and the host process, the start time point of the plug-in process, and / or the start time point of the host process, etc., so as to facilitate the calculation of information such as the life span of the host process.

[0066] The data collection calculation and process allocation module can also be used to cache the time points when the authentication plug-in calls the four major components, such as the time points when the components are started and the time points when the components are destroyed, as well as monitor the life cycle of the host process.

[0067] The data collection calculation and process allocation module can also calculate the average running time of the plug-in process, the life span of the host process, and the recycling time of the host process based on the cached time point and other information.

[0068] The activity manager can be responsible for the application's life cycle management, task stack management, process management, and permission management.

[0069] Android runtime includes core libraries and virtual machines. Android runtime is responsible for the control and management of the Android system.

[0070] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0071] The application layer and the framework layer run in a virtual machine. The virtual machine executes the java files of the application layer and the framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection. For example, in the embodiment of the present application, the virtual machine can be used to perform functions such as loading plug-in applications, mapping plug-in processes to host processes, and calculating the recycling time of host processes.

[0072] The system library can also be called the Native layer, which can include multiple functional modules, such as the media library, function library, and graphics processing library.

[0073] The hardware abstraction layer is an abstract structure between the kernel layer and the Android runtime. The hardware abstraction layer can be a package of hardware drivers, providing a unified interface for upper-layer applications to call.

[0074] The kernel layer is the layer between hardware and software. The kernel layer may include display drivers, camera drivers, etc.

[0075] It should be noted that the embodiments of the present application are only illustrated using the Android system as an example. In other operating systems (such as Windows system, IOS system, etc.), as long as the functions implemented by each functional module are similar to those in the embodiments of the present application, the solutions of the present application can also be implemented.

[0076] like Figure 3 As shown, multiple applications can be installed in the system of the electronic device. Among them, some applications can load and manage plug-ins, and these applications that can load and manage plug-ins can be called host applications. In some scenarios, the host process can also be called a pit process, and the plug-in can also be called a plug-in application. For the convenience of description, the host process and plug-in application are used as examples for explanation.

[0077] It is understandable that since the plug-in application is not installed in the system, the system cannot recognize the plug-in application. The code operation of the plug-in application needs to rely on the host application, and the plug-in application can be loaded by the host application to implement the functions of the plug-in application in the host application.

[0078] Exemplarily, the electronic device may include a basic service, which may be used to provide account management functions, payment functions, push functions, etc. The basic service may also load one or more plug-ins, such as an authentication plug-in, a data collection plug-in, an advertising plug-in, etc. For example, the authentication plug-in may be used to perform permission verification on applications that access the basic service. The data collection plug-in may be used to collect relevant data when the application is running, such as the running time of the application, the startup and shutdown of the application, and other data. The advertising plug-in may be used to detect the display of advertisements by the application, etc.

[0079] It can be understood that the basic service can be understood as a host application, and the authentication plug-in, data collection plug-in and advertisement plug-in can be understood as plug-in applications.

[0080] The host application may include one or more host processes, such as a main process, a resident process, a host process, and the like.

[0081] Among them, the main process can be used to display relevant pages of the host application.

[0082] Resident processes include core processes and persistent processes. Persistent processes can be used for plug-in management, etc. Core processes can provide plug-ins with resident capabilities, etc.

[0083] The host process can be used to run a plug-in application. A plug-in application may include one or more plug-in processes. When the host process loads a plug-in process, the electronic device needs to perform a mapping between the plug-in process and the host process.

[0084] Assume that there are three host processes in the host application, namely host process A, host process B and host process C. At the same time, the host application can load three plug-in applications, namely plug-in application X, plug-in application Y and plug-in application Z.

[0085] Among them, plug-in application X declares one plug-in process, which is plug-in process X1; plug-in application Y declares two plug-in processes, plug-in process Y1 and plug-in process Y2; plug-in application Z declares four plug-in processes, which are plug-in process Z1, plug-in process Z2, plug-in process Z3 and plug-in process Z4.

[0086] In a possible implementation, when a host application loads a plug-in application, the electronic device may map multiple plug-in processes to pre-declared host processes in sequence.

[0087] For example, Figure 4As shown, for plug-in application X, its plug-in process X1 can be mapped to host process A. For plug-in application Y, its plug-in process Y1 can be mapped to host process A, and plug-in process Y2 can be mapped to host process B. For plug-in application Z, its plug-in process Z1 can be mapped to host process A, plug-in process Z2 can be mapped to host process B, plug-in process Z3 can be mapped to host process C, and sequentially, plug-in process Z4 can be mapped to host process A again.

[0088] It can be seen that the result of the mapping is that the host process A is mapped to 4 plug-in processes, including plug-in process X1, plug-in process Y1, plug-in process Z1 and plug-in process Z4. The host process B is mapped to 2 plug-in processes, including plug-in process Y2 and plug-in process Z2. The host process C is mapped to 1 plug-in process, including plug-in process Z3. In other words, some host processes will be mapped to more plug-in processes, while other host processes will be mapped to fewer plug-in processes.

[0089] However, when the electronic device recycles process resources, the host process to which many plug-in processes are mapped will be affected by the multiple plug-in processes, causing the resources of the host process to be unable to be recycled for a long time. In other words, as long as there is a plug-in process running, the resources of the host process cannot be recycled, and the resources of other plug-in processes mapped to the host process cannot be recycled either, causing the host process and the mapped plug-in processes to occupy more memory resources, thereby reducing the operating efficiency of the electronic device.

[0090] In view of this, the plug-in process mapping method provided in the embodiment of the present application can reasonably allocate the mapping relationship between the plug-in process and the host process by calculating the running time of the plug-in process and the host process, so that multiple plug-in processes can be mapped to each host process more evenly, so that the resources of the host process and the plug-in process can be recovered in time, the occupation of memory resources can be reduced, and the operating efficiency of the electronic device can be improved.

[0091] In a possible implementation, the electronic device can record the time points at which the plug-in process calls the four major components during operation, and calculate the running time of the plug-in process and the host process according to the time points, thereby determining the mapping relationship between the plug-in process and the host process.

[0092] For example, Figure 5 A schematic diagram showing the time points recorded when a plug-in process calls a component.

[0093] For ease of description, Figure 5Take the example of a plug-in process running in a host process. It is understandable that when there are multiple plug-in processes running in a host process, the electronic device can record the time point of calling the component for each plug-in process respectively, that is, each plug-in process can have corresponding time point recording information, and the specific way of recording the time point of each plug-in process can be the same as Figure 5 Similar, no further elaboration.

[0094] Figure 5 The starting time point T0 is the time point when the host process starts running, and the ending time point T 11 The time point when the host process is destroyed. Host process destruction can also be understood as the system's resource recovery of the host process.

[0095] At time points T0 and T 11 Between time points, the electronic device can record the time points when the plug-in process calls each component, and based on the time when each component is called, calculate the average running time of the plug-in process, the time it takes for the host process to be recycled by the system from the idle state, and the life span of the host process, thereby determining the host process mapped by the plug-in process. For ease of description, the time it takes for the host process to be recycled by the system from the idle state can be referred to as the recycling time of the host process.

[0096] Understandably, Figure 5 The time point identified in the example is a time point at which the electronic device records the calling of the plug-in process component. In practice, the time point at which the plug-in process calls the component may be different from Figure 5 There are differences, which are not limited in the embodiments of the present application.

[0097] 1. Statistics of the running time of the plug-in process T plugin .

[0098] (1) Record the time points when the plug-in process calls the four major components.

[0099] During the operation of the plug-in process, the four major components of the system may be called. The electronic device can record the time point when the plug-in process calls the Activity component, Service component, Provider component or Broadcast component.

[0100] In a possible implementation, when a plug-in process calls an Activity component, the electronic device can use a plug-in method to make the Activities of each plug-in inherit from a unified plug-in management class PluginActivity. When it is detected that the Activity state called by the plug-in process changes, the time points when the initialization function onCreate() and the destruction function onDestroy() of the plug-in management class PluginActivity are called can be recorded. For example, when the plug-in process calls onCreate(), the electronic device can record the startup time of the Activity component, and when the plug-in process calls onDestroy(), the electronic device can record the destruction time of the Activity component.

[0101] When the plug-in process calls the Service component, the electronic device can record the time when the service start function startService() or the service bind function bindService() is called. When the plug-in process calls the Provider component, the electronic device can record the time when the insert data function inset(), query data function query(), update data function update() or delete data function delete() is called. When the plug-in process calls the Broadcast component, the electronic device can record the time when the function onReceive() is called.

[0102] like Figure 5 As shown, from T0 to T 10 The time points are all the time points recorded by the electronic device when the plug-in process calls the component. These time points can be used as the basis for subsequent calculations of the running time of the plug-in process, the recycling time of the host process, and the life time of the host process.

[0103] (2) Discard overlapping time points.

[0104] It is understandable that the electronic device can also discard the time point T0 to T 10 Overlapping time points in the time points.

[0105] For example, the time points within the life cycle of an Activity component can be considered as overlapping time points, that is, the time points between onCreate() and onDestroy() can be considered as overlapping time points, and the electronic device can discard them. This is because during the life cycle of an Activity component, the electronic device can display the interface corresponding to the Activity component called by the plug-in process. It can also be understood that during the life cycle of an Activity component, the plug-in process can always be in a running state. Therefore, during the life cycle of an Activity component, there is no need to use other time points to reflect that the plug-in process is in a running state, and it can be regarded as an overlapping time point and discarded.

[0106] For example, Figure 5 The T4 time point in the figure is the time point when the plug-in process calls onCreate() of the Activity component, and the T7 time point is the time point when the plug-in process calls onDestroy() of the Activity component. The time between T4 and T7 can be understood as the life cycle of the Activity component.

[0107] It is understandable that between time point T4 and time point T7, time point T5 and time point T6 are covered by the life cycle of the Activity component and can be regarded as overlapping time points. Therefore, the electronic device can discard time point T5 and time point T6.

[0108] (3) Calculate the time interval between adjacent time points.

[0109] Taking the Tx time point and the Ty time point as adjacent time points as an example, the electronic device can calculate the time interval Txy between the Tx time point and the Ty time point.

[0110] If the time interval Txy between two adjacent time points is too long, it means that the plug-in process may have stopped running. Therefore, if the time interval Txy exceeds the time T that the host process takes from idle state to being recycled by the system recycle , the time period before the time interval Txy and the time period after the time interval Txy can be regarded as two time periods. The two time periods are respectively the running time of the plug-in process running twice, and the running time can also be understood as the life cycle of the plug-in process.

[0111] For example, Figure 5 As shown, time point T7 is the time point when the Activity component is destroyed, time point T8 is the time point when the Broadcast component is called, and the time interval between time points T7 and T8 is T 78 It can be seen that T 78The time interval is longer. When the time interval exceeds the host process recycling time T recycle When , it can be considered that the plug-in process stops running after the T7 time point. After the T7 time point and before the T8 time point, the plug-in process is created and started again.

[0112] Similarly, it can be seen from the figure that T 1011 The time interval is longer. When the time interval exceeds the host process recycling time T recycle When T 10 Stop running after the time point.

[0113] The electronic device can calculate the running time T of the plug-in process when the host process ends or the plug-in process ends. plugin .For example Figure 5 The running time of the previous plug-in process T plugin = T7–T1+ T recycle , the running time of the next plug-in process is T plugin = T 10 –T8+ T recycle .

[0114] It is understandable that the electronic device can count the running time of a certain plug-in process multiple times, and then calculate the average of the multiple running times to obtain the average running time of the plug-in process. For ease of description, the average running time is used as an example for explanation.

[0115] 2. Count the host process recovery time T recycle .

[0116] like Figure 5 As shown, at T 10 After time point, until T 11 At the time point when the host process is destroyed, the electronic device no longer records the time point when the four major components are called. In other words, at T 10 Time point to T 11 During this time, the plug-in process did not call the four major components, and the host process entered an idle state.

[0117] The time point when the host process enters the idle state can be understood as the time point when the plug-in process last calls the four major components, and the time point when the host process is destroyed can be understood as the time point when the host process is recycled by the system. Figure 5 In, T 10 The time point is the time point when the host process enters the idle state, T 11 The time point is the time point when the host process is recycled by the system.

[0118] The electronic device can calculate the recycling time T of the host process when the host process ends. recycle .For example Figure 5 The host process recycling time T recycle = T 11 –T 10 .

[0119] It should be noted that when calculating the average running time T of the plug-in process plugin When the host process recycles, the host process recycles for a period of time T recycle It may be the duration of the last time the host process was recycled by the system, or it may be the average duration of one or more previous times when the host process was recycled by the system, or it may be other possible values, which are not limited in the embodiments of the present application.

[0120] It is understandable that the host process recycling time T recycle The default value of can be obtained by the electronic device according to statistics or set based on experience, for example, the recycling time T of the host process recycle The default value of may include 25 minutes (min), and may also be other possible values. The specific host process recycling time T recycle The default value of is not limited in this embodiment of the present application.

[0121] 3. Calculate the life span T of the host process host .

[0122] like Figure 6 As shown in FIG. 1 , it is assumed that the plug-in process X1 and the plug-in process Y1 need to be mapped to the host process. Taking the average running time T of the plug-in process X1 as plugin The average running time of plug-in process Y1 is 35 min. plugin Take 15 min as an example.

[0123] At time T1, the plug-in process X1 is first mapped to the host process. The host process needs to wait until the plug-in process X1 is completed before it can be recycled by the system. The life span of the host process is T host When the plug-in process X1 runs for 30 minutes, the remaining life span of the host process is T host At this time, if the plug-in process Y1 is mapped to the host process, the host process needs to wait until the plug-in process Y1 is completed before it can be recycled by the system. Therefore, the remaining life span of the host process T host From 5 min to 15 min.

[0124] According to the above, the life span of the host process can be determined by the longest average running time remaining of all plug-in processes in the current host process.

[0125] 4. Determine the host process to which the plug-in process is to be mapped.

[0126] The electronic device may compare the average running time T of the plug-in process to be mapped plugin The remaining life time T of the current host process host , and maps the plug-in process to be mapped to the remaining life span T host In the shortest or shorter host process, the impact of the mapped plug-in process on the recycling time of the original plug-in process is reduced.

[0127] In a possible implementation, if there is a non-running host process in the electronic device, the electronic device may map the plug-in process to be mapped to the non-running host process.

[0128] The electronic device may include multiple host processes. Some host processes that are not mapped to the plug-in process may not be started and run. These host processes that are not started and run may be referred to as non-running host processes.

[0129] For example, Figure 4 For example, if host process A and host process B are running plug-in processes, host process A and host process B are running host processes. If host process C is not mapped to any plug-in process, that is, there is no plug-in process running in host process C, host process C is a non-running host process.

[0130] If there is a non-running host process C in the electronic device, the electronic device can map the plug-in process to be mapped to the host process C. In this way, the plug-in process to be mapped can be run alone in the host process C without affecting other plug-in processes, so that the running of the plug-in process to be mapped will not increase the time for other plug-in processes to be recycled, and the resources of other plug-in processes can be released in time.

[0131] It is understandable that if there is a non-running host process in the electronic device, it is not necessary to calculate the life span T of the host process. host This can reduce the computing power of electronic devices and improve the efficiency of plug-in mapping.

[0132] In another possible implementation, if there is no unrunning host process in the electronic device, the electronic device can calculate the remaining life time T of the host process. host , and select the host process with the shortest or shorter life span for mapping.

[0133] It is understandable that if the average running time of the plug-in process to be mapped is T plugin Greater than the life span T of the host process host, it will delay the recycling time of the original plug-in process in the host process. If the average running time of the plug-in process to be mapped is T plugin Less than the life span T of the host process host , the recycling time of the plug-in process to be mapped will be delayed.

[0134] When the plug-in process is started for the first time, since no data has been counted yet, if the plug-in process mapped in the running host process is also running for the first time, the recycling time of the host process cannot be calculated. At this time, the electronic device can randomly select a host process for mapping.

[0135] Regardless of which host process the plug-in process to be mapped is mapped to, the increased memory size can be the same, but for the remaining life span T mapped to host For the shortest or shorter host process, it means that the plug-in process can be recycled by the system faster. In this way, the mapped plug-in process has the least impact on the recycling time of other plug-in processes, and the electronic device can recycle the resources of the host process and the plug-in process in time, reduce the occupation of memory resources, and improve the operation efficiency of the electronic device.

[0136] Figure 7 Taking the authentication plug-in as an example, a module interaction diagram of mapping the authentication plug-in process to the host process is shown. The electronic device may include a plug-in management module, a plug-in loading module, and a data acquisition calculation and process allocation module.

[0137] For example, the following uses the network acceleration function as an example to illustrate the process of mapping the plug-in process to the host process. The network acceleration function can be used to improve the stability and smoothness of the electronic device connecting to the network when the network quality is poor, thereby reducing the frequent freezes of the electronic device.

[0138] S701. The electronic device calls the service of the authentication plug-in.

[0139] The electronic device may include application A. When application A performs network acceleration, application A may call a network acceleration interface provided by the electronic device. The electronic device may call an authentication plug-in to authenticate application A and determine whether application A has permission to call the network acceleration interface. At this time, the electronic device may execute step S702.

[0140] S702: The plug-in management module determines whether the authentication plug-in is loaded.

[0141] The plug-in management module can determine whether an authentication plug-in is loaded in the electronic device. Loading a plug-in can be understood as loading the Android application package (APK) and related resources of the plug-in into the system memory, such as installing the plug-in into a preset directory in the memory.

[0142] It is understandable that, when the plug-in is loaded successfully, the electronic device can record the identification that the plug-in has been loaded, so as to facilitate the plug-in management module to use it when determining whether the plug-in is loaded again later.

[0143] If the authentication plug-in is not loaded, execute step S703; if the authentication plug-in is loaded, execute step S706.

[0144] S703: If the authentication plug-in is not loaded, load it first.

[0145] If the authentication plug-in has not been loaded in the electronic device, the authentication plug-in may be loaded first, for example, including loading the resources of the authentication plug-in into the system of the electronic device, and executing step S704.

[0146] Among them, the resources of the authentication plug-in may include relevant information of the authentication interface, relevant code for application authentication, and configuration parameters or files, etc., which are not limited in the embodiments of the present application.

[0147] S704: The plug-in loading module parses the Manifest list.

[0148] The plug-in loading module may also parse the Manifest list to facilitate subsequent acquisition of process information corresponding to the authentication plug-in based on the Manifest list and execution of step S705.

[0149] S705: Complete loading of the plug-in.

[0150] The plug-in loading module may return information indicating that the authentication plug-in loading is complete to the plug-in management module.

[0151] S706: Obtain process information of the authentication plug-in.

[0152] When the authentication plug-in is loaded, the plug-in loading module can obtain the process information corresponding to the authentication plug-in from the Manifest list.

[0153] In a possible implementation, the Manifest list may include a process attribute, which is used to define the process of the authentication plug-in. The plug-in loading module may obtain the process information corresponding to the authentication plug-in according to the process attribute and execute step S707.

[0154] S707: The plug-in loading module returns the process information of the authentication plug-in.

[0155] The plug-in loading module can return the process information of the authentication plug-in to the plug-in management module. For the convenience of description, the process of the authentication plug-in is referred to as the plug-in process in the following.

[0156] S708: The plug-in management module requests to map the host process.

[0157] The plug-in management module may transmit information for requesting to map the host process to the data collection calculation and process allocation module, wherein the information may include information such as the package name of the authentication plug-in.

[0158] After the data collection calculation and process allocation module obtains the information, step S709 may be executed.

[0159] S709: The data collection calculation and process allocation module queries the mapping relationship table to determine whether a mapping relationship exists between the plug-in process and the host process.

[0160] In a possible implementation, the data collection calculation and process allocation module can determine whether the plug-in process has been mapped to the host process based on the mapping relationship table between the plug-in process and the host process. If the mapping relationship table includes a mapping relationship between a plug-in process and a host process, it means that the plug-in process has been mapped to the host process; if the mapping relationship table does not include a mapping relationship between the plug-in process and the host process, it means that the plug-in process has not been mapped to the host process.

[0161] It is understandable that when the host process mapped by the plug-in process is recycled by the system, the mapping relationship between the plug-in process and the host process in the mapping relationship table will also be cleared. Therefore, when the plug-in management module requests to map the host process, the data collection calculation and process allocation module needs to first query the mapping relationship table to see whether the plug-in process has been mapped to the host process.

[0162] If the plug-in process has been mapped to the host process, step S710 may be executed to return to the mapped host process.

[0163] If the plug-in process has not been mapped to a host process, step S711 may be executed to calculate the host process to be mapped to the plug-in process and return the host process.

[0164] S710: If a mapping relationship between the plug-in process and the host process exists in the mapping relationship table, the mapped host process is returned.

[0165] If the data collection calculation and process allocation module determines that the plug-in process is mapped to the host process, it can return relevant information of the mapped host process to the plug-in management module, such as the process name of the host process, etc., which is not limited in the embodiment of the present application.

[0166] S711. If there is no mapping relationship between the plug-in process and the host process in the mapping relationship table, determine the host process to be mapped by the plug-in process.

[0167] In a possible implementation, if there is a non-running host process in the electronic device, the plug-in process can be mapped to the non-running host process. In this way, the plug-in process can be run independently in the host process without interfering with other plug-in processes, so that the running of the plug-in process will not increase the time for other plug-in processes to be recycled, and the resources of other plug-in processes can be released in time.

[0168] If there is no unrunning host process in the electronic device, the electronic device can calculate the remaining life time T of the host process. host , and select the host process with the shortest or shorter life span for mapping. In this way, the plug-in process has the least impact on the recycling time of other plug-in processes, and the electronic device can recycle the resources of the host process and the plug-in process in time, reduce the occupation of memory resources, and improve the operation efficiency of the electronic device.

[0169] It is understandable that during the operation of the plug-in process, the data collection calculation and process allocation module can record the time points at which the plug-in process calls the four major components, and can also calculate the average running time T of the plug-in process. plugin .

[0170] When there is no mapping relationship between the plug-in process and the host process in the mapping relationship table, the data collection calculation and process allocation module can also calculate the recycling time T of the host process based on the time point recycle , and calculate the life span T of the host process based on the average running time of the plug-in process host wait.

[0171] S712: The data collection calculation and process allocation module returns the mapped host process.

[0172] Understandably, Figure 7 The flowchart of the corresponding plug-in process mapping method reflects the process of mapping a plug-in process. The plug-in process mapping method of the embodiment of the present application can also be used in the case where multiple plug-ins map host processes. The following takes the host process including host process A and host process B, and the plug-in application including authentication plug-in, data collection plug-in and advertising plug-in as an example to illustrate the execution process when mapping multiple plug-in processes in sequence.

[0173] For example, when application A calls the network acceleration interface to perform network acceleration, the electronic device can perform authentication verification on application A through the authentication plug-in. Figure 7 The relevant description in step S701 of the corresponding embodiment is not repeated here.

[0174] The plug-in management module can determine whether the authentication plug-in has been loaded in the system. If the authentication plug-in is not loaded, the authentication plug-in can be loaded first, including loading the resources of the authentication plug-in into the system. After the authentication plug-in is loaded, the plug-in loading module can obtain the process information corresponding to the authentication plug-in from the Manifest list, and return the process information of the authentication plug-in. If the authentication plug-in has been loaded, there is no need to execute the process of loading the plug-in. The plug-in loading module can obtain the process information corresponding to the authentication plug-in in the Manifest list, and return the process information of the authentication plug-in. For details, please refer to Figure 7 The relevant descriptions in step S702 to step S707 of the corresponding embodiment are not repeated here.

[0175] The plug-in management module can also pass information for requesting to map the host process to the data acquisition calculation and process allocation module. After receiving the information, the data acquisition calculation and process allocation module can determine whether the plug-in process has been mapped to the host process before. When it is determined that the plug-in process has mapped plug-in process A, or that the plug-in process has not been mapped to the host process, and there is a non-running host process A in the current system, the data acquisition calculation and process allocation module can map the plug-in process to the host process A and return the mapped host process A to the plug-in management module. For details, please refer to Figure 7 The relevant descriptions in step S708 to step S712 of the corresponding embodiment are not repeated here.

[0176] In a possible scenario, the electronic device needs to obtain the installation list of applications in the system. In a possible implementation, the electronic device can call the relevant interface provided by the data collection plug-in to obtain data related to application installation. Similar to the authentication plug-in, the plug-in management module can first determine whether the data collection plug-in has been loaded in the system.

[0177] If the data collection plug-in is not loaded, you can load the data collection plug-in first. After the data collection plug-in is loaded, the plug-in loading module can obtain the process information corresponding to the plug-in from the Manifest list and return the process information of the plug-in. If the data collection plug-in is already loaded, there is no need to execute the process of loading the plug-in. The plug-in loading module can obtain the process information corresponding to the data collection plug-in in the Manifest list and return the process information of the plug-in to the plug-in management module.

[0178] The plug-in management module can also transmit information for requesting to map the host process to the data acquisition calculation and process allocation module. After receiving the information, the data acquisition calculation and process allocation module can determine whether the plug-in process has been mapped to the host process before. When it is determined that the plug-in process has mapped the plug-in process B, or the plug-in process has not been mapped to the host process, and there is a non-running host process B in the current system, the data acquisition calculation and process allocation module can map the process of the data acquisition plug-in to the host process B, and return the mapped host process B to the plug-in management module.

[0179] In possible scenarios, the electronic device can also call the advertising plug-in to detect the application displaying advertisements. Similar to the authentication plug-in, the plug-in management module can first determine whether the advertising plug-in has been loaded in the system.

[0180] If the advertising plug-in is not loaded, you can load the advertising plug-in first. After the advertising plug-in is loaded, the plug-in loading module can also obtain the process information corresponding to the advertising plug-in from the Manifest list and return the process information of the plug-in. If the advertising plug-in is already loaded, there is no need to execute the process of loading the plug-in. The plug-in loading module can obtain the process information corresponding to the advertising plug-in in the Manifest list and return the process information of the plug-in to the plug-in management module.

[0181] The plug-in management module can also pass information to the advertisement plug-in for requesting the mapping of the host process. After receiving the information, the advertisement plug-in can determine whether the plug-in process has been mapped to the host process before. If the plug-in process has not been mapped to the host process before, and there is no unrunning host process in the current system, that is, host process A runs the process of the authentication plug-in, and host process B runs the process of the data collection plug-in, then the data collection calculation and process allocation module can be based on Figure 5 and Figure 6 The corresponding embodiment calculates the recycling time T of each host process host , and select the host process with the shortest or shorter recycling time as the mapped host process, and return the mapped host process to the plug-in management module.

[0182] The following specific embodiments are used to describe the method of the present application in detail. The following embodiments may be combined with each other or implemented independently, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0183] Figure 8 The plug-in process mapping method of the embodiment of the present application is shown. The method includes:

[0184] S801. At a first moment, a first plug-in process is mapped to a first process. At the first moment, the first process, the second process, and the third process are running in the electronic device, and the plug-in process is not mapped in the first process, or the remaining running time of the first process is less than the remaining running time of the second process, and the remaining running time of the first process is less than the remaining running time of the third process.

[0185] S802. At a second moment, the second plug-in process is mapped to the third process. At the second moment, the plug-in process is not mapped in the third process, or the remaining running time of the third process is less than the remaining running time of the first process, and the remaining running time of the third process is less than the remaining running time of the second process.

[0186] Among them, the first process, the second process and the third process are all processes of the first application. In the process order configured when the first application is used to map the plug-in process, the first process, the second process and the third process are sorted sequentially. The first plug-in process and the second plug-in process are both processes of the second application. The first plug-in process and the second plug-in process are adjacent mapped processes.

[0187] In the embodiment of the present application, the first application may be any application in the electronic device that loads and manages plug-ins, for example, the first application may be the host application in the above embodiment. Exemplarily, the first process may include the host process A in the above embodiment, the second process may include the host process B in the above embodiment, and the third process may include the host process C in the above embodiment.

[0188] The second application may be a plug-in application that depends on the first application to run. For example, the second application may include the authentication plug-in, data collection plug-in, advertisement plug-in, etc. in the above embodiments.

[0189] It is understandable that, without calculating the remaining running time of the first process, the second process, and the third process, the electronic device can map multiple plug-in processes, such as the first plug-in process and the second plug-in process, to the first process, the second process, and the third process in sequence. The specific process of mapping the plug-in processes in the order of the first process, the second process, and the third process can be referred to. Figure 4 The relevant descriptions in the corresponding embodiments are not repeated here.

[0190] The first plug-in process and the second plug-in process are adjacently mapped processes, which can be understood as that after mapping the first plug-in process and before mapping the second plug-in process, the electronic device does not map other plug-in processes.

[0191] It is understandable that when the host process is not running a plug-in process, or the remaining running time of the host process is the shortest or relatively short, the electronic device can map the plug-in process to the host process. In this way, the mapping relationship between the plug-in process and the host process can be reasonably allocated, so that multiple plug-in processes can be mapped to each host process more evenly, so that the resources of the host process and the plug-in process can be recovered in time, the occupation of memory resources can be reduced, and the operating efficiency of the electronic device can be improved.

[0192] Optional, in Figure 8 Based on the corresponding embodiment, the remaining running time of the first process is obtained by the running time required for one or more plug-in processes to end their running, and the one or more plug-in processes are the plug-in processes running in the first process when calculating the remaining time of the first process.

[0193] In an embodiment of the present application, the remaining running time of the first process can be obtained based on big data analysis of the cloud server, and the remaining running time of the first process can also be calculated in the electronic device, which is not limited in the embodiment of the present application.

[0194] Exemplarily, the remaining running time of the first process can be understood as the life span of the host process in the above embodiment, and the running time required for one or more plug-in processes to end running can refer to Figure 5 The description of calculating the running time of the plug-in process and the life time of the host process in the corresponding embodiment will not be repeated here.

[0195] It is understandable that since the life span of the first process can be determined by the longest average remaining running time of all plug-in processes in the first process, the remaining running time of the first process can be obtained by the running time required for one or more plug-in processes to terminate their running.

[0196] Optional, in Figure 8 On the basis of the corresponding embodiments, the running time of one or more plug-in processes is related to one or more of the following: the time point when one or more plug-in processes start running, the time point when one or more plug-in processes end running, and the recycling time of the first process, wherein the recycling time of the first process includes the time from the idle state to the recycling of the first process by the system of the electronic device.

[0197] In the embodiment of the present application, the running time of the plug-in process can refer to Figure 5 The description of calculating the running time of the plug-in process in the corresponding embodiment, the recycling time of the first process can refer to Figure 5 The relevant description of calculating the recycling time of the host process in the corresponding embodiment is not repeated here.

[0198] It is understandable that the running time of one or more plug-in processes may be proportional to the time period from the start to the end of the plug-in process. In addition, since it takes some time for the first process to be recycled after the plug-in process ends, the running time of a plug-in process may be related to the start running time of the plug-in process, the end running time of the plug-in process and the recycling time of the first process.

[0199] Optional, in Figure 8 Based on the corresponding embodiment, the running time T of one or more plug-in processes plugin , satisfying the following formula:

[0200] T plugin = T end –T start + T recycle .

[0201] Among them, T start The time point when one or more plug-in processes start running, T end The time point when one or more plug-in processes end running, T recycle The recycling time of the first process.

[0202] In the embodiment of the present application, the running time of the plug-in process can refer to Figure 5 The description of calculating the running time of the plug-in process in the corresponding embodiment, the recycling time of the first process can refer to Figure 5 The description of calculating the recycling time of the host process in the corresponding embodiment is not repeated here. For example, the time point when the plug-in process starts running may include Figure 5 Corresponding to the T1 time point or the T8 time point in the embodiment, the time point at which the plug-in process ends running may include: Figure 5 Corresponding to the T7 time point or T 10 Time point.

[0203] It is understandable that the running time of one or more plug-in processes can be proportional to the time period that the plug-in is in the running state. In addition, since it takes some time for the first process to be recycled after the plug-in process ends its operation, the running time of one or more plug-in processes can also be proportional to the recycling time of the first process.

[0204] It should be noted that, in the actual calculation process, the above formula may be subjected to some deformation processing, for example, each parameter may be multiplied by a certain ratio. The specific deformation of the formula is not limited in the embodiments of the present application.

[0205] Optional, in Figure 8On the basis of the corresponding embodiment, the method may further include: recording the time points when one or more plug-in processes call the target component, wherein the target component includes one or more of the following components: Activity component, Service component, ContentProvider component, BroadcastReceiver component, and the time points of the target component include: the time points when one or more plug-in processes start running and the time points when one or more plug-in processes end running; calculating the running time of one or more plug-in processes based on the time points of the target components, and obtaining the remaining running time of the first process; mapping the first plug-in process to the first process may include: mapping the first plug-in process to the first process when the remaining running time of the first process is less than the remaining running time of the second process, and the remaining running time of the first process is less than the remaining running time of the third process.

[0206] In the embodiment of the present application, the time point at which one or more plug-in processes call the target component is recorded, and the running time of one or more plug-in processes is calculated based on the time point of the target component. Figure 5 The relevant description of calculating the running time of the plug-in process in the corresponding embodiment is not repeated here.

[0207] The implementation of mapping the first plug-in process to the first process can refer to Figure 5 The relevant description of determining the host process to be mapped to the plug-in process in the corresponding embodiment will not be repeated here.

[0208] It is understandable that recording the time points when one or more plug-in processes call the target component can be used as a basis for the electronic device to calculate the running time of the plug-in process, the recycling time of the host process, and the life time of the host process. When the remaining running time of the first process is the shortest or shorter, the electronic device can map the plug-in process to the first process, so that the mapping relationship between the plug-in process and the host process can be reasonably allocated, and the memory resources of the electronic device can be reasonably used.

[0209] Optional, in Figure 8 Based on the corresponding embodiment, the electronic device also records the time point when the first process is recycled by the system, and the recycling duration of the first process is related to the time point when the first process is recycled by the system and the time point when one or more plug-in processes end running.

[0210] In an embodiment of the present application, after the plug-in process in the first process ends its operation, the first process needs to run for a period of time before being recycled by the electronic device. Therefore, the recycling time of the first process can be related to the time interval between the recycling of the first process and the end of the plug-in operation, for example, a positive correlation.

[0211] Optional, in Figure 8Based on the corresponding embodiment, the recycling time of the first process T recycle , satisfying the following formula:

[0212] T recycle = T re –T end .

[0213] Among them, T re is the time point when the first process is recycled by the system, T end The time point when one or more plug-in processes end.

[0214] In the embodiment of the present application, the recycling time of the first process can refer to Figure 5 The description of calculating the recycling time of the host process in the corresponding embodiment is not repeated here. For example, the time point when the first process is recycled by the system may include Figure 5 Corresponding to T in the embodiment 11 Time point, the time point when the plug-in process ends can include Figure 5 Corresponding to T in the embodiment 10 Time point.

[0215] It is understandable that, in the actual calculation process, the above formula may be subjected to some deformation processing, for example, each parameter may be multiplied by a certain ratio. The specific deformation of the formula is not limited in the embodiments of the present application.

[0216] Optional, in Figure 8 On the basis of the corresponding embodiment, the method may further include: at a third moment, mapping the third plug-in process to the first process, wherein, at the third moment, the first process, the second process and the third process are not mapped with the plug-in process; at a fourth moment, mapping the fourth plug-in process to the second process, wherein, at the fourth moment, the second process and the third process are not mapped with the plug-in process; at a fifth moment, mapping the fifth plug-in process to the third process, wherein, at the fifth moment, the third process has not mapped the plug-in process; wherein the third plug-in process, the fourth plug-in process and the fifth plug-in process are all processes of the third application, and the third plug-in process, the fourth plug-in process and the fifth plug-in process are adjacently mapped processes.

[0217] In the embodiment of the present application, the third application may be a plug-in application that depends on the first application to run, for example, the third application may include the authentication plug-in, data collection plug-in, advertising plug-in, etc. in the above embodiment. The third application and the second application may be the same or different.

[0218] Since the first process, the second process and the third process are arranged in sequence, when the first process, the second process and the third process are not mapped to the plug-in process, the electronic device preferentially maps the third plug-in process to the first process.

[0219] When the first process runs the third plug-in process and the second process and the third process are not mapped with a plug-in process, the electronic device preferentially maps the fourth plug-in process to the second process.

[0220] When the first process runs the third plug-in process, the second process runs the fourth plug-in process, and the third process has no plug-in process mapped, the electronic device may map the fifth plug-in process to the third process.

[0221] It is understandable that if there is a non-running host process in the electronic device, the electronic device can map the plug-in process to be mapped to the non-running host process. In this way, there is no need to calculate the life span of the host process, reduce the computing power of the electronic device, and improve the efficiency of plug-in mapping.

[0222] Optional, in Figure 8 On the basis of the corresponding embodiments, the electronic device includes a first module, a second module and a third module, the first module is used to manage the second application, the second module is used to load the second application and obtain the process information of the second application, and the third module is used to determine the mapping relationship between the process of the second application and the process of the first application. The method may also include: judging whether the second application is loaded into the system of the electronic device through the first module; when the second application is loaded into the system of the electronic device, obtaining the process information of the first plug-in process from the second module through the first module; transmitting the first information to the third module through the first module, the first information including an identifier for indicating that the third module is a mapping process for the first plug-in process; returning the process information of the first process to the first module through the third module; mapping the first plug-in process to the first process may include: based on the process information of the first process, mapping the first plug-in process to the first process through the first module.

[0223] In the embodiment of the present application, the first module can be understood as Figure 7 Corresponding to the plug-in management module in the embodiment, the second module can be understood as Figure 7 Corresponding to the plug-in loading module in the embodiment, the third module can be understood as Figure 7 The data collection calculation and process allocation module in the corresponding embodiment.

[0224] The first module can be used to determine whether the second application is loaded into the system of the electronic device. Figure 7 The relevant description of step S702 in the corresponding embodiment; the process information of the first plug-in process obtained from the second module by the first module can be referred to Figure 7 The relevant description of step S706 and step S707 in the corresponding embodiment; the first information transmitted from the first module to the third module can refer to Figure 7 The relevant description of step S708 in the corresponding embodiment; the process information of the first process returned to the first module by the third module can be referred to Figure 7The relevant descriptions of steps S709 to S712 in the corresponding embodiment are not repeated here.

[0225] It is understandable that the electronic device can manage and load plug-in applications through the interaction of various modules, and can also obtain the process information of the plug-in application, and determine the mapping relationship between the plug-in process and the host process. In this way, the reasonable mapping of the plug-in process can be achieved through the coordinated operation between the modules, thereby reasonably allocating the resources of the electronic device.

[0226] Optional, in Figure 8 On the basis of the corresponding embodiment, the electronic device records the mapping relationship between the first plug-in process and the first process. Before returning the process information of the first process to the first module through the third module, it can also include: querying the mapping relationship based on the first plug-in process through the third module to obtain the first process.

[0227] In the embodiment of the present application, the third module can query the mapping relationship based on the first plug-in process. Figure 7 The relevant description of step S709 in the corresponding embodiment is not repeated here.

[0228] It is understandable that when the host process mapped by the plug-in process is recycled by the system, the mapping relationship between the plug-in process and the host process in the mapping relationship table will also be cleared. Therefore, when the plug-in management module requests to map the host process, the data collection calculation and process allocation module needs to first query the mapping relationship table to see whether the plug-in process has been mapped to the host process.

[0229] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0230] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the method steps of each example described in the embodiment disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0231] The embodiment of the present application can divide the functional modules of the device implementing the method according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0232] like Fig. 9 FIG. 9 is a schematic diagram of a chip structure provided by an embodiment of the present application. The chip 900 includes one or more (including two) processors 901 , a communication line 902 , a communication interface 903 and a memory 904 .

[0233] In some implementations, the memory 904 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.

[0234] The method described in the above embodiment of the present application can be applied to the processor 901, or implemented by the processor 901. The processor 901 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 901 or an instruction in the form of software. The above processor 901 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 901 can implement or execute the methods, steps and logic block diagrams related to each processing disclosed in the embodiment of the present application.

[0235] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 904, and the processor 901 reads the information in the memory 904 and completes the steps of the above method in combination with its hardware.

[0236] The processor 901 , the memory 904 , and the communication interface 903 may communicate with each other via the communication line 902 .

[0237] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0238] The embodiment of the present application also provides a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium may include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0239] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.

[0240] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while discs reproduce data optically using lasers.

[0241] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

Claims

1. A plug-in process mapping method, characterized in that: The method is applied to an electronic device, and the method comprises: At a first moment, a first plug-in process is mapped to a first process. At the first moment, the first process, the second process and the third process are running in the electronic device, no plug-in process is mapped in the first process, or the remaining running time of the first process is less than the remaining running time of the second process, and the remaining running time of the first process is less than the remaining running time of the third process, and the remaining running time of the first process is obtained by the running time required for one or more plug-in processes to end running, and the one or more plug-in processes are plug-in processes running in the first process when calculating the remaining time of the first process; At a second moment, mapping the second plug-in process to the third process, at the second moment, no plug-in process is mapped to the third process, or the remaining running time of the third process is less than the remaining running time of the first process, and the remaining running time of the third process is less than the remaining running time of the second process; The first process, the second process and the third process are all processes of the first application, the first process, the second process and the third process are sequentially arranged in the process sequence configured when the first application is used to map the plug-in process, the first plug-in process and the second plug-in process are both processes of the second application, and the first plug-in process and the second plug-in process are adjacently mapped processes; The running time of the one or more plug-in processes is related to one or more of the following: the time point when the one or more plug-in processes start running, the time point when the one or more plug-in processes end running, and the recycling time of the first process, wherein the recycling time of the first process includes the time from the first process being in an idle state to being recycled by the system of the electronic device, and the idle state is the state after one or more plug-in processes in the first process end running.

2. The method according to claim 1, characterized in that The running time T of the one or more plug-in processes plugin , satisfying the following formula: T plugin = T end –T start + T recycle ; Among them, T start is the time point when the one or more plug-in processes start running, T end is the time point at which the one or more plug-in processes end running, T recycle It is the recycling time of the first process.

3. The method according to claim 1, characterized in that: The method further comprises: Record the time points when the one or more plug-in processes call the target component, wherein the target component includes one or more of the following components: Activity component, Service component, ContentProvider component, BroadcastReceiver component, and the time points of the target component include: the time points when the one or more plug-in processes start running and the time points when the one or more plug-in processes end running; Calculating the running time of the one or more plug-in processes based on the time point of the target component, and obtaining the remaining running time of the first process; Mapping the first plug-in process to the first process includes: When the remaining running time of the first process is less than the remaining running time of the second process, and the remaining running time of the first process is less than the remaining running time of the third process, the first plug-in process is mapped to the first process.

4. The method according to claim 3, characterized in that The electronic device also records the time point when the first process is recycled by the system, and the recycling duration of the first process is related to the time point when the first process is recycled by the system and the time point when the one or more plug-in processes end running.

5. The method according to claim 4, characterized in that The recycling time of the first process is T recycle , satisfying the following formula: T recycle = T re –T end ; Among them, T re is the time point when the first process is recycled by the system, T end The time point when the one or more plug-in processes terminate their execution.

6. The method according to claim 1, characterized in that The method further comprises: At a third moment, mapping a third plug-in process to the first process, wherein at the third moment, none of the first process, the second process, and the third process is mapped with a plug-in process; At a fourth moment, mapping a fourth plug-in process to the second process, wherein at the fourth moment, neither the second process nor the third process is mapped with a plug-in process; At a fifth moment, mapping the fifth plug-in process to the third process, wherein at the fifth moment, the third process has not been mapped with a plug-in process; The third plug-in process, the fourth plug-in process and the fifth plug-in process are all processes of the third application, and the third plug-in process, the fourth plug-in process and the fifth plug-in process are adjacently mapped processes.

7. The method according to claim 1, characterized in that The electronic device includes a first module, a second module and a third module, the first module is used to manage the second application, the second module is used to load the second application and obtain process information of the second application, the third module is used to determine a mapping relationship between the process of the second application and the process of the first application, and the method further includes: determining, by the first module, whether the second application is loaded into the system of the electronic device; When the second application is loaded into the system of the electronic device, obtaining process information of the first plug-in process from the second module through the first module; Passing first information to the third module through the first module, wherein the first information includes an identifier for indicating that the third module is a mapping process for the first plug-in process; Returning the process information of the first process to the first module through the third module; Mapping the first plug-in process to the first process includes: Based on the process information of the first process, the first plug-in process is mapped to the first process through the first module.

8. The method according to claim 7, characterized in that The electronic device records a mapping relationship between the first plug-in process and the first process, and before returning the process information of the first process to the first module through the third module, further includes: The mapping relationship is queried by the third module based on the first plug-in process to obtain the first process.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 8.

10. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 8.

12. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 7.