Task proxy method and terminal equipment
By introducing the target task agent sandbox program into the terminal device, the system service process replaces the application to handle task events, solving the problem of resource occupancy by the terminal device background application process and improving device performance.
Patent Information
- Application Number
- CN202311355964.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-18
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, the application process that survives the terminal device background occupies a large amount of system resources, resulting in problems such as increased temperature of the terminal device and lag in operation.
By introducing a target task proxy sandbox program in the terminal device, the program includes target task event logic, corresponding to the target application. The system service process handles task events instead of the application, thus avoiding the start of the application.
Without starting the application, completing the application's task event processing avoids a large number of application processes surviving in the terminal device background, reducing memory resource usage, and improving the performance of the terminal device.
Smart Images

Figure CN119847685A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and more specifically, to a task agent method and terminal device. Background Art
[0002] Currently, there are a variety of mechanisms in the system framework of terminal devices that allow application processes to survive in the background of terminal devices. For example, some broadcast mechanisms allow applications to register broadcasts with system services. When a broadcast occurs, the terminal device can send the broadcast to the surviving application process for processing. For non-surviving application processes, the broadcast may also be processed after being pulled up. For another example, the card service mechanism in the Hongmeng system requires the terminal device to start the card application process in the background to update the card content, and the card application will continue to survive. In this way, the above mechanism will allow a large number of application processes to survive in the background of the terminal device, occupying a large amount of system resources of the terminal device, which may cause the terminal device to have problems such as increased temperature and lag in operation. Summary of the invention
[0003] The present application provides a task proxy method and terminal device. The technical solution can process some task events by a system service process instead of an application, so that the task event processing of the application can be completed without starting the application, thereby avoiding a large number of application processes surviving in the background of the terminal device.
[0004] In a first aspect, a method for task proxy is provided, the method being applied to a terminal device, the terminal device comprising a target task proxy sandbox program, the target task proxy sandbox program comprising a target task event logic, the target task event logic corresponding to a target application, the method comprising: associating the target task proxy sandbox program with a target task event trigger point; if the target task event trigger point is triggered, determining whether the target task proxy sandbox program needs to be called; if it is determined that the target task proxy sandbox program needs to be called, processing the target task event according to the target task event logic, wherein the target task event logic is the logic for the target application to process the target task event.
[0005] Exemplarily, the target task event trigger point may be a hook function.
[0006] The triggering of the target task event trigger point can also be understood as triggering the target task event, and the terminal device needs to process the target task event.
[0007] Based on the embodiment of the present application, the terminal device may include a target task proxy sandbox program, the target task proxy sandbox program includes a target task event logic, and the target task event logic corresponds to the target application, so that the terminal device can associate the task proxy sandbox program with the target application, so that the task proxy sandbox program can be used to simulate the target application to process the target task event. The terminal device can pre-associate the target task proxy sandbox program with the target task event trigger point. If the subsequent target task event trigger point is triggered, the terminal device can first determine whether it is necessary to call the target task proxy sandbox program. When it is determined that the target task proxy sandbox program needs to be called, the target task event is processed according to the target task event logic, so that the terminal device can use the target task proxy sandbox program to process the target task event according to the logic of the original target application processing the target task event without starting the target application.
[0008] In this way, the terminal device can use the target task agent sandbox program to handle target task events instead of the target application without starting the target application, thereby avoiding a large number of application processes surviving in the background of the terminal device and occupying the memory resources of the terminal device, which is beneficial to ensuring the performance of the terminal device.
[0009] In combination with the first aspect, in any implementation of the first aspect, the terminal device also includes permission information of the target application, and the permission information includes permissions of the terminal device system capabilities that the target application can access. The method also includes: determining whether the target application has permission to access the system capabilities of the terminal device based on the permission information; if the target application has permission to access the system capabilities of the terminal device, allowing the target task agent sandbox program to access the system capabilities of the terminal device; if the target application does not have permission to access the system capabilities of the terminal device, denying the target task agent sandbox program access to the system capabilities of the terminal device.
[0010] The system capabilities may include obtaining network status, accessing the network, accessing system files, etc.
[0011] Based on the embodiment of the present application, the terminal device also includes the permission information of the target application, so that the terminal device can determine some permissions of the system capabilities that the target application can access based on the permission information; if the terminal device determines that the target application has the permission to access the system capabilities of the terminal device, the target task agent sandbox program can be allowed to access the system capabilities of the terminal device, so that the terminal device can allow the system capabilities within the access permissions of the target task agent sandbox program, which can ensure the system security of the terminal device; if the terminal device determines that the target application does not have the permission to access the system capabilities of the terminal device, the target task agent sandbox program can be denied access to the system capabilities of the terminal device, so that the terminal device can avoid the system capabilities outside the access permissions of the target task agent sandbox program, which can ensure the system security of the terminal device. In this way, the terminal device can determine the permissions of the target application based on the permission information, so that the target task agent sandbox program associated with the target application can access the system capabilities with permission to access, thereby ensuring the system security of the terminal device.
[0012] In combination with the first aspect, in an implementation of the first aspect, in the process of processing the target task event according to the target task event logic, the method also includes: enabling the target task agent sandbox program to access the system capabilities of the terminal device through an auxiliary function.
[0013] Exemplarily, the terminal device may include an auxiliary function library, and the auxiliary function library may include several auxiliary functions.
[0014] Based on the embodiments of the present application, the terminal device may provide an auxiliary function to the target task agent sandbox program, so that the target task agent program may access the system capabilities of the terminal device through the auxiliary function.
[0015] In combination with the first aspect, in an implementation method of the first aspect, the determination of whether the target task agent sandbox program needs to be called includes: when the target application process exists, determining that the target task agent sandbox program does not need to be called; when the target application process does not exist, determining that the target task agent sandbox program needs to be called.
[0016] Exemplarily, the terminal device may determine whether the target application process exists by calling a system service.
[0017] Based on the embodiment of the present application, the terminal device can determine whether it is necessary to call the target task proxy sandbox program to process the target task event by determining whether the target application process exists. When it is determined that the target application process exists, it can be determined that it is not necessary to call the target task proxy sandbox program. When it is determined that the application process does not exist, it can be determined that it is necessary to call the target task proxy sandbox program. This technical solution enables the terminal device to determine whether it is necessary to call the target task proxy sandbox program and process the target task event according to the target task event logic.
[0018] In combination with the first aspect, in an implementation method of the first aspect, the determination of whether the target task agent sandbox program needs to be called includes: if the memory resources occupied by the process of the target application have not been released, determining that the target task agent sandbox program does not need to be called; if the memory resources occupied by the process of the target application have been released, determining that the target task agent sandbox program needs to be called.
[0019] Based on the embodiment of the present application, the terminal device can determine whether it is necessary to call the target task proxy sandbox program according to whether the memory resources occupied by the process of the target application have been released. If the memory resources occupied by the process of the target application have been released, it can be determined that the target application does not occupy system resources and it is necessary to call the target task proxy sandbox program; if the memory resources occupied by the process of the target application have been released, it means that the target application exists in the background and occupies system resources, then the target application can process the target task event without additionally calling the target task proxy sandbox program.
[0020] In combination with the first aspect, in an implementation of the first aspect, when it is determined that the target task agent sandbox program needs to be called, the method also includes: determining whether the target task agent sandbox program is included in the terminal device; processing the target task event according to the target task event logic includes: if the target task agent sandbox program is included in the terminal device, processing the target task event according to the target task event logic.
[0021] Based on the embodiment of the present application, when the terminal device determines that the target task proxy sandbox program needs to be called, it is necessary to further determine whether the terminal device includes the target task proxy sandbox program. Only when it is determined that the terminal device includes the target task proxy sandbox program, the target task proxy sandbox program will be actually called to process the target task event. This technical solution can confirm that the target task proxy sandbox program exists in the terminal device and can process the target task event, avoiding errors.
[0022] In combination with the first aspect, in an implementation of the first aspect, the method further includes: if the terminal device does not include the target task agent sandbox program, starting the target application; and processing the target task event through the target application.
[0023] Based on the embodiment of the present application, if the terminal device does not include the target task agent sandbox program, the target application program can be started to process the target task event. In this case, since the terminal device does not include the target task agent sandbox program, the terminal device will start the target application program to process the target task event. This technical solution can enable the task event to be processed in a timely manner.
[0024] In combination with the first aspect, in an implementation manner of the first aspect, when it is determined that the target task agent sandbox program does not need to be called, the method further includes: processing the target task event by the target application program.
[0025] Based on the embodiment of the present application, when the terminal device determines that it does not need to call the target task agent sandbox program, the target task event can be processed by the target application. This technical solution can use the existing surviving target application to process the target task event without restarting the application.
[0026] In combination with the first aspect, in an implementation manner of the first aspect, the target task event trigger point is associated with at least one target task agent sandbox program.
[0027] It should be understood that the at least one target task agent sandbox program may correspond to at least one target application program.
[0028] Based on the embodiment of the present application, the task event trigger point can be associated with at least one target task agent sandbox program, thereby improving the flexibility of the application of the technical solution.
[0029] In combination with the first aspect, in an implementation method of the first aspect, if the target task event trigger point is associated with multiple target task agent sandbox programs, wherein if the target task event trigger point is triggered, determining whether it is necessary to call the target task agent sandbox program includes: if the target task event trigger point is triggered, determining whether it is necessary to call the multiple target task agent sandbox programs.
[0030] Exemplarily, the task event may be a system broadcast event, such as a screen rotation event, a time zone change event, and the like.
[0031] Based on the embodiment of the present application, since a task event trigger point is associated with multiple target task agent sandbox programs, if the target task event trigger point is triggered, the terminal device can determine whether it is necessary to call multiple target task agent sandbox programs to handle the task event to avoid starting multiple applications.
[0032] In a second aspect, a terminal device is provided, comprising: one or more processors; one or more memories; the one or more memories storing one or more programs, and when the one or more programs are executed by one or more processors, the method of task agent as described in the first aspect and any possible implementation thereof is executed.
[0033] In a third aspect, a task agent device is provided, comprising: a module for implementing the task agent method as described in the first aspect and any possible implementation manner thereof.
[0034] In a fourth aspect, a chip system is provided, comprising a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method of task agent as described in the first aspect and any possible implementation thereof is executed.
[0035] In a fifth aspect, a readable storage medium is provided, wherein instructions are stored in the readable storage medium. When the instructions are executed on a terminal device, the method for task agency as described in the first aspect and any possible implementation thereof is executed.
[0036] In a sixth aspect, a program product is provided, the program product comprising a program code, and when the program code is run on a terminal device, the task agent method as described in the first aspect and any possible implementation thereof is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic architecture diagram of a terminal device provided in an embodiment of the present application.
[0038] Figure 2 This is a schematic flow chart of a task proxy method provided in an embodiment of the present application.
[0039] Figure 3 It is a schematic flowchart of a task agent for updating a weather card provided in an embodiment of the present application.
[0040] Figure 4 This is the process of processing task events by the task agent sandbox program provided in the embodiment of the present application.
[0041] Figure 5It is a schematic diagram of the correspondence between a task event trigger point and a task agent sandbox program provided in an embodiment of the present application.
[0042] Figure 6 It is a schematic flow chart of a task proxy method provided in an embodiment of the present application.
[0043] Figure 7 It is a schematic block diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0045] Before introducing the technical solution of the present application, some professional terms that may be involved in the present application are first introduced as follows.
[0046] Sandbox technology: a security mechanism used to isolate applications or processes. It can create a restricted environment in a computer system to prevent applications or processes from causing potential security threats to the system.
[0047] Sandbox program: A program that can run in a certain operating environment.
[0048] Task event: In the embodiment of the present application, the task event may be some tasks performed by the application program, for example, the task event is a weather update event.
[0049] Task event trigger point: a trigger point that can trigger an application to execute a task event. In the embodiment of the present application, the task event trigger point can be a hook function.
[0050] Task event logic: The process by which an application processes task events.
[0051] Auxiliary functions: A set of stable application programming interfaces (APIs) that allow sandbox programs to interact with the programmable host environment. Auxiliary functions can provide sandbox programs with access to the system capabilities of terminal devices (such as file systems and networks).
[0052] Application (App): Software that runs on a mobile terminal and implements specific functions and usually has a window / image / sound display. Each application can have one or more application processes.
[0053] Background Application: An application that does not have a user interface (UI) that directly interacts with the user and keeps running in the background on an electronic device. It can be used to perform functions such as data exchange and notification push.
[0054] Implicit broadcast: A broadcast that is not specifically targeted at a particular application. This broadcast will be sent to all applications that have registered receivers. Most system broadcasts are implicit broadcasts.
[0055] Currently, there are a variety of mechanisms in the system framework of terminal devices that allow application processes to survive in the background of terminal devices. For example, some broadcast mechanisms allow applications to register broadcasts with system services. When a broadcast occurs, the terminal device can send the broadcast to the surviving application process for processing. For non-surviving application processes, the broadcast may also be processed after being pulled up. For another example, the card service mechanism in the Hongmeng system requires the terminal device to start the card application process in the background to update the card content, and the card application will continue to survive. In this way, the above mechanism will allow a large number of application processes to survive in the background of the terminal device, occupying a large amount of system resources of the terminal device, which may cause the terminal device to have problems such as increased temperature and lag in operation.
[0056] In view of this, an embodiment of the present application provides a task proxy method and terminal device. This technical solution can allow the system service process of the terminal device to handle some task events instead of the application, thereby completing the task event processing of the application without starting the application, thereby avoiding a large number of application processes surviving in the background of the terminal device.
[0057] Figure 1 is a schematic architecture diagram of a terminal device provided in an embodiment of the present application. Figure 1 As shown, the terminal device 100 may include at least two parts: software and hardware. The software part may include an application layer, a system framework layer, and a kernel layer; the hardware part may include at least a storage device, a network card, and a sensor.
[0058] The application layer includes multiple applications in the terminal device 100, which may include system applications and downloaded and installed third-party applications, etc., wherein each application may include task event logic 1, task event logic 2, ..., task event logic n.
[0059] Exemplarily, the task event logic may be the execution logic of an application for processing a task event. For example, for a weather application, the task event logic may be the process in which, when it detects that a weather card user requests to update the weather, the weather application executes a weather update and returns the latest weather data to the card user.
[0060] The system framework layer may at least include a programmable framework, task agent services, security modules, and task event trigger points.
[0061] The programmable framework can support application developers to inject task agent sandbox programs into task agent services, or to unregister task agent sandbox programs from task agent services. The helper function library in the programmable framework can provide network and file system capabilities for task agent sandbox programs, so that task agent sandbox programs can access the network and file system, etc.
[0062] The application developer injects the task agent sandbox program into the task agent service, which can be understood as the developer writes the code of the application processing task event logic into the task agent service to form the task agent sandbox program. The application developer cancels the task agent sandbox program, which can be understood as deleting the code of the application processing task event logic from the task agent service.
[0063] Exemplarily, the developer of the weather application can inject the task agent sandbox program 1 into the task agent service through the programmable framework, and the task agent sandbox program 1 can correspond to the task event logic 1. For example, the task event logic 1 can be that when the weather card is updated, the weather application obtains the latest weather data to the card management service, and the task agent sandbox program 1 can subsequently replace the weather application to perform the task of obtaining the latest weather data to the card management service.
[0064] For example, the developer of the gallery application can inject the task agent sandbox program 2 into the task agent service through the programmable framework box, and the task agent sandbox program 2 can correspond to the task event logic 2. For example, the task event logic 2 can be to obtain a certain recommended picture of the gallery to the card management service, and then the task agent sandbox program 2 can replace the gallery application to perform the task of obtaining a certain recommended picture of the gallery to the card management service in the future.
[0065] It should be understood that the card management service can manage the cards of multiple applications in the terminal device 100.
[0066] The task proxy service may include a management module and an injected task proxy sandbox program. When an application injects the task proxy sandbox program into the task proxy service, the management module may query the process database of the task proxy service to determine whether there is identity information and permission information of the application that initiated the injection. If so, the management module associates the identity information and permission information of the application with the task proxy sandbox program. If not, the management module records the identity information and permission information of the application, and saves the identity information and permission information in the metadata of the injected task proxy sandbox program.
[0067] For example, the identity information may include but is not limited to the package name of the application, the user identifier (UID) of the application, the group identifier (GID) of the application, etc. The permission information may include but is not limited to the signature information of the application, the access rights of the application (such as whether it can access the network, the file system), etc.
[0068] The management module can also be used to associate a task event trigger point with a task agent sandbox program. One task event trigger point can be associated with one task agent sandbox program or multiple task agent sandbox programs.
[0069] The management module can also be used to interact with task event trigger points located in different system services and determine whether to call the task agent sandbox program to execute the corresponding task event.
[0070] For example, the task event trigger point is a hook function set in the system service. When a task event occurs, the hook function can be triggered to send a task event occurrence message and task processing party information (such as identity information) to the task proxy service. The management module in the task proxy service can determine whether the task processing party has registered the task proxy sandbox program based on the task processing party information; if it is determined that the task processing party has not registered the task proxy sandbox program, the task event can be forwarded to the task processing party for processing; if it is determined that the task processing party has registered the task proxy sandbox program, it can be determined by calling the system service whether the process corresponding to the task processing party exists. If the process exists, the task event is forwarded to the task processing party for processing. If the process does not exist, the corresponding task proxy sandbox program is called to process the task event.
[0071] In some cases, whether the process corresponding to the task processor exists can also be referred to as whether the process corresponding to the task processor is alive.
[0072] In other examples, the management module determines that the task processor has registered a task agent sandbox program, and can further determine whether the process corresponding to the task processor exists and whether the memory resources occupied by it are released by calling the system service. If the process exists and the memory resources occupied by it are not released, the management module forwards the task event to the task processor for processing; if the process does not exist, or the process exists but the memory resources occupied by it have been released, the management module calls the corresponding task agent sandbox program to process the task event.
[0073] It should be understood that in some operating systems, if a process exists but the memory resources it occupies have been released, the process can be said to be in a frozen state; if a process exists but the memory resources it occupies have not been released, the process can be said to be in a non-frozen state.
[0074] It should be understood that when calling the task agent sandbox program to execute the corresponding task event, the task agent sandbox program can complete some system capabilities such as accessing the network and file system through the auxiliary function library. During the execution of the auxiliary function, it can interact with the security module to verify whether the application injected into the task agent sandbox program has the corresponding permissions, thereby ensuring system security.
[0075] The kernel layer may include a file system, a network module, and a driver. The file system may provide the system framework layer with the system capability of file access, the network module may provide the system framework layer with the system capability of network access, and the driver may interact with the auxiliary function library and be used to drive the operation of related sensors to obtain corresponding data.
[0076] Figure 2 is a schematic flow chart of a task agent provided in an embodiment of the present application. Figure 2 As shown, the method 200 can be applied to a terminal device, which includes a target task agent sandbox program, the target task agent sandbox program includes a target task event logic, the target task event logic corresponds to the target application, and the method 200 can include steps 210 to 230.
[0077] In some examples, the target agent sandbox program included in the terminal device may be injected into the terminal device by the target application program. For example, the developer of the target application program may inject the target task event logic into the task agent service of the terminal device to form the target agent sandbox program.
[0078] In other examples, the target agent sandbox program included in the terminal device may also exist in the system of the terminal device. For example, the target agent sandbox program may be injected into the task agent service by the system developer of the terminal device according to the target task event logic.
[0079] It is understandable that the target application may include multiple target task event logics. The target task event logic corresponds to the target application and can be understood as the target task event logic belonging to one or more of the multiple target task event logics included in the target application.
[0080] It should also be understood that the target task agent sandbox program may include one or more target task event logics.
[0081] 210 , the terminal device associates the target task agent sandbox program with the target task event trigger point.
[0082] In some examples, the target task event trigger point may be a hook function.
[0083] The task agent service in the terminal device can bind the target task agent sandbox program to the hook function of the target task event trigger point to achieve the association between the two.
[0084] It should be understood that a target task event trigger point may be associated with one target task agent sandbox program or may be associated with multiple target task agent sandbox programs.
[0085] The task event may include system broadcast, scheduled task, network message, sensor input and other events.
[0086] 220, if the target task event trigger point is triggered, the terminal device determines whether it is necessary to call the target task agent sandbox program.
[0087] In the embodiment of the present application, the triggering of the target task event trigger point can also be understood as the terminal device triggering the target task event, and the terminal device is required to process the target task event. At this time, the terminal device can determine whether it is necessary to call the target task agent sandbox program to process the target task event.
[0088] In some examples, the terminal device may determine whether it is necessary to call the target task agent sandbox program to handle the target task event by determining whether the target application process exists.
[0089] In other examples, the terminal device may also determine whether it is necessary to call the target task agent sandbox program to process the target task event by determining whether the memory resources occupied by the target application process have been released.
[0090] It is understandable that the terminal device may also determine whether it is necessary to call the target task agent sandbox program to process the target task event in other ways, and the embodiments of the present application are not limited to this.
[0091] 230. If it is determined that the target task agent sandbox program needs to be called, the terminal device processes the target task event according to the target task event logic, wherein the target task event logic is the logic of the target application program processing the target task event.
[0092] For example, for a weather application, the task event logic may be a process in which, upon detecting that a weather card user requests an operation to update the weather, the weather application performs a weather update and returns the latest weather data to the card user.
[0093] Generally, when a target task event is triggered, the terminal device can start an application to process the target task event. In the embodiment of the present application, when a target task event is triggered, the terminal device determines whether it is necessary to call the target task agent sandbox program. When it is determined that the target task agent sandbox program needs to be called, the target task agent sandbox program can process the target task event without starting the target application.
[0094] Based on the embodiment of the present application, the terminal device may include a target task proxy sandbox program, the target task proxy sandbox program includes a target task event logic, and the target task event logic corresponds to the target application, so that the terminal device can associate the task proxy sandbox program with the target application, so that the task proxy sandbox program can be used to simulate the target application to process the target task event. The terminal device can pre-associate the target task proxy sandbox program with the target task event trigger point. If the subsequent target task event trigger point is triggered, the terminal device can first determine whether it is necessary to call the target task proxy sandbox program. When it is determined that the target task proxy sandbox program needs to be called, the target task event is processed according to the target task event logic, so that the terminal device can use the target task proxy sandbox program to process the target task event according to the logic of the original target application processing the target task event without starting the target application.
[0095] In this way, the terminal device can use the target task agent sandbox program to handle target task events instead of the target application without starting the target application, thereby avoiding a large number of application processes surviving in the background of the terminal device and occupying the memory resources of the terminal device, which is beneficial to ensuring the performance of the terminal device.
[0096] In some embodiments, the terminal device also includes permission information of the target application, and the permission information includes permissions of the terminal device system capabilities that the target application can access. The method 200 may also include:
[0097] The terminal device determines, based on the permission information, whether the target application has permission to access the system capabilities of the terminal device;
[0098] If the target application has permission to access the system capabilities of the terminal device, the terminal device allows the target task agent sandbox program to access the system capabilities of the terminal device;
[0099] If the target application does not have permission to access the system capabilities of the terminal device, the terminal device denies the target task agent sandbox program access to the system capabilities of the terminal device.
[0100] Exemplarily, the system capabilities may include obtaining network status, accessing the network, accessing system files, etc. The permission information may include, but is not limited to, the signature information of the application, the access rights of the application (e.g., whether the network and file system can be accessed), etc. For example, the permission information is access to the network. When the target task agent sandbox program needs to access the network during the process of processing an event, the terminal device can determine whether it has the permission to access the network according to the permission information of the target application. If the target application has the permission to access the network, the terminal device can allow the target task agent sandbox program to access the network; if the target application does not have the permission to access the network, the terminal device can deny the target task agent sandbox program access to the network, so that the target task agent sandbox program can only access the system capabilities within the permission range of the target application in the process of processing task events on behalf of the target application, thereby ensuring the system security of the terminal device.
[0101] In other examples, the terminal device may also include identity information of the target application, such as the package name of the application, the user identifier (UID) of the application, the group identifier (GID) of the application, etc. This facilitates the subsequent terminal device to determine the identity of the target application.
[0102] Based on the embodiment of the present application, the terminal device also includes permission information of the target application, so that the terminal device can determine some permissions of the system capabilities that the target application can access based on the permission information; if the terminal device determines that the target application has the permission to access the system capabilities of the terminal device, the target task agent sandbox program can be allowed to access the system capabilities of the terminal device, so that the terminal device can allow the system capabilities within the access permissions of the target task agent sandbox program, thereby ensuring the system security of the terminal device; if the terminal device determines that the target application does not have the permission to access the system capabilities of the terminal device, the target task agent sandbox program can be denied access to the system capabilities of the terminal device. In this way, the terminal device can avoid system capabilities outside the access permissions of the target task agent sandbox program, and only allow the target task agent program to access system capabilities that the original target application has permission to access, thereby ensuring the system security of the terminal device.
[0103] In this way, the terminal device can determine the permissions of the target application according to the permission information, so that the target task agent sandbox program associated with the target application can access the system capabilities with permission access, thereby ensuring the system security of the terminal device.
[0104] In some examples, the terminal device may provide an auxiliary function library to the target task agent sandbox program. The auxiliary function library may include one or more auxiliary functions, so that the target task agent sandbox program can access the system capabilities of the terminal device through the auxiliary functions.
[0105] In other examples, in the process of the target task agent sandbox program accessing the system capabilities of the terminal device through auxiliary functions, the terminal device can verify the permissions of the target application in the above manner, and after the verification passes, allow the target task agent sandbox program to access the system capabilities of the terminal device through auxiliary functions.
[0106] In some embodiments, the terminal device determines whether to call the target task agent sandbox program, including:
[0107] The terminal device determines whether the target application process exists;
[0108] When the target application process exists, it is determined that there is no need to call the target task agent sandbox program;
[0109] When the target application process does not exist, it is determined that the target task agent sandbox program needs to be called.
[0110] Exemplarily, the terminal device may determine whether the target application process exists by calling a system service.
[0111] For example, the task agent service in the terminal device can obtain the existing application process list by calling the activity management service AMS system service interface, and determine whether the target application process exists by querying the application process list. When the target application process is queried from the application list, it can be determined that the target application process exists, otherwise, it can be determined that the target application process does not exist.
[0112] In other examples, the terminal device may also determine whether the target application process exists by other means, which is not limited in this embodiment of the present application.
[0113] Based on the embodiment of the present application, the terminal device can determine whether it is necessary to call the target task proxy sandbox program to process the target proxy task event by determining whether the target application exists. When it is determined that the target application exists, it can be determined that it is not necessary to call the target task proxy sandbox program, and when it is determined that the application does not exist, it can be determined that it is necessary to call the target task proxy sandbox program. This technical solution enables the terminal device to determine whether it is necessary to call the target task proxy sandbox program and process the target task event according to the target task event logic.
[0114] In some embodiments, the terminal device determines whether to call the target task agent sandbox program, including:
[0115] If the memory resources occupied by the process of the target application program have not been released, the terminal device determines that it is not necessary to call the target task agent sandbox program;
[0116] If the memory resources occupied by the process of the target application have been released, the terminal device determines that the target task agent sandbox program needs to be called.
[0117] Exemplarily, the terminal device may determine whether a process of an application program still occupies memory resources based on system services.
[0118] It should be understood that if the terminal device determines that the memory resources occupied by the process of the target application have not been released, it can be determined that when the target task event trigger point is triggered, the target application process has been normally alive in the background and can be directly used to process the target task event, and the terminal device can determine that it is not necessary to call the target task agent sandbox program. If the terminal device determines that the memory resources occupied by the process of the target application have been released, it can be understood that the target application does not occupy system resources, and the terminal device can determine that it is necessary to call the target task agent sandbox program to process the target task event without restarting the target application.
[0119] In some operating systems, if an application process exists but the memory resources it occupies have been released, the application process or application can be said to be in a frozen state. In other operating systems, if an application process exists but the memory resources it occupies have been released, the application process or application can also be said to be in other states, which is not limited in the embodiments of the present application.
[0120] Based on the embodiment of the present application, the terminal device can determine whether it is necessary to call the target task proxy sandbox program according to whether the memory resources occupied by the process of the target application have been released. If the memory resources occupied by the process of the target application have been released, it can be determined that the target application does not occupy system resources and it is necessary to call the target task proxy sandbox program; if the memory resources occupied by the process of the target application have been released, it means that the target application exists in the background and occupies system resources, then the target application can process the target task event without additionally calling the target task proxy sandbox program.
[0121] In some embodiments, when the terminal device determines that the target task agent sandbox program needs to be called, the method 200 further includes:
[0122] Determine whether the terminal device includes a target task agent sandbox program;
[0123] The terminal device calls the target task agent sandbox program to process the target task event according to the target task event logic, including:
[0124] If the terminal device includes a target task agent sandbox program, the target task event is processed according to the target task event logic.
[0125] Based on the embodiment of the present application, when the terminal device determines that the target task proxy sandbox program needs to be called, it is necessary to further determine whether the terminal device includes the target task proxy sandbox program. Only when it is determined that the terminal device includes the target task proxy sandbox program, the target task proxy sandbox program will be actually called to process the target task event. This technical solution is conducive to the terminal device confirming that there is a target task proxy sandbox program that can process the target task event, avoiding errors.
[0126] In other examples, the terminal device may also determine whether the target application has injected the target task agent sandbox program into the terminal device, and if it is determined that the target application has injected the target task agent sandbox program into the terminal device, the target task agent sandbox program is called to process the target task event according to the target task event logic. In this way, the terminal device may determine that the task event of the application can be replaced by the sandbox program for execution.
[0127] In some embodiments, the method 200 further includes:
[0128] The terminal device processes the target task event through the target application.
[0129] Based on the embodiment of the present application, if the terminal device determines that the target task agent sandbox program is not included, the target application program can be started to process the target task event. In this case, since the terminal device does not include the target task agent sandbox program, the target task agent sandbox program cannot be used to replace the application program to process the target task event. Therefore, the terminal device will start the target application program to process the target task event. This technical solution can enable the task event to be processed in a timely manner.
[0130] In some embodiments, when it is determined that the target task agent sandbox program does not need to be called, the method 200 further includes:
[0131] The terminal device processes the target task event through the target application.
[0132] Based on the embodiment of the present application, when the terminal device determines that it does not need to call the target task agent sandbox program, the target task event can be processed by the target application. This technical solution can use the existing surviving target application to process the target task event without restarting the application.
[0133] In some embodiments, the target task event trigger point is associated with at least one target task agent sandbox program.
[0134] It should be understood that when the target task event trigger point is associated with multiple target task proxy sandbox programs, the at least one target task proxy sandbox program may correspond to at least one target application. For example, a target task proxy sandbox program may correspond to one target application, or a target task proxy sandbox program may correspond to multiple target applications, or multiple target task proxy sandbox programs may correspond to one target application, which is not limited in the embodiments of the present application.
[0135] Based on the embodiment of the present application, the task event trigger point can be associated with at least one target task agent sandbox program, thereby improving the flexibility of the application of the technical solution.
[0136] In some embodiments, if the target task event trigger point is associated with multiple target task agent sandbox programs, if the target task event trigger point is triggered, determining whether the target task agent sandbox program needs to be called includes:
[0137] If the target task event trigger point is triggered, the terminal device determines whether it is necessary to call multiple target task agent sandbox programs.
[0138] Exemplarily, the task event may be a system broadcast event, such as a screen rotation event, a time zone change event, and the like.
[0139] It is understandable that when the terminal device determines whether to call multiple target task agent sandbox programs, it can make a judgment on each target task agent sandbox program separately.
[0140] In some examples, the terminal device may determine that it is necessary to call one or more of the multiple target task agent sandbox programs to process the calling of the multiple target task agent sandbox programs. Alternatively, the terminal device may also determine that it is not necessary to call the multiple target task agent sandbox programs.
[0141] Based on the embodiments of the present application, since a task event trigger point is associated with multiple target task agent sandbox programs, if the target task event trigger point is triggered, the terminal device can determine whether it is necessary to call multiple target task agent sandbox programs to handle the task event to avoid starting multiple applications.
[0142] The following describes the method of task agency in an embodiment of the present application by taking the target application as a weather app, the task agent event as obtaining the latest weather data, and the target task agent sandbox program as obtaining the latest weather data task agent sandbox program as an example.
[0143] Figure 3 FIG. 1 is a schematic flow chart of a task agent for updating a weather card provided in an embodiment of the present application. Figure 3 As shown, the method 300 may include steps 301 to 313 .
[0144] 301, the weather app injects the task agent sandbox program for obtaining the latest weather data into the task agent service.
[0145] Exemplarily, the developer of the weather app can inject a task agent sandbox program for obtaining the latest weather data into the task agent service through the programmable framework of the terminal device. Specifically, the developer of the weather app can generate the task event logic for obtaining the latest weather data into a program format that can be parsed by the programmable framework of the terminal device, for example, in the form of a binary file and inject it into the task agent service. The sandbox runtime program can also analyze the injected task agent sandbox program to determine security. Alternatively, the sandbox runtime can also compile the injected task agent sandbox program to generate executable code.
[0146] 302 , the task proxy service determines whether identity information and permission information of the weather app exists.
[0147] When the weather app injects the task agent sandbox program for obtaining the latest weather data into the task agent service, the task agent service can query the database of the task agent service process to determine whether there is identity information and permission information of the weather app therein.
[0148] It should be understood that the identity information of the weather app may include the package name, UID, GID, etc. of the weather app; the permission information may include the signature information of the weather app, whether the network can be accessed, etc.
[0149] 303, the task proxy service obtains the identity information and permission information of the weather app.
[0150] When the task agent service determines that the identity information and permission information of the weather app exists in the database, the identity information and permission information of the weather app can be obtained, and the data structure recording the identity information and permission information of the weather app is associated with the task agent sandbox program for obtaining the latest weather data.
[0151] 304, the task proxy service records the identity information and permission information of the weather app.
[0152] When the task proxy service determines that the identity information and permission information of the weather app do not exist in the database, the identity information and permission information of the weather app can be recorded. For example, the task proxy service can obtain the permission information of the weather app by calling an interface of a specific security library.
[0153] The task proxy service can write the identity information and permission information of the weather app into a specific data structure.
[0154] 305 , when the programmable sandbox is running, the identity information and permission information of the weather app are saved in the metadata of the sandbox program of the task agent for obtaining the latest weather data.
[0155] After the task proxy server records the identity information and permission information of the weather app, the programmable sandbox runtime can save the identity information and permission information of the weather app in the metadata of the task proxy sandbox program for obtaining the latest weather data, thereby facilitating the subsequent management module to determine the corresponding information from the metadata.
[0156] 306 , the task agent service associates the Get Latest Weather Data task agent sandbox program with the Get Latest Weather Data task event trigger point.
[0157] After the task proxy service associates the Get Latest Weather Data Task Proxy Sandbox Program with the Get Latest Weather Data Task Event Trigger Point, when the Get Latest Weather Data Task Event is subsequently triggered, the task proxy service can call the corresponding Get Latest Weather Data Task Proxy Sandbox Program to process the task event, such as steps 307 to 313.
[0158] Exemplarily, the task proxy service can bind the Get Latest Weather Data Task Proxy Sandbox program to the Get Latest Weather Data Task Trigger Point Hook Function. Specifically, in the Get Latest Weather Data Task Trigger Point Hook Function, the Get Latest Weather Data Task Proxy Sandbox memory representation is obtained in the form of a pointer, and is saved in a specific data structure to manage the reference relationship.
[0159] 307, the weather card uses the direction card management service to send a request for obtaining the latest weather data.
[0160] It should be understood that the weather card users here can be understood as desktops, service centers, etc. For example, the desktop includes a card for the weather app, and the card management service includes a hook function for obtaining the latest weather data task event trigger point.
[0161] For example, the weather card user may send a request to obtain the latest weather data to the card management service at a preset interval. Alternatively, the weather card user may also send a request to obtain the latest weather data to the card management service according to the user's update operation.
[0162] 308. The card management service sends a request to the task proxy service to obtain the latest weather data.
[0163] When the card management service receives the request to obtain the latest weather data, it triggers the hook function of the task event trigger point to obtain the latest weather data and sends the request to obtain the latest weather data to the task proxy service. The hook function can also pass the information of the processor of the task event to obtain the latest weather data, that is, the relevant information of the weather app, to the task proxy service.
[0164] 309, the task proxy service determines whether the weather App process exists.
[0165] The task proxy service can determine whether the weather app process exists through the system service. For example, the task proxy service can obtain a list of surviving applications by calling the activity manager service (AMS) system service interface, and determine whether the weather app process exists by querying the application list. When the weather app process is found in the application list, it can be determined that the weather app process exists, otherwise, it can be determined that the weather app process does not exist.
[0166] When the task proxy service determines that the weather App process exists, step 310 may be executed. When the task proxy service determines that the weather App process does not exist, step 312 may be executed.
[0167] 310, the task proxy service determines whether the weather App process is in a frozen state.
[0168] Exemplarily, in some operating systems, if the task proxy service determines that the memory resources occupied by the weather App process have been released, it can be determined that the weather App process is in a frozen state, and step 312 can be executed; if the task proxy service determines that the memory resources occupied by the weather App process have not been released, it can be determined that the weather App process is in a non-frozen state, and step 311 can be executed.
[0169] It is understandable that step 310 is an optional step, and in some examples, step 310 may not be performed. In this case, when the task proxy service determines that the weather app process does not exist, step 312 may be directly performed, and when the task proxy service determines that the weather app process exists, step 311 may be directly performed.
[0170] 311, the task management service sends a request to the weather app to obtain the latest weather data.
[0171] When the task management service determines that the weather app process is in a non-frozen state, it means that the weather app process has been started and can directly process the request to obtain the latest weather data. Then the task management service can directly send the request to obtain the latest weather data to the weather app, so that the weather app process in the background can process the request to obtain the latest weather data and complete the weather update. In this case, since the weather app process already exists in the background and is in a non-frozen state, it can directly process the request to obtain the latest weather data without additionally calling the sandbox program to execute the task event to obtain the latest weather data.
[0172] 312, the task agent service determines whether the weather app is injected with the task agent sandbox program for obtaining the latest weather data.
[0173] When the task proxy service determines that the weather app process does not exist, or when the task proxy service determines that the weather app exists but is in a frozen state, it can be determined whether the weather app is injected with the task proxy sandbox program for obtaining the latest weather data.
[0174] Exemplarily, the task proxy service can determine whether the weather app has been injected with the Get Latest Weather Data task proxy sandbox program from the data structure associated with the Get Latest Weather Data event trigger point. When the task proxy service determines that the weather app has been injected with the Get Latest Weather Data task proxy sandbox program, step 313 can be executed; when the task proxy service determines that the weather app has not been injected with the Get Latest Weather Data task proxy sandbox program, step 311 can be executed, that is, the Get Latest Weather Data request is sent to the weather app for processing.
[0175] 313, the task agent service calls the task agent sandbox program to obtain the latest weather data and processes the request to obtain the latest weather data according to the task event logic.
[0176] When the task agent service determines that the weather app has been injected with the task agent sandbox program for obtaining the latest weather data, it can call the task agent sandbox program for obtaining the latest weather data to process the request for obtaining the latest weather data according to the task event logic. For example, the task agent sandbox program accesses the network through the auxiliary function library, receives the updated weather data information, and sends it to the weather card management service, which displays the latest weather data in the weather card. Figure 4 This paper introduces in detail the process of obtaining the latest weather data task agent sandbox program to handle the request of obtaining the latest weather data.
[0177] It should be understood that the process of the agent sandbox program of the task of obtaining the latest weather data processing the request for obtaining the latest weather data according to the task event logic is the process of processing the corresponding task event.
[0178] It should be understood that the embodiment of the present application does not limit the specific execution order of the above steps 301 to 313. In other examples, some steps in the above steps 301 to 313 may not be executed or replaced by other steps.
[0179] In one embodiment of the present application, the weather app can inject the Get Latest Weather Data Task Agent Sandbox Program into the task agent service; the task agent service can associate the Get Latest Weather Data Task Agent Sandbox Program with the Get Latest Weather Data Task Trigger Point; when the Get Latest Weather Data Task Event is triggered, the task agent service can determine whether to call the Get Latest Weather Data Task Agent Sandbox Program to process the Get Latest Weather Data Task Event, and when it is determined that the Get Latest Weather Data Task Agent Sandbox Program needs to be called to process the Get Latest Weather Data Task Event, the Get Latest Weather Data Task Agent Sandbox Program is called to process the Get Latest Weather Data Task Event. In this way, when it is necessary to obtain the latest weather data to update the weather card, the Get Latest Weather Data Task Agent Sandbox Program can be used to process the Get Latest Weather Data Task Event without starting the weather app, thereby avoiding increasing the number of processes in the background of the terminal device and ensuring good performance of the terminal device.
[0180] For example, Figure 4 This is the process of obtaining the latest weather data task agent sandbox program processing the request for obtaining the latest weather data provided by the embodiment of the present application. Figure 4 As shown, the process may include steps 3131 to 3138.
[0181] 3131, the task agent sandbox program of obtaining the latest weather data sends a request message for obtaining the network status to a specific auxiliary function 1 in the auxiliary function library.
[0182] In an embodiment of the present application, the task agent sandbox program for obtaining the latest weather data can simulate the weather app to process the request for obtaining the latest weather data, so that the terminal device may not start the weather app to reduce the number of processes existing in the background.
[0183] The process of step 3131 can also be understood as the process of obtaining the latest weather data task agent sandbox program calling the specific auxiliary function 1.
[0184] 3132, the security module determines whether the weather app has permission to obtain the network status.
[0185] Since obtaining network status is a system capability of the terminal device, the security module needs to verify the permission information of the weather app to ensure the security of the system.
[0186] For example, the security module can query the identity information and permission information of the corresponding weather app from the metadata of the agent sandbox program of the task of obtaining the latest weather data, and send the corresponding identity information to the permission manager service for authentication, so as to determine whether the weather app has the permission to obtain the network status. In other examples, the security module can also directly verify according to the permission information, which is not limited in the embodiments of the present application.
[0187] 3133, the auxiliary function library sends a request message for obtaining the network status to the connection service through the specific auxiliary function 1.
[0188] When the security module determines that the weather app has the permission to obtain the network status, the auxiliary function library can send a request message for obtaining the network status to the connectivity service through a specific auxiliary function to obtain the corresponding network status. For example, for obtaining the network status, the specific auxiliary function 1 can be a helper get networkstate auxiliary function.
[0189] It should be understood that other system capabilities can be implemented by calling other auxiliary functions in the auxiliary function library.
[0190] 3134, the task agent sandbox program of obtaining the latest weather data sends a request message for obtaining weather data to a specific auxiliary function 2 in the auxiliary function library.
[0191] After receiving the request message for obtaining weather data, the auxiliary function library can determine whether the weather app has the permission to access the network through the security module.
[0192] The process of step 3134 can also be understood as the process of obtaining the latest weather data task agent sandbox program calling the other specific auxiliary function 2.
[0193] 3135, the security module determines whether the weather app has permission to access the network.
[0194] Since accessing the network is a system capability of the terminal device, the security module needs to verify the permission information of the weather app to ensure the security of the system.
[0195] For example, the security module can query the identity information and permission information of the corresponding weather app from the metadata of the task agent sandbox program for obtaining the latest weather data, and send the corresponding identity information to the permission manager service for authentication, so as to determine whether the weather app has permission to access the network.
[0196] 3136, the auxiliary function library sends a request message for obtaining weather data to the system network library through the specific auxiliary function 2.
[0197] After the security module determines that the weather app has permission to access the network, the auxiliary function library can send a request message for obtaining weather data to the system network library through another specific auxiliary function 2.
[0198] 3137, the system network library sends a request message to the weather app server to obtain weather data.
[0199] After receiving the request message for obtaining weather data, the system network library can initiate a system call to notify the network module in the kernel to interact with the network card and communicate with the weather app server to obtain real-time weather data.
[0200] It should be understood that the server of the weather app can generally be a server or cloud server that provides data support for the weather app.
[0201] 3138, after receiving the weather data, the task agent sandbox program of obtaining the latest weather data sends the weather data to the card management service.
[0202] The server of the weather app can send real-time weather data to the task agent sandbox program for obtaining the latest weather data. After that, the task agent sandbox program for obtaining the latest weather data can process the real-time weather data and package it and send it to the card management service, so that the card management service can update the weather card information so that the weather data displayed on the weather card is real-time weather data.
[0203] It should be understood that the embodiment of the present application does not limit the specific execution order of the above steps 3131 to 3138. In other examples, some steps in the above steps 3131 to 3138 may not be executed or replaced by other steps. For example, step 3135 may not be executed.
[0204] Based on the embodiment of the present application, the weather app can access the network and obtain real-time weather data with the help of the auxiliary functions in the auxiliary function library, so as to have the system capability to access the network. In the process of accessing the network, the security module can also be called to verify the permissions of the weather app, and after the verification is passed, it can access the network, thereby ensuring the security of the system.
[0205] It should be understood that Figure 3 , 4 The weather app is used as an example for illustration. However, this should not limit the applicable scenarios of this application. For other apps, the process of injecting the corresponding task agent sandbox program into the task agent service and the processing process of the task agent service are similar.
[0206] For example, for a gallery app, there is a gallery card on the desktop, which can display recommended pictures to users. When the gallery card needs to update the pictures displayed to users, the task agent sandbox program for obtaining gallery recommended pictures injected by the gallery can be used to handle the task event of the gallery card update, so that the gallery app can be not started, reducing the number of application processes surviving in the background of the terminal device.
[0207] and Figure 3 The difference is that the image update task agent sandbox program needs to have file system access capabilities. Therefore, when the gallery app injects the get gallery recommended image task agent sandbox program into the task agent service, the permission information of the gallery app recorded by the task agent service may include the signature information of the gallery app, and may also include the security context of the gallery app process. When the get gallery recommended image task event is triggered, when the task agent service determines to call the get gallery recommended image task agent sandbox program to execute the task event, the get gallery recommended image task agent sandbox program can request access to the file path by calling the auxiliary function; at this time, the security module will verify the file path that the gallery app can access through the identity information and security context of the gallery app, and only allow the get gallery recommended image task agent sandbox program to access the file path that the gallery app has permission to access; after the permission verification is passed, the auxiliary function initiates a system call to read the image file from the kernel file system; thereafter, the get gallery recommended image task agent sandbox program can send the obtained recommended image file to the card management service, so that the card management service updates the image displayed on the gallery card.
[0208] Exemplarily, when recording the security context of the gallery App, the task proxy service may obtain the security context of the gallery App process by calling an interface of a specific security library.
[0209] In other examples, the image update task agent sandbox program may also have the ability to create files to simulate the gallery app creating files. For example, the image update task agent sandbox program may request to create a file through an auxiliary function in the auxiliary function library, and the identity information of the created file is consistent with the original gallery app, and the security context of the file is consistent with the security context of the gallery app.
[0210] Figure 5 It is a schematic diagram of the correspondence between a task event trigger point and a task agent sandbox program provided in an embodiment of the present application.
[0211] See also Figure 5 In (a), the task proxy service may include n task proxy sandbox programs injected by the application. Each task event trigger point may correspond to a task proxy sandbox program. For example, task event trigger point 1 may correspond to task proxy sandbox program 1, task event trigger point 2 may correspond to task proxy sandbox program 2, ..., task event trigger point n may correspond to task proxy sandbox program n.
[0212] In this case, when a task event corresponding to a task event trigger point occurs, the task proxy service can determine whether to call the task proxy sandbox program corresponding to the task event trigger point to process the task event. When the task proxy service determines to call the task proxy sandbox program to process the task event, the task proxy sandbox program can be called to process the task event, thereby not starting the corresponding application program.
[0213] Exemplarily, the weather card update task event trigger point mentioned above corresponds to a task agent sandbox program, and the gallery card update task event trigger point corresponds to a task agent sandbox program.
[0214] See also Figure 5 In (b), the task proxy service may include n task proxy sandbox programs injected by the application. Among them, one task event trigger point may correspond to multiple task proxy sandbox programs. For example, task event trigger point 1 may correspond to task proxy sandbox program 1, task proxy sandbox program 2, ..., task proxy sandbox program n.
[0215] In this case, when a task event corresponding to a task event trigger point occurs, the task proxy service can determine whether to call the n task proxy sandbox programs corresponding to the task event trigger point to process the task event. When the task proxy service determines to call the n task proxy sandbox programs to process the task event, the n task proxy sandbox programs can be called to process the task event, so that the corresponding application program may not be started.
[0216] The following will combine Figure 6 The present invention introduces a technical solution in which a task event trigger point corresponds to multiple task agent sandbox programs. Exemplarily, the task event corresponding to the task event trigger point may be a system broadcast, such as a screen rotation task event of a terminal device. In the traditional technical solution, each application may register a system broadcast receiver with the system. When a system broadcast occurs, the system forwards the system broadcast to multiple applications that have registered the receiver. In this way, multiple applications may be started, resulting in multiple application processes surviving in the background of the terminal device, occupying a large amount of resources. In the present application, the task agent service replaces the system broadcast receiver to receive the system broadcast, and the corresponding task agent sandbox program may be called to process the system broadcast to avoid starting multiple applications.
[0217] Figure 6 is a schematic flow chart of a task agent provided in an embodiment of the present application. Figure 6 As shown, the method 400 may include steps 401 to 413 .
[0218] 401, the target App injects the task agent sandbox program into the task agent service.
[0219] It is understandable that the target App may be multiple Apps, and each of the multiple Apps needs to inject the task agent sandbox program into the task agent service.
[0220] The process of App injecting the task agent sandbox program into the task agent service can be referred to the relevant description in step 301, and will not be repeated here for the sake of brevity.
[0221] 402 , the task proxy service determines whether identity information and permission information of the target App exists.
[0222] 403, the task proxy service obtains the identity information and permission information of the target App.
[0223] 404: The task proxy service records the identity information and permission information of the target App.
[0224] 405 , the programmable sandbox runtime saves the identity information and permission information of the target App in the metadata of the task agent sandbox program.
[0225] It should be understood that the steps 402 to 405 may refer to the relevant descriptions of the steps 302 to 305 in the foregoing text.
[0226] 406 , the task agent service associates the target task agent sandbox program with the system broadcast event trigger point.
[0227] It is understandable that the target task proxy sandbox program is the task proxy sandbox program injected by the target App into the task proxy service, and the target task proxy sandbox program is a plurality of task proxy sandbox programs. In this way, a system broadcast event trigger point can be associated with a plurality of task proxy sandbox programs.
[0228] Exemplarily, the task agent service may register multiple task agent sandbox programs into the list of the system broadcast event trigger response points, so as to associate the system broadcast event trigger points with the multiple task agent sandbox programs.
[0229] For example, the system broadcast event may be a screen rotation event, a time zone change event, a system screen on / off event, and the like.
[0230] 407, when a system broadcast event occurs, the task proxy service receives a message indicating that the system broadcast event occurs.
[0231] When a system broadcast event occurs, the hook function of the system broadcast task event trigger point will be triggered, and a system broadcast event occurrence message will be sent to the task proxy service, and the task proxy service will receive the system broadcast event occurrence message.
[0232] 408 , the task proxy service traverses multiple task proxy sandbox programs to determine the corresponding target App.
[0233] After receiving the system broadcast event occurrence message, the task proxy service may traverse a list of multiple task proxy sandbox programs associated with the system broadcast event trigger point to determine a corresponding target App.
[0234] 409, the task proxy service determines whether the process of the target App exists.
[0235] The task proxy service can determine whether the process of the target App exists through the system service. If it is determined that the process of the target App exists, step 410 can be executed; if it is determined that the process of the target App does not exist, step 412 can be executed.
[0236] It is understandable that the task proxy service can make a judgment on each App included in the target App.
[0237] It is understandable that some of the target apps may be in a live state, while others may be in a non-live state. The task proxy service may then execute step 410 for the live apps and step 412 for the non-live apps.
[0238] 410 , the task proxy service determines whether the process of the target App is in a frozen state.
[0239] In some operating systems, if the task proxy service determines that the process of the target App is in a frozen state, step 412 may be executed. If the task proxy service determines that the process of the target App is in a non-frozen state, step 411 may be executed.
[0240] It should be understood that the task proxy service determines whether the process of the target App is in a frozen state, as described in the above text.
[0241] 411, the task proxy service forwards the system broadcast to the broadcast receiver of the target App.
[0242] When the task proxy service determines that the process of the target App is in a non-frozen state, a system broadcast may be sent to a system broadcast receiver of the target App, so that the target App process processes the system broadcast.
[0243] It is understandable that some of the target apps may be in a non-frozen state, and other apps may be in a frozen state, and the task proxy service may send the system broadcast to the apps in the non-frozen state.
[0244] 412, the task proxy service puts the task proxy sandbox program of the target App into a queue to be run.
[0245] When the task proxy service determines that the process of the target App does not exist, the task proxy sandbox program of the target App is placed in a waiting queue to be executed.
[0246] In other examples, the task proxy service can also pre-create multiple processes, and when a task proxy sandbox program needs to be executed, one of the pre-created multiple processes is selected to execute the task proxy sandbox program. In addition, at the same time, the same process can only execute one task proxy sandbox program to avoid conflicts between applications.
[0247] 413, the target task agent sandbox program processes the system broadcast event.
[0248] The target task agent sandbox program simulates the original application to handle system broadcast events.
[0249] Based on the embodiments of the present application, a task event trigger point can be associated with multiple task agent sandbox programs; when the task event is triggered, the task agent service can determine whether to call multiple task agent sandbox programs to execute the task event. When it is determined that multiple task agent sandbox programs need to be called to execute the task event, the multiple task agent sandbox programs can be called to execute the task event, thereby avoiding the launch of multiple applications and reducing the number of application processes surviving in the background of the terminal device.
[0250] It should be understood that the various embodiments in the foregoing may be combined with each other or partially combined to form a new technical solution, and such a technical solution should not be considered to exceed the protection scope of this application.
[0251] Figure 7 is a schematic block diagram of a terminal device provided in an embodiment of the present application. Figure 7 As shown, the terminal device 800 may include one or more processors 810; one or more memories 820; the one or more memories 820 store one or more programs, and when the one or more programs are executed by one or more processors 810, the method of task agent described in any possible implementation method described above is executed.
[0252] In some embodiments, the terminal device 800 may be the terminal device 100 mentioned above.
[0253] Exemplarily, the terminal device 800 is used to execute the method 200, the method 300 and the method 400 mentioned above.
[0254] An embodiment of the present application also provides a chip system, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the task agent method described in any possible implementation method described above is executed.
[0255] It is understandable that, in order to implement the above functions, the terminal device includes hardware and / or software modules corresponding to the execution of each function. In combination with the method steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and software. Whether a function is executed in the form of hardware or software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0256] In this embodiment, the terminal device can be divided into functional modules 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 above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0257] This embodiment also provides a task agent device, including a module for implementing the task agent method in the above embodiment.
[0258] This embodiment also provides a readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes the above-mentioned related method steps to implement the task agent method in the above-mentioned embodiment.
[0259] This embodiment also provides a program product. When the program product is run on a terminal device, the terminal device executes the above-mentioned related steps to implement the task agent method in the above-mentioned embodiment.
[0260] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store execution instructions, and when the device is running, the processor can execute the execution instructions stored in the memory to enable the chip to execute the task agent method in the above-mentioned method embodiments.
[0261] Among them, the device, equipment, readable storage medium, program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
[0262] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software 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 this application.
[0263] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0264] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0265] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0266] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0267] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk.
[0268] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A task agent method, characterized in that: The method is applied to a terminal device, wherein the terminal device includes a target task agent sandbox program, wherein the target task agent sandbox program includes a target task event logic, wherein the target task event logic corresponds to a target application program, and wherein the method includes: Associating the target task agent sandbox program with the target task event trigger point; If the target task event trigger point is triggered, determining whether it is necessary to call the target task agent sandbox program; If it is determined that the target task agent sandbox program needs to be called, the target task event is processed according to the target task event logic, wherein the target task event logic is the logic of the target application program processing the target task event.
2. The method according to claim 1, characterized in that The terminal device also includes permission information of the target application, the permission information includes permissions of the terminal device system capabilities that the target application can access, and the method further includes: Determining whether the target application has permission to access the system capabilities of the terminal device according to the permission information; If the target application has permission to access the system capabilities of the terminal device, allowing the target task agent sandbox program to access the system capabilities of the terminal device; If the target application does not have permission to access the system capabilities of the terminal device, the target task agent sandbox program is denied access to the system capabilities of the terminal device.
3. The method according to claim 1 or 2, characterized in that: In the process of processing the target task event according to the target task event logic, the method further includes: The target task agent sandbox program is enabled to access the system capability of the terminal device through an auxiliary function.
4. The method according to any one of claims 1 to 3, characterized in that The determining whether the target task agent sandbox program needs to be called includes: When the target application process exists, determining that there is no need to call the target task agent sandbox program; When the target application process does not exist, it is determined that the target task agent sandbox program needs to be called.
5. The method according to any one of claims 1 to 3, characterized in that: The determining whether the target task agent sandbox program needs to be called includes: If the memory resources occupied by the process of the target application program have not been released, it is determined that there is no need to call the target task agent sandbox program; If the memory resources occupied by the process of the target application program have been released, it is determined that the target task agent sandbox program needs to be called.
6. The method according to claim 4 or 5, characterized in that: When it is determined that the target task agent sandbox program needs to be called, the method further includes: Determining whether the terminal device includes the target task agent sandbox program; The processing of the target task event according to the target task event logic includes: If the terminal device includes the target task agent sandbox program, the target task event is processed according to the target task event logic.
7. The method according to claim 6, characterized in that The method further comprises: If the terminal device does not include the target task agent sandbox program, starting the target application program; The target task event is processed by the target application.
8. The method according to claim 4 or 5, characterized in that: When it is determined that the target task agent sandbox program does not need to be called, the method further includes: The target task event is processed by the target application.
9. The method according to any one of claims 1 to 8, characterized in that The target task event trigger point is associated with at least one target task agent sandbox program.
10. The method according to claim 9, characterized in that If the target task event trigger point is associated with a plurality of target task agent sandbox programs, wherein if the target task event trigger point is triggered, determining whether the target task agent sandbox program needs to be called includes: If the target task event trigger point is triggered, it is determined whether the plurality of target task agent sandbox programs need to be called.
11. A terminal device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more programs, and when the one or more programs are executed by one or more processors, the method of the task agent according to any one of claims 1 to 10 is executed.
12. A task agent device, characterized in that: The method comprises a module for implementing the method of task agent as claimed in any one of claims 1 to 10.
13. A chip system, characterized in that: The chip system includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method of task agent according to any one of claims 1 to 10 is executed.
14. A readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed on the terminal device, the method for task agent according to any one of claims 1 to 10 is executed.