Patent Publication Number: US-10318479-B2

Title: Method and device for automatically identifying junk file

Description:
CROSS REFERENCE TO RELATED APPLICATION 
     This application is a U.S. national phase application based up an International Application No. PCT/CN2015/082109, which is based upon and claims a priority to Chinese Patent Application Serial No. 201410309621.8, filed with the State Intellectual Property Office of P. R. China on Jun. 30, 2014 by BEIJING KINGSOFT INTERNET SECURITY SOFTWARE CO., LTD., and titled with “method and device for automatically identifying junk file”, the entire contents of which are incorporated herein by reference. 
     TECHNICAL FIELD 
     The present disclosure generally relates to a mobile terminal field, and more particularly, to a method and a device for automatically identifying a junk file. 
     BACKGROUND 
     With the continuous development of the science and technology, the terminal devices become increasingly intelligent and more and more users start to use smart terminal devices with Android Systems. Since storage of a smart terminal device is limited, it is required to clear junk files regularly so as to ensure that the device has enough storage space when running and has a good performance. 
     At present, the junk file is identified artificially. A corresponding application (APP for short) is downloaded and run artificially, and different functions of the application are used artificially. The generated file is recorded and then deleted, and then the application is restarted to verify whether the deleted file has an effect on the usage of application, such as causing the breakdown of the application, or making the application stuck etc. If the deleted file does not have an effect on the usage of application, the deleted file may be recognized as a junk file. 
     However, in a process of implementing the present disclosure, the inventor found that there are following problems in the related art. It is inefficiency and high-cost to identify the junk file in the artificial way, and further the device performance would be decreased since the junk file cannot be cleared completely. 
     SUMMARY 
     The method for automatically identifying a junk file according to embodiments of the present disclosure includes: acquiring an application to be identified; analyzing the application so as to acquire attribute information of a file generated by the application; and matching the attribute information of the file and a preset junk file identification rule, and identifying the file as a junk file if the attribute information of the file is matched with the preset junk file identification rule. 
     A non-transitory computer storage medium according to embodiments of the present disclosure has one or more modules stored therein, wherein the one or more modules are caused to perform following acts: acquiring an application to be identified; analyzing the application so as to acquire attribute information of a file generated by the application; matching the attribute information of the file with a preset junk file identification rule; and identifying the file as a junk file if the attribute information of the file is matched with the preset junk file identification rule. 
     The mobile terminal according to embodiments of the present disclosure includes: a shell, a processor, a memory, a circuit board and a power supply circuit, in which the circuit board is located in a space formed by the shell, the processor and the memory are arranged on the circuit board; the power supply circuit is configured to supply power for each circuit or component in the mobile terminal; the memory is configured to store executable program codes; the processor executes a program corresponding to the executable program codes by reading the executable program codes stored in the memory so as to perform following acts: acquiring an application to be identified; analyzing the application so as to acquire attribute information of a file generated by the application; and matching the attribute information of the file with a preset junk file identification rule, and identifying the file as a junk file if the attribute information of the file is matched with the preset junk file identification rule. 
     Additional aspects and advantages of embodiments of present disclosure will be given in part in the following descriptions, become apparent in part from the following descriptions, or be learned from the practice of the embodiments of the present disclosure. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       These and other aspects and advantages of embodiments of the present disclosure will become apparent and more readily appreciated from the following descriptions made with reference to the accompanying drawings, in which: 
         FIG. 1  is a flow chart of a method for automatically identifying a junk file according to an embodiment of the present disclosure; 
         FIG. 2  is a flow chart of a method for automatically identifying a junk file according to a specific embodiment of the present disclosure; 
         FIG. 3  is a flow chart of a static analysis according to a specific embodiment of the present disclosure; 
         FIG. 4  is a flow chart of a dynamic simulation according to a specific embodiment of the present disclosure; and 
         FIG. 5  is a block diagram of a device for automatically identifying a junk file according to an embodiment of the present disclosure. 
     
    
    
     DETAILED DESCRIPTION 
     Reference will now be made in detail to embodiments of the present disclosure. Embodiments of the present disclosure will be shown in drawings, in which the same or similar elements and the elements having same or similar functions are denoted by like reference numerals throughout the descriptions. The embodiments described herein according to drawings are explanatory and illustrative and used to generally understand the present disclosure. The embodiments shall not be construed to limit the present disclosure. 
     In the following, a method for automatically identifying a junk file and a device for automatically identifying a junk file according to embodiments of the present disclosure will be described with reference to the drawings. 
       FIG. 1  is a flow chart of a method for automatically identifying a junk file according to an embodiment of the present disclosure. 
     As shown in  FIG. 1 , the method for automatically identifying a junk file may include the followings. 
     In S 101 , an application to be identified is acquired. 
     In embodiments of the present disclosure, the application may be acquired by web crawlers. For example, various social applications, game applications, system applications and the like using the Android system. 
     In S 102 , the application is analyzed so as to acquire attribute information of a file generated by the application. 
     In embodiments of the present disclosure, firstly, a static analysis is performed on the application to acquire information of the application. 
     Specifically, an installation package file of the application such as an APK file is analyzed to acquire basic information, permission information, control information, input/output function information and the like of the application. 
     Then, it is determined whether the application has a function to access to an external storage. If the application has the function to access to the external storage, a dynamic analysis may be performed on the application according to the above acquired information, so as to acquire the attribute information of the file generated by the application. 
     Specifically, a device with a corresponding simulation environment may be selected according to a type of the application, and then the application is installed on the selected device. The application is triggered to run according to the information of the application, and the file is generated. More specifically, the application may be triggered to run by sending an event according to the information of the application, or by automatically simulating a click according to the information of the application. 
     In S 103 , the attribute information of the file and a preset junk file identification rule are matched, and the file is identified as a junk file if the attribute information of the file is matched with the preset junk file identification rule. 
     Specifically, the attribute information of the file may include path information of the file, which may include a catalog and a file name. 
     In embodiments of the present disclosure, it may be determined whether the path information of the file includes a preset key word, or whether the file name of the file generated by the application includes a suffix if the type of the application is a preset type, so as to identify the file generated by the application. For example, a “log” file (file in a log record form) generated when the application is installed, a file with a suffix “*.tmp” (temporary file) generated when the application runs and the like may be junk files. 
     In embodiments of the present disclosure, after the above file is identified as the junk file, a characteristic of the file may be extracted and sent to a server, so as to update a junk file characteristic library. 
     With the method for automatically identifying a junk file in embodiments of the present disclosure, by analyzing the application, acquiring the attribute information of the file generated by the application, and matching the attribute information of the file and the preset junk file identification rule to identify whether the file generated by the application is the junk file, the junk file may be identified more quickly, simply, and intelligently, such that the cost is reduced and the identification efficiency is improved. 
       FIG. 2  is a flow chart of a method for automatically identifying a junk file according to a specific embodiment of the present disclosure. 
     As shown in  FIG. 2 , a method for updating a file characteristic library may include followings. 
     In S 201 , an application is acquired. 
     Specifically, the latest application using the Android system may be acquired by web crawlers. 
     In S 202 , a static analysis is performed on the application. 
     Specifically, a process flow of analyzing the application statically will be shown in  FIG. 3 . 
     In S 2021 , an “Androidmanifest.xml” file and a “classes.dex” file are analyzed. 
     In S 2022 , basic information, permission information, component information and the like of the application may be acquired according to a result of analyzing the “Androidmanifest.xml” file; I/O (input/output interface) related function information may be acquired according to a result of analyzing the “classes.dex” file. 
     In S 2023 , the above information is stored into a database. 
     In S 203 , it is determined whether the application has a function to access to an external storage. If yes, S 204  is executed, otherwise, the process is finished. 
     In S 204 , a dynamic analysis is performed on the application. 
     Specifically, a process flow of analyzing the application dynamically will be shown in  FIG. 4 . 
     In S 2041 , a device with a corresponding simulation environment is selected according to a type of the application. 
     In S 2042 , an installation of the application is simulated and triggered. 
     In S 2043 , it is determined whether the simulation is finished; if yes, S 2044  is executed otherwise S 2042  is executed. 
     In S 2044 , it is determined whether the simulation is failed; if yes S 2045  is executed otherwise S 2046  is executed. 
     In S 2045 , the dynamic analysis is failed. 
     In S 2046 , file path related information is acquired. 
     In S 2047 , the file path related information is stored into the database. 
     In S 205 , a generated file is automatically identified according to a path rule of junk file. 
     Specifically, the path rule of junk file may be acquired. The path rule of junk file may include a white rule and a black rule. The generated file and the while rule may be matched, and if the generated file is matched with the white rule, then the generated file is not a junk file. The generated file and the black rule may be matched, and if the generated file is matched with the black rule, then the generated file is a junk file. 
     Further, an artificial verification may be performed. If there is no problem, then the file path is used as a characteristic to perform an internal test and then is published to a test user. After testing a period of time, if there is an error report feedback, then the error characteristic is deleted and then the junk file path rule is updated; if there is no error report feedback, the characteristic may be published to the user. For example, after the social applications are filtered through the white rule and black rule, a video file without a suffix or an audio file without a suffix may be configured as a junk file. 
     With the method for automatically identifying a junk file in embodiments of the present disclosure, by performing the static analysis on the application and then simulating the installation of application to acquire the path related information of the generated file, and matching the path related information and the path rule of junk file, the junk file may be automatically identified and the characteristic may be published to update the characteristic library, such that the artificial cost is reduced, and the identification efficiency is improved, and the junk file may be identified and cleared more quickly and accurately, thus ensuring the running speed of user devices. 
     In order to implement the above embodiments, the present disclosure further provides a device for automatically identifying a junk file. 
       FIG. 5  is a block diagram of a device for automatically identifying a junk file according to an embodiment of the present disclosure. 
     As shown in  FIG. 5 , the device for automatically identifying a junk file includes an acquiring module  110 , an analyzing module  120  and a processing module  130 . 
     The acquiring module  110  is configured to acquire an application to be identified. 
     In embodiments of the present disclosure, the acquiring module  110  may acquire the application by web crawlers. For example, various social applications, game applications, system applications and like using the Android system. 
     The analyzing module  120  is configured to analyze the application to acquire attribute information of a file generated by the application. 
     In embodiments of the present disclosure, the analyzing module  120  may perform a static analysis on the application to acquire information of the application. 
     Specifically, the analyzing module  120  may analyze an installation package file of the application such as an APK file to acquire basic information, permission information, control information, input/output function information and the like of the application. And then the analyzing module  120  may perform a dynamic analysis on the application according to the above acquired information, so as to acquire the attribute information of the file generated by the application. 
     Specifically, the analyzing module  120  may select a device with a simulation environment corresponding to a type of the application, and then install the application on the selected device. The application is triggered to run according to the information of the application, and the file is generated. More specifically, the analyzing module  120  may trigger the application to run by sending an event according to the information of the application, or by automatically simulating a click according to the information of the application. 
     The processing module  130  is configured to match the attribute information of the file and a preset junk file identification rule, and to identify the file a junk file if the attribute information of the file is matched with the preset junk file identification rule. 
     Specifically, the attribute information of the file may include path information of the file, which may include a catalog and a file name. 
     In embodiments of the present disclosure, the processing module  130  may determine whether the path information of the file includes a preset key word, or whether the file name of the file generated by the application includes a suffix if the type of the application is a preset type, so as to identify the file generated by the application. For example, a “log” file (file in a log record form) generated when the application is installed, a file with a suffix “*.tmp” (temporary file) generated when the application runs and the like may be junk files. 
     In addition, the device for automatically identifying a junk file may further include an updating module  140 . 
     Specifically, if the file is identified as a junk file, the updating module  140  may extract a characteristic of the junk file and send the characteristic to a sever so as to update a junk file characteristic library. 
     Further, the device for automatically identifying a junk file may further include a determining module  150 . 
     The determining module  150  is configured to determine whether the application has a function to access to an external storage before the analyzing module  120  performs a dynamic analysis on the application according to the acquired information. 
     With the device for automatically identifying a junk file in embodiments of the present disclosure, by analyzing the application, acquiring the attribute information of the file generated by the application, and matching the attribute information of the file and the preset junk file identification rule to identify whether the file generated by the application is the junk file, the junk file may be identified more quickly, simply, and intelligently, such that the cost is reduced and the identification efficiency is improved. 
     In order to implement the above embodiments, the present disclosure further provides a storage medium, configured to store an application program that, when run, executes the method for automatically identifying a junk file according to any one of embodiments of the present disclosure. 
     In order to implement the above embodiments, the present disclosure further provides a mobile terminal. The mobile terminal includes: a shell, a processor, a memory, a circuit board and a power supply circuit, in which the circuit board is located in a space formed by the shell, the processor and the memory are arranged on the circuit board; the power supply circuit is configured to supply power for each circuit or component in the mobile terminal; the memory is configured to store executable program codes; the processor executes a program corresponding to the executable program codes by reading the executable program codes stored in the memory so as to perform followings. 
     S 101 ′, an application to be identified is acquired. 
     In embodiments of the present disclosure, the application may be acquired by web crawlers. For example, various social applications, game applications, system applications and the like using the Android system. 
     S 102 ′, the application is analyzed so as to acquire attribute information of a file generated by the application. 
     In embodiments of the present disclosure, firstly, a static analysis is performed on the application to acquire information of the application. 
     Specifically, an installation package file of the application such as an APK file is analyzed to acquire basic information, permission information, control information, input/output function information or the like of the application. 
     Then, it is determined whether the application has a function to access to an external storage. If the application has the function to access to the external storage, a dynamic analysis may be performed on the application according to the above acquired information, so as to acquire the attribute information of the file generated by the application. 
     Specifically, a device with a corresponding simulation environment may be selected according to a type of the application, and then the application is installed on the selected device. The application is triggered to run according to the information of the application, and the file is generated. More specifically, the application may be triggered to run by sending an event according to the information of the application, or by automatically simulating a click according to the information of the application. 
     S 103 ′, the attribute information of the file and a preset junk file identification rule are matched, and the file is identified as a junk file if the attribute information of the file is matched with the preset junk file identification rule. 
     Specifically, the attribute information of the file may include path information of the file, which may include a catalog and a file name. 
     In embodiments of the present disclosure, it may be determined whether the path information of the file includes a preset key word, or whether the file name of the file generated by the application includes a suffix if the type of the application is a preset type, so as to identify the file generated by the application. For example, a “log” file (file in a log record form) generated when the application is installed, a file with a suffix “*.tmp” (temporary file) generated when the application runs and the like may be junk files. 
     In embodiments of the present disclosure, after the above file is identified as the junk file, a characteristic of the file may be extracted and sent to a server, so as to update a junk file characteristic library. 
     With the mobile terminal in embodiments of the present, by analyzing the application, acquiring the attribute information of the file generated by the application, and matching the attribute information of the file and the preset junk file identification rule to identify whether the file generated by the application is the junk file, the junk file may be identified more quickly, simply, and intelligently, such that the cost is reduced and the identification efficiency is improved. 
     Reference throughout this specification to “an embodiment,” “some embodiments,” “an example,” “a specific example,” or “some examples,” means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present disclosure. Thus, the appearances of the above phrases in various places throughout this specification are not necessarily referring to the same embodiment or example of the present disclosure. Furthermore, the particular features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples. In addition, under the situation of not conflicting mutually, those skilled in the related art may combine different embodiments or examples with features of different embodiments or examples described through this specification. 
     In addition, terms such as “first” and “second” are used herein for purposes of description and are not intended to indicate or imply relative importance or significance. Thus, the feature defined with “first” and “second” may comprise one or more this feature. In the description of the present disclosure, “a plurality of” means two or more than two, unless specified otherwise. 
     It will be understood that, the flow chart or any process or method described herein in other manners may represent a module, segment, or portion of code that comprises one or more executable instructions to implement the specified logic function(s) or that comprises one or more executable instructions of the acts of the progress. Although the flow chart shows a specific order of execution, it is understood that the order of execution may differ from that which is depicted. For example, the order of execution of two or more boxes may be scrambled relative to the order shown. 
     The logic and/or act described in other manners herein or shown in the flow chart, for example, a particular sequence table of executable instructions for realizing the logical function, may be specifically achieved in any computer readable medium to be used by the instruction execution system, device or equipment (such as the system based on computers, the system comprising processors or other systems capable of obtaining the instruction from the instruction execution system, device and equipment and executing the instruction), or to be used in combination with the instruction execution system, device and equipment. As to the specification, “the computer readable medium” may be any device adaptive for including, storing, communicating, propagating or transferring programs to be used by or in combination with the instruction execution system, device or equipment. More specific examples of the computer readable medium comprise but are not limited to: an electronic connection (an electronic device) with one or more wires, a portable computer enclosure (a magnetic device), a random access memory (RAM), a read only memory (ROM), an erasable programmable read-only memory (EPROM or a flash memory), an optical fiber device and a portable compact disk read-only memory (CDROM). In addition, the computer readable medium may even be a paper or other appropriate medium capable of printing programs thereon, this is because, for example, the paper or other appropriate medium may be optically scanned and then edited, decrypted or processed with other appropriate methods when necessary to obtain the programs in an electric manner, and then the programs may be stored in the computer memories. 
     It should be understood that each part of the present disclosure may be realized by the hardware, software, firmware or their combination. In the above embodiments, a plurality of acts or methods may be realized by the software or firmware stored in the memory and executed by the appropriate instruction execution system. For example, if it is realized by the hardware, likewise in another embodiment, the acts or methods may be realized by one or a combination of the following techniques known in the art: a discrete logic circuit having a logic gate circuit for realizing a logic function of a data signal, an application-specific integrated circuit having an appropriate combination logic gate circuit, a programmable gate array (PGA), a field programmable gate array (FPGA), etc. 
     Those skilled in the art shall understand that all or parts of the acts in the above exemplifying method of the present disclosure may be achieved by commanding the related hardware with programs. The programs may be stored in a computer readable storage medium, and the programs comprise one or a combination of the acts in the method embodiments of the present disclosure when run on a computer. 
     In addition, each function cell of the embodiments of the present disclosure may be integrated in a processing module, or these cells may be separate physical existence, or two or more cells are integrated in a processing module. The integrated module may be realized in a form of hardware or in a form of software function modules. When the integrated module is realized in a form of software function module and is sold or used as a standalone product, the integrated module may be stored in a computer readable storage medium. 
     The storage medium mentioned above may be read-only memories, magnetic disks, CD, etc. 
     Although explanatory embodiments have been shown and described, it would be appreciated by those skilled in the art that the above embodiments cannot be construed to limit the present disclosure, and changes, alternatives, and modifications can be made in the embodiments without departing from spirit, principles and scope of the present disclosure.