Task execution method and apparatus
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG E COMMERCE BANK CO LTD
- Filing Date
- 2022-10-08
- Publication Date
- 2026-08-07
AI Technical Summary
然而,由于拦截工具是通过拦截目标任务的运行进程来实现执行信息的获取,目标任务的运行进程是通过安装在终端上的操作系统来生成的,因而,在需要对拦截工具中对应于目标任务的目标任务片段进行调整时,需要初始化操作系统来重新生成目标任务的运行进程,才能对应实现,即每次调整拦截工具中的目标任务片段,都要重启终端来初始化操作系统,增加了目标任务片段的调整耗时,降低了目标任务的执行效率
[0019]本说明书一个或多个实施例中,接收任务指令,根据目标任务,调整原生应用中的目标任务片段,并重启原生应用,利用预设拦截工具,从原生应用中调用目标任务片段,执行目标任务片段获得目标任务的执行信息。通过将拦截工具中对应于目标任务的目标任务片段与拦截工具分离,并将目标任务片段搭载于原生应用中,使得目标任务片段在原生应用中被调整,拦截工具在拦截了目标任务的运行进程后,只需从原生应用中调用并执行目标任务片段,来获得目标任务的执行信息,即调整前后的目标任务片段在执行时,并未对目标任务的运行进程进行更改,无需重启终端,降低目标任务片段的调整耗时,提升了目标任务的执行效率。
Smart Images

Figure CN115543573B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to a task execution method. Background Technology
[0002] With the development of internet technology, more and more applications are being developed and used, greatly facilitating and enriching people's lives.
[0003] In the development of various applications and their derivative applications, it is necessary to adjust the execution logic of their tasks according to different usage scenarios. The premise for adjusting the execution logic of their tasks is to obtain the execution information of the tasks, and on this basis, further analyze, design, and adjust to obtain a specified application that can execute the target task.
[0004] Currently, the method for obtaining task execution information involves using a pre-defined interception tool to intercept the target task's running process and directly obtain its execution information. However, since the interception tool obtains execution information by intercepting the target task's running process, and this process is generated by the operating system installed on the terminal, any adjustment to the target task segment within the interception tool requires initializing the operating system to regenerate the target task's running process. This means that each adjustment to the target task segment in the interception tool necessitates restarting the terminal to initialize the operating system, increasing the time required for adjustment and reducing the target task's execution efficiency. Therefore, a time-efficient and high-performance task execution method is urgently needed. Summary of the Invention
[0005] In view of the above, embodiments of this specification provide a task execution method. One or more embodiments of this specification also relate to a task execution apparatus, a computing device, a computer-readable storage medium, and a computer application, to address the technical deficiencies existing in the prior art.
[0006] According to a first aspect of the embodiments of this specification, a task execution method is provided, applied to a terminal, comprising:
[0007] Receive task instructions, which carry the target task;
[0008] Based on the target task, adjust the target task fragment in the native application and restart the native application. The native application is a pre-developed application designed to carry the target task fragment.
[0009] Using a pre-defined interception tool, the target task fragment is invoked from the native application, and the execution information of the target task is obtained by executing the target task fragment.
[0010] According to a second aspect of the embodiments of this specification, a task execution apparatus is provided, applied to a terminal, comprising:
[0011] The receiving module is configured to receive task instructions, wherein the task instructions carry the target task;
[0012] The adjustment module is configured to adjust the target task fragment in the native application according to the target task and restart the native application, wherein the native application is a pre-developed application for carrying the target task fragment;
[0013] The first execution module is configured to use a preset interception tool to call the target task fragment from the native application, execute the target task fragment, and obtain the execution information of the target task.
[0014] According to a third aspect of the embodiments of this specification, a computing device is provided, comprising:
[0015] Memory and processor;
[0016] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described task execution method.
[0017] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the task execution method described above.
[0018] According to a fifth aspect of the embodiments of this specification, a computer application is provided, wherein when the computer application is executed in a computer, the computer is instructed to perform the steps of the above-described task execution method.
[0019] In one or more embodiments of this specification, a task instruction is received, and a target task fragment in the native application is adjusted according to the target task. The native application is then restarted, and a preset interception tool is used to call and execute the target task fragment from the native application to obtain the execution information of the target task. By separating the target task fragment corresponding to the target task from the interception tool and embedding the target task fragment in the native application, the target task fragment is adjusted within the native application. After intercepting the running process of the target task, the interception tool only needs to call and execute the target task fragment from the native application to obtain the execution information of the target task. That is, the target task fragment before and after adjustment does not change the running process of the target task during execution, and there is no need to restart the terminal, reducing the adjustment time of the target task fragment and improving the execution efficiency of the target task. Attached Figure Description
[0020] Figure 1This is a schematic diagram of the processing flow of a task execution method in the prior art;
[0021] Figure 2 This is a flowchart illustrating a task execution method provided in one embodiment of this specification;
[0022] Figure 3 This is a flowchart illustrating the processing procedure of a task execution method for an Android system application, provided in one embodiment of this specification.
[0023] Figure 4 This is a schematic diagram of the processing flow of a task execution method provided in one embodiment of this specification;
[0024] Figure 5 This is a schematic diagram of the structure of a task execution device provided in one embodiment of this specification;
[0025] Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0026] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0027] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0028] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0029] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0030] An operating system (OS) is a set of interconnected system software applications that manage and control terminal operation, utilize and run hardware and software resources, and provide public services to organize user interaction. Based on the operating environment, operating systems can be categorized into computer operating systems, mobile terminal operating systems, server operating systems, embedded operating systems, etc.
[0031] Android operating system: a free and open-source operating system based on the Linux kernel (excluding GNU components). It is primarily used on mobile devices.
[0032] Xposed (Xposed framework, XP framework, Xposed framework): is an interception tool framework that runs on the Android operating system. It can intercept the running process of a target task and modify the running process of the target task through fragments of the target task, thereby achieving the target function corresponding to the target task fragment. Therefore, Xposed is used to intercept and modify the running process of a target task, thereby modifying the functionality of the Android operating system and applications.
[0033] Xposed modules: An interception tool that supports Xposed Android operating system applications. Users can develop and use custom Xposed modules to modify the running process of a target task, obtain execution information of the target task, and modify the execution logic of the target task. Xposed modules are developed using the Java language.
[0034] Java mapping mechanism: This refers to the ability, during application runtime, to construct objects of any class, to learn the class of any object, to learn the member variables and methods of any class, and to call the attributes and methods of any object. This ability to dynamically obtain application information and dynamically invoke objects is called the Java mapping mechanism.
[0035] Hook code: In the Java programming language, it is a code method that can capture (hook) an application's task, modify its execution logic, and obtain the task's execution information.
[0036] like Figure 1 As shown, Figure 1This diagram illustrates the processing flow of a task execution method in the prior art. An operating system is installed on the terminal, which generates the running process of the target task. The interception tool contains an interception task fragment and a target task fragment. The interception task fragment is executed to intercept the running process of the target task, and then the target task fragment is executed to obtain the execution information of the target task. After adjusting the target task fragment in the interception tool, an adjusted target task fragment is obtained, i.e., an adjusted interception tool. The terminal needs to be restarted and the running process regenerated. The interception task fragment is then executed again to intercept the running process of the target task, and then the target task fragment is executed again to obtain the execution information of the target task.
[0037] For example, consider a music player application. Upon startup, this application retrieves splash screen data and displays it on the terminal. This task of retrieving and displaying the splash screen data is the target task. The interception tool contains a segment of this target task that skips the splash screen. When the splash screen changes, the target task changes, and the corresponding segment must also be adjusted. This requires adjusting the interception tool. After obtaining the adjusted tool, the terminal needs to be restarted to achieve the desired result of skipping the splash screen. During the adjustment process, repeated debugging is required to verify the tool's performance. Each debugging session necessitates a terminal restart, increasing unnecessary restart time and resulting in insufficient debugging efficiency.
[0038] To address the aforementioned problems, this specification provides a task execution method, and also relates to a task execution device, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0039] See Figure 2 , Figure 2 A flowchart of a task execution method according to an embodiment of this specification is shown. The method is applied to a terminal and specifically includes the following steps.
[0040] Step 202: Receive task instructions, wherein the task instructions carry the target task.
[0041] This specification applies to terminals with an operating system installed. By pre-developing native applications to carry the target task fragments, it avoids the interception tool directly executing the target task fragments and thus modifying the target task's running process. Adjustments to the target task fragments only need to be implemented in the native application. The interception tool only implements the interception task of the target task's running process, thus decoupling the interception and the execution of the target task fragments. Therefore, the target task fragments can be adjusted without restarting the terminal.
[0042] The target task is an executable code method within a specified application. This executable code method includes executable code snippets. After the specified application is installed on the operating system, the user runs the target task through the terminal, and the operating system generates a corresponding running process for that target task. The target task is determined beforehand by decompiling the specified application. The specified application is an application installed on the terminal that performs the corresponding function.
[0043] The target task fragment is a code method fragment corresponding to the target task. The target task fragment obtains the execution information of the target task by modifying the running process of the target task.
[0044] Task instructions are adjustment instructions for a target task segment. Specifically, task instructions carry identification information of the target task. The identification information of the target task can be the method name of the target code method, the directory of the target code method, etc., which are not limited here.
[0045] For example, a specified application is decompiled to obtain code method 1 (Get XXX), code method 2 (CountXXX), and code method 3 (Get YYY). Depending on actual needs, the execution processes of code method 1 and code method 2 need to be modified, thus identifying code method 1 and code method 3 as target tasks. Corresponding target task fragments, Hook_Get XXX and Hook_Get YYY, have already been generated in advance. Based on the identifier information "Get XXX" of code method 1, a task instruction Vim Hook_Get XXX is generated to adjust the target task fragment Hook_Get XXX. Correspondingly, a task instruction Vim Hook_Get YYY is generated to adjust the target task fragment Hook_Get YYY.
[0046] Receiving task instructions can refer to receiving task instructions sent by the user through the terminal, or it can refer to receiving task instructions generated by the terminal based on the execution effect of the target task segment; there is no limitation here.
[0047] By receiving mission instructions carrying the target task, a basis for subsequent adjustments to the target task segments is provided.
[0048] Step 204: Based on the target task, adjust the target task fragment in the native application and restart the native application. The native application is a pre-developed application designed to carry the target task fragment.
[0049] A native application is a pre-developed application designed to carry a target task fragment. It is pre-configured to be invoked by interception tools, which then call the native application to execute the target task fragment. A native application is an application installed on the terminal that can run the target task fragment. Because the native application is also installed on the terminal, the operating system generates a running process for the target task fragment of the native application. Since changes to the content of the target task fragment require reloading of the code methods, the native application needs to be restarted after any adjustments are made to the target task fragment.
[0050] Adjusting the target task fragment in a native application can be done either by changing the specified application or by changing the target task in the same specified application; there is no limitation on this.
[0051] Based on the target task, the target task fragment in the native application is adjusted. Specifically, the corresponding target task fragment is determined from the native application based on the target task's identifier information, and then adjusted. Further, the target task fragment is adjusted by receiving an adjustment command sent by the user, wherein the adjustment command carries a replacement task fragment; the target task fragment is replaced with the replacement task fragment, and the replacement task fragment is determined to be the adjusted target task fragment.
[0052] For example, based on the target task's identification information "Get XXX" and "Get YYY", the corresponding target task segments Hook_Get XXX and Hook_Get YYY are determined from the native application. An adjustment instruction sent by the user is received, wherein the adjustment instruction carries the replacement task segments NewHook_Get XXX and NewHook_Get YYY. The replacement task segments NewHook_Get XXX and NewHook_Get YYY are used to replace the target task segments Hook_Get XXX and Hook_Get YYY. The replacement task segments NewHook_Get XXX and NewHook_Get YYY are determined to be the adjusted target task segments, and the native application is restarted.
[0053] Based on the target task, the target task fragment in the native application was adjusted, which laid the foundation for subsequent execution and obtaining the execution information of the target task. The native application was restarted, and the runtime environment was set up, which laid the foundation for subsequent invocation by the preset interception tool.
[0054] Step 206: Using a preset interception tool, call the target task fragment from the native application, execute the target task fragment to obtain the execution information of the target task.
[0055] An interceptor tool is an application that has the function of intercepting running processes and calling code methods of other applications. The interceptor tool calls the native application, which in turn calls the target task fragment to execute. The interceptor tool is an application installed on the terminal that can intercept running processes and call target task fragments. A preset interceptor tool can be obtained by extracting the target task fragment from a pre-acquired initial preset interceptor tool, or it can be directly pre-built with interception capabilities and the ability to call other applications; this is not limited here. Since the interceptor tool is installed on the terminal, the operating system generates processes on the interceptor tool to intercept and call other applications. Because the interceptor tool intercepts the running process of the target task and calls the native application, and thus calls the target task fragment, before and after the target task fragment is adjusted, there is no change; that is, the interceptor tool does not need to be restarted before or after the adjustment.
[0056] The execution information of the target task includes the parameters, time, and functions used during its execution. Obtaining this information allows for further analysis, design, and adjustment, providing a clear understanding of the target task's implementation logic and leading to a specific application capable of executing the target task.
[0057] By using a pre-defined interception tool, the target task fragment is invoked from the native application, and the execution information of the target task is obtained by executing the target task fragment. Specifically, the target task fragment is invoked from the native application using the pre-defined interception tool, loaded into the running process of the target task, and executed to obtain the execution information of the target task.
[0058] For example, using a preset interception tool, the target task fragments NewHook_Get XXX and NewHook_Get YYY of the native application are called, and the target task fragments NewHook_Get XXX and NewHook_Get YYY are loaded into the running process of the target task code method 1 (Get XXX) and code method 3 (Get YYY). The target task fragments are then executed to obtain the execution information (parameters, time, functions, etc.) of the target task.
[0059] In the embodiments described in this specification, a task instruction is received, and the target task fragment in the native application is adjusted according to the target task. The native application is then restarted, and a preset interception tool is used to call and execute the target task fragment from the native application to obtain the execution information of the target task. By separating the target task fragment corresponding to the target task from the interception tool and embedding the target task fragment in the native application, the target task fragment is adjusted within the native application. After intercepting the running process of the target task, the interception tool only needs to call and execute the target task fragment from the native application to obtain the execution information of the target task. That is, the target task fragment before and after adjustment does not change the running process of the target task during execution, and there is no need to restart the terminal, reducing the adjustment time of the target task fragment and improving the execution efficiency of the target task.
[0060] Optionally, the method further includes the following specific steps:
[0061] Identify whether each currently running application is a specified application, where a specified application is an application that can execute the target task;
[0062] Correspondingly, step 206 includes the following specific steps:
[0063] If the first application currently running is the specified application, the target task fragment is invoked from the native application using a preset interception tool. The execution of the target task fragment is then used to obtain the execution information of the first application executing the target task.
[0064] Since the target task fragment is a code method fragment corresponding to the target task of a specified application, and the interception tool actually intercepts the running process of each application task when performing the interception function, if the application corresponding to the task is not the specified application, calling the target task fragment for it will cause the application to fail to run normally on the terminal. It is necessary to identify whether the application is the specified application in advance, and then use the interception tool to call the target task fragment and execute it.
[0065] The currently running applications are those currently running on the terminal. The first application is the application corresponding to the specified application among all applications.
[0066] To identify whether each currently running application is a specified application, the specific method is to determine whether each currently running application is a specified application based on its identification information.
[0067] For example, the target task fragment is determined based on the identification information of each currently running application (application1.exe), "application2.exe" and "application3.exe", to determine whether each currently running application (application1.exe, application2.exe and application3.exe) is the specified application (application3). If application3 is determined to be the specified application, the target task fragment is called from the native application using a preset interception tool, and the target task fragment is executed to obtain the execution information of the first application executing the target task.
[0068] It identifies whether each currently running application is the specified application. If the first running application is the specified application, it uses a preset interception tool to call the target task fragment from the native application, executes the target task fragment, and obtains the execution information of the first application executing the target task. This ensures the accuracy of calling the target task fragment, thereby ensuring that the execution information of the target task can be effectively obtained.
[0069] Optionally, the method further includes the following specific steps:
[0070] If the currently running second application is not the specified application, continue running the second application.
[0071] For example, the target task segment is to determine whether each of the currently running applications (application 1, application 2, and application 3) is the specified application (application 3) based on the identification information of each application (application 1, application 2, and application 3) "application1.exe", "application 2.exe", and "application 3.exe". If application 3 is determined to be the specified application, application 1 and application 2 continue to run.
[0072] Since the target task fragment is a code method fragment corresponding to the target task of a specified application, and the interception tool actually intercepts the running process of each application task when performing the interception function, if the application corresponding to the task is not the specified application, calling the target task fragment for it will cause the application to fail to run normally on the terminal. It is necessary to identify whether the application is the specified application in advance, and then use the interception tool to call the target task fragment and execute it.
[0073] The second application is an application that does not correspond to a specific application in each application.
[0074] If the currently running second application is not the specified application, the second application continues to run. This ensures the accuracy of calling the target task fragment, thereby guaranteeing the timeliness and stability of applications that do not correspond to the specified application executing on the terminal.
[0075] Optionally, the native application includes a pre-defined API call interface;
[0076] Correspondingly, in step 206, a preset interception tool is used to call the target task fragment from the native application, including the following specific methods:
[0077] By using a pre-defined interception tool, access a pre-defined API call to invoke the target task fragment from the native application.
[0078] The default API is an application API pre-defined within the native application. It is a collection of function call code methods. Other applications access this API to invoke target task fragments within the native application. The API enables cross-application scheduling and execution of code methods across different applications.
[0079] For example, using a pre-defined interception tool, the pre-defined call interface MainHook.handleLoadPackage is accessed to call the target task fragments NewHook_Get XXX and NewHook_Get YYY from the native application.
[0080] By utilizing pre-defined interception tools and accessing pre-defined API calls, target task fragments can be invoked from native applications. This improved accuracy and efficiency in invoking target task fragments within native applications.
[0081] Optionally, before step 206, the following specific steps are also included:
[0082] Determine the storage location of the native application;
[0083] Based on the storage location and the preset interface mapping mechanism, obtain the preset call interface in the native application.
[0084] The storage location of a native application is the location where the native application's application package (APK) is stored on the terminal.
[0085] The preset interface mapping mechanism is a mapping relationship between the pre-defined storage location of the native application and the preset calling interface. Through this mechanism, the preset calling interface is obtained from the storage location of the native application on the terminal. Different object-oriented high-level programming languages have different preset interface mapping mechanisms; for example, there are Java mapping mechanisms and C# mapping mechanisms.
[0086] The storage location of the native application is determined by using its identification information.
[0087] Based on the storage location and the preset interface mapping mechanism, the preset call interface in the native application is obtained. Specifically, based on the storage location of the native application, a call interface query task is constructed, the call interface query task is run, and the preset call interface is obtained from the storage location of the native application on the terminal through the preset interface mapping mechanism.
[0088] For example, the identification information of the native application is "application3.exe". Based on the identification information "application3.exe", the storage location Path of the native application package on the terminal is determined. Based on the storage location Path, a call interface query task PathClassLoader is constructed. The call interface query task PathClassLoader is run, and the JAVA mapping mechanism is used to query the storage location Path to obtain the preset call interface MainHook.handleLoadPackage of the native application.
[0089] The system determines the storage location of the native application and, based on this location and a pre-defined interface mapping mechanism, obtains the pre-defined API calls within the native application. This method improves the correspondence between the obtained API calls and the native application, ensuring the accuracy of the obtained API calls.
[0090] Optionally, before step 206, the following specific steps are also included:
[0091] Obtain the preset interception tool, which has an entry point pre-configured;
[0092] Configure the entry point to call the target task fragment in the native application.
[0093] The entry point is a pre-configured application call interface in the interception tool, which is a collection of function call code methods. The interception tool uses this entry point to call the target task fragment in the native application. The entry point enables cross-application scheduling and execution of code methods between different applications.
[0094] For example, a preset interception tool is obtained, wherein the preset interception tool is pre-configured with an entry point handleLoadPackage, and the entry point is configured to call the target task fragments NewHook_Get XXX and NewHook_Get YYY in the native application.
[0095] A preset interception tool is retrieved, which has a pre-configured entry point that is set to call the target task fragment from the native application. This ensures the accuracy and efficiency of calling the target task fragment.
[0096] Optionally, the entry point can be configured to invoke a target task fragment from a native application, including the following specific steps:
[0097] Configure the entry point to access the default API of the native application.
[0098] The entry point is a pre-configured application call interface in the interception tool, which is a collection of function call code methods. The interception tool uses this entry point to call the target task fragment in the native application. The entry point enables cross-application scheduling and execution of code methods between different applications.
[0099] For example, a preset interception tool is obtained, wherein the preset interception tool is pre-configured with an entry point handleLoadPackage, and the entry point is configured to access the preset call interface MainHook.handleLoadPackage of the native application.
[0100] The entry point is configured to access the default API of the native application. This further ensures the accuracy of calling the target task segment.
[0101] Optionally, after configuring the entry point to invoke the target task fragment in the native application, the following specific steps are also included:
[0102] Restart the terminal.
[0103] Because the code methods in the interception tool have been modified, it is necessary to restart the terminal to load the code methods in the interception tool so that it can perform the corresponding functions.
[0104] The terminal can be restarted in two ways: either by generating a terminal restart request, displaying a terminal restart interface on the terminal based on the request, receiving user feedback on the terminal restart command, and restarting the terminal based on the command; or by directly generating a terminal restart command and restarting the terminal based on the command. No particular method is specified here.
[0105] Restarting the terminal ensured the normal operation of the subsequently configured interception tools and guaranteed the stability of task execution.
[0106] Optionally, before step 206, the following specific steps are also included:
[0107] Restart the specified application that is executing the target task.
[0108] Since the specified application is running, it cannot be determined whether the specified application has executed the target task during the execution process. It is necessary to restart the specified application that is executing the target task to ensure that the execution segment of the target task can be executed and the execution information of the target task can be obtained.
[0109] The method for restarting the specified application that executes the target task can be either to generate an application restart request for the specified application that executes the target task, display an application restart interactive interface on the terminal based on the application restart request, receive application restart instructions from the user, and restart the specified application based on the application restart instructions; or to directly generate an application restart instruction for the specified application that executes the target task, and restart the specified application based on the application restart instruction. There is no limitation here.
[0110] By restarting the terminal, the normal operation of the subsequently configured interception tools was ensured, and the execution information of the target task was effectively obtained.
[0111] The following is in conjunction with the appendix Figure 3 Taking the task execution method provided in this manual as an example, the task execution method will be further explained. Figure 3 This specification illustrates a flowchart of a task execution method for an Android system application according to an embodiment of the present specification, which specifically includes the following steps.
[0112] Step 302: Develop a native application using the Android development platform;
[0113] The embodiments in this specification are applied to terminals with an operating system installed.
[0114] For native applications, the API call MainHook.handleLoadPackage is pre-configured.
[0115] Step 304: Decompile the specified application to obtain its code methods;
[0116] The specified application is Bank A's application.
[0117] Step 306: Determine the instruction based on the code method sent by the user, and identify the target code method as the target task from the code methods of the specified application;
[0118] The target code method is the code method in Bank A's application that stores users' personal information.
[0119] Step 308: Receive the target task fragment edited according to the target task;
[0120] The target task fragment is a hook code that can intercept and invoke user personal information stored in Bank A's application.
[0121] Step 310: Load the target task fragment onto the native application and install the native application onto the terminal;
[0122] Step 312: Obtain the storage location of the native application on the terminal based on the identification information of the specified application;
[0123] Step 314: Based on the storage location of the native application, construct a call interface query task, run the call interface query task, and obtain the preset call interface from the storage location of the native application on the terminal through the preset interface mapping mechanism.
[0124] The interface mapping mechanism is a Java mapping mechanism.
[0125] Step 316: Obtain the preset interception tool;
[0126] The default interception tool is an Xposed module. Xposed has a pre-configured entry point. Xposed modules are also pre-developed on the Android platform.
[0127] Step 318: Configure the entry point to access the default API of the native application;
[0128] Configure the entry point to access the native application's default API call, MainHook.handleLoadPackage.
[0129] Step 320: Install the default blocking tool to the terminal and restart the terminal;
[0130] Step 322: Receive task instructions, adjust the target task fragment in the native application, and restart the native application;
[0131] Because the designated application has been changed from Bank A to Bank B, the target task fragment needs to be adjusted to a hook code that can intercept and call user personal information stored in Bank B.
[0132] Step 324: Identify whether each currently running application is a specified application;
[0133] Step 326: If so, use the preset interception tool to access the preset call interface, call the target task fragment from the native application, execute the target task fragment to obtain the execution information of the specified application executing the target task.
[0134] Using the Xposed module, the preset call interface MainHook.handleLoadPackage is accessed to intercept and call the HOOK code that stores user personal information from the native application. Executing the HOOK code obtains the execution information of Bank B's application that stores user personal information.
[0135] In this embodiment, the target task fragment corresponding to the target task in the interception tool is separated from the interception tool, and the target task fragment is mounted in the native application. This allows the target task fragment to be adjusted within the native application. After intercepting the running process of the target task, the interception tool only needs to call and execute the target task fragment from the native application to obtain the execution information of the target task. That is, the target task fragment before and after adjustment does not change the running process of the target task during execution, and there is no need to restart the terminal. Compared with the restart time of tens of seconds to several minutes of terminal restart, only a few seconds are needed after adjusting the target code fragment and restarting the native application. This greatly reduces the adjustment time of the target task fragment and improves the execution efficiency of the target task.
[0136] Figure 4 A schematic diagram of the processing flow of a task execution method provided in one embodiment of this specification is shown.
[0137] like Figure 4 As shown, an operating system is installed on the terminal. The operating system generates the running process of the target task. The interception tool contains an interception task fragment. After adjusting the target task fragment carried in the native application, the native application carries the adjusted target task fragment. The interception tool executes the interception task fragment to intercept the running process of the target task. The interception tool accesses the reserved call interface in the native application to call the target task fragment and obtain the execution information of the target task. There is no need to restart the terminal to regenerate the running process.
[0138] Corresponding to the above method embodiments, this specification also provides embodiments of a task execution device. Figure 5 A schematic diagram of a task execution device according to one embodiment of this specification is shown. Figure 5 As shown, the device includes:
[0139] The receiving module 502 is configured to receive a task instruction, wherein the task instruction carries the target task;
[0140] The adjustment module 504 is configured to adjust the target task fragment in the native application according to the target task and restart the native application, wherein the native application is a pre-developed application for carrying the target task fragment;
[0141] The first execution module 506 is configured to use a preset interception tool to call a target task fragment from the native application, execute the target task fragment, and obtain the execution information of the target task.
[0142] Optionally, the device further includes:
[0143] The identification module is configured to identify whether each currently running application is a specified application, wherein the specified application is an application that can execute the target task;
[0144] Correspondingly, the first execution module 506 can be further configured as follows:
[0145] If the first application currently running is the specified application, the target task fragment is invoked from the native application using a preset interception tool. The execution of the target task fragment is then used to obtain the execution information of the first application executing the target task.
[0146] Optionally, the device further includes:
[0147] The second execution module is configured to continue running the second application even if the currently running second application is not the specified application.
[0148] Optionally, the native application includes a pre-defined API call interface;
[0149] Correspondingly, the first execution module 506 can be further configured to: use a preset interception tool to access a preset call interface and call the target task fragment from the native application.
[0150] Optionally, the device further includes:
[0151] The API call module is configured to determine the storage location of the native application; based on the storage location and the preset API mapping mechanism, it obtains the preset API calls in the native application.
[0152] Optionally, the device further includes:
[0153] The entry configuration module is configured to obtain a preset interception tool, in which an entry point is pre-configured; the entry point is configured to call the target task fragment in the native application.
[0154] Optionally, the entry configuration module is further configured as follows:
[0155] Configure the entry point to access the default API of the native application.
[0156] Optionally, the device further includes:
[0157] The first restart device is configured as a restart terminal.
[0158] Optionally, the device further includes:
[0159] The second restart device is configured to restart the specified application that is executing the target task.
[0160] In the embodiments described in this specification, a task instruction is received, and the target task fragment in the native application is adjusted according to the target task. The native application is then restarted, and a preset interception tool is used to call and execute the target task fragment from the native application to obtain the execution information of the target task. By separating the target task fragment corresponding to the target task from the interception tool and embedding the target task fragment in the native application, the target task fragment is adjusted within the native application. After intercepting the running process of the target task, the interception tool only needs to call and execute the target task fragment from the native application to obtain the execution information of the target task. That is, the target task fragment before and after adjustment does not change the running process of the target task during execution, and there is no need to restart the terminal, reducing the adjustment time of the target task fragment and improving the execution efficiency of the target task.
[0161] The above is an illustrative scheme of a task execution device according to this embodiment. It should be noted that the technical solution of this task execution device and the technical solution of the task execution method described above belong to the same concept. For details not described in detail in the technical solution of the task execution device, please refer to the description of the technical solution of the task execution method described above.
[0162] Figure 6 A structural block diagram of a computing device according to one embodiment of this specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0163] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Controller (NIC)), such as an IEEE 802.11 Wireless Local Area Networks (WLAN) interface, a Wi-MAX (World Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0164] In one embodiment of this specification, the above-described components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0165] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 600 can also be a mobile or stationary server.
[0166] The processor 620 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described task execution method.
[0167] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the task execution method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the task execution method described above.
[0168] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described task execution method.
[0169] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the task execution method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the task execution method described above.
[0170] An embodiment of this specification also provides a computer application in which, when the computer application is executed on a computer, the computer is instructed to perform the steps of the above-described task execution method.
[0171] The above is an illustrative scheme of a computer application according to this embodiment. It should be noted that the technical solution of this computer application and the technical solution of the task execution method described above belong to the same concept. For details not described in detail in the technical solution of the computer application, please refer to the description of the technical solution of the task execution method described above.
[0172] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0173] The computer instructions include computer application code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer application code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0174] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0175] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0176] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A task execution method, applied to a terminal, comprising: Receive a task instruction, wherein the task instruction carries a target task; According to the target task, adjust the target task fragment in the native application and restart the native application. The native application is a pre-developed application for carrying the target task fragment, and the native application is independent of the preset interception tool. The native application includes a preset call interface, and the target task fragment is an executable code fragment. Using a preset interception tool, the target task fragment is invoked from the native application, and the execution information of the target task fragment is obtained by executing the target task fragment; the invocation of the target task fragment from the native application using the preset interception tool includes: Using a preset interception tool, access the preset call interface to call the target task fragment from the native application.
2. The method according to claim 1, further comprising, before using a preset interception tool to call the target task fragment from the native application and execute the target task fragment to obtain the execution information of the target task: Identify whether each currently running application is a specified application, wherein the specified application is an application capable of executing the target task; The step of using a preset interception tool to call the target task fragment from the native application, executing the target task fragment to obtain the execution information of the target task includes: If the first application currently running is the specified application, a preset interception tool is used to call the target task fragment from the native application, execute the target task fragment to obtain the execution information of the first application executing the target task.
3. The method according to claim 2, further comprising: If the currently running second application is not the specified application, continue running the second application.
4. The method according to claim 1, before calling the target task fragment from the native application through the calling interface using a preset interception tool, further comprising: Determine the storage location of the native application; Based on the storage location and the preset interface mapping mechanism, the preset calling interface in the native application is obtained.
5. The method according to any one of claims 1-4, further comprising: Obtain a preset interception tool, wherein the preset interception tool is pre-configured with an entry point; Configure the entry point to invoke the target task fragment in the native application.
6. The method according to claim 5, wherein configuring the entry point to invoke the target task fragment in the native application comprises: Configure the entry point to access the preset call interface of the native application.
7. The method of claim 5, further comprising, after configuring the entry point to invoke the target task fragment in the native application: Restart the terminal.
8. The method according to claim 1, further comprising, before using a preset interception tool to call the target task fragment from the native application and execute the target task fragment to obtain the execution information of the target task: Restart the specified application that is executing the target task.
9. A task execution device, applied to a terminal, comprising: The receiving module is configured to receive a task instruction, wherein the task instruction carries a target task; The adjustment module is configured to adjust the target task fragment in the native application according to the target task and restart the native application. The native application is a pre-developed application for carrying the target task fragment, and the native application is independent of the preset interception tool. The native application includes a preset calling interface, and the target task fragment is an executable code fragment. The first execution module is configured to use a preset interception tool to call the target task fragment from the native application, execute the target task fragment, and obtain the execution information of the target task; The first execution module is also configured to use a preset interception tool to access the preset call interface and call the target task fragment from the native application.
10. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the task execution method according to any one of claims 1 to 8.
11. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the task execution method according to any one of claims 1 to 8.
12. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the task execution method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Command execution method and device, storage medium and electronic device
CN112416470A
Scheduling task management method and system
CN114035915A
Configuration data updating method and device, electronic equipment and storage medium
CN114721686A