CN111522780A - Method and terminal for recording file creator information - Google Patents

Method and terminal for recording file creator information Download PDF

Info

Publication number
CN111522780A
CN111522780A CN201910105508.0A CN201910105508A CN111522780A CN 111522780 A CN111522780 A CN 111522780A CN 201910105508 A CN201910105508 A CN 201910105508A CN 111522780 A CN111522780 A CN 111522780A
Authority
CN
China
Prior art keywords
file
instruction
information
terminal
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910105508.0A
Other languages
Chinese (zh)
Other versions
CN111522780B (en
Inventor
张国祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201910105508.0A priority Critical patent/CN111522780B/en
Publication of CN111522780A publication Critical patent/CN111522780A/en
Application granted granted Critical
Publication of CN111522780B publication Critical patent/CN111522780B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a method for recording file creator information, which is used for writing creator information corresponding to a target file into metadata of the target file in the process of creating the target file, so that when the creator information of the target file needs to be acquired, the creator information of the target file can be conveniently read from the metadata of the target file. The method in the embodiment of the application comprises the following steps: a terminal acquires a file creating instruction; the terminal creates a target file according to the file creating instruction; the terminal determines creator information of the target file, wherein the creator information of the target file comprises identification information of an application or identification information of a process for creating the target file; and the terminal writes the creator information of the target file into the metadata corresponding to the target file.

Description

Method and terminal for recording file creator information
Technical Field
The present application relates to the field of file processing, and in particular, to a method for recording file creator information and a terminal for recording file creator information.
Background
Both Unix-like file systems and windows use user identification (uid) and group identification (gid) to mark files and rights restrictions. The Android system is based on the linux system and also belongs to the Unix file system, so that the uid and gid mechanisms are also adopted. However, the uid and gid in the Android system are different from those in the linux system, the uid and gid in the Android system are not used for identifying different users, but are used for identifying different applications, and the uid and gid mechanisms are used as lightweight sandbox technology for isolation.
Based on the mechanism of the uid and gid in the Android system, the Android system can distinguish creators of different files in the terminal through the uid and the gid, namely distinguish applications corresponding to the different files. In addition, the corresponding relationship between the file path created by the application and the application can be obtained through manual analysis, and then the creator of the file can be presumed through comparison between the file path of the file and the corresponding relationship.
Data of the Android system can be divided into internal data and external data. The internal data is data in the application sandbox, the uids or gids corresponding to the files of different applications are different, and the creators corresponding to different files can be determined by adopting the uids and the gids. External data, such as data stored in a secure digital card (sdcard), is data shared between different applications, shares uid and gid, and can only be in a file path manner. Determining the creator of a file by using a file path is not an accurate and convenient way.
Disclosure of Invention
The embodiment of the application provides a method for recording file creator information, which is used for writing creator information corresponding to a target file into metadata of the target file in the process of creating the target file, so that when the creator information of the target file needs to be acquired, the creator information of the target file can be directly read from the metadata of the target file.
In view of this, a first aspect of the embodiments of the present application provides a method for recording file creator information, which may include:
when the terminal creates the target file, the terminal obtains a file creating instruction, and creates the target file according to the file creating instruction, wherein the target file can be a newly created file or a file which is saved after the terminal receives a file sent by other equipment. When the terminal creates the target file, the creator information of the target file is acquired at the same time, and the creator information of the target file may include identification information of an application that creates the target file or identification information of a process, that is, it may be determined by which application the target file is created through the creator information. Then, the terminal writes the determined creator information in the metadata corresponding to the target file. The embodiment of the application provides a method for recording creator information of a target file when the target file is created. The creator information of the created target file is recorded in the metadata corresponding to the target file, and according to the characteristics of the metadata, the terminal can conveniently and accurately read the creator information corresponding to the target file from the metadata of the target file.
In one possible design, the obtaining, by the terminal, a create file instruction may include: when the terminal runs a first process, the terminal acquires the file creating instruction generated by the first process; the terminal determines creator information of the target file, which may include: and the terminal determines that the creator information of the target file is the identification information of the application corresponding to the first process or the identification information of the first process. In the embodiment of the application, when the terminal starts the first process, the identification information of the first process or the identification information of the application corresponding to the first process is recorded, after a file creating instruction generated by the first process is received, the terminal creates a target file according to the file creating instruction, and writes the previously recorded identification information of the first process or the identification information of the application corresponding to the first process into metadata of the target file to serve as creator information of the target file, so that the creator information of the target file in the process of creating the target file is recorded.
In one possible design, before the terminal obtains the instruction to create the file, the method may further include: when the terminal runs a first process, the terminal receives the target file sent by other terminals or a network server through the first process; the method for acquiring the file creating instruction by the terminal comprises the following steps: the terminal acquires a saving instruction of the first process, wherein the saving instruction is used for indicating to save the target file; before the terminal determines creator information of the target file, the method may further include: the terminal judges whether the application corresponding to the first process is a preset application or not; the terminal determines creator information of the target file, which may include: under the condition that the application corresponding to the first process is judged not to be a preset application, the terminal determines that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process; and under the condition that the application corresponding to the first process is judged to be the preset application, the terminal does not set creator information in the metadata of the target file. In the embodiment of the present application, another case of creating a file is described: after the terminal receives the target file sent by other terminals or the network server through the first process, the terminal judges whether the application corresponding to the first process is a preset application. If the target file is not the preset application, when the terminal saves the target file, determining that creator information of the target file is identification information of the first process or identification information of the application corresponding to the first process, and writing the creator information into metadata of the target file; and if the application is a preset application, not setting creator information of the target file. The preset application is set in the system of the terminal in advance, so that the situation that the information of the file creator is unreasonably modified in some scenes, such as backup file recovery, is avoided.
In one possible design, before the terminal obtains the instruction to create the file, the method may further include: when the terminal runs a first process, the terminal receives the target file sent by other terminals or a network server through the first process; the method for acquiring the file creating instruction by the terminal comprises the following steps: the terminal acquires a saving instruction of the first process, wherein the saving instruction is used for indicating to save the target file; before the terminal determines creator information of the target file, the method may further include: the terminal judges whether the application corresponding to the first process is a preset application or not; the terminal determines creator information of the target file, which may include: under the condition that the application corresponding to the first process is judged not to be a preset application, the terminal determines that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process; if the application corresponding to the first process is judged to be a preset application, the terminal acquires rule table information, the rule table information is received from the other terminal or the network server or is stored in the terminal, the rule table information is used for indicating the corresponding relation between the identification information of different files and different creator information, and the identification information of the files is used for the terminal to uniquely determine the files corresponding to the identification information; and the terminal determines creator information of the target file according to the identification information of the target file and the rule table information. In the embodiment of the present application, another method for recording creator information in a process of saving an object file sent by another terminal or a network server when the terminal receives the object file is described.
In one possible design, the method may further include: the terminal determines the file path of the target file and the creator information of the target file; the terminal generates the corresponding relation between the file path of the target file and the creator information of the target file, and stores the corresponding relation in a file path rule, wherein the file path rule is used for indicating the corresponding relation between different creator information and different file paths. In the embodiment of the application, after the terminal creates the target file and records the creator information of the target file, the corresponding relationship between the creator information of the target file and the file path of the target file can be generated and stored in the file path rule. The file path rule indicates the correspondence of different applications to the path of the file they create. The file path rule is stored in a file form on a local terminal or a network and is updated along with the updating of the application. Namely, after the terminal generates the name target file and records creator information of the target file, the file path rule can be automatically generated, when a user needs to inquire, the file corresponding to the file path rule can be directly searched from the local, manual analysis is not needed, and the workload of personnel is saved.
In one possible design, the method may further include: the terminal acquires a configuration instruction, wherein the configuration instruction is used for indicating the terminal to set creator information for a file to be configured; the terminal determines the file to be configured according to the configuration instruction, and creator information of the file to be configured is not recorded in metadata corresponding to the file to be configured; the terminal acquires the file path rule according to the configuration instruction; the terminal determines creator information of the file to be configured according to the file path of the file to be configured and the file path rule; and the terminal writes the creator information of the file to be configured in the metadata corresponding to the file to be configured. In the embodiment of the application, after the terminal generates the file path rule, creator information corresponding to the file to be configured can be determined according to the file path rule and the file path of the file to be configured. For example, a first file and a second file exist in a certain folder, wherein the first creator information is recorded in the metadata of the first file, and the creator information is not recorded in the metadata of the second file. Then in the file path rule, the folder indicates the file path corresponding to the first creator information. Therefore, the terminal can determine that the creator information of the second file is also the first creator information according to the file path rule, and write the first creator information into the metadata of the second file, thereby realizing the recording of the creator information of the second file, i.e. the file to be configured.
In one possible design, the method may include: when the terminal runs a second process, the terminal acquires a target instruction which is generated by the second process and takes the target file as an operation object; the terminal creates an associated file of the target file according to the target instruction, wherein the associated file can comprise a copy file, a modified file, an encryption and decryption file or a decompression file corresponding to the target file; if the target instruction is a preset instruction, the terminal determines that creator information of the associated file is creator information of the target file, and writes the creator information of the associated file in metadata of the associated file; if the target instruction is not a preset instruction, the terminal determines that the creator information of the associated file is the identification information of the application corresponding to the second process or the identification information of the second process, and writes the creator information of the associated file in the metadata of the associated file. In this embodiment of the application, after creating the target file, the terminal may receive a target instruction that is generated by the second process and takes the target file as an operation object, where the target instruction is, for example, a file merging instruction, a file splitting instruction, an encryption/decryption or pasting instruction, and the like. And then, the terminal creates a related file of the target file according to the target instruction, wherein the related file can comprise a copy file, a modified file, an encryption/decryption file or a decompression file and the like corresponding to the target file. And when the associated file is created, the terminal simultaneously judges whether the target instruction is a preset instruction, if so, the creator information of the associated file is still the creator information of the target file, otherwise, the creator information of the associated file is determined to be the identification information of the second process or the identification information of the application corresponding to the second process. The method and the device for generating the associated file are common in actual scenes, and the embodiment of the application explains the condition of creator information record of the associated file, so that the practicability of the scheme is improved.
In one possible design, the preset instruction may include a paste instruction, a rename instruction, an encrypt instruction, or a decrypt instruction. In the embodiment of the present application, a case of a preset instruction is described, where the preset instruction may be set by a user in advance.
In one possible design, the identification information of the application or the identification information of the process may include application name information, process name information, or package name information of the application package. In the embodiment of the present application, the identification information of the application and the identification information of the process in the creator information are described, and may include application name information, process name information, or package name information of the application package. It should be noted that the creator information may also be defined by the user or the terminal manufacturer, that is, the creator information may be any identification information that can uniquely identify the application that creates the target file.
In one possible design, the method may further include: the terminal acquires a modification instruction, wherein the modification instruction is used for indicating the terminal to modify creator information of the target file, and the modification instruction carries the target creator information; and the terminal modifies the creator information of the target file into the target creator information according to the modification instruction. In the embodiment of the present application, the modification of creator information of a target file is explained. The terminal can generate a modification instruction after responding to the user operation or receiving the instruction of other applications, wherein the modification instruction carries the target creator information set by the user for the target file. Therefore, after the terminal acquires the modification instruction, the creator information in the target file metadata can be modified into the target creator information.
In one possible design, the method may further include: the terminal acquires a display instruction, wherein the display instruction is used for indicating the terminal to display creator information of the target file; and the terminal displays the creator information of the target file according to the display instruction. In the embodiment of the application, after the terminal receives the display instruction, the creator information of the target file can be displayed according to the display instruction, so that the user can conveniently check the information.
In one possible design, the method may further include: the terminal acquires a file classification instruction, wherein the file classification instruction is used for indicating the terminal to display a plurality of files in a classification mode according to a creator of the files; and the terminal acquires creator information of the files according to the file classification instruction and displays the files in a classification mode according to the creator information of the files. In the embodiment of the application, after the terminal generates the plurality of files and records creator information of the plurality of files, the creator information of the plurality of files can be acquired according to the file classification instruction, and the plurality of files are classified and displayed according to the creator information of the plurality of files.
In one possible design, the method may further include: the terminal acquires a deletion instruction, wherein the deletion instruction carries target creator information and is used for indicating the terminal to delete a file to be deleted, and the file to be deleted is a file of which the creator information is the target creator information; the terminal searches the file to be deleted according to the deletion instruction; and the terminal deletes the target file to be deleted according to the deletion instruction. In the embodiment of the application, a method for deleting a file is provided. When a user needs to delete some files to be deleted, the terminal responds to the operation of the user to generate a deletion instruction, wherein the deletion instruction can carry creator information of the files to be deleted. Thus, the terminal can determine the file to be deleted according to the creator information and perform the deletion operation.
A second aspect of the present application provides a terminal for recording file creator information, which may include:
the acquisition unit is used for acquiring a file creating instruction;
a creating unit for creating a target file according to the create file instruction;
a determining unit, configured to determine creator information of the target file, where the creator information of the target file may include identification information of an application or identification information of a process that creates the target file;
and the writing unit is used for writing the creator information of the target file in the metadata corresponding to the target file.
In one possible design of the system, the system may be,
the determining unit is further configured to determine a first process running on the terminal, where the first process generates the file creating instruction;
the determining unit is specifically configured to determine that creator information of the target file is identification information of an application corresponding to the first process or identification information of the first process.
In one possible design of the system, the system may be,
the acquiring unit is further configured to receive the target file sent by another terminal or the network server through the first process;
the obtaining unit is specifically configured to obtain a save instruction of the first process, where the save instruction is used to instruct to save the target file;
the terminal may further include:
the judging unit is used for judging whether the application corresponding to the first process is a preset application or not;
the determining unit is specifically configured to determine, when it is determined that the application corresponding to the first process is not a preset application, that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process; and under the condition that the application corresponding to the first process is judged to be the preset application, not setting creator information in the metadata of the target file.
In one possible design of the system, the system may be,
the acquiring unit is further configured to receive the target file sent by another terminal or the network server through the first process; under the condition that the application corresponding to the first process is judged to be a preset application, rule table information is obtained, the rule table information is received from the other terminal or the network server or is stored in the terminal, the rule table information is used for indicating the corresponding relation between the identification information of different files and different creator information, and the identification information of the files is used for the terminal to uniquely determine the files corresponding to the identification information;
the obtaining unit is specifically configured to obtain a save instruction of the first process, where the save instruction is used to instruct to save the target file;
the terminal may further include:
the judging unit is used for judging whether the application corresponding to the first process is a preset application or not;
the determining unit is specifically configured to determine, when it is determined that the application corresponding to the first process is not a preset application, that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process; and under the condition that the application corresponding to the first process is judged to be the preset application, determining creator information of the target file according to the identification information of the target file and the rule table information.
In one possible design of the system, the system may be,
the determining unit is further used for determining a file path of the target file and creator information of the target file;
the creating unit is further configured to generate a corresponding relationship between a file path of the target file and creator information of the target file, and store the corresponding relationship in a file path rule, where the file path rule is used to indicate a corresponding relationship between different creator information and different file paths.
In one possible design of the system, the system may be,
the acquisition unit is also used for acquiring a configuration instruction, and the configuration instruction is used for indicating that creator information is set for a file to be configured; acquiring the file path rule;
the determining unit is further configured to determine the file to be configured according to the configuration instruction, where creator information of the file to be configured is not recorded in metadata corresponding to the file to be configured; determining creator information of the file to be configured according to the file path of the file to be configured and the file path rule;
the writing unit is further configured to write creator information of the file to be configured in the metadata corresponding to the file to be configured.
In one possible design of the system, the system may be,
the obtaining unit is further configured to obtain, when a second process is executed, a target instruction which is generated by the second process and takes the target file as an operation object;
the creating unit is further configured to create an associated file of the target file according to the target instruction, where the associated file may include a copy file, a modified file, an encryption/decryption file, or a decompression file corresponding to the target file;
the writing unit is further configured to determine that creator information of the associated file is creator information of the target file if the target instruction is a preset instruction, and write the creator information of the associated file in metadata of the associated file; and if the target instruction is not a preset instruction, determining that the creator information of the associated file is the identification information of the application corresponding to the second process or the identification information of the second process, and writing the creator information of the associated file into the metadata of the associated file.
In one possible design, the preset instruction may include a paste instruction, a rename instruction, an encrypt instruction, or a decrypt instruction.
In one possible design, the identification information of the application or the identification information of the process may include application name information, process name information, or package name information of the application package.
In one possible design of the system, the system may be,
the obtaining unit is further configured to obtain a modification instruction, where the modification instruction is used to instruct the terminal to modify creator information of the target file, and the modification instruction carries target creator information;
the terminal may further include:
and the modifying unit is used for modifying the creator information of the target file into the target creator information according to the modifying instruction.
In one possible design, the terminal may further include:
the acquisition unit is further used for acquiring a display instruction, wherein the display instruction is used for indicating and displaying creator information of the target file;
and the first display unit is used for displaying the creator information of the target file according to the display instruction.
In one possible design, the terminal may further include:
the obtaining unit is further used for obtaining a file classification instruction, and the file classification instruction is used for instructing the terminal to display a plurality of files according to the classification of creators of the files;
and the second display unit is used for acquiring the creator information of the files according to the file classification instruction and displaying the files in a classification mode according to the creator information of the files.
In one possible design, the terminal may further include:
the acquisition unit is further configured to acquire a deletion instruction, where the deletion instruction carries target creator information, and the deletion instruction is used to instruct deletion of a file to be deleted, where the file to be deleted is a file whose creator information is the target creator information;
the searching unit is used for searching the file to be deleted according to the deleting instruction;
and the deleting unit is used for deleting the target file to be deleted according to the deleting instruction.
A third aspect of the present embodiment further provides a terminal for recording file creator information, where the terminal may include:
a processor, a memory, and a transceiver; the transceiver is used for communicating with a device outside the terminal; the memory is used for storing instruction codes; the processor, when executing the instruction code, causes the terminal to perform the method as described in the first aspect and any one of the alternatives in the embodiments of the present application.
A fourth aspect of embodiments of the present application further provides a computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the method according to the first aspect and any one of the alternatives.
A fifth aspect of embodiments of the present application also provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform the method as described in the first aspect and any of the alternatives.
According to the technical scheme, the embodiment of the application has the following advantages:
and after receiving the file creating instruction, the terminal creates a target file according to the file creating instruction. In the process of creating the target file, creator information is written in the metadata corresponding to the target file in advance, and then when the creator information of the target file needs to be acquired, the creator information of the target file can be directly read from the metadata of the target file. Based on the characteristics of the metadata, the creator information of the file can be conveniently and accurately read.
Drawings
Fig. 1 is a schematic diagram of an embodiment of information of a record file creator in an embodiment of the present application;
FIG. 2 is a schematic diagram of another embodiment of information of a creator of a log file in an embodiment of the present application;
FIG. 3 is a schematic diagram of another embodiment of information of a creator of a log file in an embodiment of the present application;
FIG. 4 is a schematic diagram of another embodiment of the record creator information in the embodiment of the present application;
FIG. 5 is a schematic diagram of another embodiment of the record creator information in the embodiment of the present application;
FIG. 6 is a schematic diagram of another embodiment of the record creator information in the embodiment of the present application;
fig. 7 is a schematic diagram of another embodiment of the information of the creator of the record file in the embodiment of the present application;
fig. 8 is a schematic diagram of another embodiment of the information of the creator of the record file in the embodiment of the present application;
fig. 9A is a schematic diagram of an embodiment of a terminal in the embodiment of the present application;
fig. 9B is a schematic diagram of another embodiment of the terminal in the embodiment of the present application;
fig. 9C is a schematic diagram of another embodiment of the terminal in the embodiment of the present application;
fig. 9D is a schematic diagram of another embodiment of the terminal in the embodiment of the present application;
fig. 9E is a schematic diagram of another embodiment of the terminal in the embodiment of the present application;
fig. 9F is a schematic diagram of another embodiment of the terminal in the embodiment of the present application;
fig. 10 is a schematic diagram of another embodiment of the terminal in the embodiment of the present application.
Detailed Description
A method and a terminal for recording file creator information according to an embodiment of the present application are described in detail below with reference to the accompanying drawings.
The embodiments of the present application may be applied to Unix-type file systems and windows systems, such as but not limited to Android systems, and the Android systems are used as examples in the embodiments and the subsequent embodiments for description.
In the process of using the Android device, a user creates a large number of files in a storage space along with the operation of a large number of applications, and the applications for creating the files are creators of the files. By determining creator information for a file, a process analysis may be performed on the file. For example, when software is uninstalled, a corresponding file needs to be deleted according to creator information of the file. If some files cannot determine creators of the files, the files cannot be deleted when the corresponding software is unloaded, so that the files become unloading residual files after the software is unloaded, and storage space is occupied. In addition, the files can be displayed according to application classification by determining creator information of the files.
At present, the Android system distinguishes between creators of files in a uid and gid manner and in an application file path manner. When the creator of the file is distinguished by adopting the file path, firstly, manual participation is needed: and manually establishing codes of the file through reverse analysis application, or dynamically debugging, testing and analyzing to obtain a file path rule of the application, wherein the file path rule refers to the corresponding relation between the application and the file path. And then, the Android device determines a creator of the file by comparing the file path rule with the file path of the file.
However, the way of distinguishing file creators through file paths is not an accurate and convenient way due to the need for human intervention, and there is a possibility of omission and error: the file path rule is obtained through manual analysis, and under the condition of more applications, the conditions of omission and error in identifying the file path rule are inevitable; when an update is applied, the file path rule of the application may also be updated accordingly, resulting in a portion of the file generated before the update is applied being unable to determine the creator of the file using the updated file path rule.
Metadata, also called intermediate data and relay data, is data describing data, mainly information describing data attributes, and is used to support one or more functions such as indicating storage locations, history data, resource search, file records, and the like. The metadata can be queried through an interface provided by a file system and has a unique corresponding relationship with the data described by the metadata.
Based on this, the embodiment of the present application provides a method for recording file creator information, which is used for writing creator information corresponding to an object file in metadata of the object file in a process of creating the object file, so that when the creator information of the object file needs to be acquired, the creator information of the object file can be directly read from the metadata of the object file.
The creator information of the target file includes identification information of an application that creates the target file or identification information of a process that creates the target file, such as application name information, process name information, or package name information of an application package.
It should be noted that the process of creating the object file may be a process of directly creating the file, or a process of receiving the object file sent by another device and saving the file by the terminal, which will be described below.
Referring to fig. 1 in detail, fig. 1 is a schematic diagram of an embodiment of a method for recording file creator information in an embodiment of the present application, and the method may include:
101. when the terminal starts the first process, the terminal records the process name information of the first process.
In this embodiment, when the terminal starts the first process of the first application, the terminal may determine a process name of the first process, and record process name information of the first process. The process is similar to the first application starting process in fig. 2, the system first calls an Activity Manager Service (AMS), the AMS determines whether a first process required by the first application exists, and if not, requests a process incubation module (zygate) process to start the first process required by the first application. During the starting process of the first process, the AMS is responsible for creating relevant data of the management application framework. Before starting the first process, the AMS reads configuration information of the first application through a Packet Management Service (PMS), where the configuration information includes information such as component information, authority information, application name information, and a packet name of the first application. The AMS further determines the application name information and the package name information of the first application through the configuration information, and takes the package name or the application name of the first application as the process name of the first process. After determining the process name of the first process, the AMS calls zygate, and creation of the first process is completed by the zygate. When zygate creates the first process, it also calls the process management module in the kernel module. And managing the first process by a process management module, and recording the process name of the first process into a process name attribute in a data structure describing process information in the kernel.
102. And the terminal acquires a file creating instruction generated by the first process.
In this embodiment, when the terminal runs the first process, the terminal obtains a file creation instruction corresponding to the first process. In an actual application scenario, the instruction for creating a file may be an instruction generated by the terminal in response to the user operation when the user clicks a menu for creating a file, or an instruction for creating a file in the running process of the first process
103. And the terminal creates the target file according to the file creating instruction.
In this embodiment, after the terminal obtains the command for creating the File, the terminal creates the target File according to the command for creating the File, and a process of creating the target File is similar to the File creating flow in fig. 2, and the system may invoke an interface of a File (a class provided by java), access a File System (FS) through the interface, and complete creation of the File through the interface provided by the File and the interface provided by the FS.
104. And the terminal determines that the creator information of the target file is the process name information of the first process and writes the creator information into the metadata of the target file.
In this embodiment, in the process of creating the target file, the FS obtains the process name information of the first process recorded previously from the process management module, determines that creator information of the target file is the process name information of the first process, and writes the process name information of the first process into the metadata corresponding to the target file.
105. The terminal acquires a reading instruction, and the reading instruction is used for instructing the terminal to read creator information of the target file.
In this embodiment, after completing the creation of the target file, as shown in the creator information flow of reading the file shown in fig. 2, a user or another application may read the creator information of the created file through the second application. The second application may be an application having a function of reading file creator information, and for example, the second application may be a file management application, an album application, or the like. Specifically, the terminal generates a read instruction after responding to a user operation (for example, the user clicks an option of reading file information) or receiving a read request of other software (for example, the file analysis software requests to read file creator information when analyzing a file) through the second application. The read instruction is an instruction predefined by the system for a File interface and an FS interface (e.g., ioctl interface), and the creator information of the File can be read from the FS by the read instruction.
106. And the terminal reads the creator information from the metadata of the target file according to the reading instruction.
In this embodiment, after the terminal obtains the read instruction, the FS is accessed through the File interface, and creator information written in advance in the metadata of the target File is read from the corresponding FS interface.
Further, the terminal locally stores the corresponding relationship between different application name information and different process name information, and after the terminal acquires the process name information of the first process, the terminal can determine the application name information of the first application corresponding to the target file through the process information of the first process and the corresponding relationship, that is, determine to create the application corresponding to the target file.
Optionally, in some possible implementation manners, the user may actively modify creator information of the file, and when the user triggers modification of the creator information of the target file through an input device of the terminal, the terminal obtains the modification instruction. And the modification instruction carries target creator information, and the target creator information indicates a creator set for the target file by the user. And then, the terminal modifies the creator information of the target file into the target creator information.
107. And when the terminal runs the second process, the terminal acquires a target instruction which is generated by the second process and takes the target file as an operation object.
In this embodiment, when the second process of the terminal runs, the terminal obtains a target instruction about a target file, where the target instruction may be a copy instruction, a paste instruction, a convert instruction, a compress instruction, a modify instruction, or the like. Before the second process runs, when the second process is started, the terminal records the process name information of the second process, and the starting process of the second process is similar to that of the first process with reference to the above, and is not repeated here.
108. And the terminal creates an associated file of the target file according to the target instruction.
In this embodiment, after the terminal acquires the target instruction, the terminal executes the corresponding target operation, and creates an associated file of the target file. The created associated file may be a copy file, a conversion file, a compressed package file, a modification file, or the like, corresponding to the target instruction.
109. And the terminal judges whether the target instruction is a preset instruction or not.
In this embodiment, after acquiring the target instruction, the terminal determines whether the target instruction is a preset instruction. The preset instruction may be manually set, and for example, the preset instruction may include a paste instruction, an encryption instruction, a decryption instruction, a renaming instruction, and the like.
In practical applications, the list of the preset instructions may be maintained by the network side and pushed to the terminal at regular time or when there is an update. For example, when the terminal is updated, the terminal manufacturer may push the update content of the preset instruction to the terminal along with the update content of the system, or push the update content to the terminal when the list is updated, so as to ensure timeliness of the list.
It should be noted that the steps 108 and 109 are not necessarily executed in the order.
110. And if the target instruction is a preset instruction, the terminal determines that the creator information of the associated file is the creator information of the target file and writes the creator information into the metadata of the associated file.
In this embodiment, when creating the associated file of the target file, the terminal simultaneously determines whether the target instruction is a preset instruction, and if the target instruction is the preset instruction, when creating the associated file, the terminal acquires creator information of the target file, and writes the creator information of the target file into metadata corresponding to the currently created associated file, as creator information of the associated file.
Illustratively, in practical applications, for example, a user takes a picture through a camera application and then saves the picture locally. When the photo file is saved, that is, when the photo file is created, creator information (that is, process name information of the camera application process) of the photo file (target file) is also saved in the metadata of the photo file. Thereafter, when the user moves or copies (paste instruction) the photo file to another folder using the file management software, a duplicate file (associated file) of the photo file is created in the other folder, and the creator information of the duplicate file is still the process name information of the camera application process. Or after the user encrypts the photo file through the encryption software, an encrypted file is generated, and creator information of the encrypted file is still process name information of the camera application process.
For another example, when the backup software performs local backup, the terminal needs to store the backup file in a local preset storage space, and then may read the backup file from the preset storage space and restore the backup file to the original file. The backup file is a duplicate file of the original file, and the terminal actually executes a copy instruction and a paste instruction in the generation process of the backup file and the recovery process of the original file: when backing up a file, a terminal copies an original file (a target file) and pastes the original file into a preset storage space to generate a backup file (an associated file); when the original file is restored, the terminal copies the backup file (target file) and pastes the copy file in the original path of the original file, thereby restoring the backup file to the original file (associated file). Since the copying instruction and the pasting instruction are both preset instructions, when the terminal locally backs up the file through the backup software, the creator information of the restored original file can not be modified into the identification information of the backup software when the backed up original file is restored, namely the creator information of the original file can not be changed through local backup.
111. And if the target instruction is not a preset instruction, the terminal determines that the creator information of the associated file is the process name information of the second process, and writes the creator information into the metadata of the associated file.
In this embodiment, when creating the associated file of the target file, the terminal determines whether the target instruction is a preset instruction, and if not, when creating the associated file, the terminal acquires the recorded process name information of the second process, determines that the creator information of the associated file is the process name information of the second process, and writes the process name information of the second process into the metadata of the associated file. After the terminal obtains the reading instruction, the creator information of the associated file can be read from the metadata of the associated file. The preset instruction can be described as above.
For example, in an actual scene, for example, after a user takes a picture through a camera application and stores the picture locally, creator information of a stored picture file (target file) is process name information of a process of the camera application. If the user modifies the photo file through the retouching software, the photo file is saved (the another storage is an instruction) as a new file (an associated file). When the terminal creates the new file, the creator information of the new file is determined to be the process name information of the retouching software process, and the creator information of the new file is written in the metadata of the new file. Or, after compressing at least one photo file (compression instruction) by the compression software, the user generates a corresponding compression package file (associated file). When the terminal creates the compressed package file, the creator information of the compressed package file is determined to be the process name information of the compressed software process, and the creator information of the compressed package file is written in the metadata of the compressed package file.
It should be noted that steps 107 to 111 are optional steps.
Optionally, in some possible implementations, the terminal determines a file path of the target file and creator information of the target file; and the terminal generates a corresponding relation between the file path of the target file and the creator information of the target file and stores the corresponding relation in a file path rule, wherein the file path rule is used for indicating the corresponding relation between different creator information and different file paths.
In this embodiment, after creating the target file, the terminal generates a corresponding relationship between creator information of the target file and a file path of the target file, and stores the corresponding relationship in the file path rule. After the terminal generates the file path rule of the target file, the file path rule is stored locally in a file form, active modification of a user can be accepted, and meanwhile, when the path of the file created by some applications changes, the file path rule can be updated along with the updating of the applications. When a terminal receives a file sent by other equipment, if the creator information of the received file can be determined, a storage path corresponding to the file can be determined according to the creator information of the file and a file path rule, and the file is stored in the storage path. The file path rule is used to indicate correspondence between different creator information and different file paths, and a schematic table of the file path rule may be as shown in table 1 below.
Figure BDA0001966644420000111
TABLE 1
Optionally, in some possible implementation manners, the terminal acquires a display instruction, where the display instruction is used to instruct the terminal to display creator information of the target file; and the terminal displays the creator information of the target file according to the display instruction. In this embodiment, the terminal may respond to a user operation to generate a display instruction, query metadata corresponding to the target file according to the display instruction, determine creator information of the target file, and display the creator information of the target file. The display process can also be displayed in a popup mode or in other modes.
For example, as shown in fig. 3, when a user browses a file on an interface of file management software, after selecting the file, the user may input a display instruction by clicking a menu of the file management software for displaying creator information of the file (touch operation 301), and after acquiring the instruction, the file management software queries metadata of one or more displayed files to obtain creator information of the displayed file, and displays the creator information of the one or more displayed files in correspondence with the one or more displayed files, for example, below, above a corresponding file icon, or, as shown in fig. 3, below a screen.
As shown in fig. 4, when a user opens a certain file, a display instruction is input through a touch operation 401 (for example, a long touch, a double click, or a preset gesture) or a preset menu, and the terminal responds to the touch operation 401 to obtain creator information of the file, and superimposes and displays the creator information on a file display area. For example, when a user clicks a picture in an album and opens a picture, a display instruction may be input through a preset gesture or a preset menu, and the creator information may be displayed in a transparent or semi-transparent manner superimposed on the picture in response to a selection of the gesture or the menu by the terminal.
Optionally, in some possible implementation manners, the terminal acquires a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files in a classification manner according to a creator of the file; and the terminal acquires creator information of the files according to the file classification instruction and displays the files in a classification mode according to the creator information of the files. In this embodiment, the terminal may respond to or receive other application calls according to the operation of the user to generate a file classification instruction, and the terminal queries metadata corresponding to the target file according to the file classification instruction, determines creator information of the target file, and displays the target file in a classification manner according to the creator information of the target file. In practical application, the method can be used for various occasions. For example, music stored in different music software is displayed in different categories according to different folders, pictures stored in different applications are displayed in an album in different categories (as shown in fig. 5), documents edited by different editing software are displayed in different categories, and the like.
Optionally, in some possible implementation manners, the terminal obtains a deletion instruction, where the deletion instruction carries target creator information and is used to instruct the terminal to delete a file to be deleted, where the file to be deleted is a file whose creator information is the target creator information; the terminal searches the file to be deleted according to the deletion instruction; and the terminal deletes the target file to be deleted according to the deletion instruction. In this embodiment, the terminal may respond to or receive other application calls to acquire a deletion instruction according to an operation of a user, where the deletion instruction carries target creator information, and after acquiring the deletion instruction, the terminal searches for and deletes a file to be deleted whose creator information is the target creator information, that is, deletes a file created by an application corresponding to the target creator information. The target creator information carried in the delete command may be set by the user, or may be set by the terminal after the uninstalled application is identified, and may be set as the application name, process name, package name information of the application package, or the like of the uninstalled application.
According to the technical scheme, the embodiment of the application has the following advantages:
and when the terminal starts the first process, recording the process name information of the first process. And if the terminal establishes the target file through the first process, the terminal determines that the creator information of the target file is the process name information of the first process and writes the creator information into the metadata corresponding to the target file. Therefore, after the terminal acquires the reading instruction, the creator information of the target file can be read from the metadata of the target file. In summary, in the embodiment, the creator information of the file is recorded in the metadata of the file, and based on the characteristics of the metadata, the creator information of the file is conveniently and accurately read.
The above embodiment describes a process of directly creating a target file, and another case is described below.
Referring to fig. 6 in detail, fig. 6 is a schematic diagram of another embodiment of a method for recording file creator information in an embodiment of the present application, and the method may include:
601. the terminal receives the target file sent by other terminals or the network server through the first process.
In this embodiment, when the first process of the terminal runs, the terminal receives, through the first process, the target file sent by another terminal or the network server. The first process may be a process of backup software, bluetooth, a browser or instant messaging software, and the other terminal generally refers to any device that can perform data interaction with the terminal except the terminal, such as a mobile phone, a computer terminal, and the like. The target file may be a backup file that the terminal recovers from a preset device through backup software, a picture or a document file that is cached when a user browses a web page using a browser, or a file that the terminal receives from another device through bluetooth software, or the like.
602. And the terminal acquires a saving instruction of the first process, wherein the saving instruction is used for instructing the terminal to save the target file.
In this embodiment, the saving instruction may be a preset instruction, and the terminal receives the target file and then generates a self-generated saving instruction, for example, a saving instruction automatically generated when the terminal caches the web page file through a browser when the user browses the web page; or may be a save instruction generated by the terminal in response to a user operation, for example, when the user clicks a file save option.
603. And the terminal saves the target file according to the saving instruction.
In this embodiment, after receiving the target file, the terminal locally stores the target file.
604. The terminal judges whether the application corresponding to the first process is a preset application.
In this embodiment, a user may set a preset application list (may also be referred to as a list) in advance in a system of a terminal, where the preset application list may include an application name, a package name, or a process name list of a preset application. Therefore, when the terminal starts the first process, whether the application corresponding to the first process is the preset application or not can be determined through the process name of the first process or the application name and the package name corresponding to the process name.
The list of the preset application can be maintained by the network side and is pushed to the terminal at regular time or when updated. For example, a terminal manufacturer may maintain a preset software list and a corresponding process name of the preset software in the application market at a server side of the terminal manufacturer, and periodically push the list to the terminal, or push the list to the terminal when the list is updated, so as to ensure timeliness of the list.
It should be noted that the steps 603 and 604 are not necessarily executed in the order.
605. And under the condition that the application corresponding to the first process is judged not to be the preset application, the terminal determines that the creator information of the target file is the process name information of the first process and writes the creator information into the metadata of the target file.
In this embodiment, when the first process is started, the terminal records process name information of the first process. And if the application corresponding to the first process is not the preset application, the terminal determines that the creator information of the target file is the process name information of the first process. And the terminal reads the recorded process name information of the first process and writes the process name information into the metadata of the target file.
For example, in an actual application, the preset application list may include backup software, for example. When the terminal receives the file sent by the network through the process of the instant messaging software, the terminal stores the file locally. Because the instant messaging software is not in the preset application list, when the terminal saves the file, the creator information of the file is determined to be the process name information of the instant messaging software process, and the creator information of the file is written in the metadata of the file. For another example, after the terminal receives a file sent by another device through the bluetooth software, since the bluetooth software is not in the preset application list, when the terminal saves the file, the creator information of the file is determined to be the process name information of the bluetooth software process, and the creator information of the file is written in the metadata of the file.
606. And if the application corresponding to the first process is a preset application, the terminal acquires the rule table information.
In this embodiment, when the first process is started, the terminal records process name information of the first process. If the application corresponding to the first process is a preset application, the terminal acquires rule table information, wherein the rule table information is used for indicating the corresponding relation between the identification information of different files and different creator information, and the identification information comprises at least one of file name information, category information and modification time information of the files.
Specifically, the correspondence may be a correspondence of identification information and process name information of the target file. The identification information of the target file may be a specific identification of the target file, such as a file name, a file size, a file path, or other attribute information that may uniquely or may be combined to identify the target file. The rule table file can be stored locally after being generated by the terminal, and can also be sent to other terminals or a network server for storage. The terminal can determine creator information uniquely corresponding to the target file according to the one or more pieces of identification information of the target file. A schematic table of the rule table information may be as shown in table 2 below.
Filename Size and breadth Modifying the date Document classification Creator information
file.txt 5kb 2017.01.11 Document com.tencent.mm
string.mp3 6kb 2017.01.11 Music QQ
final.mp4 1kb 2017.01.11 Video Tremble sound
text.jpg 300kb 2018.01.11 Picture frame android.browser
Taobao, apk 100M 2018.01.12 Application package com.android.thememanager
TABLE 2
In practical applications, the rule table information may be stored in the terminal, or may be stored in another terminal or a network server. For example, if the first process is a process of backup software, the preset application list includes the backup software. The user backs up the target file through the backup software before and saves the backup file on other terminals or networks. Then, when the terminal restores the file through the backup software (receives the backup file from another terminal or the network), in order to avoid that creator information of the restored file is modified into process name information of the backup software process, before restoring the backup file, the terminal may generate the rule table information according to the creator information of the target file to be backed up, and store the rule table locally at the terminal, or store the rule table on another terminal or a network server along with the backup file. Thus, when performing file restoration, the terminal determines creator information of the restored file through the rule table.
Optionally, in some possible implementation manners, the terminal does not set creator information in the metadata of the target file when it is determined that the application corresponding to the first process is a preset application. In this embodiment, after the terminal receives the target file sent by another terminal or the network server through the first process, if the application corresponding to the first process is a preset application, the terminal does not set creator information in the metadata of the target file. The non-setting means that, if creator information already exists in the received metadata of the object file, the creator information is not modified, and if creator information does not exist in the received metadata of the object file, the terminal does not add creator information to the metadata of the object file in the process of saving the object file.
In an actual scenario, for example, if the preset application is an application of backup software, when the terminal receives a target file sent by another terminal or a network server and then performs recovery (saves the target file), creator information is not modified or added in metadata of the target file.
607. And the terminal determines creator information of the target file according to the identification information of the target file and the rule table information, and writes the creator information into metadata of the target file.
In this embodiment, after the terminal acquires the rule table information, the creator information of the target file may be determined by comparing the received identification information of the target file with the rule table information. Specifically, the file name may be determined first, and if the unique correspondence between the target file and the creator information cannot be determined yet, the file type, the file size, the modification date, or the like may be compared until the unique correspondence between the target file and the creator information is determined. After that, the terminal writes creator information of the target file in the metadata of the target file.
Optionally, in some possible implementation manners, if the application corresponding to the first process is a preset application, the terminal first determines that creator information of the target file is process name information of the first process, and writes the creator information of the target file in metadata of the target file, but the creator information written in the metadata may be inaccurate or inappropriate, so that the terminal will obtain rule table information in the future and update the creator information of the target file according to the rule table information, where the updated creator information of the target file is determined by the terminal according to the identification information of the target file and the rule table information. In this embodiment, if the first process is a process of backup software and the preset application list also includes backup software, when the terminal receives a backup file (file recovery) sent by another terminal or a network through the backup software, when the file is saved, the creator information of the saved file is modified into the process name information of the backup software process, and then the creator information of the saved file is updated according to the rule table information.
608. And the terminal acquires a reading instruction.
609. And the terminal reads the creator information corresponding to the target file according to the file reading instruction.
It should be noted that steps 608 and 609 are similar to steps 105 and 106 in the embodiment shown in fig. 1, and are not described again here.
Optionally, in some possible implementation manners, when the second process runs, the terminal acquires a target instruction which is generated by the second process and takes the target file as an operation object; the terminal creates an associated file of the target file according to the target instruction, wherein the associated file comprises a copy file, a modified file, an encryption and decryption file or a decompression file corresponding to the target file; if the target instruction is a preset instruction, the terminal determines that creator information of the associated file is creator information of the target file, and writes the creator information of the associated file in metadata of the associated file; and if the target instruction is not a preset instruction, the terminal determines that the creator information of the associated file is the process name information of the second process, and writes the creator information of the associated file in the metadata of the associated file.
It should be noted that this optional step is similar to step 107 to step 111 in the embodiment shown in fig. 1, and is not described here again.
Optionally, in some possible implementations, the terminal determines a file path of the target file and creator information of the target file; and the terminal generates a corresponding relation between the file path of the target file and the creator information of the target file and stores the corresponding relation in a file path rule, wherein the file path rule is used for indicating the corresponding relation between different creator information and different file paths.
Optionally, in some possible implementation manners, the terminal acquires a display instruction, where the display instruction is used to instruct the terminal to display creator information of the target file; and the terminal displays the creator information of the target file according to the display instruction.
Optionally, in some possible implementation manners, the terminal acquires a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files in a classification manner according to a creator of the file; and the terminal acquires creator information of the files according to the file classification instruction and displays the files in a classification mode according to the creator information of the files.
Optionally, in some possible implementation manners, the terminal obtains a deletion instruction, where the deletion instruction carries target creator information and is used to instruct the terminal to delete a file to be deleted, where the file to be deleted is a file whose creator information is the target creator information; the terminal searches the file to be deleted according to the deletion instruction; and the terminal deletes the target file to be deleted according to the deletion instruction.
It should be noted that the optional steps described above are similar to the optional steps in the embodiment shown in fig. 1, and are not described again here.
According to the technical scheme, the embodiment of the application has the following advantages:
and when the terminal receives the target file sent by other terminals through the first process, the terminal acquires the storage instruction of the first process and stores the target file according to the storage instruction. Then, the terminal determines whether the application corresponding to the first process is a preset application, if the application corresponding to the first process is the preset application, for example, the preset application list includes backup software, and if the first process is a process of the backup software, in order to avoid modifying the received file into the process name information of the first process, the terminal may obtain rule table information when saving the target file, thereby determining creator information of the target file according to the rule table information, and writing the creator information of the target file into the metadata of the target file. Or when the application corresponding to the first process is determined to be a preset application and the terminal saves the target file, the creator information in the metadata of the target file is not set. And if the first process is not the preset application, the terminal determines that the creator information of the target file is the process name information of the first process, and writes the creator information of the target file into the metadata of the target file. And then, after the terminal acquires the reading instruction, the creator information of the target file can be read according to the reading instruction. In summary, in the embodiment, the creator information of the file is recorded in the metadata of the file, and based on the characteristics of the metadata, the creator information of the file is conveniently and accurately read.
The above-described embodiments describe the process of recording and reading the file creator information when creating a file. In practical applications, however, there may be cases where: the metadata of the existing file in the system does not record the corresponding process name information, so that the creator of the file cannot be read from the metadata. For example, when a file is created, a method of recording and reading creator information in metadata of the file is an update function of a system, and a system before update does not have the function, and corresponding creator information is not recorded in metadata of a file created in the system before update. Especially for files on sdcard, there is no method for directly reading creator information in the prior art. Based on this, the following proposes to provide a method of recording and reading file creator information if no creator information is recorded in the metadata of an existing file.
Referring to fig. 7 in detail, fig. 7 is a schematic diagram of another embodiment of a method for recording file creator information in an embodiment of the present application, and the method may include:
701. the terminal obtains a configuration instruction, and the configuration instruction is used for indicating that creator information is set for the file to be configured.
In this embodiment, the terminal generates a configuration instruction after responding to a user input or an instruction of other software, where the configuration instruction is used to instruct the terminal to set creator information for a file to be configured. Corresponding creator information is not recorded in the metadata corresponding to the file to be configured.
702. And the terminal determines the file to be configured according to the configuration instruction, wherein the creator information of the file to be configured is not recorded in the metadata corresponding to the file to be configured.
In this embodiment, after the terminal acquires the configuration instruction, the terminal queries creator information of a file stored locally, and determines a file to be configured in which the creator information is not recorded in the metadata.
703. And the terminal acquires the file path rule according to the configuration instruction.
In this embodiment, after the terminal obtains the configuration instruction, the file path rule file is searched and obtained locally. It should be noted that, the file path rule file may refer to the above, as in an optional step corresponding to the embodiment shown in fig. 1 or fig. 6, the described file path rule, that is, the obtained file path rule may be a file path rule generated by the terminal according to creator information and a corresponding file path recorded in the target file metadata after the terminal creates the target file.
Optionally, the file path rule may also be a code for creating a file by a user through a reverse analysis application, or an applied file path rule obtained through dynamic debugging and test analysis. And after the terminal acquires the configuration instruction, the terminal acquires the file path rule saved by the user from the local.
704. And the terminal determines creator information of the file to be configured according to the file path of the file to be configured and the file path rule.
In this embodiment, after determining the file to be configured, the terminal may determine creator information corresponding to the file to be configured from the corresponding relationship indicated in the file path rule through the file path of the file to be configured. For example, the file to be configured includes a first file, where a file path of the first file is: and determining creator information corresponding to the first file as an application name APP1 according to the file path rule shown in the table 1 as shown in the table 1/storage/organized/APP 1/cache. In addition, if the file path of the first file is: in the/storage/my document, according to the file path rule shown in table 1, since the creator information corresponding to the first file includes APP1 and APP2, the terminal cannot determine which application name information the creator information corresponding to the first file is, and as shown in fig. 8, the terminal may display a popup window (popup window 800, where the file name of the first file is 67gfdfgdfg), and prompt the user to input the creator information of the first file.
It should be noted that, when the file to be configured is a file on the sdcard, the terminal may obtain creator information of the file to be configured by executing step 703 and step 704; if the file to be configured is internal data, the terminal can also determine the application name information corresponding to the file to be configured according to the uid and gid of the file to be configured in a mode of acquiring the uid and gid of the file.
705. And the terminal writes the creator information of the file to be configured in the metadata corresponding to the file to be configured.
In this embodiment, after determining creator information corresponding to a file to be configured, a terminal writes the creator information of the file to be configured in metadata of the file to be configured.
706. And the terminal acquires a reading instruction.
707. And the terminal reads the creator information corresponding to the file to be configured according to the file reading instruction.
It should be noted that steps 706 and 707 are similar to the process of reading creator information of the target file in steps 105 and 106 in the embodiment shown in fig. 1, and are not repeated here.
Optionally, in some possible implementation manners, when the second process runs, the terminal acquires a target instruction which is generated by the second process and takes the target file as an operation object; the terminal creates an associated file of the target file according to the target instruction, wherein the associated file comprises a copy file, a modified file, an encryption and decryption file or a decompression file corresponding to the target file; if the target instruction is a preset instruction, the terminal determines that creator information of the associated file is creator information of the target file, and writes the creator information of the associated file in metadata of the associated file; and if the target instruction is not a preset instruction, the terminal determines that the creator information of the associated file is the process name information of the second process, and writes the creator information of the associated file in the metadata of the associated file.
It should be noted that this optional step is similar to step 107 to step 111 in the embodiment shown in fig. 1, and is not described here again.
Optionally, in some possible implementation manners, the terminal acquires a display instruction, where the display instruction is used to instruct the terminal to display creator information of the target file; and the terminal displays the creator information of the target file according to the display instruction.
Optionally, in some possible implementation manners, the terminal acquires a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files in a classification manner according to a creator of the file; and the terminal acquires creator information of the files according to the file classification instruction and displays the files in a classification mode according to the creator information of the files.
Optionally, in some possible implementation manners, the terminal obtains a deletion instruction, where the deletion instruction carries target creator information and is used to instruct the terminal to delete a file to be deleted, where the file to be deleted is a file whose creator information is the target creator information; the terminal searches the file to be deleted according to the deletion instruction; and the terminal deletes the target file to be deleted according to the deletion instruction.
It should be noted that the optional steps described above are similar to the optional steps in the embodiment shown in fig. 1, and are not described again here.
According to the technical scheme, the embodiment of the application has the following advantages:
when creator information does not exist in metadata of some files in the system, the terminal determines the files to be configured. After the terminal receives the configuration instruction, the terminal determines the file to be configured according to the configuration instruction, inquires creator information corresponding to the file to be configured from an existing file path rule in the terminal through a file path of the file to be configured, and writes the creator information of the file to be configured in metadata of the file to be configured. Therefore, after the terminal acquires the reading instruction, the creator information corresponding to the reading instruction can be read from the metadata of the file to be configured. In summary, in the embodiment, the creator information of the file is recorded in the metadata of the file, and based on the characteristics of the metadata, the creator information of the file is conveniently and accurately read.
Referring to fig. 9A in detail, fig. 9A is a schematic diagram of an embodiment of a terminal in an embodiment of the present application, where the schematic diagram includes:
an acquiring unit 901 configured to acquire a file creating instruction;
a creating unit 902, configured to create a target file according to the create file instruction;
a determining unit 903, configured to determine creator information of the target file, where the creator information of the target file includes identification information of an application or identification information of a process that creates the target file;
a writing unit 904, configured to write creator information of the target file in the metadata corresponding to the target file.
In one possible design of the system, the system may be,
a determining unit 903, configured to determine a first process running on the terminal, where the first process generates the file creating instruction;
the determining unit 903 is specifically configured to determine that the creator information of the target file is identification information of an application corresponding to the first process or identification information of the first process.
In one possible design of the system, the system may be,
an obtaining unit 901, further configured to receive the target file sent by another terminal or a network server through the first process;
an obtaining unit 901, configured to specifically obtain a saving instruction of the first process, where the saving instruction is used to instruct to save the target file;
the terminal further includes:
the judging unit is used for judging whether the application corresponding to the first process is a preset application or not;
a determining unit 903, configured to determine, when it is determined that the application corresponding to the first process is not a preset application, that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process; and under the condition that the application corresponding to the first process is judged to be the preset application, not setting creator information in the metadata of the target file.
In one possible design, and with particular reference to fig. 9B, fig. 9B is a schematic diagram of another embodiment of the terminal in the embodiment of the present application,
an obtaining unit 901, further configured to receive the target file sent by another terminal or a network server through the first process; under the condition that the application corresponding to the first process is judged to be a preset application, rule table information is obtained, the rule table information is received from the other terminal or the network server or is stored in the terminal, the rule table information is used for indicating the corresponding relation between the identification information of different files and different creator information, and the identification information of the files is used for the terminal to uniquely determine the files corresponding to the identification information;
an obtaining unit 901, configured to specifically obtain a saving instruction of the first process, where the saving instruction is used to instruct to save the target file;
the terminal may further include:
a determining unit 905, configured to determine whether an application corresponding to the first process is a preset application;
a determining unit 903, configured to determine, when it is determined that the application corresponding to the first process is not a preset application, that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process; and under the condition that the application corresponding to the first process is judged to be the preset application, determining creator information of the target file according to the identification information of the target file and the rule table information.
In one possible design of the system, the system may be,
a determining unit 903, configured to determine a file path of the target file and creator information of the target file;
the creating unit 902 is further configured to generate a corresponding relationship between a file path of the target file and creator information of the target file, and store the corresponding relationship in a file path rule, where the file path rule is used to indicate a corresponding relationship between different creator information and different file paths.
In one possible design of the system, the system may be,
an obtaining unit 901, configured to obtain a configuration instruction, where the configuration instruction is used to instruct to set creator information for a file to be configured; acquiring the file path rule;
the determining unit 903 is further configured to determine, according to the configuration instruction, the file to be configured, where creator information of the file to be configured is not recorded in metadata corresponding to the file to be configured; determining creator information of the file to be configured according to the file path of the file to be configured and the file path rule;
the writing unit 904 is further configured to write creator information of the file to be configured in the metadata corresponding to the file to be configured.
In one possible design of the system, the system may be,
an obtaining unit 901, configured to, when a second process is executed, obtain a target instruction that is generated by the second process and takes the target file as an operation object;
a creating unit 902, further configured to create an associated file of the target file according to the target instruction, where the associated file includes a copy file, a modified file, an encryption/decryption file, or a decompression file corresponding to the target file;
a writing unit 904, configured to determine that creator information of the associated file is creator information of the target file if the target instruction is a preset instruction, and write the creator information of the associated file in metadata of the associated file; and if the target instruction is not a preset instruction, determining that the creator information of the associated file is the identification information of the application corresponding to the second process or the identification information of the second process, and writing the creator information of the associated file into the metadata of the associated file.
In one possible design, the preset instruction includes a paste instruction, a rename instruction, an encrypt instruction, or a decrypt instruction.
In one possible design, the identification information of the application or the identification information of the process includes application name information, process name information, or package name information of the application package.
In one possible design, and with particular reference to fig. 9C, fig. 9C is a schematic diagram of another embodiment of the terminal in the embodiment of the present application,
an obtaining unit 901, further configured to obtain a modification instruction, where the modification instruction is used to instruct the terminal to modify creator information of the target file, and the modification instruction carries target creator information;
the terminal may further include:
a modifying unit 906, configured to modify the creator information of the target file into the target creator information according to the modifying instruction.
In one possible design, and with particular reference to fig. 9D, fig. 9D is a schematic diagram of another embodiment of the terminal in the embodiment of the present application,
an obtaining unit 901, configured to obtain a display instruction, where the display instruction is used to instruct to display creator information of the target file;
the terminal may further include:
a first display unit 907 for displaying the creator information of the target file according to the display instruction.
In one possible design, and with particular reference to fig. 9E, fig. 9E is a schematic diagram of another embodiment of the terminal in the embodiment of the present application,
an obtaining unit 901, configured to obtain a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files in a classification manner according to a creator of the file;
the terminal may further include:
a second display unit 908, configured to acquire creator information of the plurality of files according to the file classification instruction, and display the plurality of files in a classification manner according to the creator information of the plurality of files.
In one possible design, and with particular reference to fig. 9F, fig. 9F is a schematic diagram of another embodiment of the terminal in the embodiment of the present application,
the obtaining unit 901 is further configured to obtain a deletion instruction, where the deletion instruction carries target creator information and is used to instruct to delete a file to be deleted, where the file to be deleted is a file whose creator information is the target creator information;
the terminal may further include:
a search unit 909, configured to search the file to be deleted according to the deletion instruction;
a deleting unit 910, configured to delete the target file to be deleted according to the deletion instruction.
Referring to fig. 10 in detail, fig. 10 is a schematic diagram of another embodiment of the terminal in the embodiment of the present application, and the schematic diagram may include:
a processor 1001, a memory 1002, and a transceiver 1003; the transceiver 1003 is used for communicating with devices other than the terminal; the memory 1002 is used for storing instruction codes; the processor 1001, when executing the instruction code, causes the terminal to perform the method as performed by the terminal in the embodiments shown in fig. 1, fig. 6 or fig. 7 and any alternative.
An embodiment of the present application further provides a computer storage medium, where the medium stores instructions, and when the instructions are executed on a computer, the instructions cause the computer to execute the method executed by the terminal in the embodiments shown in fig. 1, fig. 6, or fig. 7 and any optional manner.
Embodiments of the present application further provide a computer program product including instructions, which when executed on a computer, cause the computer to perform the method performed by the terminal in the embodiments shown in fig. 1, fig. 6, or fig. 7 and any optional manner.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present disclosure in its responsive aspects.

Claims (17)

1. A method for recording file creator information by a terminal is characterized by comprising the following steps:
acquiring a file creating instruction;
creating a target file according to the file creating instruction;
determining creator information of the target file, wherein the creator information of the target file comprises identification information of an application or a process for creating the target file;
and writing creator information of the target file into the metadata corresponding to the target file.
2. The method of claim 1, further comprising:
determining a first process running on the terminal, wherein the first process generates the file creating instruction;
determining creator information of the target file, including:
and determining that the creator information of the target file is the identification information of the application corresponding to the first process or the identification information of the first process.
3. The method of claim 1, wherein prior to said obtaining a create file instruction, the method further comprises:
receiving the target file sent by other terminals or a network server through the first process;
the instruction for acquiring the created file specifically comprises the following steps:
acquiring a saving instruction of the first process, wherein the saving instruction is used for indicating to save the target file;
prior to the determining creator information for the target file, the method further comprises:
judging whether the application corresponding to the first process is a preset application or not;
determining creator information of the target file, including:
determining that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process under the condition that the application corresponding to the first process is judged not to be a preset application;
and under the condition that the application corresponding to the first process is judged to be a preset application, not setting creator information in the metadata of the target file.
4. The method of claim 1, wherein prior to said obtaining a create file instruction, the method further comprises:
receiving the target file sent by other terminals or a network server through the first process;
the instruction for acquiring the created file specifically comprises the following steps:
acquiring a saving instruction of the first process, wherein the saving instruction is used for indicating to save the target file;
prior to the determining creator information for the target file, the method further comprises:
judging whether the application corresponding to the first process is a preset application or not;
determining creator information of the target file, including:
determining that creator information of the target file is identification information of the application corresponding to the first process or identification information of the first process under the condition that the application corresponding to the first process is judged not to be a preset application;
under the condition that the application corresponding to the first process is judged to be a preset application, rule table information is obtained, the rule table information is received from the other terminal or the network server or is stored in the terminal, the rule table information is used for indicating the corresponding relation between identification information of different files and different creator information, and the identification information of the files is used for the terminal to uniquely determine the files corresponding to the identification information;
and determining creator information of the target file according to the identification information of the target file and the rule table information.
5. The method according to any one of claims 1-4, further comprising:
determining a file path of the target file and creator information of the target file;
and generating a corresponding relation between the file path of the target file and the creator information of the target file, and storing the corresponding relation in a file path rule, wherein the file path rule is used for indicating the corresponding relation between different creator information and different file paths.
6. The method of claim 5, further comprising:
acquiring a configuration instruction, wherein the configuration instruction is used for indicating the terminal to set creator information for a file to be configured;
determining the file to be configured according to the configuration instruction, wherein creator information of the file to be configured is not recorded in metadata corresponding to the file to be configured;
acquiring the file path rule according to the configuration instruction;
determining creator information of the file to be configured according to the file path of the file to be configured and the file path rule;
and writing creator information of the file to be configured in the metadata corresponding to the file to be configured.
7. The method according to any one of claims 1 to 6, further comprising:
acquiring a target instruction which is generated by the second process and takes the target file as an operation object;
creating an associated file of the target file according to the target instruction, wherein the associated file comprises a copy file, a modified file, an encryption and decryption file or a decompression file corresponding to the target file;
if the target instruction is a preset instruction, determining that creator information of the associated file is creator information of the target file, and writing the creator information of the associated file into metadata of the associated file;
and if the target instruction is not a preset instruction, determining that the creator information of the associated file is the identification information of the application corresponding to the second process or the identification information of the second process, and writing the creator information of the associated file in the metadata of the associated file.
8. The method of claim 7, wherein the predetermined instruction comprises a paste instruction, a rename instruction, an encrypt instruction, or a decrypt instruction.
9. The method according to any one of claims 1 to 8, wherein the identification information of the application or the identification information of the process includes application name information, process name information, or package name information of an application package.
10. The method according to any one of claims 1 to 9, further comprising:
acquiring a modification instruction, wherein the modification instruction is used for indicating the terminal to modify creator information of the target file, and the modification instruction carries the target creator information;
and modifying the creator information of the target file into the target creator information according to the modification instruction.
11. The method according to any one of claims 1 to 10, further comprising:
acquiring a display instruction, wherein the display instruction is used for indicating the terminal to display creator information of the target file;
and displaying the creator information of the target file according to the display instruction.
12. The method according to any one of claims 1 to 11, further comprising:
acquiring a file classification instruction, wherein the file classification instruction is used for instructing the terminal to display a plurality of files in a classification manner according to creators of the files;
and acquiring creator information of the files according to the file classification instruction, and displaying the files according to the creator information of the files in a classification manner.
13. The method according to any one of claims 1 to 12, further comprising:
acquiring a deletion instruction, wherein the deletion instruction carries target creator information, and is used for instructing the terminal to delete a file to be deleted, and the file to be deleted is a file of which the creator information is the target creator information;
searching the file to be deleted according to the deletion instruction;
and deleting the target file to be deleted according to the deleting instruction.
14. A terminal for recording file creator information, comprising:
the acquisition unit is used for acquiring a file creating instruction;
the creating unit is used for creating a target file according to the file creating instruction;
a determining unit, configured to determine creator information of the target file, where the creator information of the target file includes identification information of an application or identification information of a process that creates the target file;
and the writing unit is used for writing the creator information of the target file in the metadata corresponding to the target file.
15. A terminal for recording file creator information, comprising:
a processor, a memory, and a transceiver;
the transceiver is used for communicating with a device outside the terminal;
the memory is used for storing instruction codes; the processor, when executing the instruction code, causes the terminal to perform the method of any of claims 1-13.
16. A computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 13.
17. A computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1 to 13.
CN201910105508.0A 2019-02-01 2019-02-01 Method and terminal for recording information of file creator Active CN111522780B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910105508.0A CN111522780B (en) 2019-02-01 2019-02-01 Method and terminal for recording information of file creator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910105508.0A CN111522780B (en) 2019-02-01 2019-02-01 Method and terminal for recording information of file creator

Publications (2)

Publication Number Publication Date
CN111522780A true CN111522780A (en) 2020-08-11
CN111522780B CN111522780B (en) 2024-01-30

Family

ID=71900600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910105508.0A Active CN111522780B (en) 2019-02-01 2019-02-01 Method and terminal for recording information of file creator

Country Status (1)

Country Link
CN (1) CN111522780B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120063749A1 (en) * 2010-09-14 2012-03-15 Kabushiki Kasiha Toshiba Video file creation device and video file creation method
US20120158667A1 (en) * 2010-12-17 2012-06-21 Verizon Patent And Licensing Inc. Asset manager
CN103473277A (en) * 2013-08-27 2013-12-25 华为技术有限公司 Snapshot method and device for file systems
US8620861B1 (en) * 2008-09-30 2013-12-31 Google Inc. Preserving file metadata during atomic save operations
US20140074790A1 (en) * 2012-09-12 2014-03-13 International Business Machines Corporation Using a metadata image of a file system and archive instance to restore data objects in the file system
CN104133641A (en) * 2014-07-24 2014-11-05 深圳市同洲电子股份有限公司 External storage equipment file deleting method and device
CN104516974A (en) * 2014-12-26 2015-04-15 华为技术有限公司 Management method and device for file system directory entry
CN105095478A (en) * 2015-08-12 2015-11-25 浪潮(北京)电子信息产业有限公司 Method and device for obtaining establishing time of file in distributed file system
CN105786805A (en) * 2014-12-15 2016-07-20 乐视移动智能信息技术(北京)有限公司 Intelligent mobile terminal, document manager and file display method of same
CN106202367A (en) * 2016-07-07 2016-12-07 腾讯科技(深圳)有限公司 A kind of processing method and processing device of object information
CN106775887A (en) * 2016-12-27 2017-05-31 努比亚技术有限公司 The discharging method and device of a kind of application program
CN106991130A (en) * 2017-03-07 2017-07-28 广东欧珀移动通信有限公司 A kind of document handling method, device and intelligent terminal

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8620861B1 (en) * 2008-09-30 2013-12-31 Google Inc. Preserving file metadata during atomic save operations
US20120063749A1 (en) * 2010-09-14 2012-03-15 Kabushiki Kasiha Toshiba Video file creation device and video file creation method
US20120158667A1 (en) * 2010-12-17 2012-06-21 Verizon Patent And Licensing Inc. Asset manager
US20140074790A1 (en) * 2012-09-12 2014-03-13 International Business Machines Corporation Using a metadata image of a file system and archive instance to restore data objects in the file system
CN103473277A (en) * 2013-08-27 2013-12-25 华为技术有限公司 Snapshot method and device for file systems
CN104133641A (en) * 2014-07-24 2014-11-05 深圳市同洲电子股份有限公司 External storage equipment file deleting method and device
CN105786805A (en) * 2014-12-15 2016-07-20 乐视移动智能信息技术(北京)有限公司 Intelligent mobile terminal, document manager and file display method of same
CN104516974A (en) * 2014-12-26 2015-04-15 华为技术有限公司 Management method and device for file system directory entry
CN105095478A (en) * 2015-08-12 2015-11-25 浪潮(北京)电子信息产业有限公司 Method and device for obtaining establishing time of file in distributed file system
CN106202367A (en) * 2016-07-07 2016-12-07 腾讯科技(深圳)有限公司 A kind of processing method and processing device of object information
CN106775887A (en) * 2016-12-27 2017-05-31 努比亚技术有限公司 The discharging method and device of a kind of application program
CN106991130A (en) * 2017-03-07 2017-07-28 广东欧珀移动通信有限公司 A kind of document handling method, device and intelligent terminal

Also Published As

Publication number Publication date
CN111522780B (en) 2024-01-30

Similar Documents

Publication Publication Date Title
US10540173B2 (en) Version control of applications
US10310949B1 (en) Disaster restore of big data application with near zero RTO
US20190108103A9 (en) Computing device replication using file system change detection methods and systems
US10152387B1 (en) Instant start of virtual machine from archive copy on backup media
US10242045B2 (en) Filtering content using synchronization data
KR101658964B1 (en) System and method for datacenter workflow automation scenarios using virtual databases
US8250040B2 (en) Storage or removal actions based on priority
US9864736B2 (en) Information processing apparatus, control method, and recording medium
US7945535B2 (en) Automatic publishing of digital content
JP2016529599A (en) Content clipboard synchronization
US20110196840A1 (en) System and method for incremental backup storage
JP5870468B2 (en) Method and apparatus for managing images of mobile terminals
JP2020537212A (en) Workflow function of the content management system implemented by the client device
CN102331957B (en) File backup method and device
US20090254585A1 (en) Method for Associating Administrative Policies with User-Definable Groups of Files
US20230101774A1 (en) Techniques for performing clipboard-to-file paste operations
US9135116B1 (en) Cloud enabled filesystems provided by an agent which interfaces with a file system on a data source device
CN113157487A (en) Data recovery method and apparatus thereof
CN110888847B (en) Recycle bin system and file recycling method
US20140365430A1 (en) Information processing apparatus, system, and control method
CN111753141B (en) Data management method and related equipment
US8423585B2 (en) Variants of files in a file system
TWI571754B (en) Method for performing file synchronization control, and associated apparatus
CN111522780B (en) Method and terminal for recording information of file creator
CN113505153B (en) Memorandum backup method based on iOS system and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant