Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In order to illustrate the technical scheme of the invention, the following description is made by specific examples.
Fig. 1 is a schematic implementation flow chart of an application fault detection method according to an embodiment of the present invention, where the application fault detection method may be applied to a terminal device with an android system, and a faulty application is running in the terminal device.
In this embodiment of the present application, the terminal device may be a smart phone, a tablet computer, a robot, or other devices that may use an android system. The Android (Android) system is an operating system of open source code based on Linux. The failed application is an application that fails, which may refer to a state in which the application cannot perform a prescribed function. The faults can be various and can be determined according to the specific application scenario of the mobile terminal, the application and the like.
The application fault detection method as shown in fig. 1 may include the steps of:
step S101, installing a target application to a terminal device, wherein the target application and the fault application contain the same preset attribute information.
In the embodiment of the present invention, the preset attribute information may be preset information that may indicate related attributes of an application (such as a type of the application, a process of running the application, a user identifier corresponding to the application, and an installation package of the application). At this time, by installing the target application having the same preset attribute information as the faulty application in the terminal device, it is possible to analyze the fault condition of the corresponding faulty application according to the installed target application in the subsequent operation without destroying the state and data when the faulty application fails.
For example, the preset attribute information may be obtained in advance by querying a process running a faulty application in the android system or by querying a service storing information of the faulty application. For example, for an android system, information for applications that it installs may be stored in a PackagerManagerService. Therefore, the target application which is the same as the preset attribute information of the fault application can be acquired and configured by checking the preset attribute information of the fault application stored in the PackagerManagerService, and the target application is installed to the terminal device.
Step S102, the target application is operated through a target process of the terminal equipment, wherein the target process is a process for operating the fault application.
In the embodiment of the invention, the target application can be operated through the target process by configuring the information of the target application. For example, the information of the designated attribute of the service component in the application configuration table of the target application is configured to be consistent with the information of the process running the fault application, so that the process running the target application is consistent with the process running the fault application. The application configuration table, the service component and other files or components are functions and services provided by the android system. Illustratively, the application configuration table is an android management xml file, and the specified attribute of the service component may be an android: process attribute.
Step S103, process information when the target process runs the target application is obtained, and application fault detection is carried out on the target application according to the process information so as to determine the fault condition of the fault application.
In the embodiment of the present invention, the process information may be parameters, variables, objects (objects), data, and other information generated when the target process runs the target application. For example, the process information may be obtained through a preset interface through a preset function or service in the android system. For example, it may be that the service component receives the process information through onStartCommand interface.
In the embodiment of the present invention, there may be various specific implementation manners of applying fault detection to the target application process according to the process information. For example, other information (such as references of internal objects or variables, etc.) when the process runs the target application may be obtained according to the process information, and then the other information and the process information are combined to perform application fault detection on the target application, where the other information may be information that cannot be obtained by directly accessing the process. Wherein, specifically, the other information can be obtained according to the process information by reflection or the like. In the embodiment of the present invention, the reflection may be a method in JAVA programming language. In the running state, for any entity class, all the attributes and methods of the class can be known through the reflection; for any one object, any method and attribute thereof can also be invoked by the reflection. Further, by way of example, fault detection may be applied to a target application process by querying or modifying process information and other information obtained from the process information.
In the embodiment of the present application, since the target application and the fault application include the same preset attribute information and the process running the target application is the same as the process running the fault application, by performing application fault detection on the target application, the running condition of the fault application can be simulated, and the fault condition of the fault application can be analyzed and determined by analyzing information such as data of the target application.
Optionally, in an embodiment of the present invention, the installing the target application to the terminal device includes:
acquiring preset attribute information of the fault application;
and installing the target application to the terminal equipment according to the preset attribute information.
Optionally, the preset attribute information includes target process information of the fault application, user information and an android installation package APK signature.
In the embodiment of the invention, the preset attribute information can be obtained in advance by inquiring a process running the faulty application in the android system or by inquiring a service storing the information of the faulty application.
The target process information may include a target process name, and the like, where in this case, by configuring an attribute android of a service component in an application configuration table android management. Xml of the target application, an exemplary process may be the same as a process name of a failed application, that is, the attribute android of the service component corresponding to the target application is configured to be the target process name, so that the process name of the target application may be the same as the process name of the failed application.
The user information may include information such as Identity (ID) of the user. When the user information of the target process is consistent, the target process can keep the consistency of the operations such as authority setting of the target application and the fault application. In the embodiment of the invention, the process User Identity (UID) set by the shared User Id attribute of the fault application can be detected in advance, and the shared User Id attribute of the target application is configured to be the same as that of the fault application, so that the User information of the target application can be kept consistent with the User information of the fault application.
The android installation package (AndroidPackage, APK) is signed as a digital signature of the android installation package. Through the APK signature, the android system can verify the application when the installation package of the application is installed, so that identity authentication of the installed application, information integrity and the like are guaranteed. By using the same key file signature as the fault application for the target application, the APK signature of the target application and the APK signature of the fault application can be kept consistent.
Optionally, after performing the fault detection according to the data information, the method further includes:
and stopping the target process from running the target application, and keeping the fault application to continue running.
In the embodiment of the invention, as the fault application can not be influenced when the target process runs the target application, the fault application can be kept to continue to run when the target process stops running the target application. For example, after the target application is stopped, the fault application can be processed in a targeted manner by the fault condition detected during the running of the target application.
The embodiment of the invention is applied to terminal equipment with an android system, a fault application is operated in the terminal equipment, and a target application is installed in the terminal equipment, wherein the target application and the fault application contain the same preset attribute information; running the target application through a target process of the terminal equipment, wherein the target process is a process running the fault application; and acquiring process information when the target process runs the target application, and detecting the application fault of the target application according to the process information so as to determine the fault condition of the fault application. According to the embodiment of the invention, the target application is operated through the target process of the terminal equipment, and the application fault detection can be carried out by detecting the target application under the condition that the fault application is not modified. And by carrying out application fault detection on the target application, the running condition of the fault application can be simulated, and the fault condition of the fault application can be analyzed and determined by modifying and debugging the data and other information of the target application, and the detection and analysis process can not influence the state of the fault application, so that the detection can be repeatedly carried out to determine the whole path and the accurate reason of the fault occurrence, the accuracy of the fault detection is improved, and the method has high practicability and usability.
Fig. 2 is a schematic implementation flow chart of an application fault detection method provided in a second embodiment of the present invention, where the application fault detection method is applied to a terminal device with an android system, and a faulty application is run in the terminal device. The application fault detection method may include the steps of:
in step S201, a target application is installed on a terminal device, where the target application and the fault application include the same preset attribute information.
In step S202, the target application is run by a target process of the terminal device, where the target process is a process running the faulty application.
The steps S201 and S202 in this embodiment are the same as or similar to the steps S101 and S102 described above, and the detailed description of the steps S101 and S102 will be omitted herein.
In step S203, process information when the target process runs the target application is obtained, and preset type parameter information of the target application is obtained according to the process information.
In the embodiment of the present invention, the process information may be parameters, variables, objects (objects), data, and other information generated when the target process runs the target application. For example, the process information may be obtained through a preset interface through a preset function or service in the android system. For example, it may be that the service component receives the process information through onStartCommand interface.
In the embodiment of the present invention, the process information may be information generated when the target application is executed, which is obtained from the process through a preset interface, service or function. Because the obtained process information often cannot fully embody a relatively complete processing path or flow when the target process runs the target application, the preset type parameter information of the target application can be further obtained according to the process information. The preset type parameter information may be child object information, variable information, and the like. For example, sub-object information, variable information and the like can be obtained according to the process information in a reflection mode and the like so as to query the current value of a specific object (such as a root object, a sub-object) or a variable in the running process of the target process and debug.
In step S204, application fault detection is performed on the target application according to the preset type parameter information, so as to determine a fault condition of the fault application.
In the embodiment of the present invention, there may be various specific implementation manners of applying fault detection to the target application process according to the process information. For example, the fault detection may be applied to the target application process by querying or modifying the process information and the preset type parameter information.
Optionally, the process information includes root object information;
correspondingly, the obtaining the preset type parameter information of the target application according to the process information includes:
and obtaining sub-object information and/or variable information of the target application according to the root object information.
In the embodiment of the present invention, the Root Object may refer to the top layer of the mapping, and the Root Object information may refer to the Root Object and information related to the Root Object. The sub-object information may be the sub-object and information related to the sub-object, such as data, service, method, etc. corresponding to the sub-object. The variable information may be a variable and information related to the variable. For example, a service component in the android system can be used for interfacing root object information in components such as Acitivity, service in the android system or services, and then a sub-object or variable reference in the target process can be obtained through reflection and other methods according to the root object information.
Optionally, the performing the application fault detection on the target application according to the preset type parameter information includes:
obtaining a query result of the preset type parameter information, or debugging the target application according to the preset type parameter information and obtaining a debugging result;
and carrying out application fault detection on the target application according to the query result or the debugging result.
In the embodiment of the application, the target application is debugged by modifying and inquiring the preset type parameter information, the process information and the like, so that the target application can be debugged on line for multiple times, the running of the fault application in the target process is not influenced, the fault condition of the fault application is detected more comprehensively, and the success rate of fault detection and fault solution is improved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
Fig. 3 is a schematic diagram of an application fault detection apparatus provided in a third embodiment of the present invention, where the application fault detection apparatus 300 is applied to a terminal device with an android system, and a faulty application is running in the terminal device. For convenience of explanation, only portions relevant to the embodiments of the present invention are shown.
The application fault detection apparatus 300 includes:
an installation module 301, configured to install a target application to a terminal device, where the target application and the fault application include the same preset attribute information;
an operation module 302, configured to operate the target application through a target process of the terminal device, where the target process is a process for operating the faulty application;
and the detection module 303 is configured to obtain process information when the target process runs the target application, and perform application fault detection according to the process information, so as to determine a fault condition of the fault application.
Optionally, the mounting module 301 specifically includes:
the acquisition unit is used for acquiring preset attribute information of the fault application;
and the installation unit is used for installing the target application to the terminal equipment according to the preset attribute information.
Optionally, in the embodiment of the present invention, the preset attribute information includes target process information of the fault application, user information, and an APK signature of the android installation package.
Optionally, the detection module 303 specifically includes:
the obtaining unit is used for obtaining preset type parameter information of the target application according to the process information;
and the detection unit is used for carrying out application fault detection on the target application according to the preset type parameter information.
Optionally, in an embodiment of the present invention, the process information includes root object information;
correspondingly, the obtaining unit is specifically configured to:
and obtaining sub-object information and/or variable information of the target application according to the root object information.
Optionally, the detection unit specifically includes:
the processing subunit is used for acquiring the query result of the preset type parameter information, or debugging the target application according to the preset type parameter information and acquiring a debugging result;
and the detection subunit is used for carrying out application fault detection on the target application according to the query result or the debugging result.
Optionally, the application fault detection device further includes:
and the stopping module is used for stopping the target process from running the target application and keeping the fault application to continue running.
According to the embodiment of the invention, the target application is operated through the target process of the terminal equipment, the application fault detection can be carried out by detecting the target application under the condition that the fault application is not modified, for example, the fault condition of the fault application can be determined by modifying and debugging the target application, so that the accuracy of the fault detection is improved, and the method has strong practicability and usability.
Fig. 4 is a schematic diagram of a terminal device according to a fourth embodiment of the present invention. As shown in fig. 4, the terminal device 4 of this embodiment includes: a processor 40, a memory 41 and a computer program 42 stored in the memory 41 and executable on the processor 40. The processor 40, when executing the computer program 42, implements the steps of the various application fault detection method embodiments described above, such as steps 101 through 103 shown in fig. 1. Alternatively, the processor 40 may perform the functions of the modules/units of the apparatus embodiments described above, such as the functions of the modules 301 to 303 shown in fig. 3, when executing the computer program 42.
Illustratively, the computer program 42 may be partitioned into one or more modules/units that are stored in the memory 41 and executed by the processor 40 to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions for describing the execution of the computer program 42 in the terminal device 4. For example, the computer program 42 may be divided into an installation module, an operation module, and a detection module, where each module specifically functions as follows:
the installation module is used for installing a target application to the terminal equipment, wherein the target application and the fault application contain the same preset attribute information;
the running module is used for running the target application through a target process of the terminal equipment, wherein the target process is a process for running the fault application;
and the detection module is used for acquiring the process information when the target process runs the target application, and carrying out application fault detection according to the process information so as to determine the fault condition of the fault application.
The terminal device 4 may be a computing device such as a robot, a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The terminal device may include, but is not limited to, a processor 40, a memory 41. It will be appreciated by those skilled in the art that fig. 4 is merely an example of the terminal device 4 and does not constitute a limitation of the terminal device 4, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the terminal device may further include an input-output device, a network access device, a bus, etc.
The processor 40 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. The memory 41 may be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used for storing the computer program as well as other programs and data required by the terminal device. The memory 41 may also be used for temporarily storing data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of 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.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. . Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.