CN111522780B - Method and terminal for recording information of file creator - Google Patents

Method and terminal for recording information of file creator Download PDF

Info

Publication number
CN111522780B
CN111522780B CN201910105508.0A CN201910105508A CN111522780B CN 111522780 B CN111522780 B CN 111522780B CN 201910105508 A CN201910105508 A CN 201910105508A CN 111522780 B CN111522780 B CN 111522780B
Authority
CN
China
Prior art keywords
file
instruction
information
target
creator information
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.)
Active
Application number
CN201910105508.0A
Other languages
Chinese (zh)
Other versions
CN111522780A (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

Abstract

The embodiment of the application provides a method for recording creator information of a target file, which is used for writing the creator information corresponding to the target file in metadata of the target file in the process of creating the target file, so that the creator information of the target file can be conveniently read from the metadata of the target file when the creator information of the target file needs to be acquired. The method comprises the following steps: the terminal acquires a file creation instruction; the terminal creates a target file according to the file creation 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 creator information of the target file in metadata corresponding to the target file.

Description

Method and terminal for recording information of file creator
Technical Field
The present invention relates to the field of document processing, and in particular, to a method for recording information of a document creator and a terminal for recording information of a document creator.
Background
Both Unix-type file systems and windows use identity tags (user identification, uid), group tags (group identification, gid) to tag files and rights limits. The Android system is based on a linux system and also belongs to a Unix file system, so that a uid mechanism and a gid mechanism are adopted. However, the uid and gid in the Android system are different from those in the linux system, the uid in the Android is not used for identifying different users, different applications are identified by using the uid and gid, and the uid and gid mechanisms are isolated as lightweight sandbox technologies.
Based on the mechanism of the uid and the 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 relation between different applications and the file path created by the applications can be obtained through manual analysis, and then the creator of the file can be estimated through the comparison between the file path of the file and the corresponding relation.
The data of the Android system can be divided into internal data and external data. The internal data, namely the data in the application sandbox, and the corresponding uid or gid of the files of different applications are different, so that the creator corresponding to the different files can be determined by adopting the uid and gid. External data, such as data stored in a secure digital card (secure digital memory card, sdcard), is shared between different applications, and uses both uid and gid, but only by way of a file path. Determining the creator of the file in the manner of a file path is not an accurate and convenient way.
Disclosure of Invention
The embodiment of the application provides a method for recording creator information of a target file, which is used for writing the creator information corresponding to the target file in metadata of the target file in the process of creating the target file, so that the creator information of the target file can be directly read from the metadata of the target file when the creator information of the target file needs to be acquired.
In view of this, a first aspect of the embodiments of the present application provides a method for recording information of a file creator, which may include:
when the terminal creates the target file, the terminal acquires a file creation instruction, and creates the target file according to the file creation instruction, wherein the target file can be a newly created file or a file stored after the terminal receives other equipment. When the terminal creates the target file, creator information of the target file is acquired at the same time, and the creator information of the target file can include identification information of an application or identification information of a process for creating the target file, that is, by the creator information, it can be determined which application the target file is created by. And then, the terminal writes the determined creator information in the metadata corresponding to the target file. In the embodiment of the application, a method for recording creator information of a target file when the target file is created is provided. 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 corresponding creator information from the metadata of the target file.
In one possible design, the terminal obtains a file creation instruction, which may include: when the terminal runs a first process, the terminal acquires the file creation instruction generated by the first process; the terminal determining creator information of the target file may include: 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 receiving the file creating instruction generated by the first process, the terminal creates the 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 be used as creator information of the target file, thereby realizing the record of creator information of the target file in the process of creating the target file.
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 terminal obtains a file creation instruction, which specifically 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 the 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 determining creator information of the target file may include: under the condition that the application corresponding to the first process is not 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 metadata of the target file. In the embodiment of the present application, another case of creating a file is described: and after the terminal receives the target files 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 or not. If the application is not the preset application, the terminal determines 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 when the target file is stored, and writes the creator information of the target file into metadata of the target file; if the application is the preset application, the creator information of the target file is not set. By setting preset application in the system of the terminal in advance, the situation that the information of the file creator is unreasonably modified in some scenes, such as the process of recovering the backup file, 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 terminal obtains a file creation instruction, which specifically 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 the 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 determining creator information of the target file may include: under the condition that the application corresponding to the first process is not 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 the preset application, the terminal acquires rule table information, wherein 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 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 application, another method for recording creator information is described in the process of storing the target file when the terminal receives the target file sent by other terminals or the network server.
In one possible design, the method may further include: the terminal determines a file path of the target file and creator information of the target file; the terminal generates a corresponding relation between the file path of the target file and 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 creating the target file and recording the creator information of the target file, the terminal may generate the correspondence between the creator information of the target file and the file path of the target file, and store the correspondence in the file path rule. The file path rules indicate the correspondence of different applications to the paths along which the file was created. The file path rules are stored locally at the terminal or on the network in the form of files, updated with the updates of the application. The terminal can automatically generate the file path rule after generating the name target file and recording the creator information of the target file, and can directly search the file corresponding to the file path rule from the local when a user needs to inquire, so that 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 obtains 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 creator information of the to-be-configured file in metadata corresponding to the to-be-configured file. In this embodiment of the present application, after the terminal generates the file path rule, creator information corresponding to the file to be configured may be determined according to the file path rule and the file path of the file to be configured. For example, under a certain folder, there are a first file in which the first creator information is recorded in the metadata of the first file and a second file in which the creator information is not recorded in the metadata of the second file. The folder indicates a file path corresponding to the first creator information in the file path rule. 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 creator information into the metadata of the second file, thereby realizing the record of the creator information of the second file, namely 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 modification 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 the creator information of the associated file is the 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 the 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 present application, after creating the target file, the terminal may receive a target instruction generated by the second process and using the target file as an operation object, where the target instruction includes a file merging instruction, a file decomposing instruction, an encryption/decryption or paste instruction, and the like. And then, 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, a decompression file and the like corresponding to the target file. And when the associated file is created, the terminal judges whether the target instruction is a preset instruction at the same time, if the target instruction is the preset instruction, 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 by operating the target file are common situations in actual scenes, and the creator information record situation of the associated file is described, so that the practicability of the scheme is improved.
In one possible design, the preset instructions may include paste instructions, rename instructions, encrypt instructions, or decrypt instructions. In the embodiment of the present application, a case of a preset instruction is described, where the preset instruction may be preset 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 application, the creator information is described as application identification information and process identification information, and may include application name information, process name information or package name information of an application package. It should be noted that, the creator information may 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; 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 application, modification of creator information of the target file is described. The terminal can generate a modification instruction after responding to user operation or receiving instructions of other applications, wherein the modification instruction carries target creator information set by a user for the target file. Thus, after the terminal acquires the modification instruction, the creator information in the metadata of the target file can be modified to 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; the terminal displays creator information of the target file according to the display instruction. In the embodiment of the application, after receiving the display instruction, the terminal can display creator information of the target file according to the display instruction, so that the user can conveniently check the creator 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 instructing the terminal to display a plurality of files according to the classification of creator of the files; the terminal obtains creator information of the plurality of files according to the file classification instruction, and displays the plurality of files according to the creator information classification of the plurality of files. In this embodiment of the present application, after generating a plurality of files and recording creator information of the plurality of files, the terminal may obtain the creator information of the plurality of files according to a file classification instruction, and display the plurality of files according to the creator information of the plurality of files in a classified manner.
In one possible design, the method may further include: the terminal acquires a deleting instruction, wherein the deleting 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 with creator information as the target creator information; the terminal searches the file to be deleted according to the deleting instruction; and the terminal deletes the target file to be deleted according to the deleting instruction. In an embodiment of the present 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 deleting instruction, wherein the deleting 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 embodiments of the present application provides a terminal for recording information of a file creator, which may include:
the acquisition unit is used for acquiring a file creation instruction;
the creation unit is used for creating a target file according to the file creation 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 created the target file;
and the writing unit is used for writing creator information of the target file in the metadata corresponding to the target file.
In one possible design of the device,
the determining unit is further used for determining a first process running on the terminal, and the first process generates the file creation 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 device,
the obtaining unit is further configured to receive, through the first process, the target file sent by the other terminal or the network server;
the acquiring unit is specifically configured to acquire 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 that the 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 it is determined that the application corresponding to the first process is not a preset application; and under the condition that the application corresponding to the first process is judged to be the preset application, the creator information in the metadata of the target file is not set.
In one possible design of the device,
the obtaining unit is further configured to receive, through the first process, the target file sent by the other terminal or the network server; acquiring rule table information when judging that the application corresponding to the first process is a preset application, wherein 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 acquiring unit is specifically configured to acquire 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 that the 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 it is determined that the application corresponding to the first process is not a preset application; 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 device,
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 correspondence between a file path of the target file and creator information of the target file, and store the correspondence in a file path rule, where the file path rule is used to indicate correspondence between different creator information and different file paths.
In one possible design of the device,
the acquisition unit is also used for acquiring a configuration instruction, wherein the configuration instruction is used for indicating to set creator information for the file to be configured; acquiring the file path rule;
The determining unit is further configured to determine the to-be-configured file according to the configuration instruction, where creator information of the to-be-configured file is not recorded in metadata corresponding to the to-be-configured file; 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 to-be-configured file in metadata corresponding to the to-be-configured file.
In one possible design of the device,
the obtaining unit is further used for obtaining a target instruction which is generated by the second process and takes the target file as an operation object when the second process is operated;
the creation unit is further configured to create an association file of the target file according to the target instruction, where the association file may include a copy file, a modification file, an encryption/decryption file, or a decompression file corresponding to the target file;
the writing unit is further configured to determine that the 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; if the target instruction is not the 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.
In one possible design, the preset instructions may include paste instructions, rename instructions, encrypt instructions, or decrypt instructions.
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 device,
the acquisition unit is further used for acquiring a modification instruction, wherein the modification instruction is used for instructing the terminal to modify creator information of the target file, and the modification instruction carries the 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 creator information of the target file according to the display instruction.
In one possible design, the terminal may further include:
the acquisition unit is also used for acquiring a file classification instruction, wherein the file classification instruction is used for instructing the terminal to display a plurality of files according to the classification of the creator of the files;
And the second display unit is used for acquiring creator information of the files according to the file classification instruction and displaying the files according to the creator information classification of the files.
In one possible design, the terminal may further include:
the acquisition unit is further used for acquiring a deleting instruction, the deleting instruction carries target creator information, the deleting instruction is used for indicating to delete a file to be deleted, and the file to be deleted is a file with creator information being 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 embodiments of the present application further provides a terminal for recording information of a file creator, which may include:
a processor, a memory, and a transceiver; the transceiver is used for communicating with devices 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 optional manner in the embodiments of the present application.
A fourth aspect of embodiments of the present application also provides a computer storage medium having instructions stored thereon which, when executed on a computer, cause the computer to perform a method as described in the foregoing first aspect and any of the alternatives.
A fifth aspect of the embodiments of the present application also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method as described in the first aspect and any of the alternatives described above.
From the above technical solutions, the embodiments of the present application have the following advantages:
and after receiving the file creation instruction, the terminal creates the target file according to the file creation instruction. In the process of creating the target file, creator information is written in 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, convenient and accurate reading of creator information of the file is realized.
Drawings
FIG. 1 is a diagram illustrating an embodiment of recording file creator information according to an embodiment of the present application;
FIG. 2 is a schematic diagram of another embodiment of recording file creator information according to an embodiment of the present application;
FIG. 3 is a schematic diagram of another embodiment of recording file creator information according to an embodiment of the present application;
FIG. 4 is a schematic diagram of another embodiment of recording file creator information according to an embodiment of the present application;
FIG. 5 is a schematic diagram of another embodiment of recording file creator information according to an embodiment of the present application;
FIG. 6 is a schematic diagram of another embodiment of recording file creator information in an embodiment of the present application;
FIG. 7 is a schematic diagram of another embodiment of recording file creator information according to an embodiment of the present application;
FIG. 8 is a schematic diagram of another embodiment of recording file creator information in an embodiment of the present application;
FIG. 9A is a schematic diagram of an embodiment of a terminal according to an embodiment of the present application;
fig. 9B is a schematic diagram of another embodiment of a terminal in an embodiment of the present application;
fig. 9C is a schematic diagram of another embodiment of a terminal in an embodiment of the present application;
fig. 9D is a schematic diagram of another embodiment of a terminal in an embodiment of the present application;
fig. 9E is a schematic diagram of another embodiment of a terminal in an embodiment of the present application;
fig. 9F is a schematic diagram of another embodiment of a terminal in an embodiment of the present application;
fig. 10 is a schematic diagram of another embodiment of a terminal in an embodiment of the present application.
Detailed Description
The following describes in detail a method and a terminal for recording information of a file creator according to embodiments of the present application with reference to the accompanying drawings.
The embodiment of the application can be applied to Unix file systems and windows systems, such as but not limited to Android systems, and the Android systems are taken as examples in the embodiment and the subsequent embodiments.
In the process of using the Android device, a large number of files are also created in the storage space along with the running of a large number of applications, and the application for creating the files is the creator of the files. By determining creator information for a file, a process analysis may be performed on the file. For example, when software uninstallation is performed, it is necessary to delete a corresponding file according to creator information of the file. If some files cannot determine the creator, 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 the storage space is occupied. In addition, the files may be displayed according to application classification by determining creator information of the files.
At present, the creator of the Android system can distinguish files in a uid and gid mode or in an application file path mode. When the creator of the file is distinguished by adopting the file path, the creator needs to participate manually: the code of the file is created manually through reverse analysis application, or the file path rule of the application is obtained through dynamic debugging and test analysis, and the file path rule refers to the corresponding relation between the application and the file path. And then, the Android device determines the creator of the file by comparing the file path rule with the file path of the file.
However, the way of distinguishing the file creator through the file path is not an accurate and convenient way due to the manual participation, and there is a possibility of omission and error: the file path rules are obtained through manual analysis, and under the condition of more applications, the situations of omission and error recognition of the file path rules are unavoidable; when an update is applied, the file path rules of the application may also be updated accordingly, resulting in a portion of the file generated prior to the update being unable to determine the creator of the file using the updated file path rules.
Metadata, also known as intermediate data, relay data, is data describing data, mainly information describing data attributes, used to support one or more functions such as indicating storage locations, history data, resource searching, file recording, etc. Metadata can be queried through an interface provided by a file system and has a unique correspondence with data described by the metadata.
Based on this, the embodiment of the application provides a method for recording creator information of a target file, which is used for writing the creator information corresponding to the target file in 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.
Wherein the creator information of the target file includes identification information of an application creating the target file or identification information of a process creating the target file, such as application name information, process name information, package name information of an application package, or the like.
In addition, the process of creating the target file may be a process of directly creating the file, or may be a process of storing the file after the terminal receives the target file sent by other devices, which will be described below.
Referring specifically to fig. 1, fig. 1 is a schematic diagram of an embodiment of a method for recording information of a file creator according to an embodiment of the present application, which 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 a terminal starts a first process of a first application, a process name of the first process may be determined, and process name information of the first process may be recorded. The process is similar to the first application starting flow in fig. 2, the system firstly calls the Activity management service module (Activity manager service, AMS), the AMS judges whether the first process required by the first application exists, if not, the process incubation module (zygate) process is requested to start the first process required by the first application. During the first process start, the AMS is responsible for creating relevant data that manages the application framework. Before starting the first process, the AMS reads configuration information of the first application through a packet management service module (package manager service, PMS), where the configuration information includes information such as component information, authority information, application name information, and packet name of the first application. The AMS further determines application name information and package name information of the first application through the configuration information, and uses the package name or the application name of the first application as a process name of the first process. After determining the process name of the first process, the AMS calls zygate, and the creation of the first process is completed by zygate. And when the zygate creates the first process, the zygate also invokes a process (process) management module in the kernel module. And the process management module manages the first process and records 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 creation 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 the file may be an instruction generated by the terminal in response to the user operation when the user clicks the menu for creating the file, or may be an instruction for creating the file during the operation of the first process
103. And the terminal creates the target file according to the file creation instruction.
In this embodiment, after the terminal obtains the instruction for creating the File, the process of creating the target File is similar to the File creation flow in fig. 2, and the system may call the interface of File (class provided by java), access the File System (FS) through the interface, and complete the creation of the File through the interface provided by File and the interface provided by FS.
104. The terminal determines that creator information of the target file is process name information of the first process, and writes the creator information into metadata of the target file.
In this embodiment, in the process of creating the target file, the FS obtains, from the process management module, the process name information of the first process recorded previously, determines that the creator information of the target file is the process name information of the first process, and then writes the process name information of the first process into metadata corresponding to the target file.
105. The terminal acquires a reading instruction for instructing the terminal to read creator information of the target file.
In this embodiment, after the creation of the target file is completed, as shown in fig. 2, the creator information flow of the file is read, and the user or other applications 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 the file creator information, for example, the second application may be a file management application, an album application, or the like. Specifically, the terminal generates a read instruction in response to a user operation (for example, the user clicks an option of reading file information) or receives a read request of other software (for example, 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 File interface and FS interface (e.g., ioctl interface), by which creator information of a File can be read from FS.
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 terminal accesses the FS through the File interface, and reads creator information written in advance in metadata of the target File from the corresponding FS interface.
Further, the terminal locally stores corresponding relations 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 relation, namely, determine the application corresponding to the target file.
Optionally, in some possible implementations, the user may actively repair 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 a modification instruction. The modification instruction carries target creator information, and the target creator information indicates a creator set by a user for a target file. Then, the terminal modifies the creator information of the target file to the target creator information.
107. 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 acquires a target instruction about the target file, where the target instruction may be a copy instruction, a paste instruction, a convert instruction, a compress instruction, or a modify instruction, etc. Before the second process is run, the terminal records the process name information of the second process when the second process is started, and the starting process of the second process is similar to the starting process 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 obtains the target instruction, the terminal executes the corresponding target operation, and creates the associated file of the target file. Wherein, the created association file can be a copy file, a conversion file, a compression package file, a modification file, or the like, corresponding to the target instruction.
109. The terminal judges whether the target instruction is a preset instruction or not.
In this embodiment, after obtaining the target instruction, the terminal determines whether the target instruction is a preset instruction. The preset instruction may be set manually, for example, may include a paste instruction, an encrypt instruction, a decrypt instruction, and a rename instruction.
In practical applications, the list of 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 manufacturer updates the system, the update content of the preset instruction can be pushed to the terminal along with the update content of the system, or pushed to the terminal when the list is updated, so as to ensure timeliness of the list.
It should be noted that the step 108 and the step 109 are not necessarily performed in the order.
110. 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 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 at the same time, if so, when creating the associated file, the terminal obtains 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.
In practical applications, for example, after a user takes a picture through a camera application, the picture is stored locally. At the time of saving, that is, at the time of creating a photo file, creator information of the photo file (target file) (that is, process name information of a camera application process) is also saved in metadata of the photo file. Thereafter, when the user moves or copies (pastes instructions) the photo file to another folder using the file management software, a copy file (associated file) of the photo file is created in the other folder, and the creator information of the copy 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 can read the backup file from the preset storage space and restore the backup file to the original file. The backup file is a copy file of the original file, and in the generating process of the backup file and the recovering process of the original file, the terminal actually executes a copy instruction and a paste instruction: when the file is backed up, the terminal copies the original file (target file) and pastes the original file (target file) in a preset storage space to generate a backup file (associated file); when the original file is restored, the terminal copies the backup file (target file) and pastes the backup file in the original path of the original file, so that the backup file is restored to the original file (associated file). The copy instruction and the paste instruction are preset instructions, so that when the terminal locally backs up the file through the backup software, the backed up original file can be ensured not to modify the creator information of the restored original file into the identification information of the backup software during restoration, namely the creator information of the original file can not be changed by the local backup.
111. If the target instruction is not the 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 metadata of the associated file.
In this embodiment, when an associated file of a target file is created, the terminal determines whether the target instruction is a preset instruction, if not, when the associated file is created, the terminal obtains recorded process name information of a second process, determines that 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 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 description of the preset command may be referred to above.
For example, in an actual scenario, for example, after a user takes a photo through a camera application, the photo file (target file) is stored locally, and the creator information of the stored photo file is the process name information of the camera application process. If the user modifies the photo file through the mapping software, the photo file is stored as a new file (associated file). When the terminal creates the new file, determining that the creator information of the new file is the process name information of the repair software process, and writing the creator information of the new file into the metadata of the new file. Or, after the user compresses at least one photo file (compression instruction) through the compression software, a corresponding compression package file (association file) is generated. The terminal determines that the creator information of the compressed package file is the process name information of the compressed software process when creating the compressed package file, and writes the creator information of the compressed package file 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; 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 this embodiment, after creating the target file, the terminal generates a correspondence between creator information of the target file and a file path of the target file, and stores the correspondence in a file path rule. After the terminal generates the file path rule of the target file, the file path rule is stored locally in the form of a file, so that the terminal can accept active modification of a user, and meanwhile, when some applications create path changes of the file, the file path rule can also be updated along with updating of the applications. When the terminal receives the file sent by other devices, 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 the file path rule, and the file can be stored in the storage path. The file path rule is used to indicate the correspondence between different creator information and different file paths, and a schematic table of the file path rule may be shown in table 1 below.
TABLE 1
Optionally, in some possible implementations, 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 creator information of the target file according to the display instruction. In this embodiment, the terminal may respond to the user operation, 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 creator information of the target file. The display process can also pop up in a popup window manner, or can be displayed in other manners.
For example, as shown in fig. 3, when a user browses a file on an interface of the file management software, after selecting the file, a display instruction may be input 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 manager software queries metadata of the displayed one or more files to obtain creator information of the displayed file, and displays the creator information of the displayed one or more files in correspondence with the one or more files, for example, below, above, or below a screen as shown in fig. 3.
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 displays the creator in a file display area in a superimposed manner. 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 terminal responds to the selection of the gesture or the menu, and creator information may be displayed in a transparent or semitransparent form on the picture in a superimposed manner.
Optionally, in some possible implementations, the terminal acquires a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files according to the classification of the creator of the file; the terminal obtains creator information of the files according to the file classification instruction, and displays the files according to the creator information classification of the files. In this embodiment, the terminal may generate a file classification instruction according to an operation response of a user or receive other application calls, and query metadata corresponding to the target file according to the file classification instruction, determine creator information of the target file, and then display the target file in a classified manner according to the creator information of the target file. In practical application, the method can be used in various occasions. For example, music saved by different music software is displayed according to different folders in a classified manner, pictures saved by different applications are displayed in an album in a classified manner (as shown in fig. 5), documents edited by different editing software are displayed in a classified manner, and the like.
Optionally, in some possible implementations, the terminal acquires 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 deleting instruction; and the terminal deletes the target file to be deleted according to the deleting instruction. In this embodiment, the terminal may respond to the operation of the user or receive other application calls to obtain a deletion instruction, where the deletion instruction carries the target creator information, and after obtaining the deletion instruction, the terminal searches and deletes a file to be deleted, where the creator information is the target creator information, that is, a file created by an application corresponding to the deletion target creator information. The target creator information carried in the deletion instruction may be set by the user, or may be set by the terminal after determining the uninstalled application, and may be set as the application name, the process name, the package name information of the uninstalled application, or the package name information of the application package.
From the above technical solutions, the embodiments of the present application have the following advantages:
When the terminal starts the first process, the process name information of the first process is recorded. If the terminal creates 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 metadata corresponding to the target file. Thus, when 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 this embodiment, by recording the creator information of the file in the metadata of the file, the creator information of the file is conveniently and accurately read based on the characteristics of the metadata.
The above embodiment describes a procedure of directly creating a target file, and another case will be described below.
Referring specifically to fig. 6, fig. 6 is a schematic diagram illustrating another embodiment of a method for recording file creator information according to an embodiment of the present application, which may include:
601. and the terminal receives the target files 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 the target file sent by the other terminal or the network server through the first process. The first process may be a process of backup software, bluetooth, browser or just-in-time communication software, and other terminals generally refer to any device, such as a mobile phone, a computer terminal, etc., that can interact with the terminal in addition to the terminal. The target file may be a backup file restored from a preset device by the terminal through the backup software, a picture and a document file cached when the user browses a web page by using a browser, or a file received from other devices by the terminal through bluetooth software, or the like.
602. The terminal acquires a saving instruction of the first process, wherein the saving instruction is used for indicating the terminal to save the target file.
In this embodiment, the storage instruction may be an instruction set in advance, and after the terminal receives the target file, the terminal generates a storage instruction automatically, for example, when the user browses a web page, the terminal caches the web page file through a browser; or may be a save instruction generated by the terminal in response to a user operation, such as a user clicking on a file save option.
603. And the terminal saves the target file according to the save 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 or not.
In this embodiment, the user may set a preset application list (also referred to as a list) in the system of the terminal in advance, where the preset application list may include an application name, a package name, or a process name list of the 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 corresponding application name and package name of the first process.
The list of the preset application can be maintained by the network side and pushed to the terminal at regular time or when updated. For example, the terminal manufacturer may maintain a preset software list in the application market and a process name corresponding to the preset software in the running process at the server side, and push the preset software list to the terminal periodically, or push the preset software list to the terminal when the preset software list is updated, so as to ensure timeliness of the preset software list.
It should be noted that, the step 603 and the step 604 are not necessarily executed in the same order.
605. And under the condition that 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 writes the creator information into the metadata of the target file.
In this embodiment, when a first process is started, a terminal records process name information of the first process. 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 metadata of the target file.
For example, in practical applications, for example, if the preset application list may include backup software. When the terminal receives the file sent by the network through the process of the instant messaging software, the terminal locally stores the file. Because the instant messaging software is not in the preset application list, when the terminal stores the file, determining that the creator information of the file is the process name information of the instant messaging software process, and writing the creator information of the file in the metadata of the file. For another example, after the terminal receives the file sent by the other device through the bluetooth software, because the bluetooth software is not in the preset application list, when the terminal saves the file, the terminal determines that the creator information of the file is the process name information of the bluetooth software process, and writes the creator information of the file in the metadata of the file.
606. And if the application corresponding to the first process is the preset application, the terminal acquires rule table information.
In this embodiment, when a first process is started, a 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 may be stored locally after being generated by the terminal, or may be transmitted to another terminal or stored on a network server. The terminal may determine creator information uniquely corresponding to the target file according to one or more identification information of the target file. A schematic representation of the rule table information may be as shown in table 2 below.
File name Size and dimensions of Date of modification File category Creator information
file.txt 5kb 2017.01.11 Document and method for producing the same com.tencent.mm
string.mp3 6kb 2017.01.11 Music QQ
final.mp4 1kb 2017.01.11 Video frequency Tremble sound
text.jpg 300kb 2018.01.11 Picture picture 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 a terminal, or may be stored in another terminal or a network server. For example, if the first process is a process of backing up software, the preset application list includes the backing up software. The user previously backs up the target file through the backup software and saves the backup file on other terminals or networks. After that, when the terminal restores the file (receives the backup file from other terminals or the network) through the backup software, in order to avoid that the creator information of the restored file is modified into the process name information of the backup software process, the terminal may generate the rule table information according to the creator information of the target file to be backed up before restoring the backup file, and store the rule table locally at the terminal, or store the rule table locally at other terminals or the network server along with the backup file. Thus, when file restoration is performed, the terminal determines creator information of the restored file through the rule table.
Optionally, in some possible implementations, if the application corresponding to the first process is determined to be a preset application, the terminal does not set creator information in metadata of the target file. In this embodiment, after the terminal receives the target file sent by other terminals 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 metadata of the target file. Wherein, the absence means that if the received metadata of the target file already contains creator information, the creator information is not modified, and if the received metadata of the target file does not contain creator information, the terminal will not add creator information to the metadata of the target file in the process of storing the target file.
In an actual scenario, for example, if the preset application is an application of backup software, when the terminal receives the target file sent by other terminals or the network server and then restores (saves the target file), the creator information is not modified or added in the 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 obtains 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 first determined, and if the unique correspondence between the target file and the creator information cannot be determined, 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 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 determines that the 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 metadata at this time may be inaccurate or inappropriate, so the terminal may acquire rule table information at a later time, 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 the backup software and the preset application list also includes the backup software, when the terminal receives the backup files (file restoration) sent by other terminals or the network through the backup software, and when the files are saved, the creator information of the saved files is modified into the process name information of the backup software process, and then the creator information of the saved files is updated according to the rule table information.
608. And the terminal acquires the reading instruction.
609. And the terminal reads creator information corresponding to the target file according to the file reading instruction.
It should be noted that, step 608 and step 609 are similar to step 105 and step 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 generated by the second process and taking 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 modification 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 the creator information of the associated file is the 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 the 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 metadata of the associated file.
It should be noted that, the optional steps are similar to steps 107 to 111 in the embodiment shown in fig. 1, and will not be repeated here.
Optionally, in some possible implementations, the terminal determines a file path of the target file and 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.
Optionally, in some possible implementations, 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 creator information of the target file according to the display instruction.
Optionally, in some possible implementations, the terminal acquires a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files according to the classification of the creator of the file; the terminal obtains creator information of the files according to the file classification instruction, and displays the files according to the creator information classification of the files.
Optionally, in some possible implementations, the terminal acquires 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 deleting instruction; and the terminal deletes the target file to be deleted according to the deleting instruction.
It should be noted that the optional steps described above are similar to those in the embodiment shown in fig. 1, and are not repeated here.
From the above technical solutions, the embodiments of the present application have the following advantages:
after the terminal receives the target file sent by other terminals through the first process, the terminal acquires a storage instruction of the first process and stores the target file according to the storage instruction. And then, the terminal judges 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 comprises backup software, and when the first process is the process of the backup software, in order to avoid that the received file is modified into the process name information of the first process, the terminal can acquire rule table information when storing 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 in metadata of the target file. Or when the application corresponding to the first process is determined to be a preset application, the terminal does not set creator information in metadata of the target file when the target file is stored. 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 in the metadata of the target file. After the terminal obtains the reading instruction, the creator information of the target file can be read according to the reading instruction. In summary, in this embodiment, by recording the creator information of the file in the metadata of the file, the creator information of the file is conveniently and accurately read based on the characteristics of the metadata.
The above-described embodiments have described the procedure of recording and reading the file creator information when creating a file. However, in practical applications, there may be cases where: corresponding process name information is not recorded in metadata of files existing in the system, so that a creator of a fixed file cannot be read from the metadata. For example, when creating a file, a method of recording and reading creator information in metadata of the file is an update function of a system, and a system before the update does not have the function, and corresponding creator information is not recorded in metadata of a file created in the system before the update. In particular for files on the sdcard, there is a lack of means in the prior art by which creator information can be read directly. Based on this, the following provides a method of recording and reading the creator information of the file if the creator information is not recorded in the metadata of the existing file.
Referring specifically to fig. 7, fig. 7 is a schematic diagram illustrating another embodiment of a method for recording file creator information according to an embodiment of the present application, which may include:
701. the terminal acquires a configuration instruction, wherein the configuration instruction is used for indicating setting creator information for a file to be configured.
In this embodiment, after responding to a user input or an instruction of other software, the terminal generates a configuration instruction, 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 metadata corresponding to the to-be-configured file.
702. And the terminal determines a 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.
In this embodiment, after the terminal obtains the configuration instruction, the terminal queries creator information of the locally stored file, and determines a to-be-configured file 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 file path rule described in the optional steps corresponding to the embodiment shown in fig. 1 or fig. 6, that is, the obtained file path rule may be a file path rule generated by the terminal according to creator information recorded in metadata of the target file and the corresponding file path after the target file is created.
Alternatively, the file path rule may be a code that the user creates the file by reverse analysis of the application, or a file path rule that the user obtains by dynamic debugging and test analysis. After the terminal acquires the configuration instruction, the terminal locally acquires the file path rule stored by the user.
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 to-be-configured file, the terminal may determine creator information corresponding to the to-be-configured file from the corresponding relationship indicated in the file path rule through the file path of the to-be-configured file. For example, the file to be configured includes a first file, where a file path of the first file is: according to the file path rule shown in table 1, creator information corresponding to the first file is determined to be an application name APP1. Note that, if the file path of the first file is: according to the file path rule shown in table 1, since the corresponding creator information 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 pop-up window display (pop-up window 800 in which the file name of the first file is 67 gfdfgdfg) 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 to-be-configured file is internal data, the terminal can also determine application name information corresponding to the to-be-configured file according to the uid and gid of the to-be-configured file by acquiring the uid and gid of the file.
705. And writing creator information of the to-be-configured file into metadata corresponding to the to-be-configured file by the terminal.
In this embodiment, after determining creator information corresponding to a to-be-configured file, the terminal writes the creator information of the to-be-configured file in metadata of the to-be-configured file.
706. And the terminal acquires the reading instruction.
707. And the terminal reads creator information corresponding to the file to be configured according to the file reading instruction.
It should be noted that, the processes of step 706 and step 707 are similar to the processes of step 105 and step 106 of reading the creator information of the target file in the embodiment shown in fig. 1, and will not be repeated here.
Optionally, in some possible implementation manners, when the second process runs, the terminal acquires a target instruction generated by the second process and taking 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 modification 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 the creator information of the associated file is the 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 the 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 metadata of the associated file.
It should be noted that, the optional steps are similar to steps 107 to 111 in the embodiment shown in fig. 1, and will not be repeated here.
Optionally, in some possible implementations, 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 creator information of the target file according to the display instruction.
Optionally, in some possible implementations, the terminal acquires a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files according to the classification of the creator of the file; the terminal obtains creator information of the files according to the file classification instruction, and displays the files according to the creator information classification of the files.
Optionally, in some possible implementations, the terminal acquires 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 deleting instruction; and the terminal deletes the target file to be deleted according to the deleting instruction.
It should be noted that the optional steps described above are similar to those in the embodiment shown in fig. 1, and are not repeated here.
From the above technical solutions, the embodiments of the present application have the following advantages:
when creator information does not exist in metadata of some files in the system, the terminal determines the files as files to be configured. After receiving the configuration instruction, the terminal determines the to-be-configured file according to the configuration instruction, inquires creator information corresponding to the to-be-configured file from file path rules existing in the terminal through a file path of the to-be-configured file, and writes the creator information of the to-be-configured file in metadata of the to-be-configured file. Therefore, after the terminal acquires the reading instruction, the corresponding creator information can be read from the metadata of the file to be configured. In summary, in this embodiment, by recording the creator information of the file in the metadata of the file, the creator information of the file is conveniently and accurately read based on the characteristics of the metadata.
Referring specifically to fig. 9A, fig. 9A is a schematic diagram of an embodiment of a terminal in an embodiment of the present application, including:
An acquisition unit 901 for acquiring an instruction to create a file;
a creating unit 902, configured to create a target file according to the file creation 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 created the target file;
a writing unit 904, configured to write creator information of the target file in metadata corresponding to the target file.
In one possible design of the device,
the determining unit 903 is further configured to determine a first process running on the terminal, where the first process generates the file creation 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 device,
the acquiring unit 901 is further configured to receive, through the first process, the target file sent by another terminal or a network server;
the acquiring unit 901 is specifically configured to acquire a save instruction of the first process, where the save 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 that, when it is determined that the application corresponding to the first process is not a preset application, the 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 creator information in the metadata of the target file is not set.
In one possible design, and with particular reference to fig. 9B, fig. 9B is a schematic diagram of another embodiment of a terminal in an embodiment of the present application,
the acquiring unit 901 is further configured to receive, through the first process, the target file sent by another terminal or a network server; acquiring rule table information when judging that the application corresponding to the first process is a preset application, wherein 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 acquiring unit 901 is specifically configured to acquire 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:
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 that, when it is determined that the application corresponding to the first process is not a preset application, the 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 device,
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 correspondence between a file path of the target file and creator information of the target file, and store the correspondence in a file path rule, where the file path rule is used to indicate correspondence between different creator information and different file paths.
In one possible design of the device,
the acquiring unit 901 is further configured to acquire a configuration instruction, where the configuration instruction is used to instruct setting creator information for a file to be configured; acquiring the file path rule;
The determining unit 903 is further configured to determine the to-be-configured file according to the configuration instruction, where creator information of the to-be-configured file is not recorded in metadata corresponding to the to-be-configured file; 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 to-be-configured file in metadata corresponding to the to-be-configured file.
In one possible design of the device,
the obtaining unit 901 is further configured to obtain, when a second process is running, a target instruction generated by the second process and using the target file as an operation object;
the creating unit 902 is further configured to create an association file of the target file according to the target instruction, where the association file includes a copy file, a modification file, an encryption/decryption file, or a decompression file corresponding to the target file;
the writing unit 904 is further configured to determine that the 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; if the target instruction is not the 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.
In one possible design, the preset instructions 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 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 a terminal in an embodiment of the present application,
the acquiring unit 901 is further configured to acquire 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 the 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 modification instruction.
In one possible design, and with particular reference to fig. 9D, fig. 9D is a schematic diagram of another embodiment of a terminal in an embodiment of the present application,
an acquiring unit 901, configured to acquire a display instruction for instructing to display creator information of the target file;
the terminal may further include:
a first display unit 907 for displaying 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 a terminal in an embodiment of the present application,
the acquiring unit 901 is further configured to acquire a file classification instruction, where the file classification instruction is used to instruct the terminal to display a plurality of files according to the classification of the creator of the file;
the terminal may further include:
a second display unit 908 for acquiring creator information of the plurality of files according to the file classification instruction, and displaying the plurality of files according to the creator information classification 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 a terminal in an embodiment of the present application,
the acquiring unit 901 is further configured to acquire a deletion instruction, where the deletion instruction carries information of a target creator, and is configured to instruct deletion of a file to be deleted, where the file to be deleted is a file whose creator information is the information of the target creator;
the terminal may further include:
a searching unit 909 configured to search the file to be deleted according to the deletion instruction;
and a deleting unit 910, configured to delete the target file to be deleted according to the deletion instruction.
Referring specifically to fig. 10, fig. 10 is a schematic diagram of another embodiment of a terminal in an embodiment of the present application, which may include:
A processor 1001, a memory 1002, and a transceiver 1003; the transceiver 1003 is configured to communicate with a device other than the terminal; the memory 1002 is configured to store instruction codes; the processor 1001, when executing the instruction codes, causes the terminal to perform the method performed by the terminal in the embodiments and any alternative shown in fig. 1, 6 or 7.
Embodiments of the present application also provide a computer storage medium storing instructions that, when executed on a computer, cause the computer to perform a method performed by a terminal in an embodiment and any of the alternatives shown in fig. 1, 6, or 7.
Embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method performed by the terminal in the embodiments and in any of the alternatives shown in fig. 1, 6 or 7.
In the above embodiments, it may be implemented in whole or in part 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, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more 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)), etc.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the 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, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are merely for illustrating the technical solution 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the response technology.

Claims (14)

1. A method for a terminal to record file creator information, comprising:
acquiring a file creation 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 identification information of a process for creating the target file;
writing creator information of the target file in metadata corresponding to the target file;
determining a file path of the target file and creator information of the target file, wherein the file path of the target file comprises: an internal storage path and an external storage path;
Generating a corresponding relation between a file path of the target file and 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;
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;
if the file to be configured is external data, determining creator information of the file to be configured according to a file path of the file to be configured and the file path rule;
if the file to be configured is internal data, determining creator information of the file to be configured according to an identity mark uid and a group mark gid of the file to be configured;
writing creator information of the to-be-configured file in metadata corresponding to the to-be-configured file.
2. The method according to claim 1, wherein the method further comprises:
determining a first process running on the terminal, wherein the first process generates the file creation instruction;
Determining creator information of the target file, comprising:
and determining the creator information of the target file as 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 the obtaining the create file instruction, the method further comprises:
receiving the target file sent by other terminals or a network server through a first process;
the file creation instruction is specifically:
acquiring a saving instruction of the first process, wherein the saving instruction is used for indicating to save the target file;
before said determining creator information for said target file, said 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, comprising:
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 not a preset application;
and under the condition that the application corresponding to the first process is judged to be the preset application, the creator information in the metadata of the target file is not set.
4. The method of claim 1, wherein prior to the obtaining the create file instruction, the method further comprises:
receiving the target file sent by other terminals or a network server through a first process;
the file creation instruction is specifically:
acquiring a saving instruction of the first process, wherein the saving instruction is used for indicating to save the target file;
before said determining creator information for said target file, said 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, comprising:
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 not a preset application;
acquiring rule table information if the application corresponding to the first process is a preset application, wherein the rule table information is received from the other terminals 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 to 4, further comprising:
acquiring a target instruction which is generated by a 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 the creator information of the associated file is the creator information of the target file, and writing the creator information of the associated file in metadata of the associated file;
if the target instruction is not the 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.
6. The method of claim 5, wherein the preset instructions comprise a paste instruction, a rename instruction, an encrypt instruction, or a decrypt instruction.
7. The method according to any one of claims 1 to 6, 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.
8. The method according to any one of claims 1 to 7, 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 target creator information;
and modifying creator information of the target file into the target creator information according to the modification instruction.
9. The method according to any one of claims 1 to 8, 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 creator information of the target file according to the display instruction.
10. The method according to any one of claims 1 to 9, further comprising:
acquiring a file classification instruction, wherein the file classification instruction is used for indicating the terminal to display a plurality of files according to the classification of creator 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 classification of the files.
11. The method according to any one of claims 1 to 10, further comprising:
acquiring a deleting instruction, wherein the deleting instruction carries target creator information, and the deleting instruction is used for instructing the terminal to delete a file to be deleted, and the file to be deleted is a file with creator information as the target creator information;
searching the file to be deleted according to the deleting instruction;
and deleting the file to be deleted according to the deleting instruction.
12. A terminal for recording file creator information, comprising:
the acquisition unit is used for acquiring a file creation instruction;
the creation unit is used for creating a target file according to the file creation 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;
a writing unit, configured to write creator information of the target file in metadata corresponding to the target file;
The determining unit is further configured to determine a file path of the target file and creator information of the target file, where the file path of the target file includes: an internal storage path and an external storage path;
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;
the acquisition unit is further used for acquiring a configuration instruction, wherein the configuration instruction is used for indicating setting creator information for a file to be configured; acquiring the file path rule;
the determining unit is further configured to determine the to-be-configured file according to the configuration instruction, where creator information of the to-be-configured file is not recorded in metadata corresponding to the to-be-configured file; 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 to-be-configured file in metadata corresponding to the to-be-configured file.
13. A terminal for recording file creator information, comprising:
A processor, a memory, and a transceiver;
the transceiver is used for communicating with devices 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-11.
14. A computer storage medium storing instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 11.
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 CN111522780A (en) 2020-08-11
CN111522780B true 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 (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5259780B2 (en) * 2010-09-14 2013-08-07 株式会社東芝 Video file creation apparatus and video file creation method
US10061863B2 (en) * 2010-12-17 2018-08-28 Verizon Patent And Licensing Inc. Asset manager
US8914334B2 (en) * 2012-09-12 2014-12-16 International Business Machines Corporation Using a metadata image of a file system and archive instance to restore data objects in the file system

Patent Citations (9)

* 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
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
CN111522780A (en) 2020-08-11

Similar Documents

Publication Publication Date Title
US11016987B2 (en) Shared folder backed integrated workspaces
JP6797290B2 (en) Content management capabilities for messaging services
US20180067933A1 (en) System and method of handling file metadata
US9864736B2 (en) Information processing apparatus, control method, and recording medium
US10057318B1 (en) System, method, and computer program for enabling a user to access and edit via a virtual drive objects synchronized to a plurality of synchronization clients
US7945535B2 (en) Automatic publishing of digital content
US9424058B1 (en) File deduplication and scan reduction in a virtualization environment
US20160239320A1 (en) File mapping and converting for dynamic disk personalization for multiple platforms
US9218381B2 (en) Method and apparatus for portable index on a removable storage medium
JP2016529599A (en) Content clipboard synchronization
JP2019517043A (en) Automatic update of hybrid application
JP2020537212A (en) Workflow function of the content management system implemented by the client device
US10878089B2 (en) Identifying malware based on content item identifiers
CN110119386B (en) Data processing method, data processing apparatus, medium, and computing device
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
US20140365430A1 (en) Information processing apparatus, system, and control method
TWI571754B (en) Method for performing file synchronization control, and associated apparatus
CN111522780B (en) Method and terminal for recording information of file creator
CN110018761B (en) Method, device and terminal for managing recently used files
US20080059538A1 (en) Method and system for synchronizing offline records
CN110888847B (en) Recycle bin system and file recycling method
US11409610B1 (en) Context-driven data backup and recovery
CN109857719B (en) Distributed file processing method, device, computer equipment and storage medium
US20190227991A1 (en) Synchronizing Different Representations of Content

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